summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-07-06 18:21:42 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2021-07-06 18:21:42 (GMT)
commit820695a78e3a277daea1bdcbb8ad54b8ee6650a5 (patch)
treefe7545305c0a77db3b9671e5a82fdffc4b2cc82e /src
parent9f13ecfa2e93840d1cc45dbf0bfcf8b955814931 (diff)
parent18bbd3f0a7f14adeebf8f342ed242ff191f9b7c5 (diff)
downloadhdf5-hdf5-1_12_1.zip
hdf5-hdf5-1_12_1.tar.gz
hdf5-hdf5-1_12_1.tar.bz2
Merge remote-tracking branch 'origin/hdf5_1_12_1' into 1.12/master forhdf5-1_12_1
HDF5 1.12.1 release.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt333
-rw-r--r--src/COPYING13
-rw-r--r--src/H5.c160
-rw-r--r--src/H5A.c25
-rw-r--r--src/H5AC.c485
-rw-r--r--src/H5ACdbg.c8
-rw-r--r--src/H5ACmodule.h10
-rw-r--r--src/H5ACmpio.c25
-rw-r--r--src/H5ACpkg.h8
-rw-r--r--src/H5ACprivate.h197
-rw-r--r--src/H5ACproxy_entry.c2
-rw-r--r--src/H5ACpublic.h353
-rw-r--r--src/H5Abtree2.c14
-rw-r--r--src/H5Adense.c98
-rw-r--r--src/H5Adeprec.c4
-rw-r--r--src/H5Aint.c88
-rw-r--r--src/H5Amodule.h47
-rw-r--r--src/H5Apkg.h11
-rw-r--r--src/H5Aprivate.h8
-rw-r--r--src/H5Apublic.h1194
-rw-r--r--src/H5Atest.c2
-rw-r--r--src/H5B.c390
-rw-r--r--src/H5B2.c22
-rw-r--r--src/H5B2cache.c32
-rw-r--r--src/H5B2dbg.c22
-rw-r--r--src/H5B2hdr.c16
-rw-r--r--src/H5B2int.c124
-rw-r--r--src/H5B2internal.c14
-rw-r--r--src/H5B2leaf.c28
-rw-r--r--src/H5B2module.h10
-rw-r--r--src/H5B2pkg.h10
-rw-r--r--src/H5B2private.h10
-rw-r--r--src/H5B2stat.c4
-rw-r--r--src/H5B2test.c8
-rw-r--r--src/H5Bcache.c11
-rw-r--r--src/H5Bdbg.c52
-rw-r--r--src/H5Bmodule.h10
-rw-r--r--src/H5Bpkg.h36
-rw-r--r--src/H5Bprivate.h12
-rw-r--r--src/H5C.c10013
-rw-r--r--src/H5CS.c12
-rw-r--r--src/H5CSprivate.h8
-rw-r--r--src/H5CX.c14
-rw-r--r--src/H5CXmodule.h10
-rw-r--r--src/H5CXprivate.h12
-rw-r--r--src/H5Cdbg.c235
-rw-r--r--src/H5Cepoch.c2
-rw-r--r--src/H5Cimage.c124
-rw-r--r--src/H5Clog.c5
-rw-r--r--src/H5Clog.h16
-rw-r--r--src/H5Clog_json.c56
-rw-r--r--src/H5Clog_trace.c56
-rw-r--r--src/H5Cmodule.h10
-rw-r--r--src/H5Cmpio.c412
-rw-r--r--src/H5Cpkg.h6223
-rw-r--r--src/H5Cprefetched.c2
-rw-r--r--src/H5Cprivate.h1682
-rw-r--r--src/H5Cpublic.h31
-rw-r--r--src/H5Cquery.c2
-rw-r--r--src/H5Ctag.c4
-rw-r--r--src/H5Ctest.c2
-rw-r--r--src/H5D.c28
-rw-r--r--src/H5Dbtree.c11
-rw-r--r--src/H5Dbtree2.c25
-rw-r--r--src/H5Dchunk.c907
-rw-r--r--src/H5Dcompact.c4
-rw-r--r--src/H5Dcontig.c4
-rw-r--r--src/H5Ddbg.c5
-rw-r--r--src/H5Ddeprec.c8
-rw-r--r--src/H5Dearray.c338
-rw-r--r--src/H5Defl.c7
-rw-r--r--src/H5Dfarray.c316
-rw-r--r--src/H5Dfill.c6
-rw-r--r--src/H5Dint.c110
-rw-r--r--src/H5Dio.c18
-rw-r--r--src/H5Dlayout.c45
-rw-r--r--src/H5Dmodule.h43
-rw-r--r--src/H5Dmpio.c16
-rw-r--r--src/H5Dnone.c6
-rw-r--r--src/H5Doh.c2
-rw-r--r--src/H5Dpkg.h14
-rw-r--r--src/H5Dprivate.h8
-rw-r--r--src/H5Dpublic.h1570
-rw-r--r--src/H5Dscatgath.c2
-rw-r--r--src/H5Dselect.c67
-rw-r--r--src/H5Dsingle.c6
-rw-r--r--src/H5Dtest.c4
-rw-r--r--src/H5Dvirtual.c313
-rw-r--r--src/H5E.c136
-rw-r--r--src/H5EA.c36
-rw-r--r--src/H5EAcache.c48
-rw-r--r--src/H5EAdbg.c99
-rw-r--r--src/H5EAdblkpage.c9
-rw-r--r--src/H5EAdblock.c11
-rw-r--r--src/H5EAhdr.c18
-rw-r--r--src/H5EAiblock.c36
-rw-r--r--src/H5EAint.c6
-rw-r--r--src/H5EAmodule.h10
-rw-r--r--src/H5EApkg.h10
-rw-r--r--src/H5EAprivate.h10
-rw-r--r--src/H5EAsblock.c10
-rw-r--r--src/H5EAstat.c11
-rw-r--r--src/H5EAtest.c4
-rw-r--r--src/H5ESpublic.h12
-rw-r--r--src/H5Edefin.h9
-rw-r--r--src/H5Edeprec.c17
-rw-r--r--src/H5Einit.h21
-rw-r--r--src/H5Eint.c61
-rw-r--r--src/H5Emodule.h39
-rw-r--r--src/H5Epkg.h10
-rw-r--r--src/H5Eprivate.h57
-rw-r--r--src/H5Epubgen.h12
-rw-r--r--src/H5Epublic.h791
-rw-r--r--src/H5Eterm.h11
-rw-r--r--src/H5F.c368
-rw-r--r--src/H5FA.c10
-rw-r--r--src/H5FAcache.c24
-rw-r--r--src/H5FAdbg.c25
-rw-r--r--src/H5FAdblkpage.c2
-rw-r--r--src/H5FAdblock.c2
-rw-r--r--src/H5FAhdr.c8
-rw-r--r--src/H5FAint.c4
-rw-r--r--src/H5FAmodule.h10
-rw-r--r--src/H5FApkg.h8
-rw-r--r--src/H5FAprivate.h8
-rw-r--r--src/H5FAstat.c8
-rw-r--r--src/H5FAtest.c2
-rw-r--r--src/H5FD.c68
-rw-r--r--src/H5FDcore.c143
-rw-r--r--src/H5FDcore.h68
-rw-r--r--src/H5FDdirect.c344
-rw-r--r--src/H5FDdirect.h69
-rw-r--r--src/H5FDdrvr_module.h10
-rw-r--r--src/H5FDfamily.c613
-rw-r--r--src/H5FDfamily.h56
-rw-r--r--src/H5FDhdfs.c1194
-rw-r--r--src/H5FDhdfs.h30
-rw-r--r--src/H5FDint.c2
-rw-r--r--src/H5FDlog.c1008
-rw-r--r--src/H5FDlog.h409
-rw-r--r--src/H5FDmirror.c1926
-rw-r--r--src/H5FDmirror.h90
-rw-r--r--src/H5FDmirror_priv.h317
-rw-r--r--src/H5FDmodule.h10
-rw-r--r--src/H5FDmpi.c70
-rw-r--r--src/H5FDmpi.h12
-rw-r--r--src/H5FDmpio.c438
-rw-r--r--src/H5FDmpio.h231
-rw-r--r--src/H5FDmulti.c863
-rw-r--r--src/H5FDmulti.h223
-rw-r--r--src/H5FDpkg.h10
-rw-r--r--src/H5FDprivate.h40
-rw-r--r--src/H5FDpublic.h98
-rw-r--r--src/H5FDros3.c580
-rw-r--r--src/H5FDros3.h16
-rw-r--r--src/H5FDs3comms.c1069
-rw-r--r--src/H5FDs3comms.h2
-rw-r--r--src/H5FDsec2.c321
-rw-r--r--src/H5FDsec2.h4
-rw-r--r--src/H5FDspace.c16
-rw-r--r--src/H5FDsplitter.c1314
-rw-r--r--src/H5FDsplitter.h110
-rw-r--r--src/H5FDstdio.c224
-rw-r--r--src/H5FDstdio.h20
-rw-r--r--src/H5FDtest.c3
-rw-r--r--src/H5FDwindows.c2
-rw-r--r--src/H5FDwindows.h36
-rw-r--r--src/H5FL.c502
-rw-r--r--src/H5FLmodule.h10
-rw-r--r--src/H5FLprivate.h38
-rw-r--r--src/H5FO.c2
-rw-r--r--src/H5FOprivate.h8
-rw-r--r--src/H5FS.c15
-rw-r--r--src/H5FScache.c14
-rw-r--r--src/H5FSdbg.c23
-rw-r--r--src/H5FSint.c4
-rw-r--r--src/H5FSmodule.h10
-rw-r--r--src/H5FSpkg.h10
-rw-r--r--src/H5FSprivate.h10
-rw-r--r--src/H5FSsection.c169
-rw-r--r--src/H5FSstat.c2
-rw-r--r--src/H5FStest.c2
-rw-r--r--src/H5Faccum.c10
-rw-r--r--src/H5Fcwfs.c4
-rw-r--r--src/H5Fdbg.c16
-rw-r--r--src/H5Fdeprec.c4
-rw-r--r--src/H5Fefc.c4
-rw-r--r--src/H5Ffake.c4
-rw-r--r--src/H5Fint.c416
-rw-r--r--src/H5Fio.c8
-rw-r--r--src/H5Fmodule.h49
-rw-r--r--src/H5Fmount.c14
-rw-r--r--src/H5Fmpi.c60
-rw-r--r--src/H5Fpkg.h19
-rw-r--r--src/H5Fprivate.h113
-rw-r--r--src/H5Fpublic.h1863
-rw-r--r--src/H5Fquery.c38
-rw-r--r--src/H5Fsfile.c2
-rw-r--r--src/H5Fspace.c4
-rw-r--r--src/H5Fsuper.c23
-rw-r--r--src/H5Fsuper_cache.c16
-rw-r--r--src/H5Ftest.c36
-rw-r--r--src/H5G.c28
-rw-r--r--src/H5Gbtree2.c156
-rw-r--r--src/H5Gcache.c6
-rw-r--r--src/H5Gcompact.c22
-rw-r--r--src/H5Gdense.c169
-rw-r--r--src/H5Gdeprec.c16
-rw-r--r--src/H5Gent.c33
-rw-r--r--src/H5Gint.c38
-rw-r--r--src/H5Glink.c58
-rw-r--r--src/H5Gloc.c22
-rw-r--r--src/H5Gmodule.h102
-rw-r--r--src/H5Gname.c136
-rw-r--r--src/H5Gnode.c123
-rw-r--r--src/H5Gobj.c41
-rw-r--r--src/H5Goh.c6
-rw-r--r--src/H5Gpkg.h45
-rw-r--r--src/H5Gprivate.h50
-rw-r--r--src/H5Gpublic.h1044
-rw-r--r--src/H5Groot.c6
-rw-r--r--src/H5Gstab.c54
-rw-r--r--src/H5Gtest.c5
-rw-r--r--src/H5Gtraverse.c9
-rw-r--r--src/H5HF.c67
-rw-r--r--src/H5HFbtree2.c20
-rw-r--r--src/H5HFcache.c50
-rw-r--r--src/H5HFdbg.c126
-rw-r--r--src/H5HFdblock.c49
-rw-r--r--src/H5HFdtable.c75
-rw-r--r--src/H5HFhdr.c257
-rw-r--r--src/H5HFhuge.c99
-rw-r--r--src/H5HFiblock.c123
-rw-r--r--src/H5HFiter.c135
-rw-r--r--src/H5HFman.c43
-rw-r--r--src/H5HFmodule.h10
-rw-r--r--src/H5HFpkg.h144
-rw-r--r--src/H5HFprivate.h27
-rw-r--r--src/H5HFsection.c436
-rw-r--r--src/H5HFspace.c44
-rw-r--r--src/H5HFstat.c4
-rw-r--r--src/H5HFtest.c23
-rw-r--r--src/H5HFtiny.c88
-rw-r--r--src/H5HG.c8
-rw-r--r--src/H5HGcache.c6
-rw-r--r--src/H5HGdbg.c5
-rw-r--r--src/H5HGmodule.h10
-rw-r--r--src/H5HGpkg.h10
-rw-r--r--src/H5HGprivate.h10
-rw-r--r--src/H5HGquery.c4
-rw-r--r--src/H5HL.c52
-rw-r--r--src/H5HLcache.c12
-rw-r--r--src/H5HLdbg.c15
-rw-r--r--src/H5HLdblk.c4
-rw-r--r--src/H5HLint.c4
-rw-r--r--src/H5HLmodule.h10
-rw-r--r--src/H5HLpkg.h10
-rw-r--r--src/H5HLprfx.c4
-rw-r--r--src/H5HLprivate.h10
-rw-r--r--src/H5HP.c74
-rw-r--r--src/H5HPprivate.h8
-rw-r--r--src/H5I.c1785
-rw-r--r--src/H5Idbg.c204
-rw-r--r--src/H5Iint.c1524
-rw-r--r--src/H5Imodule.h25
-rw-r--r--src/H5Ipkg.h69
-rw-r--r--src/H5Iprivate.h12
-rw-r--r--src/H5Ipublic.h667
-rw-r--r--src/H5Itest.c9
-rw-r--r--src/H5L.c497
-rw-r--r--src/H5Ldeprec.c2
-rw-r--r--src/H5Lexternal.c6
-rw-r--r--src/H5Lmodule.h18
-rw-r--r--src/H5Lpkg.h35
-rw-r--r--src/H5Lprivate.h63
-rw-r--r--src/H5Lpublic.h2021
-rw-r--r--src/H5M.c5
-rw-r--r--src/H5MF.c477
-rw-r--r--src/H5MFaggr.c12
-rw-r--r--src/H5MFdbg.c28
-rw-r--r--src/H5MFmodule.h10
-rw-r--r--src/H5MFpkg.h28
-rw-r--r--src/H5MFprivate.h11
-rw-r--r--src/H5MFsection.c11
-rw-r--r--src/H5MM.c91
-rw-r--r--src/H5MMprivate.h32
-rw-r--r--src/H5MMpublic.h19
-rw-r--r--src/H5MP.c32
-rw-r--r--src/H5MPmodule.h10
-rw-r--r--src/H5MPpkg.h10
-rw-r--r--src/H5MPprivate.h10
-rw-r--r--src/H5MPtest.c22
-rw-r--r--src/H5Mmodule.h53
-rw-r--r--src/H5Mpkg.h8
-rw-r--r--src/H5Mprivate.h8
-rw-r--r--src/H5Mpublic.h356
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Oainfo.c77
-rw-r--r--src/H5Oalloc.c29
-rw-r--r--src/H5Oattr.c159
-rw-r--r--src/H5Oattribute.c62
-rw-r--r--src/H5Obogus.c42
-rw-r--r--src/H5Obtreek.c64
-rw-r--r--src/H5Ocache.c11
-rw-r--r--src/H5Ocache_image.c43
-rw-r--r--src/H5Ochunk.c15
-rw-r--r--src/H5Ocont.c10
-rw-r--r--src/H5Ocopy.c38
-rw-r--r--src/H5Ocopy_ref.c120
-rw-r--r--src/H5Odbg.c35
-rw-r--r--src/H5Odeprec.c16
-rw-r--r--src/H5Odrvinfo.c66
-rw-r--r--src/H5Odtype.c185
-rw-r--r--src/H5Oefl.c84
-rw-r--r--src/H5Ofill.c182
-rw-r--r--src/H5Oflush.c26
-rw-r--r--src/H5Ofsinfo.c233
-rw-r--r--src/H5Oginfo.c65
-rw-r--r--src/H5Oint.c146
-rw-r--r--src/H5Olayout.c56
-rw-r--r--src/H5Olinfo.c67
-rw-r--r--src/H5Olink.c99
-rw-r--r--src/H5Omessage.c36
-rw-r--r--src/H5Omodule.h16
-rw-r--r--src/H5Omtime.c126
-rw-r--r--src/H5Oname.c57
-rw-r--r--src/H5Onull.c3
-rw-r--r--src/H5Opkg.h13
-rw-r--r--src/H5Opline.c135
-rw-r--r--src/H5Oprivate.h39
-rw-r--r--src/H5Opublic.h2686
-rw-r--r--src/H5Orefcount.c101
-rw-r--r--src/H5Osdspace.c157
-rw-r--r--src/H5Oshared.c11
-rw-r--r--src/H5Oshared.h20
-rw-r--r--src/H5Oshmesg.c43
-rw-r--r--src/H5Ostab.c20
-rw-r--r--src/H5Otest.c6
-rw-r--r--src/H5Ounknown.c4
-rw-r--r--src/H5P.c4
-rw-r--r--src/H5PB.c174
-rw-r--r--src/H5PBmodule.h10
-rw-r--r--src/H5PBpkg.h8
-rw-r--r--src/H5PBprivate.h8
-rw-r--r--src/H5PL.c2
-rw-r--r--src/H5PLextern.h8
-rw-r--r--src/H5PLint.c96
-rw-r--r--src/H5PLmodule.h13
-rw-r--r--src/H5PLpath.c231
-rw-r--r--src/H5PLpkg.h18
-rw-r--r--src/H5PLplugin_cache.c14
-rw-r--r--src/H5PLprivate.h25
-rw-r--r--src/H5PLpublic.h198
-rw-r--r--src/H5Pacpl.c9
-rw-r--r--src/H5Pdapl.c48
-rw-r--r--src/H5Pdcpl.c82
-rw-r--r--src/H5Pdeprec.c4
-rw-r--r--src/H5Pdxpl.c21
-rw-r--r--src/H5Pencdec.c4
-rw-r--r--src/H5Pfapl.c390
-rw-r--r--src/H5Pfcpl.c45
-rw-r--r--src/H5Pfmpl.c16
-rw-r--r--src/H5Pgcpl.c4
-rw-r--r--src/H5Pint.c10
-rw-r--r--src/H5Plapl.c4
-rw-r--r--src/H5Plcpl.c16
-rw-r--r--src/H5Pmapl.c2
-rw-r--r--src/H5Pmcpl.c2
-rw-r--r--src/H5Pmodule.h56
-rw-r--r--src/H5Pocpl.c77
-rw-r--r--src/H5Pocpypl.c4
-rw-r--r--src/H5Ppkg.h10
-rw-r--r--src/H5Pprivate.h8
-rw-r--r--src/H5Ppublic.h9682
-rw-r--r--src/H5Pstrcpl.c4
-rw-r--r--src/H5Ptest.c6
-rw-r--r--src/H5R.c4
-rw-r--r--src/H5RS.c57
-rw-r--r--src/H5RSprivate.h8
-rw-r--r--src/H5Rdeprec.c157
-rw-r--r--src/H5Rint.c221
-rw-r--r--src/H5Rmodule.h15
-rw-r--r--src/H5Rpkg.h14
-rw-r--r--src/H5Rprivate.h8
-rw-r--r--src/H5Rpublic.h795
-rw-r--r--src/H5S.c436
-rw-r--r--src/H5SL.c114
-rw-r--r--src/H5SLmodule.h10
-rw-r--r--src/H5SLprivate.h8
-rw-r--r--src/H5SM.c232
-rw-r--r--src/H5SMbtree2.c49
-rw-r--r--src/H5SMcache.c14
-rw-r--r--src/H5SMmessage.c32
-rw-r--r--src/H5SMmodule.h10
-rw-r--r--src/H5SMpkg.h22
-rw-r--r--src/H5SMprivate.h10
-rw-r--r--src/H5SMtest.c4
-rw-r--r--src/H5ST.c779
-rw-r--r--src/H5STprivate.h63
-rw-r--r--src/H5Sall.c11
-rw-r--r--src/H5Sdbg.c24
-rw-r--r--src/H5Sdeprec.c3
-rw-r--r--src/H5Shyper.c168
-rw-r--r--src/H5Smodule.h37
-rw-r--r--src/H5Smpio.c85
-rw-r--r--src/H5Snone.c57
-rw-r--r--src/H5Spkg.h34
-rw-r--r--src/H5Spoint.c102
-rw-r--r--src/H5Sprivate.h9
-rw-r--r--src/H5Spublic.h1318
-rw-r--r--src/H5Sselect.c156
-rw-r--r--src/H5Stest.c4
-rw-r--r--src/H5T.c209
-rw-r--r--src/H5TS.c1404
-rw-r--r--src/H5TSprivate.h594
-rw-r--r--src/H5Tarray.c2
-rw-r--r--src/H5Tbit.c13
-rw-r--r--src/H5Tcommit.c44
-rw-r--r--src/H5Tcompound.c18
-rw-r--r--src/H5Tconv.c2842
-rw-r--r--src/H5Tcset.c10
-rw-r--r--src/H5Tdbg.c44
-rw-r--r--src/H5Tdeprec.c11
-rw-r--r--src/H5Tenum.c55
-rw-r--r--src/H5Tfields.c15
-rw-r--r--src/H5Tfixed.c11
-rw-r--r--src/H5Tfloat.c6
-rw-r--r--src/H5Tmodule.h82
-rw-r--r--src/H5Tnative.c40
-rw-r--r--src/H5Toffset.c22
-rw-r--r--src/H5Toh.c2
-rw-r--r--src/H5Topaque.c6
-rw-r--r--src/H5Torder.c16
-rw-r--r--src/H5Tpad.c10
-rw-r--r--src/H5Tpkg.h28
-rw-r--r--src/H5Tprecis.c26
-rw-r--r--src/H5Tprivate.h20
-rw-r--r--src/H5Tpublic.h2898
-rw-r--r--src/H5Tref.c152
-rw-r--r--src/H5Tstrpad.c10
-rw-r--r--src/H5Tvisit.c4
-rw-r--r--src/H5Tvlen.c23
-rw-r--r--src/H5UC.c2
-rw-r--r--src/H5UCprivate.h8
-rw-r--r--src/H5VL.c77
-rw-r--r--src/H5VLcallback.c172
-rw-r--r--src/H5VLconnector.h118
-rw-r--r--src/H5VLconnector_passthru.h8
-rw-r--r--src/H5VLint.c201
-rw-r--r--src/H5VLmodule.h23
-rw-r--r--src/H5VLnative.c48
-rw-r--r--src/H5VLnative.h14
-rw-r--r--src/H5VLnative_attr.c5
-rw-r--r--src/H5VLnative_blob.c4
-rw-r--r--src/H5VLnative_dataset.c18
-rw-r--r--src/H5VLnative_datatype.c2
-rw-r--r--src/H5VLnative_file.c2
-rw-r--r--src/H5VLnative_group.c7
-rw-r--r--src/H5VLnative_introspect.c2
-rw-r--r--src/H5VLnative_link.c45
-rw-r--r--src/H5VLnative_object.c18
-rw-r--r--src/H5VLnative_private.h8
-rw-r--r--src/H5VLnative_token.c2
-rw-r--r--src/H5VLpassthru.c25
-rw-r--r--src/H5VLpassthru.h8
-rw-r--r--src/H5VLpkg.h11
-rw-r--r--src/H5VLprivate.h22
-rw-r--r--src/H5VLpublic.h311
-rw-r--r--src/H5VM.c478
-rw-r--r--src/H5VMprivate.h135
-rw-r--r--src/H5WB.c8
-rw-r--r--src/H5WBprivate.h10
-rw-r--r--src/H5Z.c205
-rw-r--r--src/H5Zdeflate.c36
-rw-r--r--src/H5Zfletcher32.c43
-rw-r--r--src/H5Zmodule.h75
-rw-r--r--src/H5Znbit.c361
-rw-r--r--src/H5Zpkg.h8
-rw-r--r--src/H5Zprivate.h10
-rw-r--r--src/H5Zpublic.h688
-rw-r--r--src/H5Zscaleoffset.c591
-rw-r--r--src/H5Zshuffle.c60
-rw-r--r--src/H5Zszip.c58
-rw-r--r--src/H5Ztrans.c427
-rw-r--r--src/H5api_adpt.h2
-rw-r--r--src/H5checksum.c39
-rw-r--r--src/H5config.h.in24
-rw-r--r--src/H5dbg.c29
-rw-r--r--src/H5detect.c48
-rw-r--r--src/H5err.txt5
-rw-r--r--src/H5make_libsettings.c34
-rw-r--r--src/H5module.h34
-rw-r--r--src/H5mpi.c34
-rw-r--r--src/H5overflow.h6
-rw-r--r--src/H5overflow.txt2
-rw-r--r--src/H5private.h307
-rw-r--r--src/H5public.h756
-rw-r--r--src/H5system.c722
-rw-r--r--src/H5timer.c613
-rw-r--r--src/H5trace.c294
-rw-r--r--src/H5vers.txt2
-rw-r--r--src/H5version.h6
-rw-r--r--src/H5win32defs.h83
-rw-r--r--src/Makefile.am25
-rw-r--r--src/Makefile.in314
-rw-r--r--src/hdf5.h28
-rw-r--r--src/hdf5.lnt2
-rw-r--r--src/libhdf5.settings.in4
-rw-r--r--src/uthash.h1184
509 files changed, 65413 insertions, 30622 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f582056..b3c2226 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -231,6 +231,7 @@ set (H5FD_SOURCES
${HDF5_SRC_DIR}/H5FDhdfs.c
${HDF5_SRC_DIR}/H5FDint.c
${HDF5_SRC_DIR}/H5FDlog.c
+ ${HDF5_SRC_DIR}/H5FDmirror.c
${HDF5_SRC_DIR}/H5FDmpi.c
${HDF5_SRC_DIR}/H5FDmpio.c
${HDF5_SRC_DIR}/H5FDmulti.c
@@ -238,6 +239,7 @@ set (H5FD_SOURCES
${HDF5_SRC_DIR}/H5FDs3comms.c
${HDF5_SRC_DIR}/H5FDsec2.c
${HDF5_SRC_DIR}/H5FDspace.c
+ ${HDF5_SRC_DIR}/H5FDsplitter.c
${HDF5_SRC_DIR}/H5FDstdio.c
${HDF5_SRC_DIR}/H5FDtest.c
${HDF5_SRC_DIR}/H5FDwindows.c
@@ -249,6 +251,7 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDfamily.h
${HDF5_SRC_DIR}/H5FDhdfs.h
${HDF5_SRC_DIR}/H5FDlog.h
+ ${HDF5_SRC_DIR}/H5FDmirror.h
${HDF5_SRC_DIR}/H5FDmpi.h
${HDF5_SRC_DIR}/H5FDmpio.h
${HDF5_SRC_DIR}/H5FDmulti.h
@@ -256,6 +259,7 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDros3.h
${HDF5_SRC_DIR}/H5FDs3comms.h
${HDF5_SRC_DIR}/H5FDsec2.h
+ ${HDF5_SRC_DIR}/H5FDsplitter.h
${HDF5_SRC_DIR}/H5FDstdio.h
${HDF5_SRC_DIR}/H5FDwindows.h
)
@@ -376,6 +380,8 @@ IDE_GENERATED_PROPERTIES ("H5HP" "${H5HP_HDRS}" "${H5HP_SOURCES}" )
set (H5I_SOURCES
${HDF5_SRC_DIR}/H5I.c
+ ${HDF5_SRC_DIR}/H5Idbg.c
+ ${HDF5_SRC_DIR}/H5Iint.c
${HDF5_SRC_DIR}/H5Itest.c
)
set (H5I_HDRS
@@ -434,6 +440,7 @@ set (H5MP_HDRS
)
IDE_GENERATED_PROPERTIES ("H5MP" "${H5MP_HDRS}" "${H5MP_SOURCES}" )
+
set (H5O_SOURCES
${HDF5_SRC_DIR}/H5O.c
${HDF5_SRC_DIR}/H5Oainfo.c
@@ -589,14 +596,6 @@ set (H5SM_HDRS
IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" )
-set (H5ST_SOURCES
- ${HDF5_SRC_DIR}/H5ST.c
-)
-set (H5ST_HDRS
-)
-IDE_GENERATED_PROPERTIES ("H5ST" "${H5ST_HDRS}" "${H5ST_SOURCES}" )
-
-
set (H5T_SOURCES
${HDF5_SRC_DIR}/H5T.c
${HDF5_SRC_DIR}/H5Tarray.c
@@ -709,6 +708,45 @@ set (H5Z_HDRS
)
IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" )
+set (H5_MODULE_HEADERS
+ ${HDF5_SRC_DIR}/H5module.h
+ ${HDF5_SRC_DIR}/H5Amodule.h
+ ${HDF5_SRC_DIR}/H5ACmodule.h
+ ${HDF5_SRC_DIR}/H5Bmodule.h
+ ${HDF5_SRC_DIR}/H5B2module.h
+ ${HDF5_SRC_DIR}/H5Cmodule.h
+ ${HDF5_SRC_DIR}/H5CXmodule.h
+ ${HDF5_SRC_DIR}/H5Dmodule.h
+ ${HDF5_SRC_DIR}/H5Emodule.h
+ ${HDF5_SRC_DIR}/H5EAmodule.h
+ ${HDF5_SRC_DIR}/H5Fmodule.h
+ ${HDF5_SRC_DIR}/H5FAmodule.h
+ ${HDF5_SRC_DIR}/H5FDdrvr_module.h
+ ${HDF5_SRC_DIR}/H5FDmodule.h
+ ${HDF5_SRC_DIR}/H5FLmodule.h
+ ${HDF5_SRC_DIR}/H5FSmodule.h
+ ${HDF5_SRC_DIR}/H5Gmodule.h
+ ${HDF5_SRC_DIR}/H5HFmodule.h
+ ${HDF5_SRC_DIR}/H5HGmodule.h
+ ${HDF5_SRC_DIR}/H5HLmodule.h
+ ${HDF5_SRC_DIR}/H5Imodule.h
+ ${HDF5_SRC_DIR}/H5Lmodule.h
+ ${HDF5_SRC_DIR}/H5Mmodule.h
+ ${HDF5_SRC_DIR}/H5MFmodule.h
+ ${HDF5_SRC_DIR}/H5MPmodule.h
+ ${HDF5_SRC_DIR}/H5Omodule.h
+ ${HDF5_SRC_DIR}/H5Pmodule.h
+ ${HDF5_SRC_DIR}/H5PBmodule.h
+ ${HDF5_SRC_DIR}/H5PLmodule.h
+ ${HDF5_SRC_DIR}/H5Rmodule.h
+ ${HDF5_SRC_DIR}/H5Smodule.h
+ ${HDF5_SRC_DIR}/H5SLmodule.h
+ ${HDF5_SRC_DIR}/H5SMmodule.h
+ ${HDF5_SRC_DIR}/H5Tmodule.h
+ ${HDF5_SRC_DIR}/H5VLmodule.h
+ ${HDF5_SRC_DIR}/H5Zmodule.h
+)
+
set (common_SRCS
${H5_SOURCES}
${H5A_SOURCES}
@@ -748,7 +786,6 @@ set (common_SRCS
${H5S_SOURCES}
${H5SL_SOURCES}
${H5SM_SOURCES}
- ${H5ST_SOURCES}
${H5T_SOURCES}
${H5TS_SOURCES}
${H5VL_SOURCES}
@@ -835,6 +872,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
@@ -868,6 +906,7 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5Mpkg.h
${HDF5_SRC_DIR}/H5Mprivate.h
+ ${HDF5_SRC_DIR}/H5MFpkg.h
${HDF5_SRC_DIR}/H5MFprivate.h
${HDF5_SRC_DIR}/H5MMprivate.h
@@ -901,8 +940,6 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5SMpkg.h
${HDF5_SRC_DIR}/H5SMprivate.h
- ${HDF5_SRC_DIR}/H5STprivate.h
-
${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tprivate.h
@@ -922,6 +959,8 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5Zprivate.h
${HDF5_SRC_DIR}/H5win32defs.h
+
+ ${HDF5_SRC_DIR}/uthash.h
)
set (H5_GENERATED_HEADERS
@@ -939,11 +978,10 @@ set (H5_PUBLIC_GENERATED_HEADERS
${HDF5_SRC_DIR}/H5overflow.h
)
-option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON)
+option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF)
if (HDF5_GENERATE_HEADERS)
set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
- find_package (Perl)
- if (PERL_FOUND)
+ if (H5_PERL_FOUND)
execute_process (
COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt OUTPUT_VARIABLE SCRIPT_OUTPUT
)
@@ -957,7 +995,7 @@ if (HDF5_GENERATE_HEADERS)
)
message(STATUS ${SCRIPT_OUTPUT})
else ()
- message (STATUS "Cannot generate headers - perl not found")
+ message (WARNING "Cannot generate headers - perl not found")
endif ()
endif ()
@@ -968,11 +1006,11 @@ endif ()
if (HDF5_USE_PREGEN)
set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR})
else ()
- set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR})
+ set (HDF5_GENERATED_SOURCE_DIR ${HDF5_SRC_BINARY_DIR})
endif ()
if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
+ file (MAKE_DIRECTORY "${HDF5_SRC_BINARY_DIR}/shared")
endif ()
if (LOCAL_BATCH_TEST)
@@ -996,15 +1034,19 @@ if (LOCAL_BATCH_TEST)
endif ()
endif ()
+set (lib_prog_deps)
if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
- target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
TARGET_C_PROPERTIES (H5detect STATIC)
target_link_libraries (H5detect
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
- PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
+ target_compile_options(H5detect
+ PRIVATE "$<$<PLATFORM_ID:Emscripten>:-O0>"
+ )
+ set (lib_prog_deps ${lib_prog_deps} H5detect)
if (HDF5_BATCH_H5DETECT)
configure_file (
@@ -1012,113 +1054,122 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY
)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- COMMAND ${HDF5_BATCH_CMD}
- ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
- COMMAND ${CMAKE_COMMAND}
- ARGS -E echo "Executed batch command to create H5Tinit.c"
+ OUTPUT gen_SRCS.stamp1
+ COMMAND ${HDF5_BATCH_CMD}
+ ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
+ BYPRODUCTS H5Tinit.c gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E echo "Executed batch command to create H5Tinit.c"
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ ARGS -E touch gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
add_custom_target (gen_H5Tinit
COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake
)
- if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
- COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
- WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
- )
- set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
- endif ()
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
else ()
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5detect>
- ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ add_custom_command (TARGET H5detect POST_BUILD
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5detect>
+ ARGS H5Tinit.c
+ BYPRODUCTS H5Tinit.c gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ ARGS -E touch gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Create H5Tinit.c"
)
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ add_custom_command (TARGET H5detect POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c
+ BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch shared/shared_gen_SRCS.stamp1
+ DEPENDS H5detect H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Copy H5Tinit.c to shared folder"
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
- set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
else ()
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ OUTPUT gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch gen_SRCS.stamp1
+ DEPENDS H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Touch existing H5Tinit.c"
)
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ OUTPUT shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c
+ BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch shared/shared_gen_SRCS.stamp1
+ DEPENDS H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Copy existing H5Tinit.c to shared folder"
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_SRC_DETECT_FORMAT ${HDF5_SRC_DIR}/H5detect.c)
+endif ()
+
add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
-target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS})
TARGET_C_PROPERTIES (H5make_libsettings STATIC)
target_link_libraries (H5make_libsettings
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
- PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
+target_compile_options(H5make_libsettings
+ PRIVATE "$<$<PLATFORM_ID:Emscripten>:-O0>"
+)
+set (lib_prog_deps ${lib_prog_deps} H5make_libsettings)
+
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_SRC_LIBSETTINGS_FORMAT H5make_libsettings)
+endif ()
-add_custom_command (
- OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
- ${HDF5_BINARY_DIR}/gen_SRCS.stamp2
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5make_libsettings>
- ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c
+add_custom_command (TARGET H5make_libsettings POST_BUILD
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5make_libsettings>
+ ARGS H5lib_settings.c
+ BYPRODUCTS H5lib_settings.c gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2
+ ARGS -E touch gen_SRCS.stamp2
DEPENDS H5make_libsettings
- WORKING_DIRECTORY ${HDF5_BINARY_DIR}
+ WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR}
+ COMMENT "Create H5lib_settings.c"
)
-set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE)
+set_source_files_properties (${HDF5_SRC_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
- ${HDF5_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
+ add_custom_command (TARGET H5make_libsettings POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c"
+ ARGS -E copy_if_different H5lib_settings.c shared/H5lib_settings.c
+ BYPRODUCTS shared/H5lib_settings.c shared/shared_gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2
- DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c
- WORKING_DIRECTORY ${HDF5_BINARY_DIR}
+ ARGS -E touch shared/shared_gen_SRCS.stamp2
+ DEPENDS H5make_libsettings H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR}
+ COMMENT "Copy H5lib_settings.c to shared folder"
)
- set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
+ set_source_files_properties (${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
endif ()
## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z"
@@ -1129,21 +1180,25 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
# Add H5Tinit source to build - generated by H5detect/CMake at configure time
#-----------------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
- set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
- add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2)
+ set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c)
+ add_custom_target (gen_${HDF5_LIB_TARGET} ALL
+ DEPENDS ${lib_prog_deps} ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2
+ COMMENT "Generation target files"
+ )
- add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
+ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS})
target_include_directories (${HDF5_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_BINARY_DIR}>"
)
+ target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(${HDF5_LIB_TARGET}
PUBLIC
${HDF_EXTRA_C_FLAGS}
${HDF_EXTRA_FLAGS}
PRIVATE
$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
- $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
+ $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
)
TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_LIB_TARGET}
@@ -1164,15 +1219,19 @@ if (NOT ONLY_SHARED_LIBS)
endif ()
if (BUILD_SHARED_LIBS)
- set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
- add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2)
+ set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c)
+ add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL
+ DEPENDS ${lib_prog_deps} ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
+ COMMENT "Shared generation target files"
+ )
- add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
+ add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS})
target_include_directories (${HDF5_LIBSH_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_SRC_BINARY_DIR}>"
)
+ target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(${HDF5_LIBSH_TARGET}
PUBLIC
"H5_BUILT_AS_DYNAMIC_LIB"
@@ -1181,7 +1240,7 @@ if (BUILD_SHARED_LIBS)
PRIVATE
$<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE>
$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
- $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
+ $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
@@ -1197,6 +1256,17 @@ if (BUILD_SHARED_LIBS)
endif ()
#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_SRC_FORMAT ${HDF5_LIB_TARGET})
+ else ()
+ clang_format (HDF5_SRC_FORMAT ${HDF5_LIBSH_TARGET})
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
@@ -1204,7 +1274,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
FILES
${H5_PUBLIC_HEADERS}
${H5_PUBLIC_GENERATED_HEADERS}
- ${HDF5_BINARY_DIR}/H5pubconf.h
+ ${HDF5_SRC_BINARY_DIR}/H5pubconf.h
DESTINATION
${HDF5_INSTALL_INCLUDE_DIR}
COMPONENT
@@ -1261,18 +1331,22 @@ set (_PKG_CONFIG_REQUIRES)
set (_PKG_CONFIG_REQUIRES_PRIVATE)
configure_file (
- ${HDF_RESOURCES_DIR}/libhdf5.pc.in
- ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ ${HDF_CONFIG_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc
@ONLY
)
install (
- FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc
DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
COMPONENT libraries
)
if (NOT WIN32)
- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5cc
@@ -1284,4 +1358,75 @@ if (NOT WIN32)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT libraries
)
+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
+ #legacy requires a different name
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT libraries
+ )
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Option to build documentation
+#-----------------------------------------------------------------------------
+if (DOXYGEN_FOUND)
+ set (DOXYGEN_PACKAGE ${HDF5_PACKAGE_NAME})
+ set (DOXYGEN_VERSION_STRING ${HDF5_PACKAGE_VERSION_STRING})
+ set (DOXYGEN_INCLUDE_ALIASES_PATH ${HDF5_DOXYGEN_DIR})
+ set (DOXYGEN_INCLUDE_ALIASES aliases)
+ set (DOXYGEN_VERBATIM_VARS DOXYGEN_INCLUDE_ALIASES)
+ set (DOXYGEN_PROJECT_LOGO ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png)
+ set (DOXYGEN_PROJECT_BRIEF "C-API Reference")
+ set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}")
+ set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
+ set (DOXYGEN_MACRO_EXPANSION YES)
+ set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs)
+ set (DOXYGEN_EXAMPLES_DIRECTORY "${HDF5_DOXYGEN_DIR}/examples ${HDF5_SRC_DIR} ${HDF5_SOURCE_DIR}/examples ${HDF5_TEST_SRC_DIR}")
+ set (DOXYGEN_LAYOUT_FILE ${HDF5_DOXYGEN_DIR}/hdf5doxy_layout.xml)
+ set (DOXYGEN_HTML_HEADER ${HDF5_DOXYGEN_DIR}/hdf5_header.html)
+ set (DOXYGEN_HTML_FOOTER ${HDF5_DOXYGEN_DIR}/hdf5_footer.html)
+ set (DOXYGEN_HTML_EXTRA_STYLESHEET ${HDF5_DOXYGEN_DIR}/hdf5doxy.css)
+ set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js ${HDF5_DOXYGEN_DIR}/img/ftv2node.png ${HDF5_DOXYGEN_DIR}/img/ftv2pnode.png")
+ set (DOXYGEN_SERVER_BASED_SEARCH NO)
+ set (DOXYGEN_EXTERNAL_SEARCH NO)
+ set (DOXYGEN_SEARCHENGINE_URL)
+
+# This configure and custom target work together
+ # Replace variables inside @@ with the current values
+ configure_file (${HDF5_DOXYGEN_DIR}/Doxyfile.in ${HDF5_BINARY_DIR}/Doxyfile @ONLY)
+ add_custom_target (hdf5lib_doc ALL
+ COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_SRC_DIR}
+ COMMENT "Generating HDF5 library Source API documentation with Doxygen"
+ VERBATIM )
+# This cmake function requires that the non-default doxyfile settings are provided with set (DOXYGEN_xxx) commands
+# In addition the doxyfile aliases @INCLUDE option is not supported and would need to be provided in a set (DOXYGEN_ALIASES) command.
+# doxygen_add_docs (hdf5lib_doc
+## ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox
+# ${DOXYGEN_INPUT_DIRECTORY}
+# ALL
+# WORKING_DIRECTORY ${HDF5_SRC_DIR}
+# COMMENT "Generating HDF5 library Source Documentation"
+# )
+ install (
+ DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs/html
+ DESTINATION ${HDF5_INSTALL_DATA_DIR}
+ COMPONENT Documents
+ )
+
+ if (NOT TARGET doxygen)
+ add_custom_target (doxygen)
+ endif ()
+
+ add_dependencies (doxygen hdf5lib_doc)
+
endif ()
diff --git a/src/COPYING b/src/COPYING
deleted file mode 100644
index 6497ace..0000000
--- a/src/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are 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.
-
diff --git a/src/H5.c b/src/H5.c
index 621fb77..572e5e5 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,6 +14,7 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
@@ -46,15 +47,18 @@
/********************/
/* 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*/
/*********************/
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -85,6 +89,33 @@ H5_debug_t H5_debug_g; /* debugging info */
/*******************/
/*--------------------------------------------------------------------------
+NAME
+ H5__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5__init_package()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+--------------------------------------------------------------------------*/
+herr_t
+H5__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Run the library initialization routine, if it hasn't already ran */
+ if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) {
+ if (H5_init_library() < 0)
+ HGOTO_ERROR(H5E_LIB, H5E_CANTINIT, FAIL, "unable to initialize library")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5__init_package() */
+
+/*--------------------------------------------------------------------------
* NAME
* H5_init_library -- Initialize library-global information
* USAGE
@@ -103,6 +134,11 @@ H5_init_library(void)
{
herr_t ret_value = SUCCEED;
+ /* Set the 'library initialized' flag as early as possible, to avoid
+ * possible re-entrancy.
+ */
+ H5_INIT_GLOBAL = TRUE;
+
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5_HAVE_PARALLEL
@@ -132,7 +168,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_NULL_COPY_FN, (MPI_Comm_delete_attr_function *)H5__mpi_delete_cb,
&key_val, NULL)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code)
@@ -212,10 +248,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)
@@ -228,8 +260,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)
@@ -340,10 +372,13 @@ H5_term_library(void)
*/
if (pending == 0) {
pending += DOWN(AC);
+ /* Shut down the "pluggable" interfaces, before the plugin framework */
pending += DOWN(Z);
pending += DOWN(FD);
pending += DOWN(VL);
- pending += DOWN(PL);
+ /* Don't shut down the plugin code until all "pluggable" interfaces (Z, FD, PL) are shut down */
+ if (pending == 0)
+ pending += DOWN(PL);
/* Don't shut down the error code until other APIs which use it are shut down */
if (pending == 0)
pending += DOWN(E);
@@ -540,7 +575,85 @@ done:
} /* end H5set_free_list_limits() */
/*-------------------------------------------------------------------------
- * Function: H5_debug_mask
+ * Function: H5get_free_list_sizes
+ *
+ * Purpose: Gets the current size of the different kinds of free lists that
+ * the library uses to manage memory. The free list sizes can be set with
+ * H5set_free_list_limits and garbage collected with H5garbage_collect.
+ * These lists are global for the entire library.
+ *
+ * Parameters:
+ * size_t *reg_size; OUT: The current size of all "regular" free list memory used
+ * size_t *arr_size; OUT: The current size of all "array" free list memory used
+ * size_t *blk_size; OUT: The current size of all "block" free list memory used
+ * size_t *fac_size; OUT: The current size of all "factory" free list memory used
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 6, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size);
+
+ /* Call the free list function to actually get the sizes */
+ if (H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5get_free_list_sizes() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5get_alloc_stats
+ *
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * --enable-memory-alloc-sanity-check option was given when building the
+ * library. Applications can check whether this option was enabled by
+ * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
+ * option is enabled by default for debug builds of the library and
+ * disabled by default for non-debug builds. If the option is not enabled,
+ * all the values returned with be 0. These statistics are global for the
+ * entire library, but don't include allocations from chunked dataset I/O
+ * filters or non-native VOL connectors.
+ *
+ * Parameters:
+ * H5_alloc_stats_t *stats; OUT: Memory allocation statistics
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, March 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5get_alloc_stats(H5_alloc_stats_t *stats)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*x", stats);
+
+ /* Call the internal allocation stat routine to get the values */
+ if (H5MM_get_alloc_stats(stats) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5get_alloc_stats() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5__debug_mask
*
* Purpose: Set runtime debugging flags according to the string S. The
* string should contain file numbers and package names
@@ -563,7 +676,7 @@ done:
*-------------------------------------------------------------------------
*/
static void
-H5_debug_mask(const char *s)
+H5__debug_mask(const char *s)
{
FILE * stream = stderr;
char pkg_name[32], *rest;
@@ -644,15 +757,12 @@ H5_debug_mask(const char *s)
s++;
} /* end if-else */
} /* end while */
-
- 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.
@@ -662,8 +772,8 @@ 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)
+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;
@@ -810,7 +920,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
HDstrncat(lib_str, "-", (size_t)1);
HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
} /* end if */
- if (HDstrcmp(lib_str, H5_lib_vers_info_g)) {
+ if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) {
HDfputs("Warning! Library version information error.\n"
"The HDF5 library version information are not "
"consistent in its source code.\nThis is NOT a fatal error "
@@ -847,11 +957,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 282d0ed..3d20f83 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -299,7 +299,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, h
/* 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 */
@@ -387,7 +387,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid
/* 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 */
@@ -455,7 +455,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 */
@@ -1004,7 +1004,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)
@@ -1145,7 +1145,8 @@ done:
*
* Purpose: Rename an attribute
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Raymond Lu
* October 23, 2002
@@ -1160,7 +1161,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)
@@ -1180,7 +1181,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")
@@ -1203,7 +1203,8 @@ done:
*
* Purpose: Rename an attribute
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* February 20, 2007
@@ -1380,14 +1381,14 @@ herr_t
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 */
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)
@@ -1590,7 +1591,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite
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")
diff --git a/src/H5AC.c b/src/H5AC.c
index b53cf15..2eadd21 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5AC.c
* Jul 9 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Functions in this file implement a cache for
* things which exist on disk. All "things" associated
@@ -127,14 +127,14 @@ static const H5AC_class_t *const H5AC_class_s[] = {
};
/*-------------------------------------------------------------------------
- * Function: H5AC_init
+ * 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
+ * Programmer: Quincey Koziol
* Saturday, January 18, 2003
*
*-------------------------------------------------------------------------
@@ -152,13 +152,13 @@ done:
} /* end H5AC_init() */
/*-------------------------------------------------------------------------
- * Function: H5AC__init_package
+ * Function: H5AC__init_package
*
- * Purpose: Initialize interface-specific information
+ * Purpose: Initialize interface-specific information
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
*-------------------------------------------------------------------------
@@ -187,15 +187,15 @@ H5AC__init_package(void)
} /* end H5AC__init_package() */
/*-------------------------------------------------------------------------
- * Function: H5AC_term_package
+ * Function: H5AC_term_package
*
- * Purpose: Terminate this interface.
+ * 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
+ * Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
*-------------------------------------------------------------------------
@@ -227,8 +227,6 @@ H5AC_term_package(void)
*
* Programmer: John Mainzer, 1/10/17
*
- * Changes: None.
- *
*-------------------------------------------------------------------------
*/
hbool_t
@@ -262,7 +260,6 @@ H5AC_cache_image_pending(const H5F_t *f)
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 9 1997
*
*-------------------------------------------------------------------------
@@ -353,19 +350,14 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list")
- if (aux_ptr != NULL)
- if (aux_ptr->mpi_rank == 0)
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE,
- (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted,
- TRUE, H5AC__log_flushed_entry, (void *)aux_ptr);
- else
- f->shared->cache =
- H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr);
+ if (aux_ptr->mpi_rank == 0)
+ f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE,
+ (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted,
+ TRUE, H5AC__log_flushed_entry, (void *)aux_ptr);
else
f->shared->cache =
H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL);
+ H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr);
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
@@ -450,9 +442,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
@@ -479,57 +478,108 @@ H5AC_dest(H5F_t *f)
/* Check if log messages are being emitted */
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")
+ }
+
/* 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")
+ }
#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")
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.
- */
- if (H5F_ACC_RDWR & H5F_INTENT(f))
- if (H5AC__flush_entries(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush")
+ /* 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)) {
+
+ /* 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 */
@@ -541,12 +591,12 @@ done:
* Function: H5AC_evict
*
* Purpose: Evict all entries except the pinned entries
- * in the cache.
+ * in the cache.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
- * Dec 2013
+ * Dec 2013
*
*-------------------------------------------------------------------------
*/
@@ -567,7 +617,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)
@@ -579,9 +628,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_expunge_entry
*
- * Purpose: Expunge the target entry from the cache without writing it
- * to disk even if it is dirty. The entry must not be either
- * pinned or protected.
+ * Purpose: Expunge the target entry from the cache without writing it
+ * to disk even if it is dirty. The entry must not be either
+ * pinned or protected.
*
* Return: Non-negative on success/Negative on failure
*
@@ -620,19 +669,18 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_flush
*
- * Purpose: Flush (and possibly destroy) the metadata cache associated
- * with the specified file.
+ * Purpose: Flush (and possibly destroy) the metadata cache associated
+ * with the specified file.
*
- * If the cache contains protected entries, the function will
- * fail, as protected entries cannot be flushed. However
- * all unprotected entries should be flushed before the
- * function returns failure.
+ * If the cache contains protected entries, the function will
+ * fail, as protected entries cannot be flushed. However
+ * all unprotected entries should be flushed before the
+ * function returns failure.
*
* Return: Non-negative on success/Negative on failure if there was a
* request to flush all items and something was protected.
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 9 1997
*
*-------------------------------------------------------------------------
@@ -677,15 +725,15 @@ done:
* Function: H5AC_get_entry_status
*
* Purpose: Given a file address, determine whether the metadata
- * cache contains an entry at that location. If it does,
- * also determine whether the entry is dirty, protected,
- * pinned, etc. and return that information to the caller
- * in *status.
+ * cache contains an entry at that location. If it does,
+ * also determine whether the entry is dirty, protected,
+ * pinned, etc. and return that information to the caller
+ * in *status.
*
- * If the specified entry doesn't exist, set *status_ptr
- * to zero.
+ * If the specified entry doesn't exist, set *status_ptr
+ * to zero.
*
- * On error, the value of *status is undefined.
+ * On error, the value of *status is undefined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -750,7 +798,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 9 1997
*
*-------------------------------------------------------------------------
@@ -847,8 +894,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_dirty
*
- * Purpose: Mark a pinned or protected entry as dirty. The target
- * entry MUST be either pinned, protected, or both.
+ * Purpose: Mark a pinned or protected entry as dirty. The target
+ * entry MUST be either pinned, protected, or both.
*
* Return: Non-negative on success/Negative on failure
*
@@ -890,9 +937,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() */
@@ -900,8 +948,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_clean
*
- * Purpose: Mark a pinned entry as clean. The target
- * entry MUST be pinned.
+ * Purpose: Mark a pinned entry as clean. The target
+ * entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -942,9 +990,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() */
@@ -952,8 +1001,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_unserialized
*
- * Purpose: Mark a pinned or protected entry as unserialized. The target
- * entry MUST be either pinned, protected, or both.
+ * Purpose: Mark a pinned or protected entry as unserialized. The target
+ * entry MUST be either pinned, protected, or both.
*
* Return: Non-negative on success/Negative on failure
*
@@ -983,9 +1032,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() */
@@ -993,8 +1043,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_serialized
*
- * Purpose: Mark a pinned entry as serialized. The target
- * entry MUST be pinned.
+ * Purpose: Mark a pinned entry as serialized. The target
+ * entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1023,9 +1073,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() */
@@ -1039,7 +1090,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 9 1997
*
*-------------------------------------------------------------------------
@@ -1091,7 +1141,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_pin_protected_entry()
*
- * Purpose: Pin a protected cache entry. The entry must be protected
+ * Purpose: Pin a protected cache entry. The entry must be protected
* at the time of call, and must be unpinned.
*
* Return: Non-negative on success/Negative on failure
@@ -1123,9 +1173,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() */
@@ -1168,9 +1219,110 @@ done:
} /* H5AC_prep_for_file_close() */
/*-------------------------------------------------------------------------
+ *
+ * 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
+ * Purpose: Create a flush dependency between two entries in the metadata
* cache.
*
* Return: Non-negative on success/Negative on failure
@@ -1203,10 +1355,11 @@ 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() */
@@ -1215,22 +1368,21 @@ done:
* Function: H5AC_protect
*
* Purpose: If the target entry is not in the cache, load it. If
- * necessary, attempt to evict one or more entries to keep
- * the cache within its maximum size.
+ * necessary, attempt to evict one or more entries to keep
+ * the cache within its maximum size.
*
- * Mark the target entry as protected, and return its address
- * to the caller. The caller must call H5AC_unprotect() when
- * finished with the entry.
+ * Mark the target entry as protected, and return its address
+ * to the caller. The caller must call H5AC_unprotect() when
+ * finished with the entry.
*
- * While it is protected, the entry may not be either evicted
- * or flushed -- nor may it be accessed by another call to
- * H5AC_protect. Any attempt to do so will result in a failure.
+ * While it is protected, the entry may not be either evicted
+ * or flushed -- nor may it be accessed by another call to
+ * H5AC_protect. Any attempt to do so will result in a failure.
*
* Return: Success: Ptr to the object.
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Sep 2 1997
*
*-------------------------------------------------------------------------
@@ -1293,7 +1445,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_resize_entry
*
- * Purpose: Resize a pinned or protected entry.
+ * Purpose: Resize a pinned or protected entry.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1335,9 +1487,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() */
@@ -1345,8 +1498,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_unpin_entry()
*
- * Purpose: Unpin a cache entry. The entry must be unprotected at
- * the time of call, and must be pinned.
+ * Purpose: Unpin a cache entry. The entry must be unprotected at
+ * the time of call, and must be pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1377,9 +1530,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() */
@@ -1387,7 +1541,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_destroy_flush_dependency()
*
- * Purpose: Destroy a flush dependency between two entries.
+ * Purpose: Destroy a flush dependency between two entries.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1419,10 +1573,11 @@ 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() */
@@ -1430,27 +1585,27 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_unprotect
*
- * Purpose: Undo an H5AC_protect() call -- specifically, mark the
- * entry as unprotected, remove it from the protected list,
- * and give it back to the replacement policy.
+ * Purpose: Undo an H5AC_protect() call -- specifically, mark the
+ * entry as unprotected, remove it from the protected list,
+ * and give it back to the replacement policy.
*
- * The TYPE and ADDR arguments must be the same as those in
- * the corresponding call to H5AC_protect() and the THING
- * argument must be the value returned by that call to
- * H5AC_protect().
+ * The TYPE and ADDR arguments must be the same as those in
+ * the corresponding call to H5AC_protect() and the THING
+ * argument must be the value returned by that call to
+ * H5AC_protect().
*
- * If the deleted flag is TRUE, simply remove the target entry
- * from the cache, clear it, and free it without writing it to
- * disk.
+ * If the deleted flag is TRUE, simply remove the target entry
+ * from the cache, clear it, and free it without writing it to
+ * disk.
*
- * This version of the function is a complete re-write to
- * use the new metadata cache. While there isn't all that
- * much difference between the old and new Purpose sections,
- * the original version is given below.
+ * This version of the function is a complete re-write to
+ * use the new metadata cache. While there isn't all that
+ * much difference between the old and new Purpose sections,
+ * the original version is given below.
*
- * Original purpose section:
+ * Original purpose section:
*
- * This function should be called to undo the effect of
+ * This function should be called to undo the effect of
* H5AC_protect(). The TYPE and ADDR arguments should be the
* same as the corresponding call to H5AC_protect() and the
* THING argument should be the value returned by H5AC_protect().
@@ -1460,7 +1615,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Sep 2 1997
*
*-------------------------------------------------------------------------
@@ -1831,16 +1985,16 @@ done:
* Function: H5AC_validate_config()
*
* Purpose: Run a sanity check on the contents of the supplied
- * instance of H5AC_cache_config_t.
+ * instance of H5AC_cache_config_t.
*
* Do nothing and return SUCCEED if no errors are detected,
* and flag an error and return FAIL otherwise.
*
- * At present, this function operates by packing the data
- * from the instance of H5AC_cache_config_t into an instance
- * of H5C_auto_size_ctl_t, and then calling
- * H5C_validate_resize_config(). As H5AC_cache_config_t and
- * H5C_auto_size_ctl_t diverge, we may have to change this.
+ * At present, this function operates by packing the data
+ * from the instance of H5AC_cache_config_t into an instance
+ * of H5C_auto_size_ctl_t, and then calling
+ * H5C_validate_resize_config(). As H5AC_cache_config_t and
+ * H5C_auto_size_ctl_t diverge, we may have to change this.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1906,17 +2060,17 @@ done:
* Function: H5AC_validate_cache_image_config()
*
* Purpose: Run a sanity check on the contents of the supplied
- * instance of H5AC_cache_image_config_t.
+ * instance of H5AC_cache_image_config_t.
*
* Do nothing and return SUCCEED if no errors are detected,
* and flag an error and return FAIL otherwise.
*
- * At present, this function operates by packing the data
- * from the instance of H5AC_cache_image_config_t into an
- * instance of H5C_cache_image_ctl_t, and then calling
- * H5C_validate_cache_image_config(). If and when
+ * At present, this function operates by packing the data
+ * from the instance of H5AC_cache_image_config_t into an
+ * instance of H5C_cache_image_ctl_t, and then calling
+ * H5C_validate_cache_image_config(). If and when
* H5AC_cache_image_config_t and H5C_cache_image_ctl_t
- * diverge, we may have to change this.
+ * diverge, we may have to change this.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1961,13 +2115,13 @@ done:
* Function: H5AC__check_if_write_permitted
*
* Purpose: Determine if a write is permitted under the current
- * circumstances, and set *write_permitted_ptr accordingly.
- * As a general rule it is, but when we are running in parallel
- * mode with collective I/O, we must ensure that a read cannot
- * cause a write.
+ * circumstances, and set *write_permitted_ptr accordingly.
+ * As a general rule it is, but when we are running in parallel
+ * mode with collective I/O, we must ensure that a read cannot
+ * cause a write.
*
- * In the event of failure, the value of *write_permitted_ptr
- * is undefined.
+ * In the event of failure, the value of *write_permitted_ptr
+ * is undefined.
*
* Return: Non-negative on success/Negative on failure.
*
@@ -2016,12 +2170,12 @@ H5AC__check_if_write_permitted(const H5F_t
* Function: H5AC__ext_config_2_int_config()
*
* Purpose: Utility function to translate an instance of
- * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t.
+ * H5AC_cache_config_t to an instance of H5C_auto_size_ctl_t.
*
- * Places translation in *int_conf_ptr and returns SUCCEED
- * if successful. Returns FAIL on failure.
+ * Places translation in *int_conf_ptr and returns SUCCEED
+ * if successful. Returns FAIL on failure.
*
- * Does only minimal sanity checking.
+ * Does only minimal sanity checking.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2392,7 +2546,7 @@ done:
* Purpose: Given a file address, retrieve the ring for an entry at that
* address.
*
- * On error, the value of *ring is not modified.
+ * On error, the value of *ring is not modified.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2468,11 +2622,11 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
* are in the process of a file shutdown, post an error
* message, and return FAIL.
*
- * Note that this function simply passes the call on to
- * the metadata cache proper, and returns the result.
+ * 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
@@ -2543,7 +2697,7 @@ done:
* Function: H5AC_remove_entry()
*
* Purpose: Remove an entry from the cache. Must be not protected, pinned,
- * dirty, involved in flush dependencies, etc.
+ * dirty, involved in flush dependencies, etc.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2572,9 +2726,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() */
diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c
index e6d1283..2d24adb 100644
--- a/src/H5ACdbg.c
+++ b/src/H5ACdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -257,10 +257,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
@@ -335,8 +331,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 e4a09e3..d1f9697 100644
--- a/src/H5ACmodule.h
+++ b/src/H5ACmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5AC package. Including this header means that the source file
* is part of the H5AC package.
*/
-#ifndef _H5ACmodule_H
-#define _H5ACmodule_H
+#ifndef H5ACmodule_H
+#define H5ACmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_CACHE
#define H5_MY_PKG_INIT YES
-#endif /* _H5ACmodule_H */
+#endif /* H5ACmodule_H */
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index 2e25cde..ef85c6d 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5ACmpio.c
* Jun 20 2015
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Functions in this file implement support for parallel
* I/O cache functionality
@@ -773,7 +773,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 */
@@ -971,7 +971,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 */
@@ -1272,7 +1272,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f)
if (aux_ptr->write_done)
(aux_ptr->write_done)();
- /* to prevent "messages from the past" we must synchronize all
+ /* To prevent "messages from the past" we must synchronize all
* processes again before we go on.
*/
if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
@@ -1515,7 +1515,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list")
if (num_entries > 0)
- /* mark the indicated entries as clean */
+ /* Mark the indicated entries as clean */
if (H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.")
@@ -1849,6 +1849,8 @@ done:
* Programmer: John Mainzer
* April 28, 2010
*
+ * Changes: None.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1877,9 +1879,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 (!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) {
@@ -2076,9 +2081,13 @@ 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) ||
@@ -2158,6 +2167,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op)
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
done:
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__run_sync_point() */
@@ -2253,7 +2263,6 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *ca
* request to flush all items and something was protected.
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 22 2009
*
*-------------------------------------------------------------------------
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h
index 5ec364a..7da46a0 100644
--- a/src/H5ACpkg.h
+++ b/src/H5ACpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -30,8 +30,8 @@
#error "Do not include this file outside the H5AC package!"
#endif
-#ifndef _H5ACpkg_H
-#define _H5ACpkg_H
+#ifndef H5ACpkg_H
+#define H5ACpkg_H
/* Get package's private header */
#include "H5ACprivate.h" /* Metadata cache */
@@ -423,4 +423,4 @@ H5_DLL herr_t H5AC__set_sync_point_done_callback(H5C_t *cache_ptr,
H5_DLL herr_t H5AC__set_write_done_callback(H5C_t *cache_ptr, void (*write_done)(void));
#endif /* H5_HAVE_PARALLEL */
-#endif /* _H5ACpkg_H */
+#endif /* H5ACpkg_H */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index ba3da70..283989d 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -6,34 +6,34 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5ACprivate.h
- * Jul 9 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Created: H5ACprivate.h
+ * Jul 9 1997
+ * Robb Matzke
*
- * Purpose: Constants and typedefs available to the rest of the
- * library.
+ * Purpose: Constants and typedefs available to the rest of the
+ * library.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5ACprivate_H
-#define _H5ACprivate_H
+#ifndef H5ACprivate_H
+#define H5ACprivate_H
-#include "H5ACpublic.h" /*public prototypes */
+#include "H5ACpublic.h" /*public prototypes */
/* Pivate headers needed by this header */
-#include "H5private.h" /* Generic Functions */
-#include "H5Cprivate.h" /* Cache */
-#include "H5Fprivate.h" /* File access */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Cprivate.h" /* Cache */
+#include "H5Fprivate.h" /* File access */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip lists */
/* Global metadata tag values */
#define H5AC__INVALID_TAG (haddr_t)0
@@ -90,20 +90,20 @@ typedef enum {
*
* NOTE: test/cache plays games with the f->shared->cache, and thus
* setting H5AC_DUMP_STATS_ON_CLOSE will generate constant,
- * irrelevant data when run with that test program. See
- * comments on setup_cache() / takedown_cache() in test/cache_common.c.
+ * irrelevant data when run with that test program. See
+ * comments on setup_cache() / takedown_cache() in test/cache_common.c.
* for details.
*
- * If you need to dump stats at file close in test/cache.c,
- * use the dump_stats parameter to takedown_cache(), or call
- * H5C_stats() directly.
- * JRM -- 4/12/15
+ * If you need to dump stats at file close in test/cache.c,
+ * use the dump_stats parameter to takedown_cache(), or call
+ * H5C_stats() directly.
+ * JRM -- 4/12/15
*
* Added the H5AC_DUMP_IMAGE_STATS_ON_CLOSE #define, which works much
* the same way as H5AC_DUMP_STATS_ON_CLOSE. However, the set of stats
* displayed is much smaller, and directed purely at the cache image feature.
*
- * JRM -- 11/1/15
+ * JRM -- 11/1/15
*/
#if H5C_COLLECT_CACHE_STATS
@@ -132,7 +132,7 @@ typedef enum {
#endif
/*
- * Class methods pertaining to caching. Each type of cached object will
+ * Class methods pertaining to caching. Each type of cached object will
* have a constant variable with permanent life-span that describes how
* to cache the object.
*/
@@ -222,80 +222,89 @@ typedef struct H5AC_proxy_entry_t {
/* Default cache configuration. */
#define H5AC__DEFAULT_METADATA_WRITE_STRATEGY H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED
+/* clang-format off */
#ifdef H5_HAVE_PARALLEL
-#define H5AC__DEFAULT_CACHE_CONFIG \
- { \
- /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION, \
- /* hbool_t rpt_fcn_enabled = */ FALSE, \
- /* hbool_t open_trace_file = */ FALSE, \
- /* hbool_t close_trace_file = */ FALSE, /* char trace_file_name[] = */ "", \
- /* hbool_t evictions_enabled = */ TRUE, \
- /* hbool_t set_initial_size = */ TRUE, \
- /* size_t initial_size = */ (2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.3f, \
- /* size_t max_size = */ (32 * 1024 * 1024), \
- /* size_t min_size = */ (1 * 1024 * 1024), \
- /* long int epoch_length = */ 50000, \
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
- /* hbool_t apply_max_increment = */ TRUE, \
- /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode \
- */ \
- /* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.0f, \
- /* double flash_threshold = */ 0.25f, \
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
- /* hbool_t apply_max_decrement = */ TRUE, \
- /* size_t max_decrement = */ (1 * 1024 * 1024), \
- /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
- /* size_t dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ \
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
- }
+#define H5AC__DEFAULT_CACHE_CONFIG \
+{ \
+ /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION, \
+ /* hbool_t rpt_fcn_enabled = */ FALSE, \
+ /* hbool_t open_trace_file = */ FALSE, \
+ /* hbool_t close_trace_file = */ FALSE, \
+ /* char trace_file_name[] = */ "", \
+ /* hbool_t evictions_enabled = */ TRUE, \
+ /* hbool_t set_initial_size = */ TRUE, \
+ /* size_t initial_size = */ ( 2 * 1024 * 1024), \
+ /* double min_clean_fraction = */ 0.3f, \
+ /* size_t max_size = */ (32 * 1024 * 1024), \
+ /* size_t min_size = */ (1 * 1024 * 1024), \
+ /* long int epoch_length = */ 50000, \
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
+ /* double lower_hr_threshold = */ 0.9f, \
+ /* double increment = */ 2.0f, \
+ /* hbool_t apply_max_increment = */ TRUE, \
+ /* size_t max_increment = */ (4 * 1024 * 1024), \
+ /* enum H5C_cache_flash_incr_mode */ \
+ /* flash_incr_mode = */ H5C_flash_incr__add_space, \
+ /* double flash_multiple = */ 1.0f, \
+ /* double flash_threshold = */ 0.25f, \
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
+ /* double upper_hr_threshold = */ 0.999f, \
+ /* double decrement = */ 0.9f, \
+ /* hbool_t apply_max_decrement = */ TRUE, \
+ /* size_t max_decrement = */ (1 * 1024 * 1024), \
+ /* int epochs_before_eviction = */ 3, \
+ /* hbool_t apply_empty_reserve = */ TRUE, \
+ /* double empty_reserve = */ 0.1f, \
+ /* size_t dirty_bytes_threshold = */ (256 * 1024), \
+ /* int metadata_write_strategy = */ \
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
+}
#else /* H5_HAVE_PARALLEL */
-#define H5AC__DEFAULT_CACHE_CONFIG \
- { \
- /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, \
- /* hbool_t rpt_fcn_enabled = */ FALSE, \
- /* hbool_t open_trace_file = */ FALSE, \
- /* hbool_t close_trace_file = */ FALSE, /* char trace_file_name[] = */ "", \
- /* hbool_t evictions_enabled = */ TRUE, \
- /* hbool_t set_initial_size = */ TRUE, \
- /* size_t initial_size = */ (2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.01f, \
- /* size_t max_size = */ (32 * 1024 * 1024), \
- /* size_t min_size = */ (1 * 1024 * 1024), \
- /* long int epoch_length = */ 50000, \
- /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
- /* hbool_t apply_max_increment = */ TRUE, \
- /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode \
- */ \
- /* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.4f, \
- /* double flash_threshold = */ 0.25f, \
- /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
- /* hbool_t apply_max_decrement = */ TRUE, \
- /* size_t max_decrement = */ (1 * 1024 * 1024), \
- /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
- /* size_t dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ \
- H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
- }
+#define H5AC__DEFAULT_CACHE_CONFIG \
+{ \
+ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, \
+ /* hbool_t rpt_fcn_enabled = */ FALSE, \
+ /* hbool_t open_trace_file = */ FALSE, \
+ /* hbool_t close_trace_file = */ FALSE, \
+ /* char trace_file_name[] = */ "", \
+ /* hbool_t evictions_enabled = */ TRUE, \
+ /* hbool_t set_initial_size = */ TRUE, \
+ /* size_t initial_size = */ ( 2 * 1024 * 1024), \
+ /* double min_clean_fraction = */ 0.01f, \
+ /* size_t max_size = */ (32 * 1024 * 1024), \
+ /* size_t min_size = */ ( 1 * 1024 * 1024), \
+ /* long int epoch_length = */ 50000, \
+ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
+ /* double lower_hr_threshold = */ 0.9f, \
+ /* double increment = */ 2.0f, \
+ /* hbool_t apply_max_increment = */ TRUE, \
+ /* size_t max_increment = */ (4 * 1024 * 1024), \
+ /* enum H5C_cache_flash_incr_mode */ \
+ /* flash_incr_mode = */ H5C_flash_incr__add_space, \
+ /* double flash_multiple = */ 1.4f, \
+ /* double flash_threshold = */ 0.25f, \
+ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\
+ /* double upper_hr_threshold = */ 0.999f, \
+ /* double decrement = */ 0.9f, \
+ /* hbool_t apply_max_decrement = */ TRUE, \
+ /* size_t max_decrement = */ (1 * 1024 * 1024), \
+ /* int epochs_before_eviction = */ 3, \
+ /* hbool_t apply_empty_reserve = */ TRUE, \
+ /* double empty_reserve = */ 0.1f, \
+ /* size_t dirty_bytes_threshold = */ (256 * 1024), \
+ /* int metadata_write_strategy = */ \
+ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
+}
#endif /* H5_HAVE_PARALLEL */
-#define H5AC__DEFAULT_CACHE_IMAGE_CONFIG \
- { \
- /* int32_t version = */ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, \
- /* hbool_t generate_image = */ FALSE, /* hbool_t save_resize_status = */ FALSE, \
- /* int32_t entry_ageout = */ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE \
- }
+#define H5AC__DEFAULT_CACHE_IMAGE_CONFIG \
+{ \
+ /* int32_t version = */ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, \
+ /* hbool_t generate_image = */ FALSE, \
+ /* hbool_t save_resize_status = */ FALSE, \
+ /* int32_t entry_ageout = */ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE \
+}
+/* clang-format on */
/*
* Library prototypes.
*/
@@ -376,6 +385,8 @@ H5_DLL herr_t H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr
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);
H5_DLL herr_t H5AC_resize_entry(void *thing, size_t new_size);
@@ -447,4 +458,4 @@ H5_DLL hbool_t H5AC_get_serialization_in_progress(H5F_t *f);
H5_DLL hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring);
#endif /* NDEBUG */ /* end debugging functions */
-#endif /* !_H5ACprivate_H */
+#endif /* H5ACprivate_H */
diff --git a/src/H5ACproxy_entry.c b/src/H5ACproxy_entry.c
index 76e885f..b3d31b2 100644
--- a/src/H5ACproxy_entry.c
+++ b/src/H5ACproxy_entry.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h
index 72bffd0..f8f4f28 100644
--- a/src/H5ACpublic.h
+++ b/src/H5ACpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,16 +15,14 @@
*
* Created: H5ACpublic.h
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Public include file for cache functions.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifndef _H5ACpublic_H
-#define _H5ACpublic_H
+#ifndef H5ACpublic_H
+#define H5ACpublic_H
/* Public headers needed by this file */
#include "H5public.h"
@@ -444,124 +442,347 @@ extern "C" {
#define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0
#define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1
+/**
+ * H5AC_cache_config_t is a public structure intended for use in public APIs.
+ * At least in its initial incarnation, it is basically a copy of \c struct
+ * \c H5C_auto_size_ctl_t, minus the \c report_fcn field, and plus the
+ * \c dirty_bytes_threshold field.
+ *
+ * The \c report_fcn field is omitted, as including it would require us to make
+ * \c H5C_t structure public.
+ *
+ * The \c dirty_bytes_threshold field does not appear in \c H5C_auto_size_ctl_t,
+ * as synchronization between caches on different processes is handled at the \c
+ * H5AC level, not at the level of \c H5C. Note however that there is
+ * considerable interaction between this value and the other fields in this
+ * structure.
+ *
+ * Similarly, the \c open_trace_file, \c close_trace_file, and \c
+ * trace_file_name fields do not appear in \c H5C_auto_size_ctl_t, as most trace
+ * file issues are handled at the \c H5AC level. The one exception is storage
+ * of the pointer to the trace file, which is handled by \c H5C.
+ *
+ * The structure is in H5ACpublic.h as we may wish to allow different
+ * configuration options for metadata and raw data caches.
+ */
+
+//! <!-- [H5AC_cache_config_t_snip] -->
typedef struct H5AC_cache_config_t {
/* general configuration fields: */
+ //! <!-- [H5AC_cache_config_t_general_snip] -->
int version;
+ /**< Integer field indicating the the version of the H5AC_cache_config_t
+ * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION
+ * (defined in H5ACpublic.h). */
hbool_t rpt_fcn_enabled;
+ /**< Boolean flag indicating whether the adaptive cache resize report
+ * function is enabled. This field should almost always be set to disabled
+ * (0). Since resize algorithm activity is reported via stdout, it MUST be
+ * set to disabled (0) on Windows machines.\n
+ * The report function is not supported code, and can be expected to change
+ * between versions of the library. Use it at your own risk. */
hbool_t open_trace_file;
+ /**< Boolean field indicating whether the
+ * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
+ * field should be used to open a trace file for the cache.\n
+ * The trace file is a debugging feature that allows the capture
+ * of top level metadata cache requests for purposes of debugging
+ * and/or optimization. This field should normally be set to 0, as
+ * trace file collection imposes considerable overhead.\n
+ * This field should only be set to 1 when the
+ * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
+ * contains the full path of the desired trace file, and either
+ * there is no open trace file on the cache, or the
+ * \ref H5AC_cache_config_t.close_trace_file "close_trace_file"
+ * field is also 1.\n
+ * The trace file feature is unsupported unless used at the
+ * direction of The HDF Group. It is intended to allow The HDF
+ * Group to collect a trace of cache activity in cases of occult
+ * failures and/or poor performance seen in the field, so as to aid
+ * in reproduction in the lab. If you use it absent the direction
+ * of The HDF Group, you are on your own. */
+
hbool_t close_trace_file;
- char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
+ /**< Boolean field indicating whether the current trace file
+ *(if any) should be closed.\n
+ * See the above comments on the \ref H5AC_cache_config_t.open_trace_file
+ * "open_trace_file" field. This field should be set to 0 unless there is
+ * an open trace file on the cache that you wish to close.\n
+ * The trace file feature is unsupported unless used at the direction of
+ * The HDF Group. It is intended to allow The HDF Group to collect a trace
+ * of cache activity in cases of occult failures and/or poor performance
+ * seen in the field, so as to aid in reproduction in the lab. If you use
+ * it absent the direction of The HDF Group, you are on your own. */
+
+ char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
+ /**< Full path of the trace file to be opened if the
+ * \ref H5AC_cache_config_t.open_trace_file "open_trace_file" field is set
+ * to 1.\n
+ * In the parallel case, an ascii representation of the MPI rank of the
+ * process will be appended to the file name to yield a unique trace file
+ * name for each process.\n
+ * The length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN
+ * characters.\n
+ * The trace file feature is unsupported unless used at the direction of
+ * The HDF Group. It is intended to allow The HDF Group to collect a trace
+ * of cache activity in cases of occult failures and/or poor performance
+ * seen in the field, so as to aid in reproduction in the lab. If you use
+ * it absent the direction of The HDF Group, you are on your own. */
hbool_t evictions_enabled;
+ /**< A boolean flag indicating whether evictions from the metadata cache
+ * are enabled. This flag is initially set to enabled (1).\n
+ * In rare circumstances, the raw data throughput quirements may be so high
+ * that the user wishes to postpone metadata writes so as to reserve I/O
+ * throughput for raw data. The \p evictions_enabled field exists to allow
+ * this. However, this is an extreme step, and you have no business doing
+ * it unless you have read the User Guide section on metadata caching, and
+ * have considered all other options carefully.\n
+ * The \p evictions_enabled field may not be set to disabled (0)
+ * unless all adaptive cache resizing code is disabled via the
+ * \ref H5AC_cache_config_t.incr_mode "incr_mode",
+ * \ref H5AC_cache_config_t.flash_incr_mode "flash_incr_mode",
+ * \ref H5AC_cache_config_t.decr_mode "decr_mode" fields.\n
+ * When this flag is set to disabled (\c 0), the metadata cache will not
+ * attempt to evict entries to make space for new entries, and thus will
+ * grow without bound.\n
+ * Evictions will be re-enabled when this field is set back to \c 1.
+ * This should be done as soon as possible. */
hbool_t set_initial_size;
- size_t initial_size;
+ /**< Boolean flag indicating whether the cache should be created
+ * with a user specified initial size. */
+
+ size_t initial_size;
+ /**< If \ref H5AC_cache_config_t.set_initial_size "set_initial_size"
+ * is set to 1, \p initial_size must contain he desired initial size in
+ * bytes. This value must lie in the closed interval
+ * [ \p min_size, \p max_size ]. (see below) */
double min_clean_fraction;
+ /**< This field specifies the minimum fraction of the cache
+ * that must be kept either clean or empty.\n
+ * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to
+ * start in the serial case. In the parallel case, a larger value is needed
+ * -- see the overview of the metadata cache in the
+ * “Metadata Caching in HDF5” section of the -- <em>HDF5 User’s Guide</em>
+ * for details. */
size_t max_size;
+ /**< Upper bound (in bytes) on the range of values that the
+ * adaptive cache resize code can select as the maximum cache size. */
+
size_t min_size;
+ /**< Lower bound (in bytes) on the range of values that the
+ * adaptive cache resize code can select as the mininum cache * size. */
long int epoch_length;
+ /**< Number of cache accesses between runs of the adaptive cache resize
+ * code. 50,000 is a good starting number. */
+ //! <!-- [H5AC_cache_config_t_general_snip] -->
/* size increase control fields: */
+ //! <!-- [H5AC_cache_config_t_incr_snip] -->
enum H5C_cache_incr_mode incr_mode;
+ /**< Enumerated value indicating the operational mode of the automatic
+ * cache size increase code. At present, only two values listed in
+ * #H5C_cache_incr_mode are legal. */
double lower_hr_threshold;
+ /**< Hit rate threshold used by the hit rate threshold cache size
+ * increment algorithm.\n
+ * When the hit rate over an epoch is below this threshold and the cache
+ * is full, the maximum size of the cache is multiplied by increment
+ * (below), and then clipped as necessary to stay within \p max_size, and
+ * possibly \p max_increment.\n
+ * This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good
+ * place to start. */
double increment;
+ /**< Factor by which the hit rate threshold cache size increment
+ * algorithm multiplies the current cache max size to obtain a tentative
+ * new cache size.\n
+ * The actual cache size increase will be clipped to satisfy the \p max_size
+ * specified in the general configuration, and possibly max_increment
+ * below.\n
+ * The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable
+ * value.\n
+ * If you set it to 1.0, you will effectively disable cache size increases.
+ */
hbool_t apply_max_increment;
- size_t max_increment;
+ /**< Boolean flag indicating whether an upper limit should be applied to
+ * the size of cache size increases. */
+
+ size_t max_increment;
+ /**< Maximum number of bytes by which cache size can be increased in a
+ * single step -- if applicable. */
enum H5C_cache_flash_incr_mode flash_incr_mode;
- double flash_multiple;
- double flash_threshold;
+ /**< Enumerated value indicating the operational mode of the flash cache
+ * size increase code. At present, only two listed values in
+ * #H5C_cache_flash_incr_mode are legal.*/
+
+ double flash_multiple;
+ /**< The factor by which the size of the triggering entry / entry size
+ * increase is multiplied to obtain the initial cache size increment. This
+ * increment may be reduced to reflect existing free space in the cache and
+ * the \p max_size field above.\n
+ * The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good
+ * place to start.\n
+ * At present, this field must lie in the range [0.1, 10.0]. */
+
+ double flash_threshold;
+ /**< The factor by which the current maximum cache size is multiplied to
+ * obtain the minimum size entry / entry size increase which may trigger a
+ * flash cache size increase. \n
+ * At present, this value must lie in the range [0.1, 1.0]. */
+ //! <!-- [H5AC_cache_config_t_incr_snip] -->
/* size decrease control fields: */
+ //! <!-- [H5AC_cache_config_t_decr_snip] -->
enum H5C_cache_decr_mode decr_mode;
+ /**< Enumerated value indicating the operational mode of the tomatic
+ * cache size decrease code. At present, the values listed in
+ * #H5C_cache_decr_mode are legal.*/
double upper_hr_threshold;
+ /**< Hit rate threshold for the hit rate threshold and ageout with hit
+ * rate threshold cache size decrement algorithms.\n
+ * When \p decr_mode is #H5C_decr__threshold, and the hit rate over a given
+ * epoch exceeds the supplied threshold, the current maximum cache
+ * size is multiplied by decrement to obtain a tentative new (and smaller)
+ * maximum cache size.\n
+ * When \p decr_mode is #H5C_decr__age_out_with_threshold, there is
+ * no attempt to find and evict aged out entries unless the hit rate in
+ * the previous epoch exceeded the supplied threshold.\n
+ * This field must lie in the interval [0.0, 1.0].\n
+ * For #H5C_incr__threshold, .9995 or .99995 is a good place to start.\n
+ * For #H5C_decr__age_out_with_threshold, .999 might be more useful.*/
double decrement;
+ /**< In the hit rate threshold cache size decrease algorithm, this
+ * parameter contains the factor by which the current max cache size is
+ * multiplied to produce a tentative new cache size.\n
+ * The actual cache size decrease will be clipped to satisfy the
+ * \ref H5AC_cache_config_t.min_size "min_size" specified in the general
+ * configuration, and possibly \ref H5AC_cache_config_t.max_decrement
+ * "max_decrement".\n
+ * The parameter must be be in the interval [0.0, 1.0].\n
+ * If you set it to 1.0, you will effectively
+ * disable cache size decreases. 0.9 is a reasonable starting point. */
hbool_t apply_max_decrement;
- size_t max_decrement;
+ /**< Boolean flag indicating ether an upper limit should be applied to
+ * the size of cache size decreases. */
+
+ size_t max_decrement;
+ /**< Maximum number of bytes by which the maximum cache size can be
+ * decreased in any single step -- if applicable.*/
int epochs_before_eviction;
+ /**< In the ageout based cache size reduction algorithms, this field
+ * contains the minimum number of epochs an entry must remain unaccessed in
+ * cache before the cache size reduction algorithm tries to evict it. 3 is a
+ * reasonable value. */
hbool_t apply_empty_reserve;
- double empty_reserve;
+ /**< Boolean flag indicating whether the ageout based decrement
+ * algorithms will maintain a empty reserve when decreasing cache size. */
+
+ double empty_reserve;
+ /**< Empty reserve as a fraction maximum cache size if applicable.\n When
+ * so directed, the ageout based algorithms will not decrease the maximum
+ * cache size unless the empty reserve can be met.\n The parameter must lie
+ * in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to start. */
+ //! <!-- [H5AC_cache_config_t_decr_snip] -->
/* parallel configuration fields: */
+ //! <!-- [H5AC_cache_config_t_parallel_snip] -->
size_t dirty_bytes_threshold;
- int metadata_write_strategy;
-
+ /**< Threshold number of bytes of dirty metadata generation for
+ * triggering synchronizations of the metadata caches serving the target
+ * file in the parallel case.\n Synchronization occurs whenever the number
+ * of bytes of dirty metadata created since the last synchronization exceeds
+ * this limit.\n This field only applies to the parallel case. While it is
+ * ignored elsewhere, it can still draw a value out of bounds error.\n It
+ * must be consistant across all caches on any given file.\n By default,
+ * this field is set to 256 KB. It shouldn't be more than half the current
+ * max cache size times the min clean fraction. */
+
+ int metadata_write_strategy;
+ /**< Desired metadata write strategy. The valid values for this field
+ * are:\n #H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: Specifies tha only
+ * process zero is allowed to write dirty metadata to disk.\n
+ * #H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: Specifies that process zero
+ * still makes the decisions as to what entries should be flushed, but the
+ * actual flushes are distributed across the processes in the computation to
+ * the extent possible.\n The src/H5ACpublic.h include file in the HDF5
+ * library has detailed information on each strategy. */
+ //! <!-- [H5AC_cache_config_t_parallel_snip] -->
} H5AC_cache_config_t;
-
-/****************************************************************************
- *
- * structure H5AC_cache_image_config_t
- *
- * H5AC_cache_image_ctl_t is a public structure intended for use in public
- * APIs. At least in its initial incarnation, it is a copy of struct
- * H5C_cache_image_ctl_t.
- *
- * The fields of the structure are discussed individually below:
- *
- * version: Integer field containing the version number of this version
- * of the H5C_image_ctl_t structure. Any instance of
- * H5C_image_ctl_t passed to the cache must have a known
- * version number, or an error will be flagged.
- *
- * generate_image: Boolean flag indicating whether a cache image should
- * be created on file close.
- *
- * save_resize_status: Boolean flag indicating whether the cache image
- * should include the adaptive cache resize configuration and status.
- * Note that this field is ignored at present.
- *
- * entry_ageout: Integer field indicating the maximum number of
- * times a prefetched entry can appear in subsequent cache images.
- * This field exists to allow the user to avoid the buildup of
- * infrequently used entries in long sequences of cache images.
- *
- * The value of this field must lie in the range
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100).
- *
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit
- * is imposed on number of times a prefeteched entry can appear
- * in subsequent cache images.
- *
- * A value of 0 prevents prefetched entries from being included
- * in cache images.
- *
- * Positive integers restrict prefetched entries to the specified
- * number of appearances.
- *
- * Note that the number of subsequent cache images that a prefetched
- * entry has appeared in is tracked in an 8 bit field. Thus, while
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its
- * current value, any value in excess of 255 will be the functional
- * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
- *
- ****************************************************************************/
+//! <!-- [H5AC_cache_config_t_snip] -->
#define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1
#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1
#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100
+//! <!-- [H5AC_cache_image_config_t_snip] -->
+/**
+ * H5AC_cache_image_config_t is a public structure intended for use in public
+ * APIs. At least in its initial incarnation, it is a copy of \c struct \c
+ * H5C_cache_image_ctl_t.
+ */
+
typedef struct H5AC_cache_image_config_t {
- int version;
+ int version;
+ /**< Integer field containing the version number of this version of the \c
+ * H5C_image_ctl_t structure. Any instance of \c H5C_image_ctl_t passed
+ * to the cache must have a known version number, or an error will be
+ * flagged.
+ */
hbool_t generate_image;
+ /**< Boolean flag indicating whether a cache image should be created on file
+ * close.
+ */
hbool_t save_resize_status;
- int entry_ageout;
+ /**< Boolean flag indicating whether the cache image should include the
+ * adaptive cache resize configuration and status. Note that this field
+ * is ignored at present.
+ */
+ int entry_ageout;
+ /**< Integer field indicating the maximum number of times a
+ * prefetched entry can appear in subsequent cache images. This field
+ * exists to allow the user to avoid the buildup of infrequently used
+ * entries in long sequences of cache images.
+ *
+ * The value of this field must lie in the range \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100).
+ *
+ * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit is
+ * imposed on number of times a prefeteched entry can appear in subsequent
+ * cache images.
+ *
+ * A value of 0 prevents prefetched entries from being included in cache
+ * images.
+ *
+ * Positive integers restrict prefetched entries to the specified number
+ * of appearances.
+ *
+ * Note that the number of subsequent cache images that a prefetched entry
+ * has appeared in is tracked in an 8 bit field. Thus, while \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its current
+ * value, any value in excess of 255 will be the functional equivalent of
+ * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
+ */
} H5AC_cache_image_config_t;
+//! <!-- [H5AC_cache_image_config_t_snip] -->
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 590603a..3274dd7 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Abtree2.c
* Dec 4 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: v2 B-tree callbacks for indexing attributes on objects
*
@@ -140,7 +140,6 @@ const H5B2_class_t H5A_BT2_CORDER[1] = {{
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 4 2006
*
*-------------------------------------------------------------------------
@@ -365,9 +364,8 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth,
- "Record:", (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder,
- (unsigned long)nrecord->hash);
+ HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth,
+ "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_name_debug() */
@@ -517,8 +515,8 @@ H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth, "Record:", (hsize_t)nrecord->id.val,
- (unsigned)nrecord->flags, (unsigned)nrecord->corder);
+ HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth,
+ "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_debug() */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 9ea19e7..1575f3c 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Adense.c
* Dec 4 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Routines for operating on "dense" attribute storage
* for an object.
@@ -161,7 +161,6 @@ typedef struct H5A_bt2_ud_rmbi_t {
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 4 2006
*
*-------------------------------------------------------------------------
@@ -200,9 +199,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
{
@@ -212,9 +208,6 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
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 */
@@ -234,9 +227,6 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
/* 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) {
@@ -255,10 +245,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
/* 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 */
+ } /* end if */
done:
/* Release resources */
@@ -279,9 +266,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 11 2006
+ * Programmer: Quincey Koziol
+ * Dec 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -339,9 +325,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 11 2006
+ * Programmer: Quincey Koziol
+ * Dec 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -427,9 +412,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 4 2006
+ * Programmer: Quincey Koziol
+ * Dec 4 2006
*
*-------------------------------------------------------------------------
*/
@@ -584,7 +568,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, February 20, 2007
*
*-------------------------------------------------------------------------
@@ -617,7 +601,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
*
*-------------------------------------------------------------------------
@@ -729,9 +713,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 4 2006
+ * Programmer: Quincey Koziol
+ * Dec 4 2006
*
*-------------------------------------------------------------------------
*/
@@ -825,9 +808,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 5 2006
+ * Programmer: Quincey Koziol
+ * Dec 5 2006
*
*-------------------------------------------------------------------------
*/
@@ -868,9 +850,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jan 3 2007
+ * Programmer: Quincey Koziol
+ * Jan 3 2007
*
*-------------------------------------------------------------------------
*/
@@ -1049,9 +1030,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
*
*-------------------------------------------------------------------------
*/
@@ -1146,9 +1126,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 5 2006
+ * Programmer: Quincey Koziol
+ * Dec 5 2006
*
*-------------------------------------------------------------------------
*/
@@ -1280,9 +1259,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 11 2006
+ * Programmer: Quincey Koziol
+ * Dec 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -1344,9 +1322,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 11 2006
+ * Programmer: Quincey Koziol
+ * Dec 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -1431,9 +1408,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Feb 14 2007
+ * Programmer: Quincey Koziol
+ * Feb 14 2007
*
*-------------------------------------------------------------------------
*/
@@ -1558,9 +1534,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Feb 14 2007
+ * Programmer: Quincey Koziol
+ * Feb 14 2007
*
*-------------------------------------------------------------------------
*/
@@ -1685,9 +1660,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 11 2006
+ * Programmer: Quincey Koziol
+ * Dec 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -1770,9 +1744,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jan 3 2007
+ * Programmer: Quincey Koziol
+ * Jan 3 2007
*
*-------------------------------------------------------------------------
*/
@@ -1834,9 +1807,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 c445412..e43706f 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Adeprec.c
* November 27 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * 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 71bb2f2..0609f24 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*-------------------------------------------------------------------------
*
* Created: H5Aint.c
- * Dec 18 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Dec 18 2006
+ * Quincey Koziol
*
* Purpose: Internal routines for managing attributes.
*
@@ -281,12 +281,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -341,18 +341,17 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -444,7 +443,7 @@ done:
*
* 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
@@ -601,6 +600,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")
@@ -869,7 +872,6 @@ done:
* 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
*
*-------------------------------------------------------------------------
@@ -1016,7 +1018,6 @@ done:
* Purpose: Copies attribute OLD_ATTR.
*
* Return: Success: Pointer to a new copy of the OLD_ATTR argument.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -1349,7 +1350,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2006
*
* Modification:Raymond Lu
@@ -1411,8 +1411,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * Dec 18, 2006
+ * Programmer: Quincey Koziol
+ * Dec 18, 2006
*
*-------------------------------------------------------------------------
*/
@@ -1468,11 +1468,9 @@ done:
* 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
*
*-------------------------------------------------------------------------
@@ -1592,17 +1590,16 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -1629,7 +1626,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
*
*-------------------------------------------------------------------------
@@ -1655,7 +1651,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
*
*-------------------------------------------------------------------------
@@ -1681,17 +1676,16 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1718,11 +1712,10 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2)
*
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1764,8 +1757,8 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_orde
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * Dec 18, 2006
+ * Programmer: Quincey Koziol
+ * Dec 18, 2006
*
*-------------------------------------------------------------------------
*/
@@ -1842,7 +1835,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Dec 11, 2006
*
*-------------------------------------------------------------------------
@@ -1881,11 +1874,9 @@ done:
* 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
*
*-------------------------------------------------------------------------
@@ -1948,7 +1939,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 17 2007
*
*-------------------------------------------------------------------------
@@ -2389,7 +2379,6 @@ done:
* Failure: Negative
*
* Programmer: Peter Cao
- * xcao@hdfgroup.org
* July 20, 2007
*
*-------------------------------------------------------------------------
@@ -2446,7 +2435,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
- * xcao@hdfgroup.org
* July 20, 2007
*
*-------------------------------------------------------------------------
@@ -2491,7 +2479,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* February 20, 2007
*
*-------------------------------------------------------------------------
@@ -2508,7 +2496,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
FUNC_ENTER_PACKAGE
/* Avoid thrashing things if the names are the same */
- if (HDstrcmp(old_attr_name, new_attr_name)) {
+ if (HDstrcmp(old_attr_name, new_attr_name) != 0) {
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
@@ -2539,7 +2527,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* December 6, 2017
*
*-------------------------------------------------------------------------
@@ -2638,7 +2626,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* December 6, 2017
*
*-------------------------------------------------------------------------
@@ -2679,7 +2667,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* December 6, 2017
*
*-------------------------------------------------------------------------
@@ -2724,7 +2712,7 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* December 6, 2017
*
*-------------------------------------------------------------------------
diff --git a/src/H5Amodule.h b/src/H5Amodule.h
index 551a0a4..c89c93f 100644
--- a/src/H5Amodule.h
+++ b/src/H5Amodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5A package. Including this header means that the source file
* is part of the H5A package.
*/
-#ifndef _H5Amodule_H
-#define _H5Amodule_H
+#ifndef H5Amodule_H
+#define H5Amodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,41 @@
#define H5_MY_PKG_ERR H5E_ATTR
#define H5_MY_PKG_INIT YES
-#endif /* _H5Amodule_H */
+/**\defgroup H5A H5A
+ *
+ * Use the functions in this module to manage HDF5 attributes.
+ *
+ * The Attribute Interface, H5A, provides a mechanism for attaching additional
+ * information to a dataset, group, or named datatype.
+ *
+ * Attributes are accessed by opening the object that they are attached to and
+ * are not independent objects. Typically an attribute is small in size and
+ * contains user metadata about the object that it is attached to.
+ *
+ * Attributes look similar to HDF5 datasets in that they have a datatype and
+ * dataspace. However, they do not support partial I/O operations and cannot be
+ * compressed or extended.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5A_examples.c create
+ * </td>
+ * <td>
+ * \snippet H5A_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5A_examples.c update
+ * </td>
+ * <td>
+ * \snippet H5A_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ */
+
+#endif /* H5Amodule_H */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 9ec0b12..48adeef 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5A package!"
#endif
-#ifndef _H5Apkg_H
-#define _H5Apkg_H
+#ifndef H5Apkg_H
+#define H5Apkg_H
/*
* Define this to enable debugging.
@@ -249,9 +249,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, H5O_loc_t *dst_oloc,
@@ -266,4 +263,4 @@ H5_DLL htri_t H5A__is_shared_test(hid_t aid);
H5_DLL herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count);
#endif /* H5A_TESTING */
-#endif /* _H5Apkg_H */
+#endif /* H5Apkg_H */
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index 4164154..3ed0239 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5D module
*/
-#ifndef _H5Aprivate_H
-#define _H5Aprivate_H
+#ifndef H5Aprivate_H
+#define H5Aprivate_H
/* Include package's public header */
#include "H5Apublic.h"
@@ -78,4 +78,4 @@ H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index
H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
const H5A_attr_iter_op_t *attr_op, void *op_data);
-#endif /* _H5Aprivate_H */
+#endif /* H5Aprivate_H */
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 89a3b04..0198668 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,25 +14,48 @@
/*
* This file contains public declarations for the H5A module.
*/
-#ifndef _H5Apublic_H
-#define _H5Apublic_H
+#ifndef H5Apublic_H
+#define H5Apublic_H
/* Public headers needed by this file */
#include "H5Ipublic.h" /* IDs */
#include "H5Opublic.h" /* Object Headers */
#include "H5Tpublic.h" /* Datatypes */
-/* Information struct for attribute (for H5Aget_info/H5Aget_info_by_idx) */
+//! <!-- [H5A_info_t_snip] -->
+/**
+ * Information struct for H5Aget_info() / H5Aget_info_by_idx()
+ */
typedef struct {
- hbool_t corder_valid; /* Indicate if creation order is valid */
- H5O_msg_crt_idx_t corder; /* Creation order */
- H5T_cset_t cset; /* Character set of attribute name */
- hsize_t data_size; /* Size of raw data */
+ hbool_t corder_valid; /**< Indicate if creation order is valid */
+ H5O_msg_crt_idx_t corder; /**< Creation order */
+ H5T_cset_t cset; /**< Character set of attribute name */
+ hsize_t data_size; /**< Size of raw data */
} H5A_info_t;
+//! <!-- [H5A_info_t_snip] -->
-/* Typedef for H5Aiterate2() callbacks */
+//! <!-- [H5A_operator2_t_snip] -->
+/**
+ * Typedef for H5Aiterate2() / H5Aiterate_by_name() callbacks
+ * \param[in] location_id The identifier for the group, dataset
+ * or named datatype being iterated over
+ * \param[in] attr_name The name of the current object attribute
+ * \param[in] ainfo The attribute’s info struct
+ * \param[in,out] op_data A pointer to the operator data passed in to
+ * H5Aiterate2() or H5Aiterate_by_name()
+ * \returns The return values from an operator are:
+ * \li Zero causes the iterator to continue, returning zero when
+ * all attributes have been processed.
+ * \li Positive causes the iterator to immediately return that
+ * positive value, indicating short-circuit success. The
+ * iterator can be restarted at the next attribute.
+ * \li Negative causes the iterator to immediately return that value,
+ * indicating failure. The iterator can be restarted at the next
+ * attribute.
+ */
typedef herr_t (*H5A_operator2_t)(hid_t location_id /*in*/, const char *attr_name /*in*/,
const H5A_info_t *ainfo /*in*/, void *op_data /*in,out*/);
+//! <!-- [H5A_operator2_t_snip] -->
/********************/
/* Public Variables */
@@ -45,45 +68,946 @@ typedef herr_t (*H5A_operator2_t)(hid_t location_id /*in*/, const char *attr_nam
extern "C" {
#endif
-H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id,
- hid_t aapl_id);
-H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
- hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
-H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id);
-H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id,
- hid_t lapl_id);
-H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, hid_t aapl_id, hid_t lapl_id);
-H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf);
-H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
-H5_DLL herr_t H5Aclose(hid_t attr_id);
-H5_DLL hid_t H5Aget_space(hid_t attr_id);
-H5_DLL hid_t H5Aget_type(hid_t attr_id);
-H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Closes the specified attribute
+ *
+ * \attr_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Aclose() terminates access to the attribute specified by
+ * \p attr_id by releasing the identifier.
+ *
+ * \attention Further use of a released attribute identifier is illegal; a
+ * function using such an identifier will generate an error.
+ *
+ * \since 1.0.0
+ *
+ * \see H5Acreate(), H5Aopen()
+ */
+H5_DLL herr_t H5Aclose(hid_t attr_id);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Creates an attribute attached to a specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] attr_name Name of attribute
+ * \param[in] type_id Attribute datatype identifier
+ * \space_id
+ * \acpl_id
+ * \aapl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \details H5Acreate2() creates an attribute, \p attr_name, which is attached
+ * to the object specified by the identifier \p loc_id.
+ *
+ * The attribute name, \p attr_name, must be unique for the object.
+ *
+ * The attribute is created with the specified datatype and dataspace,
+ * \p type_id and \p space_id, which are created with the H5T and
+ * H5S interfaces, respectively.
+ *
+ * If \p type_id is either a fixed-length or variable-length string,
+ * it is important to set the string length when defining the
+ * datatype. String datatypes are derived from #H5T_C_S1 (or
+ * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
+ * size. See H5Tset_size() and Creating variable-length string
+ * datatypes.
+ *
+ * The access property list is currently unused, but will be used in
+ * the future. This property list should currently be #H5P_DEFAULT.
+ *
+ * The attribute identifier returned by this function must be released
+ * with H5Aclose() resource leaks will develop.
+ *
+ * \note The \p aapl parameter is currently not used; specify #H5P_DEFAULT.
+ *
+ * \note If \p loc_id is a file identifier, the attribute will be attached
+ * that file’s root group.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Aclose()
+ *
+ */
+H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Creates an attribute attached to a specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name, relative to \p loc_id, of object that
+ * attribute is to be attached to
+ * \param[in] attr_name Attribute name
+ * \param[in] type_id Attribute datatype identifier
+ * \space_id
+ * \acpl_id
+ * \aapl_id
+ * \lapl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \details H5Acreate_by_name() creates an attribute, \p attr_name, which is
+ * attached to the object specified by \p loc_id and \p obj_name.
+ *
+ * \p loc_id is a location identifier; \p obj_name is the object
+ * name relative to \p loc_id. If \p loc_id fully specifies the
+ * object to which the attribute is to be attached, \p obj_name
+ * should be '.' (a dot).
+ *
+ * The attribute name, \p attr_name, must be unique for the object.
+ *
+ * The attribute is created with the specified datatype and
+ * dataspace, \p type_id and \p space_id, which are created with
+ * the H5T and H5S interfaces respectively.
+ *
+ * The attribute creation and access property lists are currently
+ * unused, but will be used in the future for optional attribute
+ * creation and access properties. These property lists should
+ * currently be #H5P_DEFAULT.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * The attribute identifier returned by this function must be
+ * released with H5close() or resource leaks will develop.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
+ hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Deletes an attribute from a specified location
+ *
+ * \fgdt_loc_id
+ * \param[in] attr_name Name of the attribute to delete
+ *
+ * \return \herr_t
+ *
+ * \details H5Adelete() removes the attribute specified by its name,
+ * \p attr_name, from a file, dataset, group, or named datatype.
+ * This function should not be used when attribute identifiers
+ * are open on \p loc_id as it may cause the internal indexes of
+ * the attributes to change and future writes to the open
+ * attributes to produce incorrect results.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Deletes an attribute from an object according to index order
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object, relative to location, from which
+ * attribute is to be removed
+ * \param[in] idx_type Type of index
+ * \param[in] order Order in which to iterate over index
+ * \param[in] n Offset within index
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Adelete_by_idx() removes an attribute, specified by its
+ * location in an index, from an object.
+ *
+ * The object from which the attribute is to be removed is
+ * specified by a location identifier and name, \p loc_id and
+ * \p obj_name, respectively. If \p loc_id fully specifies the
+ * object from which the attribute is to be removed, \p obj_name
+ * should be '.' (a dot).
+ *
+ * The attribute to be removed is specified by a position in an
+ * index, \p n. The type of index is specified by \p idx_type and
+ * may be #H5_INDEX_NAME, for an alpha-numeric index by name, or
+ * #H5_INDEX_CRT_ORDER, for an index by creation order. The order
+ * in which the index is to be traversed is specified by \p order
+ * and may be #H5_ITER_INC (increment) for top-down iteration,
+ * #H5_ITER_DEC (decrement) for bottom-up iteration, or
+ * #H5_ITER_NATIVE, in which case HDF5 will iterate in the
+ * fastest-available order. For example, if \p idx_type, \p order,
+ * and \p n are set to #H5_INDEX_NAME, #H5_ITER_INC, and 5,
+ * respectively, the fifth attribute by alpha-numeric order of
+ * attribute names will be removed.
+ *
+ * For a discussion of \p idx_type and \p order, the valid values
+ * of those parameters, and the use of \p n, see the description
+ * of H5Aiterate2().
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Removes an attribute from a specified location
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object, relative to location, from which
+ * attribute is to be removed
+ * \param[in] attr_name Name of attribute to delete
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Adelete_by_name() removes the attribute \p attr_name
+ * from an object specified by location and name, \p loc_id and
+ * \p obj_name, respectively.
+ *
+ * If \p loc_id fully specifies the object from which the
+ * attribute is to be removed, \p obj_name should be '.' (a dot).
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to
+ * access the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Determines whether an attribute with a given name exists on an
+ * object
+ *
+ * \fgdt_loc_id{obj_id}
+ * \param[in] attr_name Attribute name
+ *
+ * \return \htri_t
+ *
+ * \details H5Aexists() determines whether the attribute \p attr_name
+ * exists on the object specified by \p obj_id.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Determines whether an attribute with a given name exists on an
+ * object
+ *
+ * \fgdt_loc_id{obj_id}
+ * \param[in] obj_name Object name
+ * \param[in] attr_name Attribute name
+ * \lapl_id
+ *
+ * \return \htri_t
+ *
+ * \details H5Aexists_by_name() determines whether the attribute
+ * \p attr_name exists on an object. That object is specified by
+ * its location and name, \p loc_id and \p obj_name, respectively.
+ *
+ * \p loc_id specifies a location in the file containing the object.
+ * \p obj_name is the name of the object to which the attribute is
+ * attached and can be a relative name, relative to \p loc_id,
+ * or an absolute name, based in the root group of the file. If
+ * \p loc_id fully specifies the object, \p obj_name should be '.'
+ * (a dot).
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Gets an attribute creation property list identifier
+ *
+ * \attr_id
+ *
+ * \return \hid_tv{attribute's creation property list}
+ *
+ * \details H5Aget_create_plist() returns an identifier for the attribute
+ * creation property list associated with the attribute specified
+ * by \p attr_id.
+ *
+ * The creation property list identifier should be released with
+ * H5Pclose().
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Retrieves attribute information, by attribute identifier
+ *
+ * \attr_id
+ * \param[out] ainfo Attribute information struct
+ *
+ * \return \herr_t
+ *
+ * \details H5Aget_info() retrieves attribute information, locating the
+ * attribute with an attribute identifier, \p attr_id, which is
+ * the identifier returned by H5Aopen() or H5Aopen_by_idx(). The
+ * attribute information is returned in the \p ainfo struct.
+ *
+ * The \p ainfo struct is defined as follows:
+ * \snippet this H5A_info_t_snip
+ *
+ * \p corder_valid indicates whether the creation order data is
+ * valid for this attribute. Note that if creation order is not
+ * being tracked, no creation order data will be valid. Valid
+ * values are \c TRUE and \c FALSE.
+ *
+ * \p corder is a positive integer containing the creation
+ * order of the attribute. This value is 0-based, so, for
+ * example, the third attribute created will have a \p corder
+ * value of 2.
+ *
+ * \p cset indicates the character set used for the attribute’s
+ * name; valid values are defined in H5Tpublic.h and include
+ * the following:
+ * \csets
+ * This value is set with H5Pset_char_encoding().
+ *
+ * \p data_size indicates the size, in the number of characters,
+ * of the attribute.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Retrieves attribute information by attribute index position
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object to which attribute is attached,
+ * relative to location
+ * \param[in] idx_type Type of index
+ * \param[in] order Index traversal order
+ * \param[in] n Attribute’s position in index
+ * \param[out] ainfo Struct containing returned attribute information
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Aget_info_by_idx() retrieves information for an attribute
+ * that is attached to an object, which is specified by its
+ * location and name, \p loc_id and \p obj_name, respectively.
+ * The attribute is located by its index position and the attribute
+ * information is returned in the \p ainfo struct.
+ *
+ * If \p loc_id fully specifies the object to which the attribute
+ * is attached, \p obj_name should be '.' (a dot).
+ *
+ * The attribute is located by means of an index type, an index
+ * traversal order, and a position in the index, \p idx_type,
+ * \p order and \p n, respectively. These parameters and their
+ * valid values are discussed in the description of H5Aiterate2().
+ *
+ * The \p ainfo struct, which will contain the returned attribute
+ * information, is described in H5Aget_info().
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Retrieves attribute information, by attribute name
+ *
+ * \fgdt_loc_id
+ *
+ * \param[in] obj_name Name of object to which attribute is attached,
+ * relative to location
+ * \param[in] attr_name Attribute name
+ * \param[out] ainfo Struct containing returned attribute information
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Aget_info_by_name() retrieves information for an attribute,
+ * \p attr_name, that is attached to an object specified by its
+ * location and name, \p loc_id and \p obj_name, respectively.
+ * The attribute information is returned in the \p ainfo struct.
+ *
+ * If \p loc_id fully specifies the object to which the attribute
+ * is attached, \p obj_name should be '.' (a dot).
+ *
+ * The \p ainfo struct is described in H5Aget_info().
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to
+ * access the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
+ H5A_info_t *ainfo /*out*/, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Gets an attribute name
+ *
+ * \attr_id
+ * \param[in] buf_size The size of the buffer to store the name in
+ * \param[out] buf Buffer to store name in
+ *
+ * \return Returns the length of the attribute's name, which may be longer
+ * than \p buf_size, if successful. Otherwise returns a negative
+ * value.
+ *
+ * \details H5Aget_name() retrieves the name of an attribute specified by
+ * the identifier, \p attr_id. Up to \p buf_size characters are
+ * stored in \p buf followed by a \0 string terminator. If the
+ * name of the attribute is longer than (\p buf_size -1), the
+ * string terminator is stored in the last position of the buffer
+ * to properly terminate the string.
+ *
+ * If the user only wants to find out the size of this name, the
+ * values 0 and NULL can be passed in for the parameters
+ * \p bufsize and \p buf.
+ *
+ * \since 1.0.0
+ *
+ */
H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Gets an attribute name, by attribute index position
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object to which attribute is attached,
+ * relative to location
+ * \param[in] idx_type Type of index
+ * \param[in] order Index traversal order
+ * \param[in] n Attribute’s position in index
+ * \param[out] name Attribute name
+ * \param[in] size Size, in bytes, of attribute name
+ * \lapl_id
+ *
+ * \return Returns attribute name size, in bytes, if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Aget_name_by_idx() retrieves the name of an attribute that is
+ * attached to an object, which is specified by its location and
+ * name, \p loc_id and \p obj_name, respectively. The attribute is
+ * located by its index position, the size of the name is specified
+ * in \p size, and the attribute name is returned in \p name.
+ *
+ * If \p loc_id fully specifies the object to which the attribute
+ * is attached, \p obj_name should be '.' (a dot).
+ *
+ * The attribute is located by means of an index type, an index
+ * traversal order, and a position in the index, \p idx_type,
+ * \p order and \p n, respectively. These parameters and their
+ * valid values are discussed in the description of H5Aiterate2().
+ *
+ * If the attribute name’s size is unknown, the values 0 and NULL
+ * can be passed in for the parameters \p size and \p name. The
+ * function’s return value will provide the correct value for
+ * \p size.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Gets a copy of the dataspace for an attribute
+ *
+ * \attr_id
+ *
+ * \return \hid_tv{attribute dataspace}
+ *
+ * \details H5Aget_space() retrieves a copy of the dataspace for an
+ * attribute. The dataspace identifier returned from this
+ * function must be released with H5Sclose() or resource leaks
+ * will develop.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Aget_space(hid_t attr_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Returns the amount of storage required for an attribute
+ *
+ * \attr_id
+ *
+ * \return Returns the amount of storage size allocated for the attribute;
+ * otherwise returns 0 (zero).
+ *
+ * \details H5Aget_storage_size() returns the amount of storage that is
+ * required for the specified attribute, \p attr_id.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
-H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/);
-H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- H5A_info_t *ainfo /*out*/, hid_t lapl_id);
-H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/, hid_t lapl_id);
-H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name);
-H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name, hid_t lapl_id);
-H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
- H5A_operator2_t op, void *op_data);
-H5_DLL herr_t 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 lapd_id);
-H5_DLL herr_t H5Adelete(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
-H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, hid_t lapl_id);
-H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
-H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Gets an attribute datatype
+ *
+ * \attr_id
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Aget_type() retrieves a copy of the datatype for an attribute.
+ * The datatype is reopened if it is a named type before returning
+ * it to the application. The datatypes returned by this function
+ * are always read-only. If an error occurs when atomizing the
+ * return datatype, then the datatype is closed.
+ *
+ * The datatype identifier returned from this function must be
+ * released with H5Tclose() or resource leaks will develop.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Aget_type(hid_t attr_id);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Calls user-defined function for each attribute on an object
+ *
+ * \fgdt_loc_id
+ * \param[in] idx_type Type of index
+ * \param[in] order Order in which to iterate over index
+ * \param[in,out] idx Initial and returned offset within index
+ * \param[in] op User-defined function to pass each attribute to
+ * \param[in,out] op_data User data to pass through to and to be returned
+ * by iterator operator function
+ *
+ * \return \herr_t
+ * Further note that this function returns the return value of the
+ * last operator if it was non-zero, which can be a negative value,
+ * zero if all attributes were processed, or a positive value
+ * indicating short-circuit success.
+ *
+ * \details H5Aiterate2() iterates over the attributes attached to a
+ * dataset, named datatype, or group, as specified by \p loc_id.
+ * For each attribute, user-provided data, \p op_data, with
+ * additional information as defined below, is passed to a
+ * user-defined function, \p op, which operates on that
+ * attribute.
+ *
+ * The order of the iteration and the attributes iterated over
+ * are specified by three parameters: the index type,
+ * \p idx_type; the order in which the index is to be traversed,
+ * \p order; and the attribute’s position in the index, \p idx.
+ *
+ * The type of index specified by \p idx_type can be one of the
+ * following:
+ *
+ * \indexes
+ *
+ * The order in which the index is to be traversed, as specified
+ * by \p order, can be one of the following:
+ *
+ * \orders
+ *
+ * The next attribute to be operated on is specified by \p idx,
+ * a position in the index.
+ *
+ * For example, if \p idx_type, \p order, and \p idx are set to
+ * #H5_INDEX_NAME, #H5_ITER_INC, and 5, respectively, the attribute
+ * in question is the fifth attribute from the beginning of the
+ * alpha-numeric index of attribute names. If \p order were set to
+ * #H5_ITER_DEC, it would be the fifth attribute from the end of
+ * the index.
+ *
+ * The parameter \p idx is passed in on an H5Aiterate2() call with
+ * one value and may be returned with another value. The value
+ * passed in identifies the parameter to be operated on first;
+ * the value returned identifies the parameter to be operated on
+ * in the next step of the iteration.
+ *
+ * \p op is a user-defined function whose prototype is defined
+ * as follows:
+ * \snippet this H5A_operator2_t_snip
+ * \click4more
+ *
+ * \note This function is also available through the H5Aiterate() macro.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5A_operator2_t op, void *op_data);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Calls user-defined function for each attribute on an object
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object, relative to location
+ * \param[in] idx_type Type of index
+ * \param[in] order Order in which to iterate over index
+ * \param[in,out] idx Initial and returned offset within index
+ * \param[in] op User-defined function to pass each attribute to
+ * \param[in,out] op_data User data to pass through to and to be returned
+ * by iterator operator function
+ * \lapl_id
+ *
+ * \return \herr_t
+ * Further note that this function returns the return value of
+ * the last operator if it was non-zero, which can be a negative
+ * value, zero if all attributes were processed, or a positive value
+ * indicating short-circuit success.
+ *
+ * \details H5Aiterate_by_name() iterates over the attributes attached
+ * to the dataset or group specified with \p loc_id and \p obj_name.
+ * For each attribute, user-provided data, \p op_data, with
+ * additional information as defined below, is passed to a
+ * user-defined function, \p op, which operates on that attribute.
+ *
+ * If \p loc_id fully specifies the object to which these
+ * attributes are attached, \p obj_name should be '.' (a dot).
+ *
+ * The order of the iteration and the attributes iterated over
+ * are specified by three parameters: the index type, \p idx_type;
+ * the order in which the index is to be traversed, \p order;
+ * and the attribute’s position in the index, \p idx.
+ *
+ * The type of index specified by \p idx_type can be one of the
+ * following:
+ *
+ * \indexes
+ *
+ * The order in which the index is to be traversed, as specified
+ * by \p order, can be one of the following:
+ *
+ * \orders
+ *
+ * The next attribute to be operated on is specified by \p idx,
+ * a position in the index.
+ *
+ * For example, if \p idx_type, \p order, and \p idx are set to
+ * #H5_INDEX_NAME, #H5_ITER_INC, and 5, respectively, the attribute
+ * in question is the fifth attribute from the beginning of the
+ * alpha-numeric index of attribute names. If \p order were set to
+ * #H5_ITER_DEC, it would be the fifth attribute from the end of
+ * the index.
+ *
+ * The parameter \p idx is passed in on an H5Aiterate_by_name()
+ * call with one value and may be returned with another value. The
+ * value passed in identifies the parameter to be operated on first;
+ * the value returned identifies the parameter to be operated on in
+ * the next step of the iteration.
+ *
+ * \p op is a user-defined function whose prototype is defined
+ * as follows:
+ * \snippet this H5A_operator2_t_snip
+ * \click4more
+ *
+ * Valid return values from an operator and the resulting
+ * H5Aiterate_by_name() and \p op behavior are as follows:
+ *
+ * \li Zero causes the iterator to continue, returning zero when
+ * all attributes have been processed.
+ * \li A positive value causes the iterator to immediately return
+ * that positive value, indicating short-circuit success.
+ * The iterator can be restarted at the next attribute, as
+ * indicated by the return value of \p idx.
+ * \li A negative value causes the iterator to immediately return
+ * that value, indicating failure. The iterator can be
+ * restarted at the next attribute, as indicated by the return
+ * value of \p idx.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t 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);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Opens an attribute for an object specified by object identifier and
+ * attribute name
+ *
+ * \fgdt_loc_id{obj_id}
+ * \param[in] attr_name Name of attribute to open
+ * \aapl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \details H5Aopen() opens an existing attribute, \p attr_name, that is
+ * attached to object specified by an object identifier, \p obj_id.
+ *
+ * The attribute access property list, \p aapl_id, is currently unused
+ * and should be #H5P_DEFAULT.
+ *
+ * This function, H5Aopen_by_idx() or H5Aopen_by_name() must be called
+ * before the attribute can be accessed for any further purpose,
+ * including reading, writing, or any modification.
+ *
+ * The attribute identifier returned by this function must be released
+ * with H5Aclose() or resource leaks will develop.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Aclose(), H5Acreate()
+ */
+H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Opens the nth attribute attached to an object
+ *
+ * \loc_id
+ * \param[in] obj_name Name of object to which attribute is attached,
+ * relative to location
+ * \param[in] idx_type Type of index
+ * \param[in] order Index traversal order
+ * \param[in] n Attribute’s position in index
+ * \aapl_id
+ * \lapl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \details H5Aopen_by_idx() opens an existing attribute that is attached
+ * to an object specified by location and name, \p loc_id and
+ * \p obj_name, respectively. If \p loc_id fully specifies the
+ * object to which the attribute is attached, \p obj_name, should
+ * be '.' (a dot).
+ *
+ * The attribute is identified by an index type, an index traversal
+ * order, and a position in the index, \p idx_type, \p order and
+ * \p n, respectively. These parameters and their valid values are
+ * discussed in the description of H5Aiterate2().
+ *
+ * The attribute access property list, \p aapl_id, is currently
+ * unused and should currently be #H5P_DEFAULT.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * This function, H5Aopen(), or H5Aopen_by_name() must be called
+ * before an attribute can be accessed for any further purpose,
+ * including reading, writing, or any modification.
+ *
+ * The attribute identifier returned by this function must be
+ * released with H5Aclose() or resource leaks will develop.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, hid_t aapl_id, hid_t lapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Opens an attribute for an object by object name and attribute name
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object to which attribute is attached,
+ * relative to \p loc_id
+ * \param[in] attr_name Name of attribute to open
+ * \aapl_id
+ * \lapl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \details H5Aopen_by_name() opens an existing attribute, \p attr_name,
+ * that is attached to an object specified by location and name,
+ * \p loc_id and \p obj_name, respectively.
+ *
+ * \p loc_id specifies a location from which the target object can
+ * be located and \p obj_name is an object name relative to
+ * \p loc_id. If \p loc_id fully specifies the object to which the
+ * attribute is attached, \p obj_name should be '.' (a dot).
+ *
+ * The attribute access property list, \p aapl_id, is currently
+ * unused and should currently be #H5P_DEFAULT.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to access
+ * the object, \p obj_name.
+ *
+ * This function, H5Aopen(), or H5Aopen_by_idx() must be called
+ * before an attribute can be accessed for any further purpose,
+ * including reading, writing, or any modification.
+ *
+ * The attribute identifier returned by this function must be
+ * released with H5Aclose() or resource leaks will develop.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id,
+ hid_t lapl_id);
+/*-------------------------------------------------------------------------- */
+/**
+ * \ingroup H5A
+ *
+ * \brief Reads the value of an attribute
+ *
+ * \attr_id
+ * \mem_type_id{type_id}
+ * \param[out] buf Buffer for data to be read
+ *
+ * \return \herr_t
+ *
+ * \details H5Aread() reads an attribute, specified with \p attr_id. The
+ * attribute's in-memory datatype is specified with \p type_id. The
+ * entire attribute is read into \p buf from the file.
+ *
+ * Datatype conversion takes place at the time of a read or write and
+ * is automatic.
+ *
+ * \version 1.8.8 Fortran updated to Fortran2003.
+ * \version 1.4.2 The \p dims parameter was added to the Fortran API in this
+ * release.
+ * \since 1.0.0
+ *
+ * \see H5Awrite()
+ *
+ */
+H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Renames an attribute
+ *
+ * \fgdt_loc_id
+ * \param[in] old_name Name of the attribute to be changed
+ * \param[in] new_name New name for the attribute
+ *
+ * \return \herr_t
+ *
+ * \details H5Arename() changes the name of the attribute located at
+ * \p loc_id.
+ *
+ * The old name, \p old_name, is changed to the new name,
+ * \p new_name.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Writes data to an attribute
+ *
+ * \attr_id
+ * \mem_type_id{type_id}
+ * \param[out] buf Data to be written
+ *
+ * \return \herr_t
+ *
+ * \details H5Awrite() writes an attribute, specified with \p attr_id. The
+ * attribute's in-memory datatype is specified with \p type_id.
+ * The entire attribute is written from \p buf to the file.
+ *
+ * If \p type_id is either a fixed-length or variable-length string,
+ * it is important to set the string length when defining the datatype.
+ * String datatypes are derived from #H5T_C_S1 (or #H5T_FORTRAN_S1 for
+ * Fortran codes), which defaults to 1 character in size.
+ * See H5Tset_size() and Creating variable-length string datatypes.
+ *
+ * Datatype conversion takes place at the time of a read or write and
+ * is automatic.
+ *
+ * \version 1.8.8 Fortran updated to Fortran2003.
+ * \version 1.4.2 Fortran \p dims parameter added in this release
+ * \since 1.0.0
+ * \see H5Aread()
+ *
+ */
+H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf);
+/*-------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \fgdt_loc_id
+ * \param[in] obj_name Name of object, relative to location, whose
+ * attribute is to be renamed
+ * \param[in] old_attr_name Prior attribute name
+ * \param[in] new_attr_name New attribute name
+ * \lapl_id
+ *
+ * \details H5Arename_by_name() changes the name of attribute that is
+ * attached to the object specified by \p loc_id and \p obj_name.
+ * The attribute named \p old_attr_name is renamed
+ * \p new_attr_name.
+ *
+ * The link access property list, \p lapl_id, may provide
+ * information regarding the properties of links required to
+ * access the object, \p obj_name.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
+ const char *new_attr_name, hid_t lapl_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -95,16 +1019,186 @@ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *
/* Typedefs */
-/* Typedef for H5Aiterate1() callbacks */
+//! <!-- [H5A_operator1_t_snip] -->
+/**
+ * \brief Typedef for H5Aiterate1() callbacks
+ *
+ * \param[in] location_id The identifier for the group, dataset
+ * or named datatype being iterated over
+ * \param[in] attr_name The name of the current object attribute
+ * \param[in,out] operator_data A pointer to the operator data passed in to
+ * H5Aiterate1()
+ * \returns The return values from an operator are:
+ * \li Zero causes the iterator to continue, returning zero when
+ * all attributes have been processed.
+ * \li Positive causes the iterator to immediately return that
+ * positive value, indicating short-circuit success. The
+ * iterator can be restarted at the next attribute.
+ * \li Negative causes the iterator to immediately return that value,
+ * indicating failure. The iterator can be restarted at the next
+ * attribute.
+ */
typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_name /*in*/,
void *operator_data /*in,out*/);
+//! <!-- [H5A_operator1_t_snip] -->
/* Function prototypes */
-H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id);
-H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name);
-H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
-H5_DLL int H5Aget_num_attrs(hid_t loc_id);
-H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Creates an attribute attached to a specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of attribute to locate and open
+ * \param[in] type_id Identifier of attribute datatype
+ * \space_id
+ * \acpl_id
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \note The \p acpl parameters is currently not used; specify #H5P_DEFAULT.
+ *
+ * \deprecated Deprecated in favor of H5Acreate2()
+ *
+ * \details H5Acreate1() creates an attribute, \p name, which is attached
+ * to the object specified by the identifier \p loc_id.
+ *
+ * The attribute name, \p name, must be unique for the object.
+ *
+ * The attribute is created with the specified datatype and dataspace,
+ * \p type_id and \p space_id, which are created with the H5T and
+ * H5S interfaces, respectively.
+ *
+ * If \p type_id is either a fixed-length or variable-length string,
+ * it is important to set the string length when defining the
+ * datatype. String datatypes are derived from #H5T_C_S1 (or
+ * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
+ * size. See H5Tset_size() and Creating variable-length string
+ * datatypes.
+ *
+ * The attribute identifier returned by this function must be released
+ * with H5Aclose() resource leaks will develop.
+ *
+ * \since 1.8.0
+ *
+ * \version 1.8.0 The function H5Acreate() was renamed to H5Acreate1() and
+ * deprecated in this release.
+ *
+ * \see H5Aclose()
+ *
+ */
+H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Determines the number of attributes attached to an object
+ *
+ * \fgdt_loc_id
+ *
+ * \return Returns the number of attributes if successful; otherwise returns
+ * a negative value.
+ *
+ * \deprecated This function is deprecated in favor of the functions
+ * H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx().
+ *
+ * \details H5Aget_num_attrs() returns the number of attributes attached to
+ * the object specified by its identifier, \p loc_id.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Aget_num_attrs(hid_t loc_id);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Calls a user’s function for each attribute on an object
+ *
+ * \loc_id
+ * \param[in,out] idx Starting (in) and ending (out) attribute index
+ * \param[in] op User's function to pass each attribute to
+ * \param[in,out] op_data User's data to pass through to iterator operator
+ * function
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Aiterate2().
+ *
+ * \details H5Aiterate1() iterates over the attributes of the object
+ * specified by its identifier, \p loc_id. The object can be a
+ * group, dataset, or named datatype. For each attribute of the
+ * object, the \p op_data and some additional information specified
+ * below are passed to the operator function \p op. The iteration
+ * begins with the attribute specified by its index, \p idx; the
+ * index for the next attribute to be processed by the operator,
+ * \p op, is returned in \p idx. If \p idx is the null pointer,
+ * then all attributes are processed.
+ *
+ * \p op is a user-defined function whose prototype is defined as follows:
+ * \snippet this H5A_operator1_t_snip
+ * \click4more
+ *
+ * \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1()
+ * and deprecated in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void *op_data);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Opens the attribute specified by its index
+ *
+ * \loc_id
+ * \param[in] idx Index of the attribute to open
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Aopen_by_idx().
+ *
+ * \details H5Aopen_idx() opens an attribute which is attached to the
+ * object specified with \p loc_id . The location object may be
+ * either a group, dataset, or named datatype, all of which may
+ * have any sort of attribute. The attribute specified by the index,
+ * \p idx , indicates the attribute to access. The value of \p idx
+ * is a 0-based, non-negative integer. The attribute identifier
+ * returned from this function must be released with H5Aclose()
+ * or resource leaks will develop.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
+/* --------------------------------------------------------------------------*/
+/**
+ * \ingroup H5A
+ *
+ * \brief Opens an attribute specified by name
+ *
+ * \loc_id
+ * \param[in] name Attribute name
+ *
+ * \return \hid_tv{attribute}
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Aopen_by_name().
+ *
+ * \details H5Aopen_name() opens an attribute specified by its name,
+ * \p name, which is attached to the object specified with
+ * \p loc_id. The location object may be either a group, dataset,
+ * or named datatype, which may have any sort of attribute. The
+ * attribute identifier returned from this function must be
+ * released with H5Aclose() or resource leaks will develop.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -112,4 +1206,4 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
}
#endif
-#endif /* _H5Apublic_H */
+#endif /* H5Apublic_H */
diff --git a/src/H5Atest.c b/src/H5Atest.c
index dcbb4e3..62d608e 100644
--- a/src/H5Atest.c
+++ b/src/H5Atest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5B.c b/src/H5B.c
index 5743b1f..55732fa 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -6,86 +6,86 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5B.c
- * Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * 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
- * values.
+ * Purpose: Implements balanced, sibling-linked, N-ary trees
+ * capable of storing any type of data with unique key
+ * values.
*
- * A B-link-tree is a balanced tree where each node has
- * a pointer to its left and right siblings. A
- * B-link-tree is a rooted tree having the following
- * properties:
+ * A B-link-tree is a balanced tree where each node has
+ * a pointer to its left and right siblings. A
+ * B-link-tree is a rooted tree having the following
+ * properties:
*
- * 1. Every node, x, has the following fields:
+ * 1. Every node, x, has the following fields:
*
- * a. level[x], the level in the tree at which node
- * x appears. Leaf nodes are at level zero.
+ * a. level[x], the level in the tree at which node
+ * x appears. Leaf nodes are at level zero.
*
- * b. n[x], the number of children pointed to by the
- * node. Internal nodes point to subtrees while
- * leaf nodes point to arbitrary data.
+ * b. n[x], the number of children pointed to by the
+ * node. Internal nodes point to subtrees while
+ * leaf nodes point to arbitrary data.
*
- * c. The child pointers themselves, child[x,i] such
- * that 0 <= i < n[x].
+ * c. The child pointers themselves, child[x,i] such
+ * that 0 <= i < n[x].
*
- * d. n[x]+1 key values stored in increasing
- * order:
+ * d. n[x]+1 key values stored in increasing
+ * order:
*
- * key[x,0] < key[x,1] < ... < key[x,n[x]].
+ * key[x,0] < key[x,1] < ... < key[x,n[x]].
*
- * e. left[x] is a pointer to the node's left sibling
- * or the null pointer if this is the left-most
- * node at this level in the tree.
+ * e. left[x] is a pointer to the node's left sibling
+ * or the null pointer if this is the left-most
+ * node at this level in the tree.
*
- * f. right[x] is a pointer to the node's right
- * sibling or the null pointer if this is the
- * right-most node at this level in the tree.
+ * f. right[x] is a pointer to the node's right
+ * sibling or the null pointer if this is the
+ * right-most node at this level in the tree.
*
- * 3. The keys key[x,i] partition the key spaces of the
- * children of x:
+ * 3. The keys key[x,i] partition the key spaces of the
+ * children of x:
*
- * key[x,i] <= key[child[x,i],j] <= key[x,i+1]
+ * key[x,i] <= key[child[x,i],j] <= key[x,i+1]
*
- * for any valid combination of i and j.
+ * for any valid combination of i and j.
*
- * 4. There are lower and upper bounds on the number of
- * child pointers a node can contain. These bounds
- * can be expressed in terms of a fixed integer k>=2
- * called the `minimum degree' of the B-tree.
+ * 4. There are lower and upper bounds on the number of
+ * child pointers a node can contain. These bounds
+ * can be expressed in terms of a fixed integer k>=2
+ * called the `minimum degree' of the B-tree.
*
- * a. Every node other than the root must have at least
- * k child pointers and k+1 keys. If the tree is
- * nonempty, the root must have at least one child
- * pointer and two keys.
+ * a. Every node other than the root must have at least
+ * k child pointers and k+1 keys. If the tree is
+ * nonempty, the root must have at least one child
+ * pointer and two keys.
*
- * b. Every node can contain at most 2k child pointers
- * and 2k+1 keys. A node is `full' if it contains
- * exactly 2k child pointers and 2k+1 keys.
+ * b. Every node can contain at most 2k child pointers
+ * and 2k+1 keys. A node is `full' if it contains
+ * exactly 2k child pointers and 2k+1 keys.
*
- * 5. When searching for a particular value, V, and
- * key[V] = key[x,i] for some node x and entry i,
- * then:
+ * 5. When searching for a particular value, V, and
+ * key[V] = key[x,i] for some node x and entry i,
+ * then:
*
- * a. If i=0 the child[0] is followed.
+ * a. If i=0 the child[0] is followed.
*
- * b. If i=n[x] the child[n[x]-1] is followed.
+ * b. If i=n[x] the child[n[x]-1] is followed.
*
- * c. Otherwise, the child that is followed
- * (either child[x,i-1] or child[x,i]) is
- * determined by the type of object to which the
- * leaf nodes of the tree point and is controlled
- * by the key comparison function registered for
- * that type of B-tree.
+ * c. Otherwise, the child that is followed
+ * (either child[x,i-1] or child[x,i]) is
+ * determined by the type of object to which the
+ * leaf nodes of the tree point and is controlled
+ * by the key comparison function registered for
+ * that type of B-tree.
*
*
*-------------------------------------------------------------------------
@@ -100,22 +100,22 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Bpkg.h" /* B-link trees */
+#include "H5private.h" /* Generic Functions */
+#include "H5Bpkg.h" /* B-link trees */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
#define H5B_SIZEOF_HDR(F) \
- (H5_SIZEOF_MAGIC + /*magic number */ \
- 4 + /*type, level, num entries */ \
- 2 * H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
+ (H5_SIZEOF_MAGIC + /*magic number */ \
+ 4 + /*type, level, num entries */ \
+ 2 * H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
/* Default initializer for H5B_ins_ud_t */
#define H5B_INS_UD_T_NULL \
@@ -187,20 +187,19 @@ H5FL_BLK_DEFINE_STATIC(page);
H5FL_SEQ_DEFINE_STATIC(size_t);
/*-------------------------------------------------------------------------
- * Function: H5B_create
+ * Function: H5B_create
*
- * Purpose: Creates a new empty B-tree leaf node. The UDATA pointer is
- * passed as an argument to the sizeof_rkey() method for the
- * B-tree.
+ * Purpose: Creates a new empty B-tree leaf node. The UDATA pointer is
+ * passed as an argument to the sizeof_rkey() method for the
+ * B-tree.
*
- * Return: Success: Non-negative, and the address of new node is
- * returned through the ADDR_P argument.
+ * Return: Success: Non-negative, and the address of new node is
+ * returned through the ADDR_P argument.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
+ * Programmer: Robb Matzke
+ * Jun 23 1997
*
*-------------------------------------------------------------------------
*/
@@ -266,25 +265,24 @@ done:
} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
/*-------------------------------------------------------------------------
- * Function: H5B_find
+ * Function: H5B_find
*
- * Purpose: Locate the specified information in a B-tree and return
- * that information by filling in fields of the caller-supplied
- * UDATA pointer depending on the type of leaf node
- * requested. The UDATA can point to additional data passed
- * to the key comparison function.
+ * Purpose: Locate the specified information in a B-tree and return
+ * that information by filling in fields of the caller-supplied
+ * UDATA pointer depending on the type of leaf node
+ * requested. The UDATA can point to additional data passed
+ * to the key comparison function.
*
- * Note: This function does not follow the left/right sibling
- * pointers since it assumes that all nodes can be reached
- * from the parent node.
+ * Note: This function does not follow the left/right sibling
+ * pointers since it assumes that all nodes can be reached
+ * from the parent node.
*
- * Return: Non-negative (TRUE/FALSE) on success (if found, values returned
+ * Return: Non-negative (TRUE/FALSE) on success (if found, values returned
* through the UDATA argument). Negative on failure (if not found,
* UDATA is undefined).
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
+ * Programmer: Robb Matzke
+ * Jun 23 1997
*
*-------------------------------------------------------------------------
*/
@@ -362,24 +360,23 @@ done:
} /* end H5B_find() */
/*-------------------------------------------------------------------------
- * Function: H5B__split
+ * Function: H5B__split
*
- * Purpose: Split a single node into two nodes. The old node will
- * contain the left children and the new node will contain the
- * right children.
+ * Purpose: Split a single node into two nodes. The old node will
+ * contain the left children and the new node will contain the
+ * right children.
*
- * The UDATA pointer is passed to the sizeof_rkey() method but is
- * otherwise unused.
+ * The UDATA pointer is passed to the sizeof_rkey() method but is
+ * otherwise unused.
*
- * The BT_UD argument is a pointer to a protected B-tree
- * node.
+ * The BT_UD argument is a pointer to a protected B-tree
+ * node.
*
- * Return: Non-negative on success (The address of the new node is
+ * Return: Non-negative on success (The address of the new node is
* returned through the NEW_ADDR argument). Negative on failure.
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 3 1997
+ * Programmer: Robb Matzke
+ * Jul 3 1997
*
*-------------------------------------------------------------------------
*/
@@ -524,15 +521,14 @@ done:
} /* end H5B__split() */
/*-------------------------------------------------------------------------
- * Function: H5B_insert
+ * Function: H5B_insert
*
- * Purpose: Adds a new item to the B-tree.
+ * Purpose: Adds a new item to the B-tree.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
+ * Programmer: Robb Matzke
+ * Jun 23 1997
*
*-------------------------------------------------------------------------
*/
@@ -678,17 +674,16 @@ done:
} /* end H5B_insert() */
/*-------------------------------------------------------------------------
- * Function: H5B__insert_child
+ * Function: H5B__insert_child
*
- * Purpose: Insert a child to the left or right of child[IDX] depending
- * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT
- * argument is a pointer to a protected B-tree node.
+ * Purpose: Insert a child to the left or right of child[IDX] depending
+ * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT
+ * argument is a pointer to a protected B-tree node.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 8 1997
+ * Programmer: Robb Matzke
+ * Jul 8 1997
*
*-------------------------------------------------------------------------
*/
@@ -748,33 +743,32 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5
} /* end H5B_insert_child() */
/*-------------------------------------------------------------------------
- * Function: H5B__insert_helper
+ * Function: H5B__insert_helper
*
- * Purpose: Inserts the item UDATA into the tree rooted at ADDR and having
- * the specified type.
+ * Purpose: Inserts the item UDATA into the tree rooted at ADDR and having
+ * the specified type.
*
- * On return, if LT_KEY_CHANGED is non-zero, then LT_KEY is
- * the new native left key. Similarly for RT_KEY_CHANGED
- * and RT_KEY.
+ * On return, if LT_KEY_CHANGED is non-zero, then LT_KEY is
+ * the new native left key. Similarly for RT_KEY_CHANGED
+ * and RT_KEY.
*
- * If the node splits, then MD_KEY contains the key that
- * was split between the two nodes (that is, the key that
- * appears as the max key in the left node and the min key
- * in the right node).
+ * If the node splits, then MD_KEY contains the key that
+ * was split between the two nodes (that is, the key that
+ * appears as the max key in the left node and the min key
+ * in the right node).
*
- * Return: Success: A B-tree operation. The address of the new
- * node, if the node splits, is returned through
- * the NEW_NODE_P argument. The new node is always
- * to the right of the previous node. This
- * function is called recursively and the return
- * value influences the behavior of the caller.
- * See also, declaration of H5B_ins_t.
+ * Return: Success: A B-tree operation. The address of the new
+ * node, if the node splits, is returned through
+ * the NEW_NODE_P argument. The new node is always
+ * to the right of the previous node. This
+ * function is called recursively and the return
+ * value influences the behavior of the caller.
+ * See also, declaration of H5B_ins_t.
*
- * Failure: H5B_INS_ERROR
+ * Failure: H5B_INS_ERROR
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 9 1997
+ * Programmer: Robb Matzke
+ * Jul 9 1997
*
*-------------------------------------------------------------------------
*/
@@ -1105,16 +1099,15 @@ done:
} /* end H5B_insert_helper() */
/*-------------------------------------------------------------------------
- * Function: H5B__iterate_helper
+ * Function: H5B__iterate_helper
*
- * Purpose: Calls the list callback for each leaf node of the
- * B-tree, passing it the caller's UDATA structure.
+ * Purpose: Calls the list callback for each leaf node of the
+ * B-tree, passing it the caller's UDATA structure.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
+ * Programmer: Robb Matzke
+ * Jun 23 1997
*
*-------------------------------------------------------------------------
*/
@@ -1170,16 +1163,15 @@ done:
} /* end H5B__iterate_helper() */
/*-------------------------------------------------------------------------
- * Function: H5B_iterate
+ * Function: H5B_iterate
*
- * Purpose: Calls the list callback for each leaf node of the
- * B-tree, passing it the UDATA structure.
+ * Purpose: Calls the list callback for each leaf node of the
+ * B-tree, passing it the UDATA structure.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jun 23 1997
+ * Programmer: Robb Matzke
+ * Jun 23 1997
*
*-------------------------------------------------------------------------
*/
@@ -1207,25 +1199,25 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op,
} /* end H5B_iterate() */
/*-------------------------------------------------------------------------
- * Function: H5B__remove_helper
+ * Function: H5B__remove_helper
*
- * Purpose: The recursive part of removing an item from a B-tree. The
- * sub B-tree that is being considered is located at ADDR and
- * the item to remove is described by UDATA. If the removed
- * item falls at the left or right end of the current level then
- * it might be necessary to adjust the left and/or right keys
- * (LT_KEY and/or RT_KEY) to to indicate that they changed by
- * setting LT_KEY_CHANGED and/or RT_KEY_CHANGED.
+ * Purpose: The recursive part of removing an item from a B-tree. The
+ * sub B-tree that is being considered is located at ADDR and
+ * the item to remove is described by UDATA. If the removed
+ * item falls at the left or right end of the current level then
+ * it might be necessary to adjust the left and/or right keys
+ * (LT_KEY and/or RT_KEY) to to indicate that they changed by
+ * setting LT_KEY_CHANGED and/or RT_KEY_CHANGED.
*
- * Return: Success: A B-tree operation, see comments for
- * H5B_ins_t declaration. This function is
- * called recursively and the return value
- * influences the actions of the caller. It is
- * also called by H5B_remove().
+ * Return: Success: A B-tree operation, see comments for
+ * H5B_ins_t declaration. This function is
+ * called recursively and the return value
+ * influences the actions of the caller. It is
+ * also called by H5B_remove().
*
- * Failure: H5B_INS_ERROR, a negative value.
+ * Failure: H5B_INS_ERROR, a negative value.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, September 16, 1998
*
*-------------------------------------------------------------------------
@@ -1544,17 +1536,17 @@ done:
} /* end H5B__remove_helper() */
/*-------------------------------------------------------------------------
- * Function: H5B_remove
+ * Function: H5B_remove
*
- * Purpose: Removes an item from a B-tree.
+ * Purpose: Removes an item from a B-tree.
*
- * Note: The current version does not attempt to rebalance the tree.
+ * Note: The current version does not attempt to rebalance the tree.
* (Read the paper Yao & Lehman paper for details on why)
*
- * Return: Non-negative on success/Negative on failure (failure includes
- * not being able to find the object which is to be removed).
+ * Return: Non-negative on success/Negative on failure (failure includes
+ * not being able to find the object which is to be removed).
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, September 16, 1998
*
*-------------------------------------------------------------------------
@@ -1591,14 +1583,14 @@ done:
} /* end H5B_remove() */
/*-------------------------------------------------------------------------
- * Function: H5B_delete
+ * Function: H5B_delete
*
- * Purpose: Deletes an entire B-tree from the file, calling the 'remove'
+ * Purpose: Deletes an entire B-tree from the file, calling the 'remove'
* callbacks for each node.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
*-------------------------------------------------------------------------
@@ -1664,16 +1656,15 @@ done:
} /* end H5B_delete() */
/*-------------------------------------------------------------------------
- * Function: H5B_shared_new
+ * Function: H5B_shared_new
*
- * Purpose: Allocates & constructs a shared v1 B-tree struct for client.
+ * Purpose: Allocates & constructs a shared v1 B-tree struct for client.
*
- * Return: Success: non-NULL pointer to struct allocated
- * Failure: NULL
+ * Return: Success: non-NULL pointer to struct allocated
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * May 27 2008
+ * Programmer: Quincey Koziol
+ * May 27 2008
*
*-------------------------------------------------------------------------
*/
@@ -1703,9 +1694,9 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
shared->sizeof_rkey = sizeof_rkey;
HDassert(shared->sizeof_rkey);
shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey;
- shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */
+ shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */
shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */
- (shared->two_k + 1) * shared->sizeof_rkey); /*keys */
+ (shared->two_k + 1) * shared->sizeof_rkey); /*keys */
HDassert(shared->sizeof_rnode);
/* Allocate and clear shared buffers */
@@ -1737,13 +1728,13 @@ done:
} /* end H5B_shared_new() */
/*-------------------------------------------------------------------------
- * Function: H5B_shared_free
+ * Function: H5B_shared_free
*
- * Purpose: Free B-tree shared info
+ * Purpose: Free B-tree shared info
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 27, 2008
*
*-------------------------------------------------------------------------
@@ -1768,17 +1759,16 @@ H5B_shared_free(void *_shared)
} /* end H5B_shared_free() */
/*-------------------------------------------------------------------------
- * Function: H5B__copy
+ * Function: H5B__copy
*
- * Purpose: Deep copies an existing H5B_t node.
+ * Purpose: Deep copies an existing H5B_t node.
*
- * Return: Success: Pointer to H5B_t object.
+ * Return: Success: Pointer to H5B_t object.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Apr 18 2000
+ * Programmer: Quincey Koziol
+ * Apr 18 2000
*
*-------------------------------------------------------------------------
*/
@@ -1835,15 +1825,14 @@ done:
} /* end H5B__copy() */
/*-------------------------------------------------------------------------
- * Function: H5B__get_info_helper
+ * Function: H5B__get_info_helper
*
- * Purpose: Walks the B-tree nodes, getting information for all of them.
+ * Purpose: Walks the B-tree nodes, getting information for all of them.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jun 3 2008
+ * Programmer: Quincey Koziol
+ * Jun 3 2008
*
*-------------------------------------------------------------------------
*/
@@ -1854,8 +1843,8 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_
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 level; /* Node level */
- size_t sizeof_rnode; /* Size of raw (disk) node */
+ unsigned level; /* Node level */
+ size_t sizeof_rnode; /* Size of raw (disk) node */
haddr_t next_addr; /* Address of next node to the right */
haddr_t left_child; /* Address of left-most child in node */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2052,7 +2041,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 26, 2008
*
*-------------------------------------------------------------------------
diff --git a/src/H5B2.c b/src/H5B2.c
index d2cd503..5453387 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2.c
* Jan 31 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Implements a B-tree, with several modifications from
* the "standard" methods.
@@ -119,7 +119,6 @@ H5FL_DEFINE_STATIC(H5B2_t);
* filled in), negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jan 31 2005
*
*-------------------------------------------------------------------------
@@ -191,7 +190,6 @@ done:
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 15 2009
*
*-------------------------------------------------------------------------
@@ -256,7 +254,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -298,7 +295,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 23 2015
*
*-------------------------------------------------------------------------
@@ -370,7 +366,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 5 2009
*
*-------------------------------------------------------------------------
@@ -404,7 +399,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
*
*-------------------------------------------------------------------------
@@ -454,7 +448,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
*
*-------------------------------------------------------------------------
@@ -704,7 +697,6 @@ done:
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 23 2005
*
*-------------------------------------------------------------------------
@@ -899,7 +891,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 25 2005
*
*-------------------------------------------------------------------------
@@ -973,7 +964,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 14 2006
*
*-------------------------------------------------------------------------
@@ -1055,7 +1045,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 25 2005
*
*-------------------------------------------------------------------------
@@ -1095,7 +1084,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
*
*-------------------------------------------------------------------------
@@ -1152,7 +1140,6 @@ done:
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 10 2005
*
*-------------------------------------------------------------------------
@@ -1394,7 +1381,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 15 2009
*
*-------------------------------------------------------------------------
@@ -1506,7 +1492,6 @@ done:
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 9 2005
*
*-------------------------------------------------------------------------
@@ -1524,9 +1509,6 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *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 24fdf98..e333d61 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2cache.c
* Jan 31 2005
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement v2 B-tree metadata cache methods.
*
@@ -156,7 +156,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
*
*-------------------------------------------------------------------------
@@ -223,7 +222,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
*
*-------------------------------------------------------------------------
@@ -252,7 +250,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Magic number */
- if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature")
image += H5_SIZEOF_MAGIC;
@@ -321,7 +319,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -351,7 +348,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
*
*-------------------------------------------------------------------------
@@ -421,7 +417,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
*
*-------------------------------------------------------------------------
@@ -512,7 +507,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mike McGreevy
- * mcgreevy@hdfgroup.org
* June 18, 2008
*
*-------------------------------------------------------------------------
@@ -543,7 +537,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 18, 2010
*
*-------------------------------------------------------------------------
@@ -617,7 +610,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
*
*-------------------------------------------------------------------------
@@ -656,7 +648,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
internal->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature")
image += H5_SIZEOF_MAGIC;
@@ -740,7 +732,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -772,7 +763,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
*
*-------------------------------------------------------------------------
@@ -858,7 +848,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Neil Fortner
- * nfortne2@hdfgroup.org
* Apr 25 2012
*
*-------------------------------------------------------------------------
@@ -869,7 +858,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.
@@ -936,7 +925,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mike McGreevy
- * mcgreevy@hdfgroup.org
* June 18, 2008
*
*-------------------------------------------------------------------------
@@ -968,7 +956,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 18, 2010
*
*-------------------------------------------------------------------------
@@ -1041,7 +1028,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
*
*-------------------------------------------------------------------------
@@ -1078,7 +1064,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
leaf->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature")
image += H5_SIZEOF_MAGIC;
@@ -1139,7 +1125,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -1170,7 +1155,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
*
*-------------------------------------------------------------------------
@@ -1243,7 +1227,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Neil Fortner
- * nfortne2@hdfgroup.org
* Apr 25 2012
*
*-------------------------------------------------------------------------
@@ -1254,7 +1237,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.
@@ -1321,7 +1304,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 f60fb91..711b200 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2dbg.c
* Feb 2 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Dump debugging information about a v2 B-tree.
*
@@ -72,7 +72,6 @@
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -120,10 +119,12 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:", hdr->cache_info.is_dirty ? "True" : "False");
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of records in tree:", hdr->root.all_nrec);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Number of records in tree:", hdr->root.all_nrec);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of records in root node:", hdr->root.node_nrec);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of root node:", hdr->root.addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Address of root node:", hdr->root.addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", hdr->split_percent);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", hdr->merge_percent);
@@ -150,7 +151,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 4 2005
*
*-------------------------------------------------------------------------
@@ -217,8 +217,8 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co
for (u = 0; u < internal->nrec; u++) {
/* Print node pointer */
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
- HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str,
- internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
+ HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
internal->node_ptrs[u].addr);
/* Print record */
@@ -231,8 +231,9 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co
/* Print final node pointer */
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
- HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str,
- internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr);
+ HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
+ internal->node_ptrs[u].addr);
done:
if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -251,7 +252,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 31ad4b1..bdde5ba 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2int.c
* Feb 27 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Internal routines for managing v2 B-trees.
*
@@ -92,7 +92,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
*
*-------------------------------------------------------------------------
@@ -224,7 +223,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 27 2009
*
*-------------------------------------------------------------------------
@@ -269,7 +267,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 21 2006
*
*-------------------------------------------------------------------------
@@ -350,7 +347,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 13 2009
*
*-------------------------------------------------------------------------
@@ -385,7 +381,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 13 2009
*
*-------------------------------------------------------------------------
@@ -421,7 +416,6 @@ done:
* Return: SUCCEED (Can't fail)
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 27 2009
*
*-------------------------------------------------------------------------
@@ -448,7 +442,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
*
*-------------------------------------------------------------------------
@@ -476,7 +469,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
*
*-------------------------------------------------------------------------
@@ -507,7 +499,6 @@ done:
* Return: Non-NULL pointer to header on success/NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2015
*
*-------------------------------------------------------------------------
@@ -573,7 +564,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2015
*
*-------------------------------------------------------------------------
@@ -605,7 +595,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -683,7 +672,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 311d324..610da6c 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2int.c
* Feb 27 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Internal routines for managing v2 B-trees.
*
@@ -87,7 +87,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
*
*-------------------------------------------------------------------------
@@ -130,7 +129,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 28 2006
*
*-------------------------------------------------------------------------
@@ -140,15 +138,15 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
- uint8_t * left_native, *right_native; /* Pointers to childs' native records */
- H5B2_node_ptr_t * left_node_ptrs = NULL,
- *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- uint16_t mid_record; /* Index of "middle" record in current node */
- uint16_t old_node_nrec; /* Number of records in internal node split */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ H5B2_node_ptr_t *left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ uint16_t mid_record; /* Index of "middle" record in current node */
+ uint16_t old_node_nrec; /* Number of records in internal node split */
unsigned left_child_flags = H5AC__NO_FLAGS_SET,
right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
herr_t ret_value = SUCCEED; /* Return value */
@@ -336,7 +334,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 3 2005
*
*-------------------------------------------------------------------------
@@ -419,7 +416,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 9 2005
*
*-------------------------------------------------------------------------
@@ -427,13 +423,13 @@ done:
herr_t
H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
- uint8_t * left_native, *right_native; /* Pointers to childs' native records */
- H5B2_node_ptr_t * left_node_ptrs = NULL,
- *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ H5B2_node_ptr_t *left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */
unsigned left_child_flags = H5AC__NO_FLAGS_SET,
right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
@@ -691,7 +687,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 9 2005
*
*-------------------------------------------------------------------------
@@ -701,20 +696,20 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
unsigned idx)
{
H5B2_node_ptr_t *left_node_ptrs = NULL,
- *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- haddr_t middle_addr; /* Address of middle child node */
- void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- void * middle_child = NULL; /* Pointers to middle child node */
- uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
- uint16_t * middle_nrec; /* Pointers to middle child # of records */
- uint8_t * left_native, *right_native; /* Pointers to childs' native records */
- uint8_t * middle_native; /* Pointers to middle child's native records */
- hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */
- hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */
+ haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ void * middle_child = NULL; /* Pointers to middle child node */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *middle_nrec; /* Pointers to middle child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ uint8_t * middle_native; /* Pointers to middle child's native records */
+ hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */
+ hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1118,7 +1113,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 4 2005
*
*-------------------------------------------------------------------------
@@ -1128,16 +1122,16 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
- uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
- H5B2_node_ptr_t * left_node_ptrs = NULL,
- *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET,
- right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
+ H5B2_node_ptr_t *left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1294,7 +1288,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 4 2005
*
*-------------------------------------------------------------------------
@@ -1304,19 +1297,19 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- haddr_t middle_addr; /* Address of middle child node */
- void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
- void * middle_child = NULL; /* Pointer to middle child node */
- uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- uint16_t * middle_nrec; /* Pointer to middle child # of records */
- uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
- uint8_t * middle_native; /* Pointer to middle child's native records */
- H5B2_node_ptr_t * left_node_ptrs = NULL,
- *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */
- hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */
+ haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ void * middle_child = NULL; /* Pointer to middle child node */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t *middle_nrec; /* Pointer to middle child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
+ uint8_t * middle_native; /* Pointer to middle child's native records */
+ H5B2_node_ptr_t *left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */
+ hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
unsigned left_child_flags = H5AC__NO_FLAGS_SET,
right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
@@ -1561,7 +1554,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 23 2015
*
*-------------------------------------------------------------------------
@@ -1620,7 +1612,6 @@ done:
* Return: Value from callback, non-negative on success, negative on error
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 11 2005
*
*-------------------------------------------------------------------------
@@ -1743,7 +1734,6 @@ done:
* Return: Value from callback, non-negative on success, negative on error
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 9 2005
*
*-------------------------------------------------------------------------
@@ -1915,7 +1905,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Dec 1 2016
*
*-------------------------------------------------------------------------
@@ -1944,7 +1933,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t
/* If the node is in the cache, check for retargeting its parent */
if (node_status & H5AC_ES__IN_CACHE) {
- void ** parent_ptr; /* Pointer to child node's parent */
+ void ** parent_ptr = NULL; /* Pointer to child node's parent */
hbool_t update_deps = FALSE; /* Whether to update flush dependencies */
/* Get child node pointer */
@@ -2016,7 +2005,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 2ac0c84..c00f555 100644
--- a/src/H5B2internal.c
+++ b/src/H5B2internal.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2internal.c
* Dec 01 2016
- * Quincey Koziol <koziol@lbl.gov>
+ * Quincey Koziol
*
* Purpose: Routines for managing v2 B-tree internal ndoes.
*
@@ -77,7 +77,6 @@ H5FL_DEFINE(H5B2_internal_t);
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 3 2005
*
*-------------------------------------------------------------------------
@@ -177,7 +176,6 @@ done:
* Return: Pointer to internal node on success/NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 25 2006
*
*-------------------------------------------------------------------------
@@ -276,7 +274,6 @@ done:
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 9 2005
*
*-------------------------------------------------------------------------
@@ -353,7 +350,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 2 2005
*
*-------------------------------------------------------------------------
@@ -523,7 +519,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 24 2015
*
*-------------------------------------------------------------------------
@@ -801,7 +796,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 3 2005
*
*-------------------------------------------------------------------------
@@ -1046,7 +1040,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 14 2006
*
*-------------------------------------------------------------------------
@@ -1341,7 +1334,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -1392,7 +1384,6 @@ done:
* Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 19 2005
*
*-------------------------------------------------------------------------
@@ -1433,7 +1424,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 0455bed..20ace84 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5B2leaf.c
* Dec 01 2016
- * Quincey Koziol <koziol@lbl.gov>
+ * Quincey Koziol
*
* Purpose: Routines for managing v2 B-tree leaf ndoes.
*
@@ -78,7 +78,6 @@ H5FL_DEFINE(H5B2_leaf_t);
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -166,7 +165,6 @@ done:
* Return: Pointer to leaf node on success/NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 5 2010
*
*-------------------------------------------------------------------------
@@ -260,7 +258,6 @@ done:
* Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 9 2005
*
*-------------------------------------------------------------------------
@@ -332,7 +329,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 3 2005
*
*-------------------------------------------------------------------------
@@ -447,7 +443,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 23 2015
*
*-------------------------------------------------------------------------
@@ -604,7 +599,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 4 2005
*
*-------------------------------------------------------------------------
@@ -613,11 +607,11 @@ herr_t
H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t child_addr; /* Address of child node */
- void * child = NULL; /* Pointer to child node */
- uint8_t * child_native; /* Pointer to child's native records */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t child_addr = HADDR_UNDEF; /* Address of child node */
+ void * child = NULL; /* Pointer to child node */
+ uint8_t * child_native; /* Pointer to child's native records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -762,7 +756,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 3 2005
*
*-------------------------------------------------------------------------
@@ -871,7 +864,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 14 2006
*
*-------------------------------------------------------------------------
@@ -972,7 +964,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -1017,7 +1008,6 @@ done:
* Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 19 2005
*
*-------------------------------------------------------------------------
@@ -1039,13 +1029,13 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t
* Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 19 2005
*
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
+H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf,
+ const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
diff --git a/src/H5B2module.h b/src/H5B2module.h
index 9b0e0d9..aa0e163 100644
--- a/src/H5B2module.h
+++ b/src/H5B2module.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5B2 package. Including this header means that the source file
* is part of the H5B2 package.
*/
-#ifndef _H5B2module_H
-#define _H5B2module_H
+#ifndef H5B2module_H
+#define H5B2module_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_BTREE
#define H5_MY_PKG_INIT NO
-#endif /* _H5B2module_H */
+#endif /* H5B2module_H */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 5d0248c..8d620cc 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Monday, January 31, 2005
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5B2 package!"
#endif
-#ifndef _H5B2pkg_H
-#define _H5B2pkg_H
+#ifndef H5B2pkg_H
+#define H5B2pkg_H
/* Get package's private header */
#include "H5B2private.h"
@@ -453,4 +453,4 @@ H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata);
H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo);
#endif /* H5B2_TESTING */
-#endif /* _H5B2pkg_H */
+#endif /* H5B2pkg_H */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 26dd580..21ea823 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
*
* Created: H5B2private.h
* Jan 31 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Private header for library accessible B-tree routines.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5B2private_H
-#define _H5B2private_H
+#ifndef H5B2private_H
+#define H5B2private_H
/* Private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
@@ -149,4 +149,4 @@ H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info);
-#endif /* _H5B2private_H */
+#endif /* H5B2private_H */
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index fb2e0fe..4735276 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* 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 28b416f..2b84332 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Thursday, February 3, 2005
*
* Purpose: v2 B-tree testing functions.
@@ -305,7 +305,7 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const
HDassert(record);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:", *(const hsize_t *)record);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_debug() */
@@ -435,7 +435,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, cons
HDassert(record);
- HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth,
"Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val);
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index a6686e8..ec7457f 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Bcache.c
* Oct 31 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Implement B-tree metadata cache methods.
*
@@ -89,7 +89,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
*
*-------------------------------------------------------------------------
@@ -125,7 +124,6 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len)
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 24, 2008
*
*-------------------------------------------------------------------------
@@ -168,7 +166,7 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses")
/* magic number */
- if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature")
image += H5_SIZEOF_MAGIC;
@@ -230,7 +228,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -265,7 +262,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
*
*-------------------------------------------------------------------------
@@ -349,7 +345,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 757fa4a..23d0a8f 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5Bdbg.c
- * Dec 11 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Bdbg.c
+ * Dec 11 2008
+ * Quincey Koziol
*
- * Purpose: Debugging routines for B-link tree package.
+ * Purpose: Debugging routines for B-link tree package.
*
*-------------------------------------------------------------------------
*/
@@ -31,21 +31,20 @@
/***********/
/* 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
*
*-------------------------------------------------------------------------
*/
@@ -96,13 +95,13 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5
((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);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "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");
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of left sibling:", bt->left);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of right sibling:", bt->right);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right);
HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren,
shared->two_k);
@@ -111,7 +110,8 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5
*/
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, "%*s%-*s %" PRIuHADDR "\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) {
@@ -136,16 +136,16 @@ done:
} /* end H5B_debug() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Bmodule.h b/src/H5Bmodule.h
index 86e6514..cfd3d53 100644
--- a/src/H5Bmodule.h
+++ b/src/H5Bmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5B package. Including this header means that the source file
* is part of the H5B package.
*/
-#ifndef _H5Bmodule_H
-#define _H5Bmodule_H
+#ifndef H5Bmodule_H
+#define H5Bmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_BTREE
#define H5_MY_PKG_INIT NO
-#endif /* _H5Bmodule_H */
+#endif /* H5Bmodule_H */
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index bc50d78..0a79628 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -6,31 +6,31 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, May 15, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 15, 2003
*
- * Purpose: This file contains declarations which are visible only within
- * the H5B package. Source files outside the H5B package should
- * include H5Bprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5B package. Source files outside the H5B package should
+ * include H5Bprivate.h instead.
*/
#if !(defined H5B_FRIEND || defined H5B_MODULE)
#error "Do not include this file outside the H5B package!"
#endif
-#ifndef _H5Bpkg_H
-#define _H5Bpkg_H
+#ifndef H5Bpkg_H
+#define H5Bpkg_H
/* Get package's private header */
#include "H5Bprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5FLprivate.h" /* Free Lists */
/**************************/
@@ -49,20 +49,20 @@
typedef struct H5B_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions */
/* _must_ be first field in structure */
- H5UC_t * rc_shared; /*ref-counted shared info */
- unsigned level; /*node level */
- unsigned nchildren; /*number of child pointers */
- haddr_t left; /*address of left sibling */
- haddr_t right; /*address of right sibling */
+ H5UC_t * rc_shared; /*ref-counted shared info */
+ unsigned level; /*node level */
+ unsigned nchildren; /*number of child pointers */
+ haddr_t left; /*address of left sibling */
+ haddr_t right; /*address of right sibling */
uint8_t *native; /*array of keys in native format */
- haddr_t *child; /*2k child pointers */
+ haddr_t *child; /*2k child pointers */
} H5B_t;
/* Callback info for loading a B-tree node into the cache */
typedef struct H5B_cache_ud_t {
H5F_t * f; /* File that B-tree node is within */
- const struct H5B_class_t *type; /* Type of tree */
- H5UC_t * rc_shared; /* Ref-counted shared info */
+ const struct H5B_class_t *type; /* Type of tree */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
} H5B_cache_ud_t;
/*****************************/
@@ -86,4 +86,4 @@ H5_DLL herr_t H5B__node_dest(H5B_t *bt);
herr_t H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata);
#endif
-#endif /*_H5Bpkg_H*/
+#endif /*H5Bpkg_H*/
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index a1f3ff6..265b6c6 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,17 +15,15 @@
*
* Created: H5Bprivate.h
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Private non-prototype header.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifndef _H5Bprivate_H
-#define _H5Bprivate_H
+#ifndef H5Bprivate_H
+#define H5Bprivate_H
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
@@ -159,4 +157,4 @@ H5_DLL herr_t H5B_shared_free(void *_shared);
H5_DLL herr_t H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B_class_t *type,
void *udata);
H5_DLL htri_t H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr);
-#endif /* _H5Bprivate_H */
+#endif /* H5Bprivate_H */
diff --git a/src/H5C.c b/src/H5C.c
index b41049e..185b421 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,52 +19,35 @@
*
* Purpose: Functions in this file implement a generic cache for
* things which exist on disk, and which may be
- * unambiguously referenced by their disk addresses.
+ * unambiguously referenced by their disk addresses.
*
- * The code in this module was initially written in
- * support of a complete re-write of the metadata cache
- * in H5AC.c However, other uses for the cache code
- * suggested themselves, and thus this file was created
- * in an attempt to support re-use.
- *
- * For a detailed overview of the cache, please see the
- * header comment for H5C_t in H5Cpkg.h.
+ * For a detailed overview of the cache, please see the
+ * header comment for H5C_t in H5Cpkg.h.
*
*-------------------------------------------------------------------------
*/
/**************************************************************************
*
- * To Do:
- *
- * Code Changes:
- *
- * - Remove extra functionality in H5C__flush_single_entry()?
- *
- * - Change protect/unprotect to lock/unlock.
- *
- * - Flush entries in increasing address order in
- * H5C__make_space_in_cache().
- *
- * - Also in H5C__make_space_in_cache(), use high and low water marks
- * to reduce the number of I/O calls.
+ * To Do:
*
- * - When flushing, attempt to combine contiguous entries to reduce
- * I/O overhead. Can't do this just yet as some entries are not
- * contiguous. Do this in parallel only or in serial as well?
+ * Code Changes:
*
- * - Create MPI type for dirty objects when flushing in parallel.
+ * - Change protect/unprotect to lock/unlock.
*
- * - Now that TBBT routines aren't used, fix nodes in memory to
- * point directly to the skip list node from the LRU list, eliminating
- * skip list lookups when evicting objects from the cache.
+ * - Flush entries in increasing address order in
+ * H5C__make_space_in_cache().
*
- * Tests:
+ * - Also in H5C__make_space_in_cache(), use high and low water marks
+ * to reduce the number of I/O calls.
*
- * - Trim execution time. (This is no longer a major issue with the
- * shift from the TBBT to a hash table for indexing.)
+ * - When flushing, attempt to combine contiguous entries to reduce
+ * I/O overhead. Can't do this just yet as some entries are not
+ * contiguous. Do this in parallel only or in serial as well?
*
- * - Add random tests.
+ * - Fix nodes in memory to point directly to the skip list node from
+ * the LRU list, eliminating skip list lookups when evicting objects
+ * from the cache.
*
**************************************************************************/
@@ -78,16 +61,16 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
@@ -135,15 +118,15 @@ static herr_t H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_
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,
+ hbool_t coll_access,
#endif /* H5_HAVE_PARALLEL */
- const H5C_class_t *type, haddr_t addr, void *udata);
+ const H5C_class_t *type, haddr_t addr, void *udata);
static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry);
@@ -151,18 +134,18 @@ 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, H5C_cache_entry_t *target_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
@@ -198,16 +181,16 @@ H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t);
* Function: H5C_create
*
* Purpose: Allocate, initialize, and return the address of a new
- * instance of H5C_t.
+ * instance of H5C_t.
*
- * In general, the max_cache_size parameter must be positive,
- * and the min_clean_size parameter must lie in the closed
- * interval [0, max_cache_size].
+ * In general, the max_cache_size parameter must be positive,
+ * and the min_clean_size parameter must lie in the closed
+ * interval [0, max_cache_size].
*
- * The check_write_permitted parameter must either be NULL,
- * or point to a function of type H5C_write_permitted_func_t.
- * If it is NULL, the cache will use the write_permitted
- * flag to determine whether writes are permitted.
+ * The check_write_permitted parameter must either be NULL,
+ * or point to a function of type H5C_write_permitted_func_t.
+ * If it is NULL, the cache will use the write_permitted
+ * flag to determine whether writes are permitted.
*
* Return: Success: Pointer to the new instance.
*
@@ -216,6 +199,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 *
@@ -306,10 +365,16 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
cache_ptr->ignore_tags = FALSE;
cache_ptr->num_objs_corked = 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;
cache_ptr->slist_size_increase = 0;
@@ -380,8 +445,8 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
(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 = 1.0;
+ (cache_ptr->resize_ctl).flash_threshold = 0.25;
(cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
(cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD;
@@ -480,13 +545,13 @@ done:
*
* Purpose: Print results of a automatic cache resize.
*
- * This function should only be used where HDprintf() behaves
- * well -- i.e. not on Windows.
+ * This function should only be used where HDprintf() behaves
+ * well -- i.e. not on Windows.
*
* Return: void
*
* Programmer: John Mainzer
- * 10/27/04
+ * 10/27/04
*
*-------------------------------------------------------------------------
*/
@@ -517,18 +582,18 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr,
HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
- HDfprintf(stdout, "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", cache_ptr->prefix,
+ HDfprintf(stdout, "%scache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
break;
case flash_increase:
HDassert(old_max_cache_size < new_max_cache_size);
- HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %Zu.\n", cache_ptr->prefix,
+ HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix,
(int)((cache_ptr->resize_ctl).flash_incr_mode),
cache_ptr->flash_size_increase_threshold);
- HDfprintf(stdout, "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", cache_ptr->prefix,
+ HDfprintf(stdout, "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
break;
@@ -569,21 +634,20 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr,
cache_ptr->prefix, hit_rate);
}
- HDfprintf(stdout, "%s cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n",
- cache_ptr->prefix, old_max_cache_size, old_min_clean_size, new_max_cache_size,
- new_min_clean_size);
+ HDfprintf(stdout, "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
+ old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
break;
case at_max_size:
HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
- HDfprintf(stdout, "%s cache already at maximum size so no change.\n", cache_ptr->prefix);
+ HDfprintf(stdout, "%s cache already at maximum size so no change.\n", cache_ptr->prefix);
break;
case at_min_size:
HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n", cache_ptr->prefix,
hit_rate);
- HDfprintf(stdout, "%s cache already at minimum size.\n", cache_ptr->prefix);
+ HDfprintf(stdout, "%s cache already at minimum size.\n", cache_ptr->prefix);
break;
case increase_disabled:
@@ -601,36 +665,33 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr,
HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
- HDfprintf(stdout, "%s cache not full so no increase in size.\n", cache_ptr->prefix);
+ HDfprintf(stdout, "%s cache not full so no increase in size.\n", cache_ptr->prefix);
break;
default:
HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix);
break;
}
-
- return;
-
} /* H5C_def_auto_resize_rpt_fcn() */
/*-------------------------------------------------------------------------
- * Function: H5C_free_tag_list_cb
+ * Function: H5C__free_tag_list_cb
*
* Purpose: Callback function to free tag nodes from the skip list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
- * January 2014
+ * January 2014
*
*-------------------------------------------------------------------------
*/
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);
@@ -638,15 +699,15 @@ 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() */
/*-------------------------------------------------------------------------
*
* Function: H5C_prep_for_file_close
*
* Purpose: This function should be called just prior to the cache
- * flushes at file close. There should be no protected
- * entries in the cache at this point.
+ * flushes at file close. There should be no protected
+ * entries in the cache at this point.
*
* Return: Non-negative on success/Negative on failure
*
@@ -740,12 +801,26 @@ done:
* This function fails if any object are protected since the
* resulting file might not be consistent.
*
- * Note that *cache_ptr has been freed upon successful return.
+ * Note that *cache_ptr has been freed upon successful return.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
- * 6/2/04
+ * 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.
*
*-------------------------------------------------------------------------
*/
@@ -767,33 +842,59 @@ 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)
+
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 (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);
+
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",
+
+ if (cache_ptr->get_entry_ptr_from_addr_counter > 0) {
+
+ HDfprintf(stdout, "*** %" PRId64 " 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;
@@ -802,7 +903,18 @@ 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() */
/*-------------------------------------------------------------------------
@@ -813,7 +925,15 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
- * Dec 2013
+ * 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.
*
*-------------------------------------------------------------------------
*/
@@ -827,10 +947,21 @@ 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")
+ /* 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)
} /* H5C_evict() */
@@ -839,8 +970,8 @@ done:
* Function: H5C_expunge_entry
*
* Purpose: Use this function to tell the cache to expunge an entry
- * from the cache without writing it to disk even if it is
- * dirty. The entry may not be either pinned or protected.
+ * from the cache without writing it to disk even if it is
+ * dirty. The entry may not be either pinned or protected.
*
* Return: Non-negative on success/Negative on failure
*
@@ -868,7 +999,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 */
@@ -903,7 +1034,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 */
@@ -913,47 +1044,47 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_flush_cache
*
- * Purpose: Flush (and possibly destroy) the entries contained in the
- * specified cache.
+ * Purpose: Flush (and possibly destroy) the entries contained in the
+ * specified cache.
*
- * If the cache contains protected entries, the function will
- * fail, as protected entries cannot be flushed. However
- * all unprotected entries should be flushed before the
- * function returns failure.
+ * If the cache contains protected entries, the function will
+ * fail, as protected entries cannot be flushed. However
+ * all unprotected entries should be flushed before the
+ * function returns failure.
*
* 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
- * 6/2/04
+ * 6/2/04
*
- * Changes: Modified function to test for slist chamges in
- * pre_serialize and serialize callbacks, and re-start
- * scans through the slist when such changes occur.
+ * Changes: Modified function to test for slist chamges in
+ * pre_serialize and serialize callbacks, and re-start
+ * scans through the slist when such changes occur.
*
- * This has been a potential problem for some time,
- * and there has been code in this function to deal
- * with elements of this issue. However the shift
- * to the V3 cache in combination with the activities
- * of some of the cache clients (in particular the
- * free space manager and the fractal heap) have
- * made this re-work necessary.
+ * This has been a potential problem for some time,
+ * and there has been code in this function to deal
+ * with elements of this issue. However the shift
+ * to the V3 cache in combination with the activities
+ * of some of the cache clients (in particular the
+ * free space manager and the fractal heap) have
+ * made this re-work necessary.
*
- * JRM -- 12/13/14
+ * JRM -- 12/13/14
*
- * Modified function to support rings. Basic idea is that
- * every entry in the cache is assigned to a ring. Entries
- * in the outermost ring are flushed first, followed by
- * those in the next outermost ring, and so on until the
- * innermost ring is flushed. See header comment on
- * H5C_ring_t in H5Cprivate.h for a more detailed
- * discussion.
+ * Modified function to support rings. Basic idea is that
+ * every entry in the cache is assigned to a ring. Entries
+ * in the outermost ring are flushed first, followed by
+ * those in the next outermost ring, and so on until the
+ * innermost ring is flushed. See header comment on
+ * H5C_ring_t in H5Cprivate.h for a more detailed
+ * discussion.
*
- * JRM -- 8/30/15
+ * JRM -- 8/30/15
*
- * Modified function to call the free space manager
- * settling functions.
- * JRM -- 6/9/16
+ * Modified function to call the free space manager
+ * settling functions.
+ * JRM -- 6/9/16
*
*-------------------------------------------------------------------------
*/
@@ -1010,8 +1141,8 @@ 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 */
@@ -1079,24 +1210,24 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_flush_to_min_clean
*
- * Purpose: Flush dirty entries until the caches min clean size is
- * attained.
+ * Purpose: Flush dirty entries until the caches min clean size is
+ * attained.
*
- * This function is used in the implementation of the
- * metadata cache in PHDF5. To avoid "messages from the
- * future", the cache on process 0 can't be allowed to
- * flush entries until the other processes have reached
- * the same point in the calculation. If this constraint
- * is not met, it is possible that the other processes will
- * read metadata generated at a future point in the
- * computation.
+ * This function is used in the implementation of the
+ * metadata cache in PHDF5. To avoid "messages from the
+ * future", the cache on process 0 can't be allowed to
+ * flush entries until the other processes have reached
+ * the same point in the calculation. If this constraint
+ * is not met, it is possible that the other processes will
+ * read metadata generated at a future point in the
+ * computation.
*
*
* Return: Non-negative on success/Negative on failure or if
- * write is not permitted.
+ * write is not permitted.
*
* Programmer: John Mainzer
- * 9/16/05
+ * 9/16/05
*
*-------------------------------------------------------------------------
*/
@@ -1141,12 +1272,12 @@ done:
* exist on disk yet, but it must have an address and disk
* space reserved.
*
- * Observe that this function cannot occasion a read.
+ * Observe that this function cannot occasion a read.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
- * 6/2/04
+ * 6/2/04
*
*-------------------------------------------------------------------------
*/
@@ -1186,8 +1317,8 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
#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 */
@@ -1375,8 +1506,8 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
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 */
@@ -1405,8 +1536,8 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
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 */
@@ -1420,27 +1551,27 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_dirty
*
- * Purpose: Mark a pinned or protected entry as dirty. The target entry
- * MUST be either pinned or protected, and MAY be both.
+ * Purpose: Mark a pinned or protected entry as dirty. The target entry
+ * MUST be either pinned or protected, and MAY be both.
*
- * In the protected case, this call is the functional
- * equivalent of setting the H5C__DIRTIED_FLAG on an unprotect
- * call.
+ * In the protected case, this call is the functional
+ * equivalent of setting the H5C__DIRTIED_FLAG on an unprotect
+ * call.
*
- * In the pinned but not protected case, if the entry is not
- * already dirty, the function places function marks the entry
- * dirty and places it on the skip list.
+ * In the pinned but not protected case, if the entry is not
+ * already dirty, the function places function marks the entry
+ * dirty and places it on the skip list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
* 5/15/06
*
- * JRM -- 11/5/08
- * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to
- * update the new clean_index_size and dirty_index_size
- * fields of H5C_t in the case that the entry was clean
- * prior to this call, and is pinned and not protected.
+ * JRM -- 11/5/08
+ * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to
+ * update the new clean_index_size and dirty_index_size
+ * fields of H5C_t in the case that the entry was clean
+ * prior to this call, and is pinned and not protected.
*
*-------------------------------------------------------------------------
*/
@@ -1529,11 +1660,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_clean
*
- * Purpose: Mark a pinned entry as clean. The target entry MUST be pinned.
+ * Purpose: Mark a pinned entry as clean. The target entry MUST be pinned.
*
- * If the entry is not
- * already clean, the function places function marks the entry
- * clean and removes it from the skip list.
+ * If the entry is not
+ * already clean, the function places function marks the entry
+ * clean and removes it from the skip list.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1608,8 +1739,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_unserialized
*
- * Purpose: Mark a pinned or protected entry as unserialized. The target
- * entry MUST be either pinned or protected, and MAY be both.
+ * Purpose: Mark a pinned or protected entry as unserialized. The target
+ * entry MUST be either pinned or protected, and MAY be both.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1654,8 +1785,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_serialized
*
- * Purpose: Mark a pinned entry as serialized. The target entry MUST be
- * pinned.
+ * Purpose: Mark a pinned entry as serialized. The target entry MUST be
+ * pinned.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1730,8 +1861,8 @@ H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, hadd
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 */
@@ -1836,8 +1967,8 @@ H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, hadd
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 */
@@ -1847,11 +1978,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_resize_entry
*
- * Purpose: Resize a pinned or protected entry.
+ * Purpose: Resize a pinned or protected entry.
*
- * Resizing an entry dirties it, so if the entry is not
- * already dirty, the function places the entry on the
- * skip list.
+ * Resizing an entry dirties it, so if the entry is not
+ * already dirty, the function places the entry on the
+ * skip list.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1883,7 +2014,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 */
@@ -1979,7 +2111,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 */
@@ -1989,15 +2122,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_pin_protected_entry()
*
- * Purpose: Pin a protected cache entry. The entry must be protected
- * at the time of call, and must be unpinned.
+ * Purpose: Pin a protected cache entry. The entry must be protected
+ * at the time of call, and must be unpinned.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
* 4/26/06
*
- * Changes: Added extreme sanity checks on entry and exit.
+ * Changes: Added extreme sanity checks on entry and exit.
* JRM -- 4/26/14
*
*-------------------------------------------------------------------------
@@ -2019,8 +2152,8 @@ 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 */
@@ -2034,8 +2167,8 @@ 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 */
@@ -2046,16 +2179,16 @@ done:
* Function: H5C_protect
*
* Purpose: If the target entry is not in the cache, load it. If
- * necessary, attempt to evict one or more entries to keep
- * the cache within its maximum size.
+ * necessary, attempt to evict one or more entries to keep
+ * the cache within its maximum size.
*
- * Mark the target entry as protected, and return its address
- * to the caller. The caller must call H5C_unprotect() when
- * finished with the entry.
+ * Mark the target entry as protected, and return its address
+ * to the caller. The caller must call H5C_unprotect() when
+ * finished with the entry.
*
- * While it is protected, the entry may not be either evicted
- * or flushed -- nor may it be accessed by another call to
- * H5C_protect. Any attempt to do so will result in a failure.
+ * While it is protected, the entry may not be either evicted
+ * or flushed -- nor may it be accessed by another call to
+ * H5C_protect. Any attempt to do so will result in a failure.
*
* Return: Success: Ptr to the desired entry
* Failure: NULL
@@ -2076,8 +2209,8 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign
#ifdef H5_HAVE_PARALLEL
hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
- hbool_t write_permitted;
- hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */
+ hbool_t write_permitted = FALSE;
+ hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */
size_t empty_space;
void * thing;
H5C_cache_entry_t *entry_ptr;
@@ -2098,8 +2231,8 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign
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 */
@@ -2227,11 +2360,11 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign
hit = FALSE;
- if (NULL == (thing = H5C_load_entry(f,
+ if (NULL == (thing = H5C__load_entry(f,
#ifdef H5_HAVE_PARALLEL
- coll_access,
+ coll_access,
#endif /* H5_HAVE_PARALLEL */
- type, addr, udata)))
+ type, addr, udata)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry")
entry_ptr = (H5C_cache_entry_t *)thing;
@@ -2473,8 +2606,8 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign
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 */
@@ -2513,19 +2646,19 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_set_cache_auto_resize_config
*
- * Purpose: Set the cache automatic resize configuration to the
- * provided values if they are in range, and fail if they
- * are not.
+ * Purpose: Set the cache automatic resize configuration to the
+ * provided values if they are in range, and fail if they
+ * are not.
*
- * If the new configuration enables automatic cache resizing,
- * coerce the cache max size and min clean size into agreement
- * with the new policy and re-set the full cache hit rate
- * stats.
+ * If the new configuration enables automatic cache resizing,
+ * coerce the cache max size and min clean size into agreement
+ * with the new policy and re-set the full cache hit rate
+ * stats.
*
* Return: SUCCEED on success, and FAIL on failure.
*
* Programmer: John Mainzer
- * 10/8/04
+ * 10/8/04
*
*-------------------------------------------------------------------------
*/
@@ -2572,7 +2705,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_incr__threshold:
- if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) ||
+ if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) ||
((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
cache_ptr->size_increase_possible = FALSE;
break;
@@ -2592,21 +2725,21 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_decr__threshold:
- if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) ||
+ if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out_with_threshold:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
- (config_ptr->upper_hr_threshold >= (double)1.0f))
+ (config_ptr->upper_hr_threshold >= 1.0))
cache_ptr->size_decrease_possible = FALSE;
break;
@@ -2648,7 +2781,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
/* since new_min_clean_size is of type size_t, we have
*
- * ( 0 <= new_min_clean_size )
+ * ( 0 <= new_min_clean_size )
*
* by definition.
*/
@@ -2748,18 +2881,186 @@ done:
} /* H5C_set_evictions_enabled() */
/*-------------------------------------------------------------------------
+ *
+ * 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
- * unprotected at the time of call, but must be pinned.
+ * Purpose: Unpin a cache entry. The entry can be either protected or
+ * unprotected at the time of call, but must be pinned.
*
* Return: Non-negative on success/Negative on failure
*
* 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
*
*-------------------------------------------------------------------------
*/
@@ -2779,8 +3080,8 @@ 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 */
@@ -2790,8 +3091,8 @@ 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 */
@@ -2801,26 +3102,101 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C_unprotect
*
- * Purpose: Undo an H5C_protect() call -- specifically, mark the
- * entry as unprotected, remove it from the protected list,
- * and give it back to the replacement policy.
+ * Purpose: Undo an H5C_protect() call -- specifically, mark the
+ * entry as unprotected, remove it from the protected list,
+ * and give it back to the replacement policy.
*
- * The TYPE and ADDR arguments must be the same as those in
- * the corresponding call to H5C_protect() and the THING
- * argument must be the value returned by that call to
- * H5C_protect().
+ * The TYPE and ADDR arguments must be the same as those in
+ * the corresponding call to H5C_protect() and the THING
+ * argument must be the value returned by that call to
+ * H5C_protect().
*
* Return: Non-negative on success/Negative on failure
*
- * If the deleted flag is TRUE, simply remove the target entry
- * from the cache, clear it, and free it without writing it to
- * disk.
+ * If the deleted flag is TRUE, simply remove the target entry
+ * from the cache, clear it, and free it without writing it to
+ * disk.
*
* Return: Non-negative on success/Negative on failure
*
* 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
@@ -2862,9 +3238,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;
@@ -2877,8 +3259,9 @@ 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))
+ 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 */
@@ -2887,11 +3270,13 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* drops to zero.
*/
if (entry_ptr->ro_ref_count > 1) {
+
/* Sanity check */
HDassert(entry_ptr->is_protected);
HDassert(entry_ptr->is_read_only);
if (dirtied)
+
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??")
/* Reduce the RO ref count */
@@ -2899,26 +3284,35 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
/* Pin or unpin the entry as requested. */
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) {
+
/* 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")
+
} /* end if */
}
else {
+
if (entry_ptr->is_read_only) {
+
/* Sanity check */
HDassert(entry_ptr->ro_ref_count == 1);
if (dirtied)
+
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
@@ -2948,64 +3342,91 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
#endif /* H5_HAVE_PARALLEL */
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 (dirtied) {
+
if (entry_ptr->image_up_to_date) {
+
entry_ptr->image_up_to_date = FALSE;
- if (entry_ptr->flush_dep_nparents > 0)
+
+ 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 */
+ } /* end if */
/* Check for newly dirtied entry */
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)
+ 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 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.
+
+ /* 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)
+ 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 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) {
+
/* 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) {
+
/* 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")
} /* end if */
@@ -3020,9 +3441,14 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* and then add it to the skip list if it isn't there already.
*/
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
@@ -3035,45 +3461,62 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* JRM - 5/19/04
*/
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?!?")
/* 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);
+ 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) {
/* 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")
+
} /* end else if */
#endif /* H5_HAVE_PARALLEL */
}
@@ -3081,580 +3524,578 @@ 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)) {
+ 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() */
+ FUNC_LEAVE_NOAPI(ret_value)
- /*-------------------------------------------------------------------------
- *
- * Function: H5C_unsettle_entry_ring
- *
- * Purpose: Advise the metadata cache that the specified entry's free space
- * manager ring is no longer settled (if it was on entry).
- *
- * If the target free space manager ring is already
- * unsettled, do nothing, and return SUCCEED.
- *
- * If the target free space manager ring is settled, and
- * we are not in the process of a file shutdown, mark
- * the ring as unsettled, and return SUCCEED.
- *
- * If the target free space manager is settled, and we
- * are in the process of a file shutdown, post an error
- * message, and return FAIL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * January 3, 2017
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_unsettle_entry_ring(void *_entry)
- {
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */
- H5C_t * cache; /* Cache for file */
- herr_t ret_value = SUCCEED; /* Return value */
+} /* H5C_unprotect() */
- FUNC_ENTER_NOAPI(FAIL)
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_unsettle_entry_ring
+ *
+ * Purpose: Advise the metadata cache that the specified entry's free space
+ * manager ring is no longer settled (if it was on entry).
+ *
+ * If the target free space manager ring is already
+ * unsettled, do nothing, and return SUCCEED.
+ *
+ * If the target free space manager ring is settled, and
+ * we are not in the process of a file shutdown, mark
+ * the ring as unsettled, and return SUCCEED.
+ *
+ * If the target free space manager is settled, and we
+ * are in the process of a file shutdown, post an error
+ * message, and return FAIL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_unsettle_entry_ring(void *_entry)
+{
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */
+ H5C_t * cache; /* Cache for file */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Sanity checks */
- HDassert(entry);
- HDassert(entry->ring != H5C_RING_UNDEFINED);
- HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) ||
- (H5C_RING_MDFSM == entry->ring));
- cache = entry->cache_ptr;
- HDassert(cache);
- HDassert(cache->magic == H5C__H5C_T_MAGIC);
-
- switch (entry->ring) {
- case H5C_RING_USER:
- /* Do nothing */
- break;
+ FUNC_ENTER_NOAPI(FAIL)
- case H5C_RING_RDFSM:
- if (cache->rdfsm_settled) {
- if (cache->flush_in_progress || cache->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
- cache->rdfsm_settled = FALSE;
- } /* end if */
- break;
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(entry->ring != H5C_RING_UNDEFINED);
+ HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) ||
+ (H5C_RING_MDFSM == entry->ring));
+ cache = entry->cache_ptr;
+ HDassert(cache);
+ HDassert(cache->magic == H5C__H5C_T_MAGIC);
+
+ switch (entry->ring) {
+ case H5C_RING_USER:
+ /* Do nothing */
+ break;
- case H5C_RING_MDFSM:
- if (cache->mdfsm_settled) {
- if (cache->flush_in_progress || cache->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
- cache->mdfsm_settled = FALSE;
- } /* end if */
- break;
+ case H5C_RING_RDFSM:
+ if (cache->rdfsm_settled) {
+ if (cache->flush_in_progress || cache->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
+ cache->rdfsm_settled = FALSE;
+ } /* end if */
+ break;
- default:
- HDassert(FALSE); /* this should be un-reachable */
- break;
- } /* end switch */
+ case H5C_RING_MDFSM:
+ if (cache->mdfsm_settled) {
+ if (cache->flush_in_progress || cache->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
+ cache->mdfsm_settled = FALSE;
+ } /* end if */
+ break;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_unsettle_entry_ring() */
+ default:
+ HDassert(FALSE); /* this should be un-reachable */
+ break;
+ } /* end switch */
- /*-------------------------------------------------------------------------
- * Function: H5C_unsettle_ring()
- *
- * Purpose: Advise the metadata cache that the specified free space
- * manager ring is no longer settled (if it was on entry).
- *
- * If the target free space manager ring is already
- * unsettled, do nothing, and return SUCCEED.
- *
- * If the target free space manager ring is settled, and
- * we are not in the process of a file shutdown, mark
- * the ring as unsettled, and return SUCCEED.
- *
- * If the target free space manager is settled, and we
- * are in the process of a file shutdown, post an error
- * message, and return FAIL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 10/15/16
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring)
- {
- H5C_t *cache_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_unsettle_entry_ring() */
- FUNC_ENTER_NOAPI(FAIL)
+/*-------------------------------------------------------------------------
+ * Function: H5C_unsettle_ring()
+ *
+ * Purpose: Advise the metadata cache that the specified free space
+ * manager ring is no longer settled (if it was on entry).
+ *
+ * If the target free space manager ring is already
+ * unsettled, do nothing, and return SUCCEED.
+ *
+ * If the target free space manager ring is settled, and
+ * we are not in the process of a file shutdown, mark
+ * the ring as unsettled, and return SUCCEED.
+ *
+ * If the target free space manager is settled, and we
+ * are in the process of a file shutdown, post an error
+ * message, and return FAIL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 10/15/16
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring)
+{
+ H5C_t *cache_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- HDassert(f->shared->cache);
- HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring));
- cache_ptr = f->shared->cache;
- HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic);
+ FUNC_ENTER_NOAPI(FAIL)
- switch (ring) {
- case H5C_RING_RDFSM:
- if (cache_ptr->rdfsm_settled) {
- if (cache_ptr->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
- cache_ptr->rdfsm_settled = FALSE;
- } /* end if */
- break;
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring));
+ cache_ptr = f->shared->cache;
+ HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic);
+
+ switch (ring) {
+ case H5C_RING_RDFSM:
+ if (cache_ptr->rdfsm_settled) {
+ if (cache_ptr->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
+ cache_ptr->rdfsm_settled = FALSE;
+ } /* end if */
+ break;
- case H5C_RING_MDFSM:
- if (cache_ptr->mdfsm_settled) {
- if (cache_ptr->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
- cache_ptr->mdfsm_settled = FALSE;
- } /* end if */
- break;
+ case H5C_RING_MDFSM:
+ if (cache_ptr->mdfsm_settled) {
+ if (cache_ptr->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
+ cache_ptr->mdfsm_settled = FALSE;
+ } /* end if */
+ break;
- default:
- HDassert(FALSE); /* this should be un-reachable */
- break;
- } /* end switch */
+ default:
+ HDassert(FALSE); /* this should be un-reachable */
+ break;
+ } /* end switch */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_unsettle_ring() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_unsettle_ring() */
- /*-------------------------------------------------------------------------
- * Function: H5C_validate_resize_config()
- *
- * Purpose: Run a sanity check on the specified sections of the
- * provided instance of struct H5C_auto_size_ctl_t.
- *
- * Do nothing and return SUCCEED if no errors are detected,
- * and flag an error and return FAIL otherwise.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 3/23/05
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, unsigned int tests)
- {
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C_validate_resize_config()
+ *
+ * Purpose: Run a sanity check on the specified sections of the
+ * provided instance of struct H5C_auto_size_ctl_t.
+ *
+ * Do nothing and return SUCCEED if no errors are detected,
+ * and flag an error and return FAIL otherwise.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 3/23/05
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- if (config_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry")
+ if (config_ptr == NULL)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry")
- if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version")
+ if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version")
- if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) {
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) {
- if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
+ if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
- if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
+ if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
- if (config_ptr->min_size > config_ptr->max_size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
+ if (config_ptr->min_size > config_ptr->max_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
- if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) ||
- (config_ptr->initial_size > config_ptr->max_size)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "initial_size must be in the interval [min_size, max_size]")
+ if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) ||
+ (config_ptr->initial_size > config_ptr->max_size)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "initial_size must be in the interval [min_size, max_size]")
- if ((config_ptr->min_clean_fraction < (double)0.0f) ||
- (config_ptr->min_clean_fraction > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "min_clean_fraction must be in the interval [0.0, 1.0]")
+ if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]")
- if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small")
+ if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small")
- if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big")
- } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */
+ if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big")
+ } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */
- if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) {
- if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) {
+ if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
- if (config_ptr->incr_mode == H5C_incr__threshold) {
- if ((config_ptr->lower_hr_threshold < (double)0.0f) ||
- (config_ptr->lower_hr_threshold > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "lower_hr_threshold must be in the range [0.0, 1.0]")
+ if (config_ptr->incr_mode == H5C_incr__threshold) {
+ if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "lower_hr_threshold must be in the range [0.0, 1.0]")
- if (config_ptr->increment < (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "increment must be greater than or equal to 1.0")
+ if (config_ptr->increment < 1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0")
- /* no need to check max_increment, as it is a size_t,
- * and thus must be non-negative.
- */
- } /* H5C_incr__threshold */
+ /* no need to check max_increment, as it is a size_t,
+ * and thus must be non-negative.
+ */
+ } /* H5C_incr__threshold */
- switch (config_ptr->flash_incr_mode) {
- case H5C_flash_incr__off:
- /* nothing to do here */
- break;
+ switch (config_ptr->flash_incr_mode) {
+ case H5C_flash_incr__off:
+ /* nothing to do here */
+ break;
- case H5C_flash_incr__add_space:
- if ((config_ptr->flash_multiple < (double)0.1f) ||
- (config_ptr->flash_multiple > (double)10.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "flash_multiple must be in the range [0.1, 10.0]")
- if ((config_ptr->flash_threshold < (double)0.1f) ||
- (config_ptr->flash_threshold > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "flash_threshold must be in the range [0.1, 1.0]")
- break;
+ case H5C_flash_incr__add_space:
+ if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "flash_multiple must be in the range [0.1, 10.0]")
+ if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "flash_threshold must be in the range [0.1, 1.0]")
+ break;
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode")
- break;
- } /* end switch */
- } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode")
+ break;
+ } /* end switch */
+ } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */
- if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) {
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) {
- if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) &&
- (config_ptr->decr_mode != H5C_decr__age_out) &&
- (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) {
+ if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) &&
+ (config_ptr->decr_mode != H5C_decr__age_out) &&
+ (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode")
- }
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode")
+ }
- if (config_ptr->decr_mode == H5C_decr__threshold) {
- if (config_ptr->upper_hr_threshold > (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
+ if (config_ptr->decr_mode == H5C_decr__threshold) {
+ if (config_ptr->upper_hr_threshold > 1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
- if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
+ if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
- /* no need to check max_decrement as it is a size_t
- * and thus must be non-negative.
- */
- } /* H5C_decr__threshold */
+ /* no need to check max_decrement as it is a size_t
+ * and thus must be non-negative.
+ */
+ } /* H5C_decr__threshold */
- if ((config_ptr->decr_mode == H5C_decr__age_out) ||
- (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) {
+ if ((config_ptr->decr_mode == H5C_decr__age_out) ||
+ (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) {
- if (config_ptr->epochs_before_eviction < 1)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive")
- if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
+ if (config_ptr->epochs_before_eviction < 1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive")
+ if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
- if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > (double)1.0f) ||
- (config_ptr->empty_reserve < (double)0.0f)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "empty_reserve must be in the interval [0.0, 1.0]")
+ if ((config_ptr->apply_empty_reserve) &&
+ ((config_ptr->empty_reserve > 1.0) || (config_ptr->empty_reserve < 0.0)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]")
- /* no need to check max_decrement as it is a size_t
- * and thus must be non-negative.
- */
- } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
+ /* no need to check max_decrement as it is a size_t
+ * and thus must be non-negative.
+ */
+ } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
- if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
- if ((config_ptr->upper_hr_threshold > (double)1.0f) ||
- (config_ptr->upper_hr_threshold < (double)0.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "upper_hr_threshold must be in the interval [0.0, 1.0]")
- } /* H5C_decr__age_out_with_threshold */
- } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */
-
- if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) {
- if ((config_ptr->incr_mode == H5C_incr__threshold) &&
- ((config_ptr->decr_mode == H5C_decr__threshold) ||
- (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) &&
- (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config")
- } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */
+ if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
+ if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "upper_hr_threshold must be in the interval [0.0, 1.0]")
+ } /* H5C_decr__age_out_with_threshold */
+ } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */
+
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) {
+ if ((config_ptr->incr_mode == H5C_incr__threshold) &&
+ ((config_ptr->decr_mode == H5C_decr__threshold) ||
+ (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config")
+ } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_validate_resize_config() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_validate_resize_config() */
- /*-------------------------------------------------------------------------
- * Function: H5C_create_flush_dependency()
- *
- * Purpose: Initiates a parent<->child entry flush dependency. The parent
- * entry must be pinned or protected at the time of call, and must
- * have all dependencies removed before the cache can shut down.
- *
- * Note: Flush dependencies in the cache indicate that a child entry
- * must be flushed to the file before its parent. (This is
- * currently used to implement Single-Writer/Multiple-Reader (SWMR)
- * I/O access for data structures in the file).
- *
- * Creating a flush dependency between two entries will also pin
- * the parent entry.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/05/09
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing)
- {
- H5C_t * cache_ptr;
- H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
- H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C_create_flush_dependency()
+ *
+ * Purpose: Initiates a parent<->child entry flush dependency. The parent
+ * entry must be pinned or protected at the time of call, and must
+ * have all dependencies removed before the cache can shut down.
+ *
+ * Note: Flush dependencies in the cache indicate that a child entry
+ * must be flushed to the file before its parent. (This is
+ * currently used to implement Single-Writer/Multiple-Reader (SWMR)
+ * I/O access for data structures in the file).
+ *
+ * Creating a flush dependency between two entries will also pin
+ * the parent entry.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/05/09
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_create_flush_dependency(void *parent_thing, void *child_thing)
+{
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
+ H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(parent_entry);
- HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(parent_entry->addr));
- HDassert(child_entry);
- HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(child_entry->addr));
- cache_ptr = parent_entry->cache_ptr;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr == child_entry->cache_ptr);
+ /* Sanity checks */
+ HDassert(parent_entry);
+ HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(parent_entry->addr));
+ HDassert(child_entry);
+ HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
#ifndef NDEBUG
- /* Make sure the parent is not already a parent */
- {
- unsigned u;
+ /* Make sure the parent is not already a parent */
+ {
+ unsigned u;
- for (u = 0; u < child_entry->flush_dep_nparents; u++)
- HDassert(child_entry->flush_dep_parent[u] != parent_entry);
- } /* end block */
-#endif /* NDEBUG */
+ for (u = 0; u < child_entry->flush_dep_nparents; u++)
+ HDassert(child_entry->flush_dep_parent[u] != parent_entry);
+ } /* end block */
+#endif /* NDEBUG */
- /* More sanity checks */
- if (child_entry == parent_entry)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL,
- "Child entry flush dependency parent can't be itself")
- if (!(parent_entry->is_protected || parent_entry->is_pinned))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected")
+ /* More sanity checks */
+ if (child_entry == parent_entry)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself")
+ if (!(parent_entry->is_protected || parent_entry->is_pinned))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected")
- /* Check for parent not pinned */
- if (!parent_entry->is_pinned) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_nchildren == 0);
- HDassert(!parent_entry->pinned_from_client);
- HDassert(!parent_entry->pinned_from_cache);
+ /* Check for parent not pinned */
+ if (!parent_entry->is_pinned) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_nchildren == 0);
+ HDassert(!parent_entry->pinned_from_client);
+ HDassert(!parent_entry->pinned_from_cache);
- /* Pin the parent entry */
- parent_entry->is_pinned = TRUE;
- H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry)
- } /* end else */
+ /* Pin the parent entry */
+ parent_entry->is_pinned = TRUE;
+ H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry)
+ } /* end else */
- /* Mark the entry as pinned from the cache's action (possibly redundantly) */
- parent_entry->pinned_from_cache = TRUE;
+ /* Mark the entry as pinned from the cache's action (possibly redundantly) */
+ parent_entry->pinned_from_cache = TRUE;
- /* Check if we need to resize the child's parent array */
- if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) {
- if (child_entry->flush_dep_parent_nalloc == 0) {
- /* Array does not exist yet, allocate it */
- HDassert(!child_entry->flush_dep_parent);
+ /* Check if we need to resize the child's parent array */
+ if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) {
+ if (child_entry->flush_dep_parent_nalloc == 0) {
+ /* Array does not exist yet, allocate it */
+ HDassert(!child_entry->flush_dep_parent);
- if (NULL == (child_entry->flush_dep_parent =
- H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT;
- } /* end if */
- else {
- /* Resize existing array */
- HDassert(child_entry->flush_dep_parent);
-
- if (NULL == (child_entry->flush_dep_parent =
- H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
- 2 * child_entry->flush_dep_parent_nalloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc *= 2;
- } /* end else */
- cache_ptr->entry_fd_height_change_counter++;
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT;
} /* end if */
+ else {
+ /* Resize existing array */
+ HDassert(child_entry->flush_dep_parent);
- /* Add the dependency to the child's parent array */
- child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry;
- child_entry->flush_dep_nparents++;
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
+ 2 * child_entry->flush_dep_parent_nalloc)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc *= 2;
+ } /* end else */
+ cache_ptr->entry_fd_height_change_counter++;
+ } /* end if */
- /* Increment parent's number of children */
- parent_entry->flush_dep_nchildren++;
+ /* Add the dependency to the child's parent array */
+ child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry;
+ child_entry->flush_dep_nparents++;
- /* Adjust the number of dirty children */
- if (child_entry->is_dirty) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren);
+ /* Increment parent's number of children */
+ parent_entry->flush_dep_nchildren++;
- parent_entry->flush_dep_ndirty_children++;
+ /* Adjust the number of dirty children */
+ if (child_entry->is_dirty) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren);
- /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
- if (parent_entry->type->notify &&
- (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry dirty flag set")
- } /* end if */
+ parent_entry->flush_dep_ndirty_children++;
- /* adjust the parent's number of unserialized children. Note
- * that it is possible for and entry to be clean and unserialized.
- */
- if (!child_entry->image_up_to_date) {
- HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren);
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if (parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag set")
+ } /* end if */
+
+ /* adjust the parent's number of unserialized children. Note
+ * that it is possible for and entry to be clean and unserialized.
+ */
+ if (!child_entry->image_up_to_date) {
+ HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren);
- parent_entry->flush_dep_nunser_children++;
+ parent_entry->flush_dep_nunser_children++;
- /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
- if (parent_entry->type->notify &&
- (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry serialized flag reset")
- } /* end if */
+ /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
+ if (parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag reset")
+ } /* end if */
- /* Post-conditions, for successful operation */
- HDassert(parent_entry->is_pinned);
- HDassert(parent_entry->flush_dep_nchildren > 0);
- HDassert(child_entry->flush_dep_parent);
- HDassert(child_entry->flush_dep_nparents > 0);
- HDassert(child_entry->flush_dep_parent_nalloc > 0);
+ /* Post-conditions, for successful operation */
+ HDassert(parent_entry->is_pinned);
+ HDassert(parent_entry->flush_dep_nchildren > 0);
+ HDassert(child_entry->flush_dep_parent);
+ HDassert(child_entry->flush_dep_nparents > 0);
+ HDassert(child_entry->flush_dep_parent_nalloc > 0);
#ifndef NDEBUG
- H5C__assert_flush_dep_nocycle(parent_entry, child_entry);
+ H5C__assert_flush_dep_nocycle(parent_entry, child_entry);
#endif /* NDEBUG */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_create_flush_dependency() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_create_flush_dependency() */
- /*-------------------------------------------------------------------------
- * Function: H5C_destroy_flush_dependency()
- *
- * Purpose: Terminates a parent<-> child entry flush dependency. The
- * parent entry must be pinned.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/05/09
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing)
- {
- H5C_t * cache_ptr;
- H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
- H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C_destroy_flush_dependency()
+ *
+ * Purpose: Terminates a parent<-> child entry flush dependency. The
+ * parent entry must be pinned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/05/09
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_destroy_flush_dependency(void *parent_thing, void *child_thing)
+{
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
+ H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(parent_entry);
- HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(parent_entry->addr));
- HDassert(child_entry);
- HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(child_entry->addr));
- cache_ptr = parent_entry->cache_ptr;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr == child_entry->cache_ptr);
-
- /* Usage checks */
- if (!parent_entry->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned")
- if (NULL == child_entry->flush_dep_parent)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
- "Child entry doesn't have a flush dependency parent array")
- if (0 == parent_entry->flush_dep_nchildren)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
- "Parent entry flush dependency ref. count has no child dependencies")
-
- /* Search for parent in child's parent array. This is a linear search
- * because we do not expect large numbers of parents. If this changes, we
- * may wish to change the parent array to a skip list */
- for (u = 0; u < child_entry->flush_dep_nparents; u++)
- if (child_entry->flush_dep_parent[u] == parent_entry)
- break;
- if (u == child_entry->flush_dep_nparents)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
- "Parent entry isn't a flush dependency parent for child entry")
-
- /* Remove parent entry from child's parent array */
- if (u < (child_entry->flush_dep_nparents - 1))
- HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1],
- (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0]));
- child_entry->flush_dep_nparents--;
-
- /* Adjust parent entry's nchildren and unpin parent if it goes to zero */
- parent_entry->flush_dep_nchildren--;
- if (0 == parent_entry->flush_dep_nchildren) {
- /* Sanity check */
- HDassert(parent_entry->pinned_from_cache);
+ /* Sanity checks */
+ HDassert(parent_entry);
+ HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(parent_entry->addr));
+ HDassert(child_entry);
+ HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
+
+ /* Usage checks */
+ if (!parent_entry->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned")
+ if (NULL == child_entry->flush_dep_parent)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Child entry doesn't have a flush dependency parent array")
+ if (0 == parent_entry->flush_dep_nchildren)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Parent entry flush dependency ref. count has no child dependencies")
+
+ /* Search for parent in child's parent array. This is a linear search
+ * because we do not expect large numbers of parents. If this changes, we
+ * may wish to change the parent array to a skip list */
+ for (u = 0; u < child_entry->flush_dep_nparents; u++)
+ if (child_entry->flush_dep_parent[u] == parent_entry)
+ break;
+ if (u == child_entry->flush_dep_nparents)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Parent entry isn't a flush dependency parent for child entry")
+
+ /* Remove parent entry from child's parent array */
+ if (u < (child_entry->flush_dep_nparents - 1))
+ HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1],
+ (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0]));
+ child_entry->flush_dep_nparents--;
+
+ /* Adjust parent entry's nchildren and unpin parent if it goes to zero */
+ parent_entry->flush_dep_nchildren--;
+ if (0 == parent_entry->flush_dep_nchildren) {
+ /* Sanity check */
+ HDassert(parent_entry->pinned_from_cache);
- /* Check if we should unpin parent entry now */
- if (!parent_entry->pinned_from_client)
- if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry")
+ /* Check if we should unpin parent entry now */
+ if (!parent_entry->pinned_from_client)
+ if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry")
- /* Mark the entry as unpinned from the cache's action */
- parent_entry->pinned_from_cache = FALSE;
- } /* end if */
+ /* Mark the entry as unpinned from the cache's action */
+ parent_entry->pinned_from_cache = FALSE;
+ } /* end if */
- /* Adjust parent entry's ndirty_children */
- if (child_entry->is_dirty) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_ndirty_children > 0);
+ /* Adjust parent entry's ndirty_children */
+ if (child_entry->is_dirty) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_ndirty_children > 0);
- parent_entry->flush_dep_ndirty_children--;
+ parent_entry->flush_dep_ndirty_children--;
- /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
- if (parent_entry->type->notify &&
- (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry dirty flag reset")
- } /* end if */
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if (parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag reset")
+ } /* end if */
- /* adjust parent entry's number of unserialized children */
- if (!child_entry->image_up_to_date) {
- HDassert(parent_entry->flush_dep_nunser_children > 0);
+ /* adjust parent entry's number of unserialized children */
+ if (!child_entry->image_up_to_date) {
+ HDassert(parent_entry->flush_dep_nunser_children > 0);
- parent_entry->flush_dep_nunser_children--;
+ parent_entry->flush_dep_nunser_children--;
- /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
- if (parent_entry->type->notify &&
- (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry serialized flag set")
- } /* end if */
+ /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
+ if (parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag set")
+ } /* end if */
- /* Shrink or free the parent array if apporpriate */
- if (child_entry->flush_dep_nparents == 0) {
- child_entry->flush_dep_parent =
- H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent);
- child_entry->flush_dep_parent_nalloc = 0;
- } /* end if */
- else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT &&
- child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) {
- if (NULL == (child_entry->flush_dep_parent =
- H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
- child_entry->flush_dep_parent_nalloc / 4)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc /= 4;
- } /* end if */
+ /* Shrink or free the parent array if apporpriate */
+ if (child_entry->flush_dep_nparents == 0) {
+ child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent);
+ child_entry->flush_dep_parent_nalloc = 0;
+ } /* end if */
+ else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT &&
+ child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) {
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
+ child_entry->flush_dep_parent_nalloc / 4)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc /= 4;
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_destroy_flush_dependency() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_destroy_flush_dependency() */
/*************************************************************************/
/**************************** Private Functions: *************************/
@@ -3663,7 +4104,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5C__pin_entry_from_client()
*
- * Purpose: Internal routine to pin a cache entry from a client action.
+ * Purpose: Internal routine to pin a cache entry from a client action.
*
* Return: Non-negative on success/Negative on failure
*
@@ -3673,543 +4114,899 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_COLLECT_CACHE_STATS
- static herr_t H5C__pin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr)
+static herr_t
+H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
#else
static herr_t
H5C__pin_entry_from_client(H5C_t H5_ATTR_UNUSED *cache_ptr, H5C_cache_entry_t *entry_ptr)
#endif
- {
- herr_t ret_value = SUCCEED; /* Return value */
+{
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
- HDassert(entry_ptr->is_protected);
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->is_protected);
- /* Check if the entry is already pinned */
- if (entry_ptr->is_pinned) {
- /* Check if the entry was pinned through an explicit pin from a client */
- if (entry_ptr->pinned_from_client)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned")
- } /* end if */
- else {
- entry_ptr->is_pinned = TRUE;
+ /* Check if the entry is already pinned */
+ if (entry_ptr->is_pinned) {
+ /* Check if the entry was pinned through an explicit pin from a client */
+ if (entry_ptr->pinned_from_client)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned")
+ } /* end if */
+ else {
+ entry_ptr->is_pinned = TRUE;
- H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr)
- } /* end else */
+ H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr)
+ } /* end else */
- /* Mark that the entry was pinned through an explicit pin from a client */
- entry_ptr->pinned_from_client = TRUE;
+ /* Mark that the entry was pinned through an explicit pin from a client */
+ entry_ptr->pinned_from_client = TRUE;
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__pin_entry_from_client() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__pin_entry_from_client() */
- /*-------------------------------------------------------------------------
- * Function: H5C__unpin_entry_real()
- *
- * Purpose: Internal routine to unpin a cache entry.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 1/6/18
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__unpin_entry_real(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hbool_t update_rp)
- {
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C__unpin_entry_real()
+ *
+ * Purpose: Internal routine to unpin a cache entry.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 1/6/18
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
#if H5C_DO_SANITY_CHECKS
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
#else
FUNC_ENTER_STATIC_NOERR
#endif
- /* Sanity checking */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
- HDassert(entry_ptr->is_pinned);
+ /* Sanity checking */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->is_pinned);
- /* If requested, update the replacement policy if the entry is not protected */
- if (update_rp && !entry_ptr->is_protected)
- H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL)
+ /* If requested, update the replacement policy if the entry is not protected */
+ if (update_rp && !entry_ptr->is_protected)
+ H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL)
- /* Unpin the entry now */
- entry_ptr->is_pinned = FALSE;
+ /* Unpin the entry now */
+ entry_ptr->is_pinned = FALSE;
- /* Update the stats for an unpin operation */
- H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
+ /* Update the stats for an unpin operation */
+ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
#if H5C_DO_SANITY_CHECKS
done:
#endif
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__unpin_entry_real() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__unpin_entry_real() */
- /*-------------------------------------------------------------------------
- * Function: H5C__unpin_entry_from_client()
- *
- * Purpose: Internal routine to unpin a cache entry from a client action.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/24/09
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__unpin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr,
- hbool_t update_rp)
- {
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C__unpin_entry_from_client()
+ *
+ * Purpose: Internal routine to unpin a cache entry from a client action.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/24/09
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checking */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
+ /* Sanity checking */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
- /* Error checking (should be sanity checks?) */
- if (!entry_ptr->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned")
- if (!entry_ptr->pinned_from_client)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client")
+ /* Error checking (should be sanity checks?) */
+ if (!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned")
+ if (!entry_ptr->pinned_from_client)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client")
- /* Check if the entry is not pinned from a flush dependency */
- if (!entry_ptr->pinned_from_cache)
- if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
+ /* Check if the entry is not pinned from a flush dependency */
+ if (!entry_ptr->pinned_from_cache)
+ if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
- /* Mark the entry as explicitly unpinned by the client */
- entry_ptr->pinned_from_client = FALSE;
+ /* Mark the entry as explicitly unpinned by the client */
+ entry_ptr->pinned_from_client = FALSE;
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__unpin_entry_from_client() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__unpin_entry_from_client() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__auto_adjust_cache_size
- *
- * Purpose: Obtain the current full cache hit rate, and compare it
- * with the hit rate thresholds for modifying cache size.
- * If one of the thresholds has been crossed, adjusts the
- * size of the cache accordingly.
- *
- * The function then resets the full cache hit rate
- * statistics, and exits.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- *
- * Programmer: John Mainzer, 10/7/04
- *
- *-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__auto_adjust_cache_size
+ *
+ * Purpose: Obtain the current full cache hit rate, and compare it
+ * with the hit rate thresholds for modifying cache size.
+ * If one of the thresholds has been crossed, adjusts the
+ * size of the cache accordingly.
+ *
+ * The function then resets the full cache hit rate
+ * statistics, and exits.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * an attempt to flush a protected item.
+ *
+ *
+ * Programmer: John Mainzer, 10/7/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted)
+{
+ H5C_t * cache_ptr = f->shared->cache;
+ hbool_t reentrant_call = FALSE;
+ hbool_t inserted_epoch_marker = FALSE;
+ size_t new_max_cache_size = 0;
+ size_t old_max_cache_size = 0;
+ size_t new_min_clean_size = 0;
+ size_t old_min_clean_size = 0;
+ double hit_rate;
+ enum H5C_resize_status status = in_spec; /* will change if needed */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length);
+ HDassert(0.0 <= (cache_ptr->resize_ctl).min_clean_fraction);
+ HDassert((cache_ptr->resize_ctl).min_clean_fraction <= 100.0);
+
+ /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
+ * is a re-entrant call via a client callback called in the resize
+ * process. To avoid an infinite recursion, set reentrant_call to
+ * TRUE, and goto done.
*/
- static herr_t H5C__auto_adjust_cache_size(H5F_t * f, hbool_t write_permitted)
- {
- H5C_t * cache_ptr = f->shared->cache;
- hbool_t reentrant_call = FALSE;
- hbool_t inserted_epoch_marker = FALSE;
- size_t new_max_cache_size = 0;
- size_t old_max_cache_size = 0;
- size_t new_min_clean_size = 0;
- size_t old_min_clean_size = 0;
- double hit_rate;
- enum H5C_resize_status status = in_spec; /* will change if needed */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length);
- HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction);
- HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f);
-
- /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
- * is a re-entrant call via a client callback called in the resize
- * process. To avoid an infinite recursion, set reentrant_call to
- * TRUE, and goto done.
- */
- if (cache_ptr->resize_in_progress) {
- reentrant_call = TRUE;
- HGOTO_DONE(SUCCEED)
- } /* end if */
+ if (cache_ptr->resize_in_progress) {
+ reentrant_call = TRUE;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
- cache_ptr->resize_in_progress = TRUE;
+ cache_ptr->resize_in_progress = TRUE;
- if (!cache_ptr->resize_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled")
+ if (!cache_ptr->resize_enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled")
- HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) ||
- ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off));
+ HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) ||
+ ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off));
- if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
+ if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
- HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f));
+ HDassert((0.0 <= hit_rate) && (hit_rate <= 1.0));
- switch ((cache_ptr->resize_ctl).incr_mode) {
- case H5C_incr__off:
- if (cache_ptr->size_increase_possible)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?")
- break;
+ switch ((cache_ptr->resize_ctl).incr_mode) {
+ case H5C_incr__off:
+ if (cache_ptr->size_increase_possible)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?")
+ break;
- case H5C_incr__threshold:
- if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) {
+ case H5C_incr__threshold:
+ if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) {
- if (!cache_ptr->size_increase_possible) {
+ if (!cache_ptr->size_increase_possible) {
- status = increase_disabled;
+ status = increase_disabled;
+ }
+ else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) {
+
+ HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size);
+ status = at_max_size;
+ }
+ else if (!cache_ptr->cache_full) {
+
+ status = not_full;
+ }
+ else {
+
+ new_max_cache_size =
+ (size_t)(((double)(cache_ptr->max_cache_size)) * (cache_ptr->resize_ctl).increment);
+
+ /* clip to max size if necessary */
+ if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
+
+ new_max_cache_size = (cache_ptr->resize_ctl).max_size;
}
- else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) {
- HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size);
- status = at_max_size;
+ /* clip to max increment if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_increment) &&
+ ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) <
+ new_max_cache_size)) {
+
+ new_max_cache_size =
+ cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment;
}
- else if (!cache_ptr->cache_full) {
- status = not_full;
+ status = increase;
+ }
+ }
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
+ }
+
+ /* If the decr_mode is either age out or age out with threshold, we
+ * must run the marker maintenance code, whether we run the size
+ * reduction code or not. We do this in two places -- here we
+ * insert a new marker if the number of active epoch markers is
+ * is less than the the current epochs before eviction, and after
+ * the ageout call, we cycle the markers.
+ *
+ * However, we can't call the ageout code or cycle the markers
+ * unless there was a full complement of markers in place on
+ * entry. The inserted_epoch_marker flag is used to track this.
+ */
+
+ if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) {
+
+ if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker")
+
+ inserted_epoch_marker = TRUE;
+ }
+
+ /* don't run the cache size decrease code unless the cache size
+ * increase code is disabled, or the size increase code sees no need
+ * for action. In either case, status == in_spec at this point.
+ */
+
+ if (status == in_spec) {
+
+ switch ((cache_ptr->resize_ctl).decr_mode) {
+ case H5C_decr__off:
+ break;
+
+ case H5C_decr__threshold:
+ if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) {
+
+ if (!cache_ptr->size_decrease_possible) {
+
+ status = decrease_disabled;
+ }
+ else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) {
+
+ HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size);
+ status = at_min_size;
}
else {
new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) *
- (cache_ptr->resize_ctl).increment);
+ (cache_ptr->resize_ctl).decrement);
- /* clip to max size if necessary */
- if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
+ /* clip to min size if necessary */
+ if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) {
- new_max_cache_size = (cache_ptr->resize_ctl).max_size;
+ new_max_cache_size = (cache_ptr->resize_ctl).min_size;
}
- /* clip to max increment if necessary */
- if (((cache_ptr->resize_ctl).apply_max_increment) &&
- ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) <
- new_max_cache_size)) {
+ /* clip to max decrement if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_decrement) &&
+ (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) <
+ cache_ptr->max_cache_size)) {
new_max_cache_size =
- cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment;
+ cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
}
- status = increase;
+ status = decrease;
}
}
break;
+ case H5C_decr__age_out_with_threshold:
+ case H5C_decr__age_out:
+ if (!inserted_epoch_marker) {
+ if (!cache_ptr->size_decrease_possible)
+ status = decrease_disabled;
+ else {
+ if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size,
+ write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed")
+ } /* end else */
+ } /* end if */
+ break;
+
default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
}
+ }
+
+ /* cycle the epoch markers here if appropriate */
+ if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (!inserted_epoch_marker)) {
+
+ /* move last epoch marker to the head of the LRU list */
+ if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker")
+ }
- /* If the decr_mode is either age out or age out with threshold, we
- * must run the marker maintenance code, whether we run the size
- * reduction code or not. We do this in two places -- here we
- * insert a new marker if the number of active epoch markers is
- * is less than the the current epochs before eviction, and after
- * the ageout call, we cycle the markers.
+ if ((status == increase) || (status == decrease)) {
+
+ old_max_cache_size = cache_ptr->max_cache_size;
+ old_min_clean_size = cache_ptr->min_clean_size;
+
+ new_min_clean_size =
+ (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
+
+ /* new_min_clean_size is of size_t, and thus must be non-negative.
+ * Hence we have
*
- * However, we can't call the ageout code or cycle the markers
- * unless there was a full complement of markers in place on
- * entry. The inserted_epoch_marker flag is used to track this.
+ * ( 0 <= new_min_clean_size ).
+ *
+ * by definition.
*/
+ HDassert(new_min_clean_size <= new_max_cache_size);
+ HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size);
+ HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size);
- if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
- ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
- (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) {
+ cache_ptr->max_cache_size = new_max_cache_size;
+ cache_ptr->min_clean_size = new_min_clean_size;
- if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker")
+ if (status == increase) {
- inserted_epoch_marker = TRUE;
+ cache_ptr->cache_full = FALSE;
}
+ else if (status == decrease) {
- /* don't run the cache size decrease code unless the cache size
- * increase code is disabled, or the size increase code sees no need
- * for action. In either case, status == in_spec at this point.
- */
+ cache_ptr->size_decreased = TRUE;
+ }
- if (status == in_spec) {
+ /* update flash cache size increase fields as appropriate */
+ if (cache_ptr->flash_size_increase_possible) {
- switch ((cache_ptr->resize_ctl).decr_mode) {
- case H5C_decr__off:
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
break;
- case H5C_decr__threshold:
- if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) {
+ case H5C_flash_incr__add_space:
+ cache_ptr->flash_size_increase_threshold = (size_t)(
+ ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold));
+ break;
- if (!cache_ptr->size_decrease_possible) {
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
+ }
+ }
+ }
- status = decrease_disabled;
- }
- else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) {
+ if ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
+ (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, status,
+ old_max_cache_size, new_max_cache_size, old_min_clean_size,
+ new_min_clean_size);
+ }
- HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size);
- status = at_min_size;
- }
- else {
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ /* this should be impossible... */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
- new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) *
- (cache_ptr->resize_ctl).decrement);
+done:
+ /* Sanity checks */
+ HDassert(cache_ptr->resize_in_progress);
+ if (!reentrant_call)
+ cache_ptr->resize_in_progress = FALSE;
+ HDassert((!reentrant_call) || (cache_ptr->resize_in_progress));
- /* clip to min size if necessary */
- if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) {
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__auto_adjust_cache_size() */
- new_max_cache_size = (cache_ptr->resize_ctl).min_size;
- }
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout
+ *
+ * Purpose: Implement the ageout automatic cache size decrement
+ * algorithm. Note that while this code evicts aged out
+ * entries, the code does not change the maximum cache size.
+ * Instead, the function simply computes the new value (if
+ * any change is indicated) and reports this value in
+ * *new_max_cache_size_ptr.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * an attempt to flush a protected item.
+ *
+ *
+ * Programmer: John Mainzer, 11/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr,
+ size_t *new_max_cache_size_ptr, hbool_t write_permitted)
+{
+ H5C_t *cache_ptr = f->shared->cache;
+ size_t test_size;
+ herr_t ret_value = SUCCEED; /* Return value */
- /* clip to max decrement if necessary */
- if (((cache_ptr->resize_ctl).apply_max_decrement) &&
- (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) <
- cache_ptr->max_cache_size)) {
+ FUNC_ENTER_STATIC
- new_max_cache_size =
- cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
- }
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert((status_ptr) && (*status_ptr == in_spec));
+ HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0));
- status = decrease;
- }
+ /* remove excess epoch markers if any */
+ if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction)
+ if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers")
+
+ if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) &&
+ (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) {
+
+ if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) {
+
+ /* evict aged out cache entries if appropriate... */
+ if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries")
+
+ /* ... and then reduce cache size if appropriate */
+ if (cache_ptr->index_size < cache_ptr->max_cache_size) {
+
+ if ((cache_ptr->resize_ctl).apply_empty_reserve) {
+
+ test_size = (size_t)(((double)cache_ptr->index_size) /
+ (1 - (cache_ptr->resize_ctl).empty_reserve));
+
+ if (test_size < cache_ptr->max_cache_size) {
+
+ *status_ptr = decrease;
+ *new_max_cache_size_ptr = test_size;
}
- break;
+ }
+ else {
- case H5C_decr__age_out_with_threshold:
- case H5C_decr__age_out:
- if (!inserted_epoch_marker) {
- if (!cache_ptr->size_decrease_possible)
- status = decrease_disabled;
- else {
- if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size,
- write_permitted) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed")
- } /* end else */
- } /* end if */
- break;
+ *status_ptr = decrease;
+ *new_max_cache_size_ptr = cache_ptr->index_size;
+ }
- default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
+ if (*status_ptr == decrease) {
+
+ /* clip to min size if necessary */
+ if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) {
+
+ *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size;
+ }
+
+ /* clip to max decrement if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_decrement) &&
+ (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) <
+ cache_ptr->max_cache_size)) {
+
+ *new_max_cache_size_ptr =
+ cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
+ }
+ }
}
}
+ else {
- /* cycle the epoch markers here if appropriate */
- if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
- ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
- (!inserted_epoch_marker)) {
-
- /* move last epoch marker to the head of the LRU list */
- if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker")
+ *status_ptr = at_min_size;
}
+ }
- if ((status == increase) || (status == decrease)) {
+done:
- old_max_cache_size = cache_ptr->max_cache_size;
- old_min_clean_size = cache_ptr->min_clean_size;
+ FUNC_LEAVE_NOAPI(ret_value)
- new_min_clean_size =
- (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
+} /* H5C__autoadjust__ageout() */
- /* new_min_clean_size is of size_t, and thus must be non-negative.
- * Hence we have
- *
- * ( 0 <= new_min_clean_size ).
- *
- * by definition.
- */
- HDassert(new_min_clean_size <= new_max_cache_size);
- HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size);
- HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size);
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__cycle_epoch_marker
+ *
+ * Purpose: Remove the oldest epoch marker from the LRU list,
+ * and reinsert it at the head of the LRU list. Also
+ * remove the epoch marker's index from the head of the
+ * ring buffer, and re-insert it at the tail of the ring
+ * buffer.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr)
+{
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- cache_ptr->max_cache_size = new_max_cache_size;
- cache_ptr->min_clean_size = new_min_clean_size;
+ FUNC_ENTER_STATIC
- if (status == increase) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- cache_ptr->cache_full = FALSE;
- }
- else if (status == decrease) {
+ if (cache_ptr->epoch_markers_active <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?")
- cache_ptr->size_decreased = TRUE;
- }
+ /* remove the last marker from both the ring buffer and the LRU list */
- /* update flash cache size increase fields as appropriate */
- if (cache_ptr->flash_size_increase_possible) {
+ i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first];
- switch ((cache_ptr->resize_ctl).flash_incr_mode) {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
- "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ cache_ptr->epoch_marker_ringbuf_first =
+ (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- case H5C_flash_incr__add_space:
- cache_ptr->flash_size_increase_threshold =
- (size_t)(((double)(cache_ptr->max_cache_size)) *
- ((cache_ptr->resize_ctl).flash_threshold));
- break;
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
- }
- }
- }
+ if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ if ((cache_ptr->epoch_marker_active)[i] != TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
- if ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
- (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate,
- status, old_max_cache_size, new_max_cache_size,
- old_min_clean_size, new_min_clean_size);
- }
+ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr,
+ (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL))
- if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
- /* this should be impossible... */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
+ /* now, re-insert it at the head of the LRU list, and at the tail of
+ * the ring buffer.
+ */
+
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
+
+ cache_ptr->epoch_marker_ringbuf_last =
+ (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
+
+ cache_ptr->epoch_marker_ringbuf_size += 1;
+
+ if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+
+ H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr,
+ (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL))
done:
- /* Sanity checks */
- HDassert(cache_ptr->resize_in_progress);
- if (!reentrant_call)
- cache_ptr->resize_in_progress = FALSE;
- HDassert((!reentrant_call) || (cache_ptr->resize_in_progress));
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__auto_adjust_cache_size() */
+ FUNC_LEAVE_NOAPI(ret_value)
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout
- *
- * Purpose: Implement the ageout automatic cache size decrement
- * algorithm. Note that while this code evicts aged out
- * entries, the code does not change the maximum cache size.
- * Instead, the function simply computes the new value (if
- * any change is indicated) and reports this value in
- * *new_max_cache_size_ptr.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- *
- * Programmer: John Mainzer, 11/18/04
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status *status_ptr,
- size_t *new_max_cache_size_ptr, hbool_t write_permitted)
- {
- H5C_t *cache_ptr = f->shared->cache;
- size_t test_size;
- herr_t ret_value = SUCCEED; /* Return value */
+} /* H5C__autoadjust__ageout__cycle_epoch_marker() */
- FUNC_ENTER_NOAPI_NOINIT
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__evict_aged_out_entries
+ *
+ * Purpose: Evict clean entries in the cache that haven't
+ * been accessed for at least
+ * (cache_ptr->resize_ctl).epochs_before_eviction epochs,
+ * and flush dirty entries that haven't been accessed for
+ * that amount of time.
+ *
+ * Depending on configuration, the function will either
+ * flush or evict all such entries, or all such entries it
+ * encounters until it has freed the maximum amount of space
+ * allowed under the maximum decrement.
+ *
+ * If we are running in parallel mode, writes may not be
+ * permitted. If so, the function simply skips any dirty
+ * entries it may encounter.
+ *
+ * The function makes no attempt to maintain the minimum
+ * clean size, as there is no guarantee that the cache size
+ * will be changed.
+ *
+ * If there is no cache size change, the minimum clean size
+ * constraint will be met through a combination of clean
+ * entries and free space in the cache.
+ *
+ * If there is a cache size reduction, the minimum clean size
+ * will be re-calculated, and will be enforced the next time
+ * we have to make space in the cache.
+ *
+ * Observe that this function cannot occasion a read.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted)
+{
+ H5C_t * cache_ptr = f->shared->cache;
+ size_t eviction_size_limit;
+ size_t bytes_evicted = 0;
+ hbool_t prev_is_dirty = FALSE;
+ hbool_t restart_scan;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *next_ptr;
+ H5C_cache_entry_t *prev_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert((status_ptr) && (*status_ptr == in_spec));
- HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0));
+ FUNC_ENTER_STATIC
- /* remove excess epoch markers if any */
- if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction)
- if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers")
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
- (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) &&
- (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) {
+ /* if there is a limit on the amount that the cache size can be decrease
+ * in any one round of the cache size reduction algorithm, load that
+ * limit into eviction_size_limit. Otherwise, set eviction_size_limit
+ * to the equivalent of infinity. The current size of the index will
+ * do nicely.
+ */
+ if ((cache_ptr->resize_ctl).apply_max_decrement) {
- if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) {
+ eviction_size_limit = (cache_ptr->resize_ctl).max_decrement;
+ }
+ else {
- /* evict aged out cache entries if appropriate... */
- if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries")
+ eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */
+ }
- /* ... and then reduce cache size if appropriate */
- if (cache_ptr->index_size < cache_ptr->max_cache_size) {
+ if (write_permitted) {
- if ((cache_ptr->resize_ctl).apply_empty_reserve) {
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
- test_size = (size_t)(((double)cache_ptr->index_size) /
- (1 - (cache_ptr->resize_ctl).empty_reserve));
+ while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
+ (bytes_evicted < eviction_size_limit)) {
+ hbool_t skipping_entry = FALSE;
- if (test_size < cache_ptr->max_cache_size) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert((entry_ptr->ro_ref_count) == 0);
- *status_ptr = decrease;
- *new_max_cache_size_ptr = test_size;
- }
- }
- else {
+ next_ptr = entry_ptr->next;
+ prev_ptr = entry_ptr->prev;
- *status_ptr = decrease;
- *new_max_cache_size_ptr = cache_ptr->index_size;
- }
+ if (prev_ptr != NULL)
+ prev_is_dirty = prev_ptr->is_dirty;
- if (*status_ptr == decrease) {
+ if (entry_ptr->is_dirty) {
+ HDassert(!entry_ptr->prefetched_dirty);
- /* clip to min size if necessary */
- if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) {
+ /* dirty corked entry is skipped */
+ if (entry_ptr->tag_info && entry_ptr->tag_info->corked)
+ skipping_entry = TRUE;
+ else {
+ /* reset entries_removed_counter and
+ * last_entry_removed_ptr prior to the call to
+ * H5C__flush_single_entry() so that we can spot
+ * unexpected removals of entries from the cache,
+ * and set the restart_scan flag if proceeding
+ * would be likely to cause us to scan an entry
+ * that is no longer in the cache.
+ */
+ cache_ptr->entries_removed_counter = 0;
+ cache_ptr->last_entry_removed_ptr = NULL;
- *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size;
- }
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- /* clip to max decrement if necessary */
- if (((cache_ptr->resize_ctl).apply_max_decrement) &&
- (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) <
- cache_ptr->max_cache_size)) {
+ if (cache_ptr->entries_removed_counter > 1 ||
+ cache_ptr->last_entry_removed_ptr == prev_ptr)
+ restart_scan = TRUE;
+ } /* end else */
+ } /* end if */
+ else if (!entry_ptr->prefetched_dirty) {
- *new_max_cache_size_ptr =
- cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
- }
- }
- }
- }
+ bytes_evicted += entry_ptr->size;
+
+ if (H5C__flush_single_entry(
+ f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ } /* end else-if */
else {
+ HDassert(!entry_ptr->is_dirty);
+ HDassert(entry_ptr->prefetched_dirty);
- *status_ptr = at_min_size;
- }
- }
+ skipping_entry = TRUE;
+ } /* end else */
+
+ if (prev_ptr != NULL) {
+ if (skipping_entry)
+ entry_ptr = prev_ptr;
+ else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) ||
+ (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) {
+ /* Something has happened to the LRU -- start over
+ * from the tail.
+ */
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+
+ H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
+ } /* end else-if */
+ else
+ entry_ptr = prev_ptr;
+ } /* end if */
+ else
+ entry_ptr = NULL;
+ } /* end while */
+
+ /* for now at least, don't bother to maintain the minimum clean size,
+ * as the cache should now be less than its maximum size. Due to
+ * the vaguries of the cache size reduction algorthim, we may not
+ * reduce the size of the cache.
+ *
+ * If we do, we will calculate a new minimum clean size, which will
+ * be enforced the next time we try to make space in the cache.
+ *
+ * If we don't, no action is necessary, as we have just evicted and/or
+ * or flushed a bunch of entries and therefore the sum of the clean
+ * and free space in the cache must be greater than or equal to the
+ * min clean space requirement (assuming that requirement was met on
+ * entry).
+ */
+
+ } /* end if */
+ else /* ! write_permitted */ {
+ /* Since we are not allowed to write, all we can do is evict
+ * any clean entries that we may encounter before we either
+ * hit the eviction size limit, or encounter the epoch marker.
+ *
+ * If we are operating read only, this isn't an issue, as there
+ * will not be any dirty entries.
+ *
+ * If we are operating in R/W mode, all the dirty entries we
+ * skip will be flushed the next time we attempt to make space
+ * when writes are permitted. This may have some local
+ * performance implications, but it shouldn't cause any net
+ * slowdown.
+ */
+ HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
+ (bytes_evicted < eviction_size_limit)) {
+ HDassert(!(entry_ptr->is_protected));
+
+ prev_ptr = entry_ptr->prev;
+
+ if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty))
+ if (H5C__flush_single_entry(
+ f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
+
+ /* just skip the entry if it is dirty, as we can't do
+ * anything with it now since we can't write.
+ *
+ * Since all entries are clean, serialize() will not be called,
+ * and thus we needn't test to see if the LRU has been changed
+ * out from under us.
+ */
+ entry_ptr = prev_ptr;
+ } /* end while */
+ } /* end else */
+
+ if (cache_ptr->index_size < cache_ptr->max_cache_size)
+ cache_ptr->cache_full = FALSE;
done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__autoadjust__ageout__evict_aged_out_entries() */
- FUNC_LEAVE_NOAPI(ret_value)
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__insert_new_marker
+ *
+ * Purpose: Find an unused marker cache entry, mark it as used, and
+ * insert it at the head of the LRU list. Also add the
+ * marker's index in the epoch_markers array.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/19/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr)
+{
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- } /* H5C__autoadjust__ageout() */
+ FUNC_ENTER_STATIC
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__cycle_epoch_marker
- *
- * Purpose: Remove the oldest epoch marker from the LRU list,
- * and reinsert it at the head of the LRU list. Also
- * remove the epoch marker's index from the head of the
- * ring buffer, and re-insert it at the tail of the ring
- * buffer.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr)
- {
- herr_t ret_value = SUCCEED; /* Return value */
- int i;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers")
+
+ /* find an unused marker */
+ i = 0;
+ while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS)
+ i++;
+
+ if (i >= H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker")
- FUNC_ENTER_NOAPI_NOINIT
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ (cache_ptr->epoch_marker_active)[i] = TRUE;
- if (cache_ptr->epoch_markers_active <= 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?")
+ cache_ptr->epoch_marker_ringbuf_last =
+ (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- /* remove the last marker from both the ring buffer and the LRU list */
+ (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
- i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first];
+ cache_ptr->epoch_marker_ringbuf_size += 1;
+
+ if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) {
+
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ }
+
+ H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr,
+ (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL))
+
+ cache_ptr->epoch_markers_active += 1;
+
+done:
+
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5C__autoadjust__ageout__insert_new_marker() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__remove_all_markers
+ *
+ * Purpose: Remove all epoch markers from the LRU list and mark them
+ * as inactive.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr)
+{
+ int ring_buf_index;
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ while (cache_ptr->epoch_markers_active > 0) {
+ /* get the index of the last epoch marker in the LRU list
+ * and remove it from the ring buffer.
+ */
+
+ ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
+ i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
cache_ptr->epoch_marker_ringbuf_first =
(cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
@@ -4218,4228 +5015,4226 @@ done:
if (cache_ptr->epoch_marker_ringbuf_size < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+
if ((cache_ptr->epoch_marker_active)[i] != TRUE)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ /* remove the epoch marker from the LRU list */
H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
(cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
(FAIL))
- /* now, re-insert it at the head of the LRU list, and at the tail of
- * the ring buffer.
- */
+ /* mark the epoch marker as unused. */
+ (cache_ptr->epoch_marker_active)[i] = FALSE;
HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- cache_ptr->epoch_marker_ringbuf_last =
- (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ /* decrement the number of active epoch markers */
+ cache_ptr->epoch_markers_active -= 1;
- (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
-
- cache_ptr->epoch_marker_ringbuf_size += 1;
-
- if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
+ }
- H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
- (FAIL))
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__autoadjust__ageout__cycle_epoch_marker() */
+} /* H5C__autoadjust__ageout__remove_all_markers() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__evict_aged_out_entries
- *
- * Purpose: Evict clean entries in the cache that haven't
- * been accessed for at least
- * (cache_ptr->resize_ctl).epochs_before_eviction epochs,
- * and flush dirty entries that haven't been accessed for
- * that amount of time.
- *
- * Depending on configuration, the function will either
- * flush or evict all such entries, or all such entries it
- * encounters until it has freed the maximum amount of space
- * allowed under the maximum decrement.
- *
- * If we are running in parallel mode, writes may not be
- * permitted. If so, the function simply skips any dirty
- * entries it may encounter.
- *
- * The function makes no attempt to maintain the minimum
- * clean size, as there is no guarantee that the cache size
- * will be changed.
- *
- * If there is no cache size change, the minimum clean size
- * constraint will be met through a combination of clean
- * entries and free space in the cache.
- *
- * If there is a cache size reduction, the minimum clean size
- * will be re-calculated, and will be enforced the next time
- * we have to make space in the cache.
- *
- * Observe that this function cannot occasion a read.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, hbool_t write_permitted)
- {
- H5C_t * cache_ptr = f->shared->cache;
- size_t eviction_size_limit;
- size_t bytes_evicted = 0;
- hbool_t prev_is_dirty = FALSE;
- hbool_t restart_scan;
- H5C_cache_entry_t *entry_ptr;
- H5C_cache_entry_t *next_ptr;
- H5C_cache_entry_t *prev_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__remove_excess_markers
+ *
+ * Purpose: Remove epoch markers from the end of the LRU list and
+ * mark them as inactive until the number of active markers
+ * equals the the current value of
+ * (cache_ptr->resize_ctl).epochs_before_eviction.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/19/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr)
+{
+ int ring_buf_index;
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- /* if there is a limit on the amount that the cache size can be decrease
- * in any one round of the cache size reduction algorithm, load that
- * limit into eviction_size_limit. Otherwise, set eviction_size_limit
- * to the equivalent of infinity. The current size of the index will
- * do nicely.
+ if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry")
+
+ while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) {
+ /* get the index of the last epoch marker in the LRU list
+ * and remove it from the ring buffer.
*/
- if ((cache_ptr->resize_ctl).apply_max_decrement) {
- eviction_size_limit = (cache_ptr->resize_ctl).max_decrement;
- }
- else {
+ ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
+ i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
- eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */
- }
+ cache_ptr->epoch_marker_ringbuf_first =
+ (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- if (write_permitted) {
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ if ((cache_ptr->epoch_marker_active)[i] != TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
- while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
- (bytes_evicted < eviction_size_limit)) {
- hbool_t skipping_entry = FALSE;
+ /* remove the epoch marker from the LRU list */
+ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!(entry_ptr->is_protected));
- HDassert(!(entry_ptr->is_read_only));
- HDassert((entry_ptr->ro_ref_count) == 0);
+ /* mark the epoch marker as unused. */
+ (cache_ptr->epoch_marker_active)[i] = FALSE;
- next_ptr = entry_ptr->next;
- prev_ptr = entry_ptr->prev;
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- if (prev_ptr != NULL)
- prev_is_dirty = prev_ptr->is_dirty;
+ /* decrement the number of active epoch markers */
+ cache_ptr->epoch_markers_active -= 1;
- if (entry_ptr->is_dirty) {
- HDassert(!entry_ptr->prefetched_dirty);
+ HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
+ }
- /* dirty corked entry is skipped */
- if (entry_ptr->tag_info && entry_ptr->tag_info->corked)
- skipping_entry = TRUE;
- else {
- /* reset entries_removed_counter and
- * last_entry_removed_ptr prior to the call to
- * H5C__flush_single_entry() so that we can spot
- * unexpected removals of entries from the cache,
- * and set the restart_scan flag if proceeding
- * would be likely to cause us to scan an entry
- * that is no longer in the cache.
- */
- cache_ptr->entries_removed_counter = 0;
- cache_ptr->last_entry_removed_ptr = NULL;
+done:
- if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ FUNC_LEAVE_NOAPI(ret_value)
- if (cache_ptr->entries_removed_counter > 1 ||
- cache_ptr->last_entry_removed_ptr == prev_ptr)
- restart_scan = TRUE;
- } /* end else */
- } /* end if */
- else if (!entry_ptr->prefetched_dirty) {
+} /* H5C__autoadjust__ageout__remove_excess_markers() */
- bytes_evicted += entry_ptr->size;
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flash_increase_cache_size
+ *
+ * Purpose: If there is not at least new_entry_size - old_entry_size
+ * bytes of free space in the cache and the current
+ * max_cache_size is less than (cache_ptr->resize_ctl).max_size,
+ * perform a flash increase in the cache size and then reset
+ * the full cache hit rate statistics, and exit.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 12/31/07
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size)
+{
+ size_t new_max_cache_size = 0;
+ size_t old_max_cache_size = 0;
+ size_t new_min_clean_size = 0;
+ size_t old_min_clean_size = 0;
+ size_t space_needed;
+ enum H5C_resize_status status = flash_increase; /* may change */
+ double hit_rate;
+ herr_t ret_value = SUCCEED; /* Return value */
- if (H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- } /* end else-if */
- else {
- HDassert(!entry_ptr->is_dirty);
- HDassert(entry_ptr->prefetched_dirty);
+ FUNC_ENTER_STATIC
- skipping_entry = TRUE;
- } /* end else */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->flash_size_increase_possible);
+ HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold);
+ HDassert(old_entry_size < new_entry_size);
- if (prev_ptr != NULL) {
- if (skipping_entry)
- entry_ptr = prev_ptr;
- else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) ||
- (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) ||
- (prev_ptr->is_pinned)) {
- /* Something has happened to the LRU -- start over
- * from the tail.
- */
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ if (old_entry_size >= new_entry_size)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size")
- H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
- } /* end else-if */
- else
- entry_ptr = prev_ptr;
- } /* end if */
- else
- entry_ptr = NULL;
- } /* end while */
+ space_needed = new_entry_size - old_entry_size;
- /* for now at least, don't bother to maintain the minimum clean size,
- * as the cache should now be less than its maximum size. Due to
- * the vaguries of the cache size reduction algorthim, we may not
- * reduce the size of the cache.
- *
- * If we do, we will calculate a new minimum clean size, which will
- * be enforced the next time we try to make space in the cache.
- *
- * If we don't, no action is necessary, as we have just evicted and/or
- * or flushed a bunch of entries and therefore the sum of the clean
- * and free space in the cache must be greater than or equal to the
- * min clean space requirement (assuming that requirement was met on
- * entry).
- */
+ if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
+ (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) {
- } /* end if */
- else /* ! write_permitted */ {
- /* Since we are not allowed to write, all we can do is evict
- * any clean entries that we may encounter before we either
- * hit the eviction size limit, or encounter the epoch marker.
- *
- * If we are operating read only, this isn't an issue, as there
- * will not be any dirty entries.
- *
- * If we are operating in R/W mode, all the dirty entries we
- * skip will be flushed the next time we attempt to make space
- * when writes are permitted. This may have some local
- * performance implications, but it shouldn't cause any net
- * slowdown.
- */
- HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
- entry_ptr = cache_ptr->LRU_tail_ptr;
- while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
- (bytes_evicted < eviction_size_limit)) {
- HDassert(!(entry_ptr->is_protected));
+ /* we have work to do */
- prev_ptr = entry_ptr->prev;
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
+ break;
- if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty))
- if (H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
-
- /* just skip the entry if it is dirty, as we can't do
- * anything with it now since we can't write.
- *
- * Since all entries are clean, serialize() will not be called,
- * and thus we needn't test to see if the LRU has been changed
- * out from under us.
- */
- entry_ptr = prev_ptr;
- } /* end while */
- } /* end else */
+ case H5C_flash_incr__add_space:
+ if (cache_ptr->index_size < cache_ptr->max_cache_size) {
- if (cache_ptr->index_size < cache_ptr->max_cache_size)
- cache_ptr->cache_full = FALSE;
+ HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed);
+ space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size;
+ }
+ space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__autoadjust__ageout__evict_aged_out_entries() */
+ new_max_cache_size = cache_ptr->max_cache_size + space_needed;
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__insert_new_marker
- *
- * Purpose: Find an unused marker cache entry, mark it as used, and
- * insert it at the head of the LRU list. Also add the
- * marker's index in the epoch_markers array.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/19/04
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr)
- {
- herr_t ret_value = SUCCEED; /* Return value */
- int i;
+ break;
- FUNC_ENTER_NOAPI_NOINIT
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
+ }
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
- if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers")
+ new_max_cache_size = (cache_ptr->resize_ctl).max_size;
+ }
- /* find an unused marker */
- i = 0;
- while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS)
- i++;
+ HDassert(new_max_cache_size > cache_ptr->max_cache_size);
- if (i >= H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker")
+ new_min_clean_size =
+ (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
- HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
- HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
- HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
+ HDassert(new_min_clean_size <= new_max_cache_size);
- (cache_ptr->epoch_marker_active)[i] = TRUE;
+ old_max_cache_size = cache_ptr->max_cache_size;
+ old_min_clean_size = cache_ptr->min_clean_size;
- cache_ptr->epoch_marker_ringbuf_last =
- (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->max_cache_size = new_max_cache_size;
+ cache_ptr->min_clean_size = new_min_clean_size;
- (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
+ /* update flash cache size increase fields as appropriate */
+ HDassert(cache_ptr->flash_size_increase_possible);
- cache_ptr->epoch_marker_ringbuf_size += 1;
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
+ break;
- if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) {
+ case H5C_flash_incr__add_space:
+ cache_ptr->flash_size_increase_threshold = (size_t)(
+ ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold));
+ break;
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
}
- H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
- (FAIL))
+ /* note that we don't cycle the epoch markers. We can
+ * argue either way as to whether we should, but for now
+ * we don't.
+ */
- cache_ptr->epoch_markers_active += 1;
+ if ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
+
+ /* get the hit rate for the reporting function. Should still
+ * be good as we haven't reset the hit rate statistics.
+ */
+ if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
+
+ (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate,
+ status, old_max_cache_size, new_max_cache_size,
+ old_min_clean_size, new_min_clean_size);
+ }
+
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ /* this should be impossible... */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__autoadjust__ageout__insert_new_marker() */
+} /* H5C__flash_increase_cache_size() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__remove_all_markers
- *
- * Purpose: Remove all epoch markers from the LRU list and mark them
- * as inactive.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
- 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;
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_invalidate_cache
+ *
+ * Purpose: Flush and destroy the entries contained in the target
+ * cache.
+ *
+ * If the cache 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).
+ *
+ * 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.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * 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
+H5C__flush_invalidate_cache(H5F_t *f, unsigned flags)
+{
+ H5C_t * cache_ptr;
+ H5C_ring_t ring;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ 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_ptr);
+ HDassert(cache_ptr->slist_enabled);
- while (cache_ptr->epoch_markers_active > 0) {
- /* get the index of the last epoch marker in the LRU list
- * and remove it from the ring buffer.
- */
+#if H5C_DO_SANITY_CHECKS
+ {
+ int32_t i;
+ uint32_t index_len = 0;
+ uint32_t slist_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;
+
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
- i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
+ for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
- cache_ptr->epoch_marker_ringbuf_first =
- (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ 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];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
- cache_ptr->epoch_marker_ringbuf_size -= 1;
+ slist_len += cache_ptr->slist_ring_len[i];
+ slist_size += cache_ptr->slist_ring_size[i];
- if (cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ } /* end for */
- if ((cache_ptr->epoch_marker_active)[i] != TRUE)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
+ }
+#endif /* H5C_DO_SANITY_CHECKS */
- /* remove the epoch marker from the LRU list */
- H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
- (FAIL))
+ /* remove ageout markers if present */
+ if (cache_ptr->epoch_markers_active > 0) {
- /* mark the epoch marker as unused. */
- (cache_ptr->epoch_marker_active)[i] = FALSE;
+ if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
- HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
- HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
- HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers")
+ }
- /* decrement the number of active epoch markers */
- cache_ptr->epoch_markers_active -= 1;
+ /* flush invalidate each ring, starting from the outermost ring and
+ * working inward.
+ */
+ ring = H5C_RING_USER;
- HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
- }
+ while (ring < H5C_RING_NTYPES) {
-done:
+ if (H5C__flush_invalidate_ring(f, ring, flags) < 0)
- FUNC_LEAVE_NOAPI(ret_value)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed")
+ ring++;
- } /* H5C__autoadjust__ageout__remove_all_markers() */
+ } /* end while */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__remove_excess_markers
- *
- * Purpose: Remove epoch markers from the end of the LRU list and
- * mark them as inactive until the number of active markers
- * equals the the current value of
- * (cache_ptr->resize_ctl).epochs_before_eviction.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/19/04
- *
- *-------------------------------------------------------------------------
- */
- 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;
+ /* Invariants, after destroying all entries in the hash table */
+ if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) {
- FUNC_ENTER_NOAPI_NOINIT
+ 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);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ } /* end if */
+ else {
- if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry")
+ H5C_cache_entry_t *entry_ptr; /* Cache entry */
+ unsigned u; /* Local index variable */
- while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) {
- /* get the index of the last epoch marker in the LRU list
- * and remove it from the ring buffer.
- */
+ /* All rings except ring 4 should be empty now */
+ /* (Ring 4 has the superblock) */
+ for (u = H5C_RING_USER; u < H5C_RING_SB; u++) {
- ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
- i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
+ 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);
- cache_ptr->epoch_marker_ringbuf_first =
- (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ } /* end for */
- cache_ptr->epoch_marker_ringbuf_size -= 1;
+ /* Check that any remaining pinned entries are in the superblock ring */
- if (cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
- if ((cache_ptr->epoch_marker_active)[i] != TRUE)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ entry_ptr = cache_ptr->pel_head_ptr;
- /* remove the epoch marker from the LRU list */
- H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
- (FAIL))
+ while (entry_ptr) {
- /* mark the epoch marker as unused. */
- (cache_ptr->epoch_marker_active)[i] = FALSE;
+ /* Check ring */
+ HDassert(entry_ptr->ring == H5C_RING_SB);
- HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
- HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
- HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
+ /* Advance to next entry in pinned entry list */
+ entry_ptr = entry_ptr->next;
- /* decrement the number of active epoch markers */
- cache_ptr->epoch_markers_active -= 1;
+ } /* end while */
+ } /* end else */
- HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
- }
+ HDassert(cache_ptr->dirty_index_size == 0);
+ HDassert(cache_ptr->slist_len == 0);
+ HDassert(cache_ptr->slist_size == 0);
+ HDassert(cache_ptr->pl_len == 0);
+ HDassert(cache_ptr->pl_size == 0);
+ HDassert(cache_ptr->LRU_list_len == 0);
+ HDassert(cache_ptr->LRU_list_size == 0);
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__autoadjust__ageout__remove_excess_markers() */
+} /* H5C__flush_invalidate_cache() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__flash_increase_cache_size
- *
- * Purpose: If there is not at least new_entry_size - old_entry_size
- * bytes of free space in the cache and the current
- * max_cache_size is less than (cache_ptr->resize_ctl).max_size,
- * perform a flash increase in the cache size and then reset
- * the full cache hit rate statistics, and exit.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 12/31/07
- *
- *-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
+ * Function: H5C__flush_invalidate_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.
+ *
+ * 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 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.
+ *
+ * Programmer: John Mainzer
+ * 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_t * cache_ptr;
+ hbool_t restart_slist_scan;
+ uint32_t protected_entries = 0;
+ int32_t i;
+ int32_t cur_ring_pel_len;
+ int32_t old_ring_pel_len;
+ unsigned cooked_flags;
+ unsigned evict_flags;
+ H5SL_node_t * node_ptr = NULL;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *next_entry_ptr = NULL;
+#if H5C_DO_SANITY_CHECKS
+ uint32_t initial_slist_len = 0;
+ size_t initial_slist_size = 0;
+#endif /* H5C_DO_SANITY_CHECKS */
+ herr_t ret_value = SUCCEED;
+
+ 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);
+
+ HDassert(cache_ptr->epoch_markers_active == 0);
+
+ /* Filter out the flags that are not relevant to the flush/invalidate.
+ */
+ cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG;
+ evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG;
+
+ /* The flush procedure here is a bit strange.
+ *
+ * In the outer while loop we make at least one pass through the
+ * cache, and then repeat until either all the pinned entries in
+ * the ring unpin themselves, or until the number of pinned entries
+ * in the ring stops declining. In this later case, we scream and die.
+ *
+ * Since the fractal heap can dirty, resize, and/or move entries
+ * in is flush callback, it is possible that the cache will still
+ * contain dirty entries at this point. If so, we must make more
+ * passes through the skip list to allow it to empty.
+ *
+ * Further, since clean entries can be dirtied, resized, and/or moved
+ * as the result of a flush call back (either the entries own, or that
+ * for some other cache entry), we can no longer promise to flush
+ * the cache entries in increasing address order.
+ *
+ * Instead, we just do the best we can -- making a pass through
+ * the skip list, and then a pass through the "clean" entries, and
+ * then repeating as needed. Thus it is quite possible that an
+ * entry will be evicted from the cache only to be re-loaded later
+ * in the flush process (From what Quincey tells me, the pin
+ * mechanism makes this impossible, but even it it is true now,
+ * we shouldn't count on it in the future.)
+ *
+ * The bottom line is that entries will probably be flushed in close
+ * to increasing address order, but there are no guarantees.
*/
- static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, size_t old_entry_size,
- size_t new_entry_size)
- {
- size_t new_max_cache_size = 0;
- size_t old_max_cache_size = 0;
- size_t new_min_clean_size = 0;
- size_t old_min_clean_size = 0;
- size_t space_needed;
- enum H5C_resize_status status = flash_increase; /* may change */
- double hit_rate;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->flash_size_increase_possible);
- HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold);
- HDassert(old_entry_size < new_entry_size);
- if (old_entry_size >= new_entry_size)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size")
+ /* compute the number of pinned entries in this ring */
- space_needed = new_entry_size - old_entry_size;
+ entry_ptr = cache_ptr->pel_head_ptr;
+ cur_ring_pel_len = 0;
- if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
- (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) {
+ while (entry_ptr != NULL) {
- /* we have work to do */
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
+ if (entry_ptr->ring == ring)
+ cur_ring_pel_len++;
- switch ((cache_ptr->resize_ctl).flash_incr_mode) {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
- "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ entry_ptr = entry_ptr->next;
- case H5C_flash_incr__add_space:
- if (cache_ptr->index_size < cache_ptr->max_cache_size) {
+ } /* end while */
- HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed);
- space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size;
- }
- space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple);
+ old_ring_pel_len = cur_ring_pel_len;
- new_max_cache_size = cache_ptr->max_cache_size + space_needed;
+ while (cache_ptr->index_ring_len[ring] > 0) {
- break;
+ /* 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
+ * that the slist will not be empty after we finish the scan.
+ */
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+#if H5C_DO_SANITY_CHECKS
+ /* Depending on circumstances, H5C__flush_single_entry() will
+ * remove dirty entries from the slist as it flushes them.
+ * Thus for sanity checks we must make note of the initial
+ * slist length and size before we do any flushes.
+ */
+ initial_slist_len = cache_ptr->slist_len;
+ initial_slist_size = cache_ptr->slist_size;
+
+ /* There is also the possibility that entries will be
+ * dirtied, resized, moved, and/or removed from the cache
+ * as the result of calls to the flush callbacks. We use
+ * the slist_len_increase and slist_size_increase increase
+ * fields in struct H5C_t to track these changes for purpose
+ * of sanity checking.
+ *
+ * To this end, we must zero these fields before we start
+ * the pass through the slist.
+ */
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ /* Set the cache_ptr->slist_changed to false.
+ *
+ * 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
+ * modifications to the slist that might corrupt the scan of
+ * the slist -- and restart the scan in this event.
+ */
+ cache_ptr->slist_changed = FALSE;
+
+ /* this done, start the scan of the slist */
+ restart_slist_scan = TRUE;
+
+ 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)
+ /* the slist is empty -- break out of inner loop */
break;
- }
- if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
+ /* Get cache entry for this node */
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- new_max_cache_size = (cache_ptr->resize_ctl).max_size;
- }
+ if (NULL == next_entry_ptr)
- HDassert(new_max_cache_size > cache_ptr->max_cache_size);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- new_min_clean_size =
- (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
+ 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(new_min_clean_size <= new_max_cache_size);
+ } /* end if */
- old_max_cache_size = cache_ptr->max_cache_size;
- old_min_clean_size = cache_ptr->min_clean_size;
+ entry_ptr = next_entry_ptr;
- cache_ptr->max_cache_size = new_max_cache_size;
- cache_ptr->min_clean_size = new_min_clean_size;
+ /* It is possible that entries will be dirtied, resized,
+ * flushed, or removed from the cache via the take ownership
+ * flag as the result of pre_serialize or serialized callbacks.
+ *
+ * This in turn can corrupt the scan through the slist.
+ *
+ * We test for slist modifications in the pre_serialize
+ * and serialize callbacks, and restart the scan of the
+ * slist if we find them. However, best we do some extra
+ * sanity checking just in case.
+ */
+ HDassert(entry_ptr != NULL);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->in_slist);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->ring >= ring);
- /* update flash cache size increase fields as appropriate */
- HDassert(cache_ptr->flash_size_increase_possible);
+ /* increment node pointer now, before we delete its target
+ * from the slist.
+ */
+ node_ptr = H5SL_next(node_ptr);
- switch ((cache_ptr->resize_ctl).flash_incr_mode) {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
- "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ if (node_ptr != NULL) {
- case H5C_flash_incr__add_space:
- cache_ptr->flash_size_increase_threshold = (size_t)(
- ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold));
- break;
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
+ 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);
+ HDassert(entry_ptr != next_entry_ptr);
+ } /* end if */
+ else {
+
+ next_entry_ptr = NULL;
}
- /* note that we don't cycle the epoch markers. We can
- * argue either way as to whether we should, but for now
- * we don't.
+ /* Note that we now remove nodes from the slist as we flush
+ * the associated entries, instead of leaving them there
+ * until we are done, and then destroying all nodes in
+ * the slist.
+ *
+ * While this optimization used to be easy, with the possibility
+ * of new entries being added to the slist in the midst of the
+ * 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 ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
+ if (entry_ptr->is_protected) {
- /* get the hit rate for the reporting function. Should still
- * be good as we haven't reset the hit rate statistics.
- */
- if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
+ /* we have major problems -- but lets flush
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate,
- status, old_max_cache_size, new_max_cache_size,
- old_min_clean_size, new_min_clean_size);
- }
+ } /* end if */
+ else if (entry_ptr->is_pinned) {
- if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
- /* this should be impossible... */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
- }
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0)
-done:
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed")
- FUNC_LEAVE_NOAPI(ret_value)
+ if (cache_ptr->slist_changed) {
- } /* H5C__flash_increase_cache_size() */
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr);
- /*-------------------------------------------------------------------------
- * Function: H5C__flush_invalidate_cache
- *
- * Purpose: Flush and destroy the entries contained in the target
- * cache.
- *
- * If the cache 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).
- *
- * 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.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 3/24/065
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__flush_invalidate_cache(H5F_t * f, unsigned flags)
- {
- H5C_t * cache_ptr;
- H5C_ring_t ring;
- herr_t ret_value = SUCCEED;
+ } /* end if */
+ } /* end else-if */
+ else {
- FUNC_ENTER_STATIC
+ 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)
- 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_ptr);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed")
-#if H5C_DO_SANITY_CHECKS
- {
- int32_t i;
- uint32_t index_len = 0;
- uint32_t slist_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;
-
- HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- 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++) {
- 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];
- dirty_index_size += cache_ptr->dirty_index_ring_size[i];
-
- 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);
- HDassert(cache_ptr->index_size == index_size);
- HDassert(cache_ptr->clean_index_size == clean_index_size);
- HDassert(cache_ptr->dirty_index_size == dirty_index_size);
- HDassert(cache_ptr->slist_len == slist_len);
- HDassert(cache_ptr->slist_size == slist_size);
- }
-#endif /* H5C_DO_SANITY_CHECKS */
+ if (cache_ptr->slist_changed) {
- /* 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")
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+ } /* end if */
+ } /* end else */
+ } /* end if */
+ } /* end while loop scanning skip list */
- /* flush invalidate each ring, starting from the outermost ring and
- * working inward.
+#if H5C_DO_SANITY_CHECKS
+ /* It is possible that entries were added to the slist during
+ * the scan, either before or after scan pointer. The following
+ * asserts take this into account.
+ *
+ * Don't bother with the sanity checks if node_ptr != NULL, as
+ * in this case we broke out of the loop because it got changed
+ * out from under us.
*/
- 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")
- ring++;
- } /* end while */
- /* Invariants, after destroying all entries in the hash table */
- 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);
+ 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 */
- 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++) {
- 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);
- HDassert(cache_ptr->pl_len == 0);
- HDassert(cache_ptr->pl_size == 0);
- HDassert(cache_ptr->LRU_list_len == 0);
- HDassert(cache_ptr->LRU_list_size == 0);
+#endif /* H5C_DO_SANITY_CHECKS */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__flush_invalidate_cache() */
+ /* Since we are doing a destroy, we must make a pass through
+ * the hash table and try to flush - destroy all entries that
+ * remain.
+ *
+ * It used to be that all entries remaining in the cache at
+ * this point had to be clean, but with the fractal heap mods
+ * this may not be the case. If so, we will flush entries out
+ * in increasing address order.
+ *
+ * Writes to disk are possible here.
+ */
- /*-------------------------------------------------------------------------
- * Function: H5C_flush_invalidate_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.
- *
- * 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 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.
- *
- * Programmer: John Mainzer
- * 9/1/15
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags)
- {
- H5C_t * cache_ptr;
- hbool_t restart_slist_scan;
- uint32_t protected_entries = 0;
- int32_t i;
- int32_t cur_ring_pel_len;
- int32_t old_ring_pel_len;
- unsigned cooked_flags;
- unsigned evict_flags;
- H5SL_node_t * node_ptr = NULL;
- H5C_cache_entry_t *entry_ptr = NULL;
- H5C_cache_entry_t *next_entry_ptr = NULL;
-#if H5C_DO_SANITY_CHECKS
- uint32_t initial_slist_len = 0;
- size_t initial_slist_size = 0;
-#endif /* H5C_DO_SANITY_CHECKS */
- herr_t ret_value = SUCCEED;
+ /* reset the counters so that we can detect insertions, loads,
+ * and moves caused by the pre_serialize and serialize calls.
+ */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
- FUNC_ENTER_NOAPI(FAIL)
+ next_entry_ptr = cache_ptr->il_head;
- 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_ptr);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
+ while (next_entry_ptr != NULL) {
- HDassert(cache_ptr->epoch_markers_active == 0);
+ entry_ptr = next_entry_ptr;
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
- /* Filter out the flags that are not relevant to the flush/invalidate.
- */
- cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG;
- evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG;
+ next_entry_ptr = entry_ptr->il_next;
+ HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC));
- /* The flush procedure here is a bit strange.
- *
- * In the outer while loop we make at least one pass through the
- * cache, and then repeat until either all the pinned entries in
- * the ring unpin themselves, or until the number of pinned entries
- * in the ring stops declining. In this later case, we scream and die.
- *
- * Since the fractal heap can dirty, resize, and/or move entries
- * in is flush callback, it is possible that the cache will still
- * contain dirty entries at this point. If so, we must make more
- * passes through the skip list to allow it to empty.
- *
- * Further, since clean entries can be dirtied, resized, and/or moved
- * as the result of a flush call back (either the entries own, or that
- * for some other cache entry), we can no longer promise to flush
- * the cache entries in increasing address order.
- *
- * Instead, we just do the best we can -- making a pass through
- * the skip list, and then a pass through the "clean" entries, and
- * then repeating as needed. Thus it is quite possible that an
- * entry will be evicted from the cache only to be re-loaded later
- * in the flush process (From what Quincey tells me, the pin
- * mechanism makes this impossible, but even it it is true now,
- * we shouldn't count on it in the future.)
+ 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) {
+
+ HDassert(!(entry_ptr->is_dirty));
+ }
+ } /* end if */
+ 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
+ * into the cache, or moved to a new location
+ * in the file as a side effect of the flush.
+ *
+ * It's also possible that removing a clean
+ * entry will remove the last child of a proxy
+ * entry, allowing it to be removed also and
+ * invalidating the next_entry_ptr.
+ *
+ * If either of these happen, and one of the target
+ * or proxy entries happens to be the next entry in
+ * the hash bucket, we could either find ourselves
+ * either scanning a non-existant entry, scanning
+ * through a different bucket, or skipping an entry.
+ *
+ * Neither of these are good, so restart the
+ * the scan at the head of the hash bucket
+ * after the flush if we detect that the next_entry_ptr
+ * becomes invalid.
+ *
+ * This is not as inefficient at it might seem,
+ * as hash buckets typically have at most two
+ * or three entries.
+ */
+ 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")
+
+ /* Restart the index list scan if necessary. Must
+ * do this if the next entry is evicted, and also if
+ * one or more entries are inserted, loaded, or moved
+ * as these operations can result in part of the scan
+ * being skipped -- which can cause a spurious failure
+ * 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)) {
+
+ next_entry_ptr = cache_ptr->il_head;
+
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+
+ H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr)
+
+ } /* end if */
+ else {
+
+ cache_ptr->entry_watched_for_removal = NULL;
+ }
+ } /* end if */
+ } /* end if */
+ } /* end for loop scanning hash table */
+
+ /* We can't do anything if entries are pinned. The
+ * hope is that the entries will be unpinned as the
+ * result of destroys of entries that reference them.
*
- * The bottom line is that entries will probably be flushed in close
- * to increasing address order, but there are no guarantees.
+ * We detect this by noting the change in the number
+ * of pinned entries from pass to pass. If it stops
+ * shrinking before it hits zero, we scream and die.
*/
-
- /* compute the number of pinned entries in this ring */
+ old_ring_pel_len = cur_ring_pel_len;
entry_ptr = cache_ptr->pel_head_ptr;
cur_ring_pel_len = 0;
+
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 */
- 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
- * that the slist will not be empty after we finish the scan.
- */
+ /* 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 H5C_DO_SANITY_CHECKS
- /* Depending on circumstances, H5C__flush_single_entry() will
- * remove dirty entries from the slist as it flushes them.
- * Thus for sanity checks we must make note of the initial
- * slist length and size before we do any flushes.
- */
- initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
-
- /* There is also the possibility that entries will be
- * dirtied, resized, moved, and/or removed from the cache
- * as the result of calls to the flush callbacks. We use
- * the slist_len_increase and slist_size_increase increase
- * fields in struct H5C_t to track these changes for purpose
- * of sanity checking.
- *
- * To this end, we must zero these fields before we start
- * the pass through the slist.
- */
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
-#endif /* H5C_DO_SANITY_CHECKS */
+ /* Don't error if allowed to have pinned entries remaining */
+ if (evict_flags) {
- /* Set the cache_ptr->slist_changed to false.
- *
- * 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
- * modifications to the slist that might corrupt the scan of
- * the slist -- and restart the scan in this event.
- */
- cache_ptr->slist_changed = FALSE;
+ HGOTO_DONE(TRUE)
+ }
- /* this done, start the scan of the slist */
- restart_slist_scan = TRUE;
- while (restart_slist_scan || (node_ptr != NULL)) {
- if (restart_slist_scan) {
- restart_slist_scan = FALSE;
+ 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 */
- /* Start at beginning of skip list */
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- if (node_ptr == NULL)
- /* the slist is empty -- break out of inner loop */
- break;
+ HDassert(protected_entries == cache_ptr->pl_len);
- /* 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 ((protected_entries > 0) && (protected_entries == cache_ptr->index_len))
- 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 */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
+ "Only protected entries left in cache, protected_entries = %d",
+ (int)protected_entries)
- entry_ptr = next_entry_ptr;
-
- /* It is possible that entries will be dirtied, resized,
- * flushed, or removed from the cache via the take ownership
- * flag as the result of pre_serialize or serialized callbacks.
- *
- * This in turn can corrupt the scan through the slist.
- *
- * We test for slist modifications in the pre_serialize
- * and serialize callbacks, and restart the scan of the
- * slist if we find them. However, best we do some extra
- * sanity checking just in case.
- */
- HDassert(entry_ptr != NULL);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->in_slist);
- HDassert(entry_ptr->is_dirty);
- HDassert(entry_ptr->ring >= ring);
+ } /* main while loop */
- /* increment node pointer now, before we delete its target
- * 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 ?!?!")
- 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
- next_entry_ptr = NULL;
-
- /* Note that we now remove nodes from the slist as we flush
- * the associated entries, instead of leaving them there
- * until we are done, and then destroying all nodes in
- * the slist.
- *
- * While this optimization used to be easy, with the possibility
- * of new entries being added to the slist in the midst of the
- * 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) {
- /* 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")
-
- 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.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- 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) {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_changed = FALSE;
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- } /* end if */
- } /* end else */
- } /* end if */
- } /* end while loop scanning skip list */
+ /* Invariants, after destroying all entries in the ring */
+ for (i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) {
-#if H5C_DO_SANITY_CHECKS
- /* It is possible that entries were added to the slist during
- * the scan, either before or after scan pointer. The following
- * asserts take this into account.
- *
- * Don't bother with the sanity checks if node_ptr != NULL, as
- * in this case we broke out of the loop because it got changed
- * out from under us.
- */
+ 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);
+ HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0);
- 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 */
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+ HDassert(cache_ptr->slist_ring_size[i] == (size_t)0);
- /* Since we are doing a destroy, we must make a pass through
- * the hash table and try to flush - destroy all entries that
- * remain.
- *
- * It used to be that all entries remaining in the cache at
- * this point had to be clean, but with the fractal heap mods
- * this may not be the case. If so, we will flush entries out
- * in increasing address order.
- *
- * Writes to disk are possible here.
- */
+ } /* end for */
- /* reset the counters so that we can detect insertions, loads,
- * and moves caused by the pre_serialize and serialize calls.
- */
- 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;
- 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);
+ HDassert(protected_entries <= cache_ptr->pl_len);
- next_entry_ptr = entry_ptr->il_next;
- HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC));
+ if (protected_entries > 0) {
- 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)
- HDassert(!(entry_ptr->is_dirty));
- } /* end if */
- 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
- * into the cache, or moved to a new location
- * in the file as a side effect of the flush.
- *
- * It's also possible that removing a clean
- * entry will remove the last child of a proxy
- * entry, allowing it to be removed also and
- * invalidating the next_entry_ptr.
- *
- * If either of these happen, and one of the target
- * or proxy entries happens to be the next entry in
- * the hash bucket, we could either find ourselves
- * either scanning a non-existant entry, scanning
- * through a different bucket, or skipping an entry.
- *
- * Neither of these are good, so restart the
- * the scan at the head of the hash bucket
- * after the flush if we detect that the next_entry_ptr
- * becomes invalid.
- *
- * This is not as inefficient at it might seem,
- * as hash buckets typically have at most two
- * or three entries.
- */
- 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")
-
- /* Restart the index list scan if necessary. Must
- * do this if the next entry is evicted, and also if
- * one or more entries are inserted, loaded, or moved
- * as these operations can result in part of the scan
- * being skipped -- which can cause a spurious failure
- * 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)) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries")
+ }
+ else if (cur_ring_pel_len > 0) {
- next_entry_ptr = cache_ptr->il_head;
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring")
+ }
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+done:
- H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr)
- } /* end if */
- else
- cache_ptr->entry_watched_for_removal = NULL;
- } /* end if */
- } /* end if */
- } /* end for loop scanning hash table */
+ FUNC_LEAVE_NOAPI(ret_value)
- /* We can't do anything if entries are pinned. The
- * hope is that the entries will be unpinned as the
- * result of destroys of entries that reference them.
- *
- * We detect this by noting the change in the number
- * of pinned entries from pass to pass. If it stops
- * shrinking before it hits zero, we scream and die.
- */
- old_ring_pel_len = cur_ring_pel_len;
- entry_ptr = cache_ptr->pel_head_ptr;
- cur_ring_pel_len = 0;
- while (entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring >= 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.
+ *
+ * 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.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 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
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
+{
+ H5C_t * cache_ptr = f->shared->cache;
+ hbool_t flushed_entries_last_pass;
+ hbool_t flush_marked_entries;
+ hbool_t ignore_protected;
+ hbool_t tried_to_flush_protected_entry = FALSE;
+ hbool_t restart_slist_scan;
+ uint32_t protected_entries = 0;
+ H5SL_node_t * node_ptr = NULL;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *next_entry_ptr = NULL;
+#if H5C_DO_SANITY_CHECKS
+ uint32_t initial_slist_len = 0;
+ size_t initial_slist_size = 0;
+#endif /* H5C_DO_SANITY_CHECKS */
+ int i;
+ herr_t ret_value = SUCCEED;
- if (entry_ptr->ring == ring)
- cur_ring_pel_len++;
+ FUNC_ENTER_STATIC
- entry_ptr = entry_ptr->next;
- } /* end while */
+ 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);
- /* 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) {
- /* Don't error if allowed to have pinned entries remaining */
- 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)
- } /* end if */
+#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))
- HDassert(protected_entries == cache_ptr->pl_len);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
+#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- 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 */
+ ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0);
+ flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0);
- /* Invariants, after destroying all entries in the ring */
- 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);
- HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0);
+ if (!flush_marked_entries) {
- HDassert(cache_ptr->slist_ring_len[i] == 0);
- HDassert(cache_ptr->slist_ring_size[i] == (size_t)0);
- } /* end for */
+ for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) {
- HDassert(protected_entries <= cache_ptr->pl_len);
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+ }
+ }
- 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")
+ HDassert(cache_ptr->flush_in_progress);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_flush_invalidate_ring() */
+ /* When we are only flushing marked entries, the slist will usually
+ * still contain entries when we have flushed everything we should.
+ * Thus we track whether we have flushed any entries in the last
+ * pass, and terminate if we haven't.
+ */
+ flushed_entries_last_pass = TRUE;
- /*-------------------------------------------------------------------------
- * 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.
+ /* Set the cache_ptr->slist_changed to false.
*
- * 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.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 9/1/15
- *
- *-------------------------------------------------------------------------
+ * 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_cache 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.
*/
- static herr_t H5C__flush_ring(H5F_t * f, H5C_ring_t ring, unsigned flags)
- {
- H5C_t * cache_ptr = f->shared->cache;
- hbool_t flushed_entries_last_pass;
- hbool_t flush_marked_entries;
- hbool_t ignore_protected;
- hbool_t tried_to_flush_protected_entry = FALSE;
- hbool_t restart_slist_scan;
- uint32_t protected_entries = 0;
- H5SL_node_t * node_ptr = NULL;
- H5C_cache_entry_t *entry_ptr = NULL;
- H5C_cache_entry_t *next_entry_ptr = NULL;
+ cache_ptr->slist_changed = FALSE;
+
+ 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
- uint32_t initial_slist_len = 0;
- size_t initial_slist_size = 0;
+ /* For sanity checking, try to verify that the skip list has
+ * the expected size and number of entries at the end of each
+ * internal while loop (see below).
+ *
+ * Doing this get a bit tricky, as depending on flags, we may
+ * or may not flush all the entries in the slist.
+ *
+ * To make things more entertaining, with the advent of the
+ * fractal heap, the entry serialize callback can cause entries
+ * to be dirtied, resized, and/or moved. Also, the
+ * pre_serialize callback can result in an entry being
+ * removed from the cache via the take ownership flag.
+ *
+ * To deal with this, we first make note of the initial
+ * skip list length and size:
+ */
+ initial_slist_len = cache_ptr->slist_len;
+ initial_slist_size = cache_ptr->slist_size;
+
+ /* As mentioned above, there is the possibility that
+ * entries will be dirtied, resized, flushed, or removed
+ * from the cache via the take ownership flag during
+ * our pass through the skip list. To capture the number
+ * of entries added, and the skip list size delta,
+ * zero the slist_len_increase and slist_size_increase of
+ * the cache's instance of H5C_t. These fields will be
+ * updated elsewhere to account for slist insertions and/or
+ * dirty entry size changes.
+ */
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
+
+ /* at the end of the loop, use these values to compute the
+ * expected slist length and size and compare this with the
+ * value recorded in the cache's instance of H5C_t.
+ */
#endif /* H5C_DO_SANITY_CHECKS */
- int i;
- herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC
+ restart_slist_scan = TRUE;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_ptr);
- HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
+ while ((restart_slist_scan) || (node_ptr != NULL)) {
-#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")
-#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
+ if (restart_slist_scan) {
- ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0);
- flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0);
+ restart_slist_scan = FALSE;
- if (!flush_marked_entries)
- for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++)
- HDassert(cache_ptr->slist_ring_len[i] == 0);
+ /* Start at beginning of skip list */
+ node_ptr = H5SL_first(cache_ptr->slist_ptr);
- HDassert(cache_ptr->flush_in_progress);
+ if (node_ptr == NULL) {
- /* When we are only flushing marked entries, the slist will usually
- * still contain entries when we have flushed everything we should.
- * Thus we track whether we have flushed any entries in the last
- * pass, and terminate if we haven't.
- */
- flushed_entries_last_pass = TRUE;
+ /* the slist is empty -- break out of inner loop */
+ break;
+ }
- /* Set the cache_ptr->slist_changed to false.
- *
- * 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_cache 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.
- */
- cache_ptr->slist_changed = FALSE;
+ /* Get cache entry for this node */
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) &&
- (flushed_entries_last_pass)) {
- flushed_entries_last_pass = FALSE;
+ if (NULL == next_entry_ptr)
-#if H5C_DO_SANITY_CHECKS
- /* For sanity checking, try to verify that the skip list has
- * the expected size and number of entries at the end of each
- * internal while loop (see below).
- *
- * Doing this get a bit tricky, as depending on flags, we may
- * or may not flush all the entries in the slist.
+ 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;
+
+ /* With the advent of the fractal heap, the free space
+ * manager, and the version 3 cache, it is possible
+ * that the pre-serialize or serialize callback will
+ * dirty, resize, or take ownership of other entries
+ * in the cache.
*
- * To make things more entertaining, with the advent of the
- * fractal heap, the entry serialize callback can cause entries
- * to be dirtied, resized, and/or moved. Also, the
- * pre_serialize callback can result in an entry being
- * removed from the cache via the take ownership flag.
+ * To deal with this, I have inserted code to detect any
+ * change in the skip list not directly under the control
+ * of this function. If such modifications are detected,
+ * we must re-start the scan of the skip list to avoid
+ * the possibility that the target of the next_entry_ptr
+ * may have been flushed or deleted from the cache.
*
- * To deal with this, we first make note of the initial
- * skip list length and size:
- */
- initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
-
- /* As mentioned above, there is the possibility that
- * entries will be dirtied, resized, flushed, or removed
- * from the cache via the take ownership flag during
- * our pass through the skip list. To capture the number
- * of entries added, and the skip list size delta,
- * zero the slist_len_increase and slist_size_increase of
- * the cache's instance of H5C_t. These fields will be
- * updated elsewhere to account for slist insertions and/or
- * dirty entry size changes.
+ * To verify that all such possibilities have been dealt
+ * with, we do a bit of extra sanity checking on
+ * entry_ptr.
*/
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
+ 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)) {
+
+ HDassert(entry_ptr->ring >= ring);
+ }
- /* at the end of the loop, use these values to compute the
- * expected slist length and size and compare this with the
- * value recorded in the cache's instance of H5C_t.
+ /* Advance node pointer now, before we delete its target
+ * from the slist.
*/
-#endif /* H5C_DO_SANITY_CHECKS */
+ node_ptr = H5SL_next(node_ptr);
- restart_slist_scan = TRUE;
+ if (node_ptr != NULL) {
- while ((restart_slist_scan) || (node_ptr != NULL)) {
- if (restart_slist_scan) {
- restart_slist_scan = FALSE;
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- /* Start at beginning of skip list */
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
+ if (NULL == next_entry_ptr)
- if (node_ptr == NULL)
- /* the slist is empty -- break out of inner loop */
- break;
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- /* Get cache entry for this node */
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
- if (NULL == next_entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
+ if (!flush_marked_entries || next_entry_ptr->flush_marker) {
- 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 */
+ HDassert(next_entry_ptr->ring >= ring);
+ }
- entry_ptr = next_entry_ptr;
-
- /* With the advent of the fractal heap, the free space
- * manager, and the version 3 cache, it is possible
- * that the pre-serialize or serialize callback will
- * dirty, resize, or take ownership of other entries
- * in the cache.
- *
- * To deal with this, I have inserted code to detect any
- * change in the skip list not directly under the control
- * of this function. If such modifications are detected,
- * we must re-start the scan of the skip list to avoid
- * the possibility that the target of the next_entry_ptr
- * may have been flushed or deleted from the cache.
- *
- * To verify that all such possibilities have been dealt
- * with, we do a bit of extra sanity checking on
- * entry_ptr.
- */
- 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)
- 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) {
- 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 ?!?!")
+ HDassert(entry_ptr != next_entry_ptr);
+
+ } /* end if */
+ else {
- HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(next_entry_ptr->is_dirty);
- HDassert(next_entry_ptr->in_slist);
+ 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)) {
+
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- if (!flush_marked_entries || next_entry_ptr->flush_marker)
- HDassert(next_entry_ptr->ring >= ring);
+ 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++;
- HDassert(entry_ptr != next_entry_ptr);
} /* end if */
- else
- next_entry_ptr = NULL;
+ else {
- 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 (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0)
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry")
+
+ if (cache_ptr->slist_changed) {
- if (entry_ptr->is_protected) {
- /* we probably have major problems -- but lets
- * flush everything we can before we decide
- * whether to flag an error.
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
*/
- tried_to_flush_protected_entry = TRUE;
- protected_entries++;
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+
} /* 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) {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- 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 ) ) */
+ 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);
-#endif /* H5C_DO_SANITY_CHECKS */
- } /* while */
+ /* 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);
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ } /* while */
+
+ HDassert(protected_entries <= cache_ptr->pl_len);
- HDassert(protected_entries <= cache_ptr->pl_len);
+ if (((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry))
- if (((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items")
#if H5C_DO_SANITY_CHECKS
- 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 */
+ 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() */
- /*-------------------------------------------------------------------------
- *
- * 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).
- *
- * 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
- * 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.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- * Programmer: John Mainzer, 5/5/04
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5C__flush_ring() */
+
+/*-------------------------------------------------------------------------
+ *
+ * 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).
+ *
+ * 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
+ * sequence of flushes.
+ *
+ * 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.
+ *
+ * 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 */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(f);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring != H5C_RING_UNDEFINED);
+ 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);
+
+ /* Set the flag for destroying the entry, based on the 'take ownership'
+ * and 'destroy' flags
+ */
+ if (take_ownership) {
+
+ destroy_entry = FALSE;
+ }
+ 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) {
+
+ write_entry = TRUE;
+ }
+ 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
+ * the entry images, set suppress_image_entry_frees to TRUE.
*
- *-------------------------------------------------------------------------
+ * Set suppress_image_entry_writes to TRUE if indicated by the
+ * image_ctl flags.
*/
- 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 */
-
- FUNC_ENTER_PACKAGE
-
- HDassert(f);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring != H5C_RING_UNDEFINED);
- 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);
-
- /* Set the flag for destroying the entry, based on the 'take ownership'
- * and 'destroy' flags
- */
- if (take_ownership)
- destroy_entry = FALSE;
- else
- destroy_entry = destroy;
+ if ((cache_ptr->close_warning_received) && (cache_ptr->image_ctl.generate_image) &&
+ (cache_ptr->num_entries_in_image > 0) && (cache_ptr->image_entries != NULL)) {
- /* 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)
- write_entry = TRUE;
- else
- write_entry = FALSE;
+ /* Sanity checks */
+ HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image));
+ HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image));
+ HDassert((!clear_only) || !(entry_ptr->include_in_image));
+ HDassert((!take_ownership) || !(entry_ptr->include_in_image));
+ HDassert((!free_file_space) || !(entry_ptr->include_in_image));
- /* if we have received close warning, and we have been instructed to
- * generate a metadata cache image, and we have actually constructed
- * the entry images, set suppress_image_entry_frees to TRUE.
- *
- * 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) {
- /* Sanity checks */
- HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image));
- HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image));
- HDassert((!clear_only) || !(entry_ptr->include_in_image));
- HDassert((!take_ownership) || !(entry_ptr->include_in_image));
- HDassert((!free_file_space) || !(entry_ptr->include_in_image));
+ suppress_image_entry_frees = TRUE;
- suppress_image_entry_frees = TRUE;
+ if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) {
+
+ suppress_image_entry_writes = TRUE;
- if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES)
- suppress_image_entry_writes = TRUE;
} /* end if */
+ } /* end if */
- /* run initial sanity checks */
+ /* run initial sanity checks */
#if H5C_DO_SANITY_CHECKS
+ if (cache_ptr->slist_enabled) {
+
if (entry_ptr->in_slist) {
+
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 */
-#endif /* H5C_DO_SANITY_CHECKS */
+ }
+ else { /* slist is disabled */
- if (entry_ptr->is_protected) {
- HDassert(!entry_ptr->is_protected);
+ HDassert(!entry_ptr->in_slist);
- /* Attempt to flush a protected entry -- scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry")
- } /* end if */
+ if (!entry_ptr->is_dirty) {
- /* Set entry_ptr->flush_in_progress = TRUE and set
- * entry_ptr->flush_marker = FALSE
- *
- * We will set flush_in_progress back to FALSE at the end if the
- * entry still exists at that point.
- */
- entry_ptr->flush_in_progress = TRUE;
- entry_ptr->flush_marker = FALSE;
+ if (entry_ptr->flush_marker)
- /* Preserve current dirty state for later */
- was_dirty = entry_ptr->is_dirty;
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?")
+ }
+ }
+#endif /* H5C_DO_SANITY_CHECKS */
- /* The entry is dirty, and we are doing a flush, a flush destroy or have
- * been requested to generate an image. In those cases, serialize the
- * entry.
- */
- if (write_entry || generate_image) {
- HDassert(entry_ptr->is_dirty);
+ 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")
+
+ } /* end if */
+
+ /* Set entry_ptr->flush_in_progress = TRUE and set
+ * entry_ptr->flush_marker = FALSE
+ *
+ * We will set flush_in_progress back to FALSE at the end if the
+ * entry still exists at that point.
+ */
+ entry_ptr->flush_in_progress = TRUE;
+ entry_ptr->flush_marker = FALSE;
+
+ /* Preserve current dirty state for later */
+ was_dirty = entry_ptr->is_dirty;
+
+ /* The entry is dirty, and we are doing a flush, a flush destroy or have
+ * been requested to generate an image. In those cases, serialize the
+ * entry.
+ */
+ 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);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ 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 */
- if (!(entry_ptr->image_up_to_date)) {
- /* Sanity check */
- HDassert(!entry_ptr->prefetched);
+ } /* end if */
- /* 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")
- } /* end if ( ! (entry_ptr->image_up_to_date) ) */
- } /* end if */
+ if (!(entry_ptr->image_up_to_date)) {
- /* Finally, write the image to disk.
- *
- * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the
- * in the entry's type, we silently skip the write. This
- * flag should only be used in test code.
- */
- if (write_entry) {
- HDassert(entry_ptr->is_dirty);
+ /* 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")
+
+ } /* end if ( ! (entry_ptr->image_up_to_date) ) */
+ } /* end if */
+
+ /* Finally, write the image to disk.
+ *
+ * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the
+ * in the entry's type, we silently skip the write. This
+ * flag should only be used in test code.
+ */
+ 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.
- *
- * This happens if both suppress_image_entry_writes and
- * entry_ptr->include_in_image are TRUE, or if the
- * 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)) {
- H5FD_mem_t mem_type = H5FD_MEM_DEFAULT;
+ /* Write the image to disk unless the write is suppressed.
+ *
+ * This happens if both suppress_image_entry_writes and
+ * entry_ptr->include_in_image are TRUE, or if the
+ * 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)) {
+
+ 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) {
+
+ 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 {
-#endif /* H5_HAVE_PARALLEL */
- 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
- mem_type = entry_ptr->type->mem_type;
+ 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 */
+ }
+#endif /* H5_HAVE_PARALLEL */
- /* 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 ( write_entry ) */
+ } /* end if */
- /* At this point, all pre-serialize and serialize calls have been
- * made if it was appropriate to make them. Similarly, the entry
- * has been written to disk if desired.
- *
- * Thus it is now safe to update the cache data structures for the
- * flush.
+ /* 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))
- /* start by updating the statistics */
- if (clear_only) {
- /* only log a clear if the entry was dirty */
- if (was_dirty) {
- H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
- } /* end if */
- }
- else if (write_entry) {
- HDassert(was_dirty);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush")
- /* only log a flush if we actually wrote to disk */
- H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
- } /* end else if */
+ } /* if ( write_entry ) */
- /* Note that the algorithm below is (very) similar to the set of operations
- * in H5C_remove_entry() and should be kept in sync with changes
- * to that code. - QAK, 2016/11/30
- */
+ /* At this point, all pre-serialize and serialize calls have been
+ * made if it was appropriate to make them. Similarly, the entry
+ * has been written to disk if desired.
+ *
+ * Thus it is now safe to update the cache data structures for the
+ * flush.
+ */
- /* Update the cache internal data structures. */
- if (destroy) {
- /* Sanity checks */
- if (take_ownership)
- HDassert(!destroy_entry);
- else
- HDassert(destroy_entry);
- HDassert(!entry_ptr->is_pinned);
+ /* start by updating the statistics */
+ if (clear_only) {
- /* Update stats, while entry is still in the cache */
- H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership)
+ /* only log a clear if the entry was dirty */
+ if (was_dirty) {
- /* If the entry's type has a 'notify' callback and the entry is about
- * 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")
+ H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
- /* Update the cache internal data structures as appropriate
- * for a destroy. Specifically:
- *
- * 1) Delete it from the index
- *
- * 2) Delete it from the skip list if requested.
- *
- * 3) Delete it from the collective read access list.
- *
- * 4) Update the replacement policy for eviction
- *
- * 5) Remove it from the tag list for this object
- *
- * Finally, if the destroy_entry flag is set, discard the
- * entry.
- */
- H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+ }
+ else if (write_entry) {
- if (entry_ptr->in_slist && del_from_slist_on_destroy)
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
+ HDassert(was_dirty);
-#ifdef H5_HAVE_PARALLEL
- /* Check for collective read access flag */
- 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 */
+ /* only log a flush if we actually wrote to disk */
+ H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
- H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
+ } /* end else if */
- /* 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")
+ /* Note that the algorithm below is (very) similar to the set of operations
+ * in H5C_remove_entry() and should be kept in sync with changes
+ * to that code. - QAK, 2016/11/30
+ */
- /* 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);
- } /* end if */
+ /* Update the cache internal data structures. */
+ if (destroy) {
+
+ /* Sanity checks */
+ if (take_ownership) {
+
+ HDassert(!destroy_entry);
+ }
else {
- HDassert(clear_only || write_entry);
- HDassert(entry_ptr->is_dirty);
- HDassert(entry_ptr->in_slist);
- /* We are either doing a flush or a clear.
- *
- * A clear and a flush are the same from the point of
- * view of the replacement policy and the slist.
- * Hence no differentiation between them.
- *
- * JRM -- 7/7/07
- */
+ HDassert(destroy_entry);
+ }
+
+ HDassert(!entry_ptr->is_pinned);
+
+ /* Update stats, while entry is still in the cache */
+ H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership)
+
+ /* If the entry's type has a 'notify' callback and the entry is about
+ * 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")
- H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL)
+ /* Update the cache internal data structures as appropriate
+ * for a destroy. Specifically:
+ *
+ * 1) Delete it from the index
+ *
+ * 2) Delete it from the skip list if requested.
+ *
+ * 3) Delete it from the collective read access list.
+ *
+ * 4) Update the replacement policy for eviction
+ *
+ * 5) Remove it from the tag list for this object
+ *
+ * Finally, if the destroy_entry flag is set, discard the
+ * entry.
+ */
+ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL)
+
+ if ((entry_ptr->in_slist) && (del_from_slist_on_destroy)) {
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
+ }
- /* mark the entry as clean and update the index for
- * entry clean. Also, call the clear callback
- * if defined.
- */
- entry_ptr->is_dirty = FALSE;
+#ifdef H5_HAVE_PARALLEL
+ /* Check for collective read access flag */
+ if (entry_ptr->coll_access) {
- H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr);
+ entry_ptr->coll_access = FALSE;
- /* 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 (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")
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
- /* 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")
- } /* end if */
- } /* end else */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
+ H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
- /* reset the flush_in progress flag */
- entry_ptr->flush_in_progress = FALSE;
+ /* 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")
- /* capture the cache entry address for the log_flush call at the
- end before the entry_ptr gets freed */
- entry_addr = entry_ptr->addr;
+ /* 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);
- /* Internal cache data structures should now be up to date, and
- * consistent with the status of the entry.
+ } /* end if */
+ else {
+
+ HDassert(clear_only || write_entry);
+ HDassert(entry_ptr->is_dirty);
+ HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist));
+
+ /* We are either doing a flush or a clear.
*
- * Now discard the entry if appropriate.
+ * A clear and a flush are the same from the point of
+ * view of the replacement policy and the slist.
+ * Hence no differentiation between them.
+ *
+ * JRM -- 7/7/07
*/
- if (destroy) {
- /* Sanity check */
- HDassert(0 == entry_ptr->flush_dep_nparents);
- /* if both suppress_image_entry_frees and entry_ptr->include_in_image
- * are true, simply set entry_ptr->image_ptr to NULL, as we have
- * another pointer to the buffer in an instance of H5C_image_entry_t
- * in cache_ptr->image_entries.
- *
- * Otherwise, free the buffer if it exists.
- */
- if (suppress_image_entry_frees && entry_ptr->include_in_image)
- entry_ptr->image_ptr = NULL;
- else if (entry_ptr->image_ptr != NULL)
- entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
+ H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL)
- /* If the entry is not a prefetched entry, verify that the flush
- * dependency parents addresses array has been transferred.
- *
- * If the entry is prefetched, the free_isr routine will dispose of
- * the flush dependency parents addresses array if necessary.
+ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
+
+ /* mark the entry as clean and update the index for
+ * entry clean. Also, call the clear callback
+ * if defined.
+ */
+ entry_ptr->is_dirty = FALSE;
+
+ 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 (!entry_ptr->prefetched) {
- HDassert(0 == entry_ptr->fd_parent_count);
- HDassert(NULL == entry_ptr->fd_parent_addrs);
- } /* end if */
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0))
- /* Check whether we should free the space in the file that
- * the entry occupies
+ 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 (free_file_space) {
- hsize_t fsf_size;
+ 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")
+ }
+ } /* end if */
+ } /* end else */
+
+ /* reset the flush_in progress flag */
+ 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
+ */
+ entry_addr = entry_ptr->addr;
- /* Sanity checks */
- HDassert(H5F_addr_defined(entry_ptr->addr));
- HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr));
+ /* Internal cache data structures should now be up to date, and
+ * consistent with the status of the entry.
+ *
+ * Now discard the entry if appropriate.
+ */
+ if (destroy) {
+
+ /* Sanity check */
+ HDassert(0 == entry_ptr->flush_dep_nparents);
+
+ /* if both suppress_image_entry_frees and entry_ptr->include_in_image
+ * are true, simply set entry_ptr->image_ptr to NULL, as we have
+ * another pointer to the buffer in an instance of H5C_image_entry_t
+ * in cache_ptr->image_entries.
+ *
+ * Otherwise, free the buffer if it exists.
+ */
+ if (suppress_image_entry_frees && entry_ptr->include_in_image) {
+
+ 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.
+ *
+ * If the entry is prefetched, the free_isr routine will dispose of
+ * the flush dependency parents addresses array if necessary.
+ */
+ 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) {
+
+ hsize_t fsf_size;
+
+ /* Sanity checks */
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr));
#ifndef NDEBUG
- {
- size_t curr_len;
+ {
+ size_t curr_len;
- /* Get the actual image size for the thing again */
- entry_ptr->type->image_len((void *)entry_ptr, &curr_len);
- HDassert(curr_len == entry_ptr->size);
- }
+ /* Get the actual image size for the thing again */
+ entry_ptr->type->image_len((void *)entry_ptr, &curr_len);
+ HDassert(curr_len == entry_ptr->size);
+ }
#endif /* NDEBUG */
- /* If the file space free size callback is defined, use
- * 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")
- } /* end if */
- 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")
- } /* end if ( free_file_space ) */
-
- /* Reset the pointer to the cache the entry is within. -QAK */
- entry_ptr->cache_ptr = NULL;
-
- /* increment entries_removed_counter and set
- * last_entry_removed_ptr. As we are likely abuut to
- * free the entry, recall that last_entry_removed_ptr
- * must NEVER be dereferenced.
- *
- * Recall that these fields are maintained to allow functions
- * that perform scans of lists of entries to detect the
- * unexpected removal of entries (via expunge, eviction,
- * or take ownership at present), so that they can re-start
- * their scans if necessary.
- *
- * Also check if the entry we are watching for removal is being
- * removed (usually the 'next' entry for an iteration) and reset
- * it to indicate that it was removed.
+ /* If the file space free size callback is defined, use
+ * it to get the size of the block of file space to free.
+ * Otherwise use entry_ptr->size.
*/
- cache_ptr->entries_removed_counter++;
- cache_ptr->last_entry_removed_ptr = entry_ptr;
- 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) {
- /* Reset dirty flag */
- entry_ptr->is_dirty = FALSE;
+ if (entry_ptr->type->fsf_size) {
- /* 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")
- } /* end if */
+ 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 */
+
+ 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")
+
+ } /* end if ( free_file_space ) */
+
+ /* Reset the pointer to the cache the entry is within. -QAK */
+ entry_ptr->cache_ptr = NULL;
+
+ /* increment entries_removed_counter and set
+ * last_entry_removed_ptr. As we are likely abuut to
+ * free the entry, recall that last_entry_removed_ptr
+ * must NEVER be dereferenced.
+ *
+ * Recall that these fields are maintained to allow functions
+ * that perform scans of lists of entries to detect the
+ * unexpected removal of entries (via expunge, eviction,
+ * or take ownership at present), so that they can re-start
+ * their scans if necessary.
+ *
+ * Also check if the entry we are watching for removal is being
+ * removed (usually the 'next' entry for an iteration) and reset
+ * it to indicate that it was removed.
+ */
+ cache_ptr->entries_removed_counter++;
+ cache_ptr->last_entry_removed_ptr = entry_ptr;
+
+ if (entry_ptr == cache_ptr->entry_watched_for_removal) {
+
+ cache_ptr->entry_watched_for_removal = NULL;
+ }
- /* we are about to discard the in core representation --
- * set the magic field to bad magic so we can detect a
- * freed entry if we see one.
+ /* Check for actually destroying the entry in memory */
+ /* (As opposed to taking ownership of it) */
+ 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.
*/
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0))
- /* verify that the image has been freed */
- HDassert(entry_ptr->image_ptr == NULL);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag cleared")
- 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.
- * set bad magic here too so the cache will choke
- * unless the entry is re-inserted properly
- */
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- } /* end else */
- } /* if (destroy) */
+ /* we are about to discard the in core representation --
+ * set the magic field to bad magic so we can detect a
+ * freed entry if we see one.
+ */
+ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- /* Check if we have to update the page buffer with cleared entries
- * so it doesn't go out of date
- */
- if (update_page_buffer) {
- /* Sanity check */
- HDassert(!destroy);
- HDassert(entry_ptr->image_ptr);
+ /* 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 (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 */
+ else {
- 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")
+ HDassert(take_ownership);
-done:
- HDassert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress));
- HDassert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty));
+ /* client is taking ownership of the entry.
+ * set bad magic here too so the cache will choke
+ * unless the entry is re-inserted properly
+ */
+ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__flush_single_entry() */
+ } /* end else */
+ } /* if (destroy) */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__verify_len_eoa
- *
- * Purpose: Verify that 'len' does not exceed eoa when 'actual' is
- * false i.e. 'len" is the initial speculative length from
- * get_load_size callback with null image pointer.
- * If exceed, adjust 'len' accordingly.
- *
- * Verify that 'len' should not exceed eoa when 'actual' is
- * true i.e. 'len' is the actual length from get_load_size
- * callback with non-null image pointer.
- * If exceed, return error.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- * Programmer: Vailin Choi
- * 9/6/15
- *
- *-------------------------------------------------------------------------
+ /* Check if we have to update the page buffer with cleared entries
+ * so it doesn't go out of date
*/
- static herr_t H5C__verify_len_eoa(H5F_t * f, const H5C_class_t *type, haddr_t addr, size_t *len,
- hbool_t actual)
- {
- H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */
- haddr_t eoa; /* End-of-allocation in the file */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ if (update_page_buffer) {
- /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
- * type to H5FD_MEM_DRAW via its call to H5F__accum_read().
- * Thus we do the same for purposes of computing the EOA
- * for sanity checks.
- */
- cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
+ /* Sanity check */
+ HDassert(!destroy);
+ HDassert(entry_ptr->image_ptr);
- /* Get the file's end-of-allocation value */
- eoa = H5F_get_eoa(f, cooked_type);
- if (!H5F_addr_defined(eoa))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file")
+ if ((f->shared->page_buf) && (f->shared->page_buf->page_size >= entry_ptr->size)) {
- /* Check for bad address in general */
- if (H5F_addr_gt(addr, eoa))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation")
+ if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size,
+ entry_ptr->image_ptr) > 0)
- /* Check if the amount of data to read will be past the EOA */
- if (H5F_addr_gt((addr + *len), eoa)) {
- if (actual)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA")
- else
- /* Trim down the length of the metadata */
- *len = (size_t)(eoa - addr);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache")
} /* end if */
+ } /* end if */
- if (*len <= 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA")
+ 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:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__verify_len_eoa() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C_load_entry
- *
- * Purpose: Attempt to load the entry at the specified disk address
- * and with the specified type into memory. If successful.
- * return the in memory address of the entry. Return NULL
- * on failure.
- *
- * Note that this function simply loads the entry into
- * core. It does not insert it into the cache.
- *
- * Return: Non-NULL on success / NULL on failure.
- *
- * Programmer: John Mainzer, 5/18/04
- *
- *-------------------------------------------------------------------------
+ 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() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__verify_len_eoa
+ *
+ * Purpose: Verify that 'len' does not exceed eoa when 'actual' is
+ * false i.e. 'len" is the initial speculative length from
+ * get_load_size callback with null image pointer.
+ * If exceed, adjust 'len' accordingly.
+ *
+ * Verify that 'len' should not exceed eoa when 'actual' is
+ * true i.e. 'len' is the actual length from get_load_size
+ * callback with non-null image pointer.
+ * If exceed, return error.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Vailin Choi
+ * 9/6/15
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, hbool_t actual)
+{
+ H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */
+ haddr_t eoa; /* End-of-allocation in the file */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
+ * type to H5FD_MEM_DRAW via its call to H5F__accum_read().
+ * Thus we do the same for purposes of computing the EOA
+ * for sanity checks.
*/
- static void *H5C_load_entry(H5F_t * f,
+ cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
+
+ /* Get the file's end-of-allocation value */
+ eoa = H5F_get_eoa(f, cooked_type);
+ if (!H5F_addr_defined(eoa))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file")
+
+ /* Check for bad address in general */
+ if (H5F_addr_gt(addr, eoa))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation")
+
+ /* Check if the amount of data to read will be past the EOA */
+ if (H5F_addr_gt((addr + *len), eoa)) {
+ if (actual)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA")
+ else
+ /* Trim down the length of the metadata */
+ *len = (size_t)(eoa - addr);
+ } /* end if */
+
+ if (*len <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__verify_len_eoa() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__load_entry
+ *
+ * Purpose: Attempt to load the entry at the specified disk address
+ * and with the specified type into memory. If successful.
+ * return the in memory address of the entry. Return NULL
+ * on failure.
+ *
+ * Note that this function simply loads the entry into
+ * core. It does not insert it into the cache.
+ *
+ * Return: Non-NULL on success / NULL on failure.
+ *
+ * Programmer: John Mainzer, 5/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5C__load_entry(H5F_t *f,
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access,
+ hbool_t coll_access,
#endif /* H5_HAVE_PARALLEL */
- const H5C_class_t *type, haddr_t addr, void *udata)
- {
- hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
- uint8_t * image = NULL; /* Buffer for disk image */
- void * thing = NULL; /* Pointer to thing loaded */
- H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */
- size_t len; /* Size of image in file */
+ const H5C_class_t *type, haddr_t addr, void *udata)
+{
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
+ uint8_t * image = NULL; /* Buffer for disk image */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */
+ size_t len; /* Size of image in file */
#ifdef H5_HAVE_PARALLEL
- int mpi_rank = 0; /* MPI process rank */
- MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */
- int mpi_code; /* MPI error code */
-#endif /* H5_HAVE_PARALLEL */
- void *ret_value = NULL; /* Return value */
+ int mpi_rank = 0; /* MPI process rank */
+ MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */
+ int mpi_code; /* MPI error code */
+#endif /* H5_HAVE_PARALLEL */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- HDassert(f->shared->cache);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
- HDassert(type->get_initial_load_size);
- if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
- HDassert(type->get_final_load_size);
- else
- HDassert(NULL == type->get_final_load_size);
- HDassert(type->deserialize);
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert(type);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(type->get_initial_load_size);
+ if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
+ HDassert(type->get_final_load_size);
+ else
+ HDassert(NULL == type->get_final_load_size);
+ HDassert(type->deserialize);
- /* Can't see how skip reads could be usefully combined with
- * the speculative read flag. Hence disallow.
- */
- HDassert(
- !((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
-
- /* Call the get_initial_load_size callback, to retrieve the initial size of image */
- if (type->get_initial_load_size(udata, &len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size")
- HDassert(len > 0);
-
- /* Check for possible speculative read off the end of the file */
- if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
- if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA")
-
- /* Allocate the buffer for reading the on-disk entry image */
- if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
+ /* Can't see how skip reads could be usefully combined with
+ * the speculative read flag. Hence disallow.
+ */
+ HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
+
+ /* Call the get_initial_load_size callback, to retrieve the initial size of image */
+ if (type->get_initial_load_size(udata, &len) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size")
+ HDassert(len > 0);
+
+ /* Check for possible speculative read off the end of the file */
+ if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
+ if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA")
+
+ /* Allocate the buffer for reading the on-disk entry image */
+ if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
#ifdef H5_HAVE_PARALLEL
- if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- if ((mpi_rank = H5F_mpi_get_rank(f)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
- if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ if ((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
+ if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- /* Get the on-disk entry image */
- if (0 == (type->flags & H5C__CLASS_SKIP_READS)) {
- unsigned tries, max_tries; /* The # of read attempts */
- unsigned retries; /* The # of retries */
- htri_t chk_ret; /* return from verify_chksum callback */
- size_t actual_len = len; /* The actual length, after speculative reads have been resolved */
- uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */
- void * new_image; /* Pointer to image */
- hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */
-
- /* Get the # of read attempts */
- max_tries = tries = H5F_GET_READ_ATTEMPTS(f);
-
- /*
- * This do/while loop performs the following till the metadata checksum
- * is correct or the file's number of allowed read attempts are reached.
- * --read the metadata
- * --determine the actual size of the metadata
- * --perform checksum verification
- */
- do {
- if (actual_len != len) {
- if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = (uint8_t *)new_image;
+ /* Get the on-disk entry image */
+ if (0 == (type->flags & H5C__CLASS_SKIP_READS)) {
+ unsigned tries, max_tries; /* The # of read attempts */
+ unsigned retries; /* The # of retries */
+ htri_t chk_ret; /* return from verify_chksum callback */
+ size_t actual_len = len; /* The actual length, after speculative reads have been resolved */
+ uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */
+ void * new_image; /* Pointer to image */
+ hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */
+
+ /* Get the # of read attempts */
+ max_tries = tries = H5F_GET_READ_ATTEMPTS(f);
+
+ /*
+ * This do/while loop performs the following till the metadata checksum
+ * is correct or the file's number of allowed read attempts are reached.
+ * --read the metadata
+ * --determine the actual size of the metadata
+ * --perform checksum verification
+ */
+ do {
+ if (actual_len != len) {
+ if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
+ image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ } /* end if */
#ifdef H5_HAVE_PARALLEL
- if (!coll_access || 0 == mpi_rank) {
+ if (!coll_access || 0 == mpi_rank) {
#endif /* H5_HAVE_PARALLEL */
- if (H5F_block_read(f, type->mem_type, addr, len, image) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
+ if (H5F_block_read(f, type->mem_type, addr, len, image) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
#ifdef H5_HAVE_PARALLEL
- } /* end if */
- /* if the collective metadata read optimization is turned on,
- * bcast the metadata read from process 0 to all ranks in the file
- * communicator
- */
- if (coll_access) {
- int buf_size;
+ } /* end if */
+ /* if the collective metadata read optimization is turned on,
+ * bcast the metadata read from process 0 to all ranks in the file
+ * communicator
+ */
+ if (coll_access) {
+ int buf_size;
- H5_CHECKED_ASSIGN(buf_size, int, len, size_t);
- if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ H5_CHECKED_ASSIGN(buf_size, int, len, size_t);
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- /* If the entry could be read speculatively and the length is still
- * changing, check for updating the actual size
- */
- if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) {
- /* Retrieve the actual length */
- actual_len = len;
- if (type->get_final_load_size(image, len, udata, &actual_len) < 0)
- continue; /* Transfer control to while() and count towards retries */
-
- /* Check for the length changing */
- if (actual_len != len) {
- /* Verify that the length isn't past the EOA for the file */
- if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA")
-
- /* Expand buffer to new size */
- if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = (uint8_t *)new_image;
+ /* If the entry could be read speculatively and the length is still
+ * changing, check for updating the actual size
+ */
+ if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) {
+ /* Retrieve the actual length */
+ actual_len = len;
+ if (type->get_final_load_size(image, len, udata, &actual_len) < 0)
+ continue; /* Transfer control to while() and count towards retries */
+
+ /* Check for the length changing */
+ if (actual_len != len) {
+ /* Verify that the length isn't past the EOA for the file */
+ if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA")
+
+ /* Expand buffer to new size */
+ if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
+ image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- if (actual_len > len) {
+ if (actual_len > len) {
#ifdef H5_HAVE_PARALLEL
- if (!coll_access || 0 == mpi_rank) {
+ if (!coll_access || 0 == mpi_rank) {
#endif /* H5_HAVE_PARALLEL */
- /* If the thing's image needs to be bigger for a speculatively
- * loaded thing, go get the on-disk image again (the extra portion).
- */
- if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len,
- image + len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image")
+ /* If the thing's image needs to be bigger for a speculatively
+ * loaded thing, go get the on-disk image again (the extra portion).
+ */
+ if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len, image + len) <
+ 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image")
#ifdef H5_HAVE_PARALLEL
- }
- /* If the collective metadata read optimization is turned on,
- * Bcast the metadata read from process 0 to all ranks in the file
- * communicator */
- if (coll_access) {
- int buf_size;
-
- H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t);
- if (MPI_SUCCESS !=
- (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
- } /* end if */
- } /* end if (actual_len != len) */
- else {
- /* The length has stabilized */
- len_changed = FALSE;
+ }
+ /* If the collective metadata read optimization is turned on,
+ * Bcast the metadata read from process 0 to all ranks in the file
+ * communicator */
+ if (coll_access) {
+ int buf_size;
+
+ H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t);
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+ } /* end if (actual_len != len) */
+ else {
+ /* The length has stabilized */
+ len_changed = FALSE;
- /* Set the final length */
- len = actual_len;
- } /* else */
- } /* end if */
+ /* Set the final length */
+ len = actual_len;
+ } /* else */
+ } /* end if */
- /* If there's no way to verify the checksum for a piece of metadata
- * (usually because there's no checksum in the file), leave now
- */
- if (type->verify_chksum == NULL)
- break;
+ /* If there's no way to verify the checksum for a piece of metadata
+ * (usually because there's no checksum in the file), leave now
+ */
+ if (type->verify_chksum == NULL)
+ break;
- /* Verify the checksum for the metadata image */
- if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback")
- if (chk_ret == TRUE)
- break;
+ /* Verify the checksum for the metadata image */
+ if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback")
+ if (chk_ret == TRUE)
+ break;
- /* Sleep for some time */
- H5_nanosleep(nanosec);
- nanosec *= 2; /* Double the sleep time next time */
- } while (--tries);
+ /* Sleep for some time */
+ H5_nanosleep(nanosec);
+ nanosec *= 2; /* Double the sleep time next time */
+ } while (--tries);
- /* Check for too many tries */
- if (tries == 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL,
- "incorrect metadatda checksum after all read attempts")
+ /* Check for too many tries */
+ if (tries == 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "incorrect metadata checksum after all read attempts")
- /* Calculate and track the # of retries */
- retries = max_tries - tries;
- if (retries) /* Does not track 0 retry */
- if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries)
+ /* Calculate and track the # of retries */
+ retries = max_tries - tries;
+ if (retries) /* Does not track 0 retry */
+ if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries)
- /* Set the final length (in case it wasn't set earlier) */
- len = actual_len;
- } /* end if !H5C__CLASS_SKIP_READS */
+ /* Set the final length (in case it wasn't set earlier) */
+ len = actual_len;
+ } /* end if !H5C__CLASS_SKIP_READS */
- /* Deserialize the on-disk image into the native memory form */
- if (NULL == (thing = type->deserialize(image, len, udata, &dirty)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image")
+ /* Deserialize the on-disk image into the native memory form */
+ if (NULL == (thing = type->deserialize(image, len, udata, &dirty)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image")
- entry = (H5C_cache_entry_t *)thing;
+ entry = (H5C_cache_entry_t *)thing;
- /* In general, an entry should be clean just after it is loaded.
- *
- * However, when this code is used in the metadata cache, it is
- * possible that object headers will be dirty at this point, as
- * the deserialize function will alter object headers if necessary to
- * fix an old bug.
- *
- * In the following assert:
- *
- * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
- *
- * note that type ids 5 & 6 are associated with object headers in the
- * metadata cache.
- *
- * When we get to using H5C for other purposes, we may wish to
- * tighten up the assert so that the loophole only applies to the
- * metadata cache.
- */
+ /* In general, an entry should be clean just after it is loaded.
+ *
+ * However, when this code is used in the metadata cache, it is
+ * possible that object headers will be dirty at this point, as
+ * the deserialize function will alter object headers if necessary to
+ * fix an old bug.
+ *
+ * In the following assert:
+ *
+ * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
+ *
+ * note that type ids 5 & 6 are associated with object headers in the
+ * metadata cache.
+ *
+ * When we get to using H5C for other purposes, we may wish to
+ * tighten up the assert so that the loophole only applies to the
+ * metadata cache.
+ */
- HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6));
-
- entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
- entry->cache_ptr = f->shared->cache;
- entry->addr = addr;
- entry->size = len;
- HDassert(entry->size < H5C_MAX_ENTRY_SIZE);
- entry->image_ptr = image;
- entry->image_up_to_date = !dirty;
- entry->type = type;
- entry->is_dirty = dirty;
- entry->dirtied = FALSE;
- entry->is_protected = FALSE;
- entry->is_read_only = FALSE;
- entry->ro_ref_count = 0;
- entry->is_pinned = FALSE;
- entry->in_slist = FALSE;
- entry->flush_marker = FALSE;
+ HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6));
+
+ entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ entry->cache_ptr = f->shared->cache;
+ entry->addr = addr;
+ entry->size = len;
+ HDassert(entry->size < H5C_MAX_ENTRY_SIZE);
+ entry->image_ptr = image;
+ entry->image_up_to_date = !dirty;
+ entry->type = type;
+ entry->is_dirty = dirty;
+ entry->dirtied = FALSE;
+ entry->is_protected = FALSE;
+ entry->is_read_only = FALSE;
+ entry->ro_ref_count = 0;
+ entry->is_pinned = FALSE;
+ entry->in_slist = FALSE;
+ entry->flush_marker = FALSE;
#ifdef H5_HAVE_PARALLEL
- entry->clear_on_unprotect = FALSE;
- entry->flush_immediately = FALSE;
- entry->coll_access = coll_access;
+ entry->clear_on_unprotect = FALSE;
+ entry->flush_immediately = FALSE;
+ entry->coll_access = coll_access;
#endif /* H5_HAVE_PARALLEL */
- entry->flush_in_progress = FALSE;
- entry->destroy_in_progress = FALSE;
-
- entry->ring = H5C_RING_UNDEFINED;
-
- /* Initialize flush dependency fields */
- entry->flush_dep_parent = NULL;
- entry->flush_dep_nparents = 0;
- entry->flush_dep_parent_nalloc = 0;
- entry->flush_dep_nchildren = 0;
- entry->flush_dep_ndirty_children = 0;
- entry->flush_dep_nunser_children = 0;
- entry->ht_next = NULL;
- entry->ht_prev = NULL;
- entry->il_next = NULL;
- entry->il_prev = NULL;
-
- entry->next = NULL;
- entry->prev = NULL;
+ entry->flush_in_progress = FALSE;
+ entry->destroy_in_progress = FALSE;
+
+ entry->ring = H5C_RING_UNDEFINED;
+
+ /* Initialize flush dependency fields */
+ entry->flush_dep_parent = NULL;
+ entry->flush_dep_nparents = 0;
+ entry->flush_dep_parent_nalloc = 0;
+ entry->flush_dep_nchildren = 0;
+ entry->flush_dep_ndirty_children = 0;
+ entry->flush_dep_nunser_children = 0;
+ entry->ht_next = NULL;
+ entry->ht_prev = NULL;
+ entry->il_next = NULL;
+ entry->il_prev = NULL;
+
+ entry->next = NULL;
+ entry->prev = NULL;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- entry->aux_next = NULL;
- entry->aux_prev = NULL;
+ entry->aux_next = NULL;
+ entry->aux_prev = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
#ifdef H5_HAVE_PARALLEL
- entry->coll_next = NULL;
- entry->coll_prev = NULL;
+ entry->coll_next = NULL;
+ entry->coll_prev = NULL;
#endif /* H5_HAVE_PARALLEL */
- /* initialize cache image related fields */
- entry->include_in_image = FALSE;
- entry->lru_rank = 0;
- entry->image_dirty = FALSE;
- entry->fd_parent_count = 0;
- entry->fd_parent_addrs = NULL;
- entry->fd_child_count = 0;
- entry->fd_dirty_child_count = 0;
- entry->image_fd_height = 0;
- entry->prefetched = FALSE;
- entry->prefetch_type_id = 0;
- entry->age = 0;
- entry->prefetched_dirty = FALSE;
+ /* initialize cache image related fields */
+ entry->include_in_image = FALSE;
+ entry->lru_rank = 0;
+ entry->image_dirty = FALSE;
+ entry->fd_parent_count = 0;
+ entry->fd_parent_addrs = NULL;
+ entry->fd_child_count = 0;
+ entry->fd_dirty_child_count = 0;
+ entry->image_fd_height = 0;
+ entry->prefetched = FALSE;
+ entry->prefetch_type_id = 0;
+ entry->age = 0;
+ entry->prefetched_dirty = FALSE;
#ifndef NDEBUG /* debugging field */
- entry->serialization_count = 0;
+ entry->serialization_count = 0;
#endif /* NDEBUG */
- entry->tl_next = NULL;
- entry->tl_prev = NULL;
- entry->tag_info = NULL;
+ entry->tl_next = NULL;
+ entry->tl_prev = NULL;
+ entry->tag_info = NULL;
- H5C__RESET_CACHE_ENTRY_STATS(entry);
+ H5C__RESET_CACHE_ENTRY_STATS(entry);
- ret_value = thing;
+ ret_value = thing;
done:
- /* Cleanup on error */
- if (NULL == ret_value) {
- /* Release resources */
- if (thing && type->free_icr(thing) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
- if (image)
- image = (uint8_t *)H5MM_xfree(image);
- } /* end if */
+ /* Cleanup on error */
+ if (NULL == ret_value) {
+ /* Release resources */
+ if (thing && type->free_icr(thing) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
+ if (image)
+ image = (uint8_t *)H5MM_xfree(image);
+ } /* end if */
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_load_entry() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__load_entry() */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__make_space_in_cache
- *
- * Purpose: Attempt to evict cache entries until the index_size
- * is at least needed_space below max_cache_size.
- *
- * In passing, also attempt to bring cLRU_list_size to a
- * value greater than min_clean_size.
- *
- * Depending on circumstances, both of these goals may
- * be impossible, as in parallel mode, we must avoid generating
- * a write as part of a read (to avoid deadlock in collective
- * I/O), and in all cases, it is possible (though hopefully
- * highly unlikely) that the protected list may exceed the
- * maximum size of the cache.
- *
- * Thus the function simply does its best, returning success
- * unless an error is encountered.
- *
- * Observe that this function cannot occasion a read.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 5/14/04
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted)
- {
- H5C_t *cache_ptr = f->shared->cache;
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__make_space_in_cache
+ *
+ * Purpose: Attempt to evict cache entries until the index_size
+ * is at least needed_space below max_cache_size.
+ *
+ * In passing, also attempt to bring cLRU_list_size to a
+ * value greater than min_clean_size.
+ *
+ * Depending on circumstances, both of these goals may
+ * be impossible, as in parallel mode, we must avoid generating
+ * a write as part of a read (to avoid deadlock in collective
+ * I/O), and in all cases, it is possible (though hopefully
+ * highly unlikely) that the protected list may exceed the
+ * maximum size of the cache.
+ *
+ * Thus the function simply does its best, returning success
+ * unless an error is encountered.
+ *
+ * Observe that this function cannot occasion a read.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 5/14/04
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted)
+{
+ H5C_t *cache_ptr = f->shared->cache;
#if H5C_COLLECT_CACHE_STATS
- int32_t clean_entries_skipped = 0;
- int32_t dirty_pf_entries_skipped = 0;
- int32_t total_entries_scanned = 0;
+ int32_t clean_entries_skipped = 0;
+ int32_t dirty_pf_entries_skipped = 0;
+ int32_t total_entries_scanned = 0;
#endif /* H5C_COLLECT_CACHE_STATS */
- uint32_t entries_examined = 0;
- uint32_t initial_list_len;
- size_t empty_space;
- hbool_t reentrant_call = FALSE;
- hbool_t prev_is_dirty = FALSE;
- hbool_t didnt_flush_entry = FALSE;
- hbool_t restart_scan;
- H5C_cache_entry_t *entry_ptr;
- H5C_cache_entry_t *prev_ptr;
- H5C_cache_entry_t *next_ptr;
- uint32_t num_corked_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ uint32_t entries_examined = 0;
+ uint32_t initial_list_len;
+ size_t empty_space;
+ hbool_t reentrant_call = FALSE;
+ hbool_t prev_is_dirty = FALSE;
+ hbool_t didnt_flush_entry = FALSE;
+ hbool_t restart_scan;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *prev_ptr;
+ H5C_cache_entry_t *next_ptr;
+ uint32_t num_corked_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE
- /* Sanity checks */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
-
- /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this
- * is a re-entrant call via a client callback called in the make
- * space in cache process. To avoid an infinite recursion, set
- * reentrant_call to TRUE, and goto done.
- */
- if (cache_ptr->msic_in_progress) {
- reentrant_call = TRUE;
- HGOTO_DONE(SUCCEED);
- } /* end if */
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
- cache_ptr->msic_in_progress = TRUE;
+ /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this
+ * is a re-entrant call via a client callback called in the make
+ * space in cache process. To avoid an infinite recursion, set
+ * reentrant_call to TRUE, and goto done.
+ */
+ if (cache_ptr->msic_in_progress) {
+ reentrant_call = TRUE;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
- if (write_permitted) {
- restart_scan = FALSE;
- initial_list_len = cache_ptr->LRU_list_len;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ cache_ptr->msic_in_progress = TRUE;
- if (cache_ptr->index_size >= cache_ptr->max_cache_size)
- empty_space = 0;
- else
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
+ if (write_permitted) {
+ restart_scan = FALSE;
+ initial_list_len = cache_ptr->LRU_list_len;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size)
+ empty_space = 0;
+ else
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) ||
- ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) &&
- (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!(entry_ptr->is_protected));
- HDassert(!(entry_ptr->is_read_only));
- HDassert((entry_ptr->ro_ref_count) == 0);
+ while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) ||
+ ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) &&
+ (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert((entry_ptr->ro_ref_count) == 0);
- next_ptr = entry_ptr->next;
- prev_ptr = entry_ptr->prev;
+ next_ptr = entry_ptr->next;
+ prev_ptr = entry_ptr->prev;
- if (prev_ptr != NULL)
- prev_is_dirty = prev_ptr->is_dirty;
+ if (prev_ptr != NULL)
+ prev_is_dirty = prev_ptr->is_dirty;
- if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) {
+ if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) {
- /* Skip "dirty" corked entries. */
- ++num_corked_entries;
- didnt_flush_entry = TRUE;
- }
- else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) &&
- (!entry_ptr->prefetched_dirty)) {
+ /* Skip "dirty" corked entries. */
+ ++num_corked_entries;
+ didnt_flush_entry = TRUE;
+ }
+ else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) &&
+ (!entry_ptr->prefetched_dirty)) {
- didnt_flush_entry = FALSE;
+ didnt_flush_entry = FALSE;
- if (entry_ptr->is_dirty) {
+ if (entry_ptr->is_dirty) {
#if H5C_COLLECT_CACHE_STATS
- if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) {
+ if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) {
- cache_ptr->entries_scanned_to_make_space++;
- }
+ cache_ptr->entries_scanned_to_make_space++;
+ }
#endif /* H5C_COLLECT_CACHE_STATS */
- /* reset entries_removed_counter and
- * last_entry_removed_ptr prior to the call to
- * H5C__flush_single_entry() so that we can spot
- * unexpected removals of entries from the cache,
- * and set the restart_scan flag if proceeding
- * would be likely to cause us to scan an entry
- * that is no longer in the cache.
- */
- cache_ptr->entries_removed_counter = 0;
- cache_ptr->last_entry_removed_ptr = NULL;
+ /* reset entries_removed_counter and
+ * last_entry_removed_ptr prior to the call to
+ * H5C__flush_single_entry() so that we can spot
+ * unexpected removals of entries from the cache,
+ * and set the restart_scan flag if proceeding
+ * would be likely to cause us to scan an entry
+ * that is no longer in the cache.
+ */
+ cache_ptr->entries_removed_counter = 0;
+ cache_ptr->last_entry_removed_ptr = NULL;
- if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- if ((cache_ptr->entries_removed_counter > 1) ||
- (cache_ptr->last_entry_removed_ptr == prev_ptr))
+ if ((cache_ptr->entries_removed_counter > 1) ||
+ (cache_ptr->last_entry_removed_ptr == prev_ptr))
- restart_scan = TRUE;
- }
- else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size
+ restart_scan = TRUE;
+ }
+ else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size
#ifdef H5_HAVE_PARALLEL
- && !(entry_ptr->coll_access)
+ && !(entry_ptr->coll_access)
#endif /* H5_HAVE_PARALLEL */
- ) {
+ ) {
#if H5C_COLLECT_CACHE_STATS
- cache_ptr->entries_scanned_to_make_space++;
+ cache_ptr->entries_scanned_to_make_space++;
#endif /* H5C_COLLECT_CACHE_STATS */
- if (H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- }
- else {
- /* We have enough space so don't flush clean entry. */
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ }
+ else {
+ /* We have enough space so don't flush clean entry. */
#if H5C_COLLECT_CACHE_STATS
- clean_entries_skipped++;
+ clean_entries_skipped++;
#endif /* H5C_COLLECT_CACHE_STATS */
- didnt_flush_entry = TRUE;
- }
+ didnt_flush_entry = TRUE;
+ }
#if H5C_COLLECT_CACHE_STATS
- total_entries_scanned++;
+ total_entries_scanned++;
#endif /* H5C_COLLECT_CACHE_STATS */
- }
- else {
+ }
+ else {
- /* Skip epoch markers, entries that are in the process
- * of being flushed, and entries marked as prefetched_dirty
- * (occurs in the R/O case only).
- */
- didnt_flush_entry = TRUE;
+ /* Skip epoch markers, entries that are in the process
+ * of being flushed, and entries marked as prefetched_dirty
+ * (occurs in the R/O case only).
+ */
+ didnt_flush_entry = TRUE;
#if H5C_COLLECT_CACHE_STATS
- if (entry_ptr->prefetched_dirty)
- dirty_pf_entries_skipped++;
+ if (entry_ptr->prefetched_dirty)
+ dirty_pf_entries_skipped++;
#endif /* H5C_COLLECT_CACHE_STATS */
- }
-
- if (prev_ptr != NULL) {
+ }
- if (didnt_flush_entry) {
+ if (prev_ptr != NULL) {
- /* epoch markers don't get flushed, and we don't touch
- * entries that are in the process of being flushed.
- * Hence no need for sanity checks, as we haven't
- * flushed anything. Thus just set entry_ptr to prev_ptr
- * and go on.
- */
- entry_ptr = prev_ptr;
- }
- else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) ||
- (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) ||
- (prev_ptr->is_pinned)) {
+ if (didnt_flush_entry) {
- /* something has happened to the LRU -- start over
- * from the tail.
- */
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
- H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
- }
- else {
+ /* epoch markers don't get flushed, and we don't touch
+ * entries that are in the process of being flushed.
+ * Hence no need for sanity checks, as we haven't
+ * flushed anything. Thus just set entry_ptr to prev_ptr
+ * and go on.
+ */
+ entry_ptr = prev_ptr;
+ }
+ else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) ||
+ (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) {
- entry_ptr = prev_ptr;
- }
+ /* something has happened to the LRU -- start over
+ * from the tail.
+ */
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
}
else {
- entry_ptr = NULL;
+ entry_ptr = prev_ptr;
}
+ }
+ else {
- entries_examined++;
+ entry_ptr = NULL;
+ }
- if (cache_ptr->index_size >= cache_ptr->max_cache_size) {
+ entries_examined++;
- empty_space = 0;
- }
- else {
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size) {
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- }
+ empty_space = 0;
+ }
+ else {
- HDassert(cache_ptr->index_size ==
- (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
}
+ HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
+ }
+
#if H5C_COLLECT_CACHE_STATS
- cache_ptr->calls_to_msic++;
+ cache_ptr->calls_to_msic++;
- cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped;
- cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped;
- cache_ptr->total_entries_scanned_in_msic += total_entries_scanned;
+ cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped;
+ cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped;
+ cache_ptr->total_entries_scanned_in_msic += total_entries_scanned;
- if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) {
+ if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) {
- cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped;
- }
+ cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped;
+ }
- if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic)
- cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped;
+ if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic)
+ cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped;
- if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) {
+ if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) {
- cache_ptr->max_entries_scanned_in_msic = total_entries_scanned;
- }
+ cache_ptr->max_entries_scanned_in_msic = total_entries_scanned;
+ }
#endif /* H5C_COLLECT_CACHE_STATS */
- /* NEED: work on a better assert for corked entries */
- HDassert((entries_examined > (2 * initial_list_len)) ||
- ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) >
- cache_ptr->max_cache_size) ||
- ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) ||
- ((num_corked_entries)));
+ /* NEED: work on a better assert for corked entries */
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) >
+ cache_ptr->max_cache_size) ||
+ ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) ||
+ ((num_corked_entries)));
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- HDassert((entries_examined > (2 * initial_list_len)) ||
- (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size));
- HDassert((entries_examined > (2 * initial_list_len)) ||
- (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size));
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size));
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size));
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- }
- else {
+ }
+ else {
- HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
+ HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- initial_list_len = cache_ptr->cLRU_list_len;
- entry_ptr = cache_ptr->cLRU_tail_ptr;
+ initial_list_len = cache_ptr->cLRU_list_len;
+ entry_ptr = cache_ptr->cLRU_tail_ptr;
- while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
- (entries_examined <= initial_list_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));
+ while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
+ (entries_examined <= initial_list_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));
- prev_ptr = entry_ptr->aux_prev;
+ prev_ptr = entry_ptr->aux_prev;
- if ((!(entry_ptr->prefetched_dirty))
+ if ((!(entry_ptr->prefetched_dirty))
#ifdef H5_HAVE_PARALLEL
- && (!(entry_ptr->coll_access))
+ && (!(entry_ptr->coll_access))
#endif /* H5_HAVE_PARALLEL */
- ) {
- if (H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ ) {
+ if (H5C__flush_single_entry(
+ f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- } /* end if */
+ } /* end if */
- /* we are scanning the clean LRU, so the serialize function
- * will not be called on any entry -- thus there is no
- * concern about the list being modified out from under
- * this function.
- */
+ /* we are scanning the clean LRU, so the serialize function
+ * will not be called on any entry -- thus there is no
+ * concern about the list being modified out from under
+ * this function.
+ */
- entry_ptr = prev_ptr;
- entries_examined++;
- }
-#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+ entry_ptr = prev_ptr;
+ entries_examined++;
}
+#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+ }
done:
- /* Sanity checks */
- HDassert(cache_ptr->msic_in_progress);
- if (!reentrant_call)
- cache_ptr->msic_in_progress = FALSE;
- HDassert((!reentrant_call) || (cache_ptr->msic_in_progress));
+ /* Sanity checks */
+ HDassert(cache_ptr->msic_in_progress);
+ if (!reentrant_call)
+ cache_ptr->msic_in_progress = FALSE;
+ HDassert((!reentrant_call) || (cache_ptr->msic_in_progress));
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__make_space_in_cache() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__make_space_in_cache() */
/*-------------------------------------------------------------------------
*
- * Function: H5C_validate_lru_list
+ * Function: H5C__validate_lru_list
*
* Purpose: Debugging function that scans the LRU list for errors.
*
- * If an error is detected, the function generates a
- * diagnostic and returns FAIL. If no error is detected,
- * the function returns SUCCEED.
+ * If an error is detected, the function generates a
+ * diagnostic and returns FAIL. If no error is detected,
+ * the function returns SUCCEED.
*
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* 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)
+{
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- static herr_t 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;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- 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))) {
-
- 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))) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
- }
+ FUNC_ENTER_STATIC
- entry_ptr = cache_ptr->LRU_head_ptr;
- while (entry_ptr != NULL) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if ((entry_ptr != cache_ptr->LRU_head_ptr) &&
- ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ if (cache_ptr->LRU_list_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- if ((entry_ptr != cache_ptr->LRU_tail_ptr) &&
- ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
- if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) {
+ 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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- }
+ 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")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ 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")
- if ((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size)) {
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- }
+ 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)
+ HDassert(0);
- if (ret_value != SUCCEED) {
-
- HDassert(0);
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-
- } /* H5C_validate_lru_list() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* 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.
*
- * If an error is detected, the function generates a
- * diagnostic and returns FAIL. If no error is detected,
- * the function returns SUCCEED.
+ * If an error is detected, the function generates a
+ * diagnostic and returns FAIL. If no error is detected,
+ * the function returns SUCCEED.
*
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* 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)
+{
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- static herr_t 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;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- 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))) {
-
- 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))) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
- }
-
- entry_ptr = cache_ptr->pel_head_ptr;
- while (entry_ptr != NULL) {
+ FUNC_ENTER_STATIC
- if ((entry_ptr != cache_ptr->pel_head_ptr) &&
- ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ 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 ((entry_ptr != cache_ptr->pel_tail_ptr) &&
- ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) {
+ if (cache_ptr->pel_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
- if (!entry_ptr->is_pinned) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- if (!((entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache))) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- }
+ if (!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- if ((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size)) {
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
- }
+ 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)
+ HDassert(0);
- if (ret_value != SUCCEED) {
-
- HDassert(0);
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-
- } /* H5C_validate_pinned_entry_list() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* 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.
*
- * If an error is detected, the function generates a
- * diagnostic and returns FAIL. If no error is detected,
- * the function returns SUCCEED.
+ * If an error is detected, the function generates a
+ * diagnostic and returns FAIL. If no error is detected,
+ * the function returns SUCCEED.
*
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* 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)
+{
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- static herr_t 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;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- 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))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
-
- 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))) {
-
- 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))) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
- }
+ FUNC_ENTER_STATIC
- entry_ptr = cache_ptr->pl_head_ptr;
- while (entry_ptr != NULL) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if ((entry_ptr != cache_ptr->pl_head_ptr) &&
- ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) {
+ if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) &&
+ (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ if (cache_ptr->pl_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- 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 ((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 (!entry_ptr->is_protected) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- if ((entry_ptr->is_read_only) && (entry_ptr->ro_ref_count <= 0)) {
+ 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")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- }
+ if (!entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- if ((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size)) {
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
- }
+ 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)
+ HDassert(0);
- if (ret_value != SUCCEED) {
-
- HDassert(0);
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-
- } /* H5C_validate_protected_entry_list() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* 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
- * an entry to be in the skip list twice.
+ * is in present. We need this, as it is possible for
+ * an entry to be in the skip list twice.
*
* Return: FALSE if the entry is not in the skip list, and TRUE
- * if it is.
+ * if it is.
*
* 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)
+{
+ H5SL_node_t *node_ptr;
+ hbool_t in_slist;
- static hbool_t 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;
+ 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;
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
+ entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_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);
- 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
+ node_ptr = H5SL_next(node_ptr);
+ }
- if (entry_ptr == target_ptr) {
+ return (in_slist);
+} /* H5C__entry_in_skip_list() */
+#endif /* H5C_DO_SLIST_SANITY_CHECKS */
- in_slist = TRUE;
- }
- else {
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_marked_entries
+ *
+ * Purpose: Flushes all marked entries in the cache.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * 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
+ *
+ *-------------------------------------------------------------------------
+ */
- node_ptr = H5SL_next(node_ptr);
- }
- }
+herr_t
+H5C__flush_marked_entries(H5F_t *f)
+{
+ herr_t ret_value = SUCCEED;
- return (in_slist);
+ FUNC_ENTER_PACKAGE
- } /* H5C_entry_in_skip_list() */
-#endif /* H5C_DO_SLIST_SANITY_CHECKS */
+ /* Assertions */
+ HDassert(f != NULL);
- /*-------------------------------------------------------------------------
- *
- * Function: H5C__flush_marked_entries
- *
- * Purpose: Flushes all marked entries in the cache.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- * Programmer: Mike McGreevy
- * November 3, 2010
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C__flush_marked_entries(H5F_t * f)
- {
- herr_t ret_value = SUCCEED;
+ /* 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")
- FUNC_ENTER_PACKAGE
+ /* Flush all marked entries */
+ if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
- /* Assertions */
- HDassert(f != NULL);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
- /* Flush all marked entries */
- 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 */
- /*-------------------------------------------------------------------------
- *
- * Function: H5C_cork
- *
- * Purpose: To cork/uncork/get cork status of an object depending on "action":
- * H5C__SET_CORK:
- * To cork the object
- * Return error if the object is already corked
- * H5C__UNCORK:
- * To uncork the obejct
- * Return error if the object is not corked
- * H5C__GET_CORKED:
- * To retrieve the cork status of an object in
- * the parameter "corked"
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * January 2014
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
- {
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- herr_t ret_value = SUCCEED;
+ FUNC_LEAVE_NOAPI(ret_value)
- FUNC_ENTER_NOAPI_NOINIT
+} /* H5C__flush_marked_entries */
- /* Assertions */
- HDassert(cache_ptr != NULL);
- HDassert(H5F_addr_defined(obj_addr));
- HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED);
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_cork
+ *
+ * Purpose: To cork/uncork/get cork status of an object depending on "action":
+ * H5C__SET_CORK:
+ * To cork the object
+ * Return error if the object is already corked
+ * H5C__UNCORK:
+ * To uncork the obejct
+ * Return error if the object is not corked
+ * H5C__GET_CORKED:
+ * To retrieve the cork status of an object in
+ * the parameter "corked"
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ * January 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
+{
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ herr_t ret_value = SUCCEED;
- /* Search the list of corked object addresses in the cache */
- tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr);
+ FUNC_ENTER_NOAPI_NOINIT
- if (H5C__GET_CORKED == action) {
- HDassert(corked);
- if (tag_info != NULL && tag_info->corked)
- *corked = TRUE;
- else
- *corked = FALSE;
- } /* end if */
- else {
- /* Sanity check */
- HDassert(H5C__SET_CORK == action || H5C__UNCORK == action);
-
- /* Perform appropriate action */
- if (H5C__SET_CORK == action) {
- /* Check if this is the first entry for this tagged object */
- if (NULL == tag_info) {
- /* Allocate new tag info struct */
- if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry")
-
- /* Set the tag for all entries */
- tag_info->tag = obj_addr;
-
- /* Insert tag info into skip list */
- if (H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
- } /* end if */
- else {
- /* Check for object already corked */
- if (tag_info->corked)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked")
- HDassert(tag_info->entry_cnt > 0 && tag_info->head);
- } /* end else */
+ /* Assertions */
+ HDassert(cache_ptr != NULL);
+ HDassert(H5F_addr_defined(obj_addr));
+ HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED);
- /* Set the corked status for the entire object */
- tag_info->corked = TRUE;
- cache_ptr->num_objs_corked++;
+ /* Search the list of corked object addresses in the cache */
+ tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr);
+ if (H5C__GET_CORKED == action) {
+ HDassert(corked);
+ if (tag_info != NULL && tag_info->corked)
+ *corked = TRUE;
+ else
+ *corked = FALSE;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(H5C__SET_CORK == action || H5C__UNCORK == action);
+
+ /* Perform appropriate action */
+ if (H5C__SET_CORK == action) {
+ /* Check if this is the first entry for this tagged object */
+ if (NULL == tag_info) {
+ /* Allocate new tag info struct */
+ if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry")
+
+ /* Set the tag for all entries */
+ tag_info->tag = obj_addr;
+
+ /* Insert tag info into skip list */
+ if (H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
} /* end if */
else {
- /* Sanity check */
- HDassert(tag_info);
+ /* Check for object already corked */
+ if (tag_info->corked)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked")
+ HDassert(tag_info->entry_cnt > 0 && tag_info->head);
+ } /* end else */
- /* Check for already uncorked */
- if (!tag_info->corked)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked")
+ /* Set the corked status for the entire object */
+ tag_info->corked = TRUE;
+ cache_ptr->num_objs_corked++;
- /* Set the corked status for the entire object */
- tag_info->corked = FALSE;
- cache_ptr->num_objs_corked--;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(tag_info);
- /* Remove the tag info from the tag list, if there's no more entries with this tag */
- if (0 == tag_info->entry_cnt) {
- /* Sanity check */
- HDassert(NULL == tag_info->head);
+ /* Check for already uncorked */
+ if (!tag_info->corked)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked")
- if (H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list")
+ /* Set the corked status for the entire object */
+ tag_info->corked = FALSE;
+ cache_ptr->num_objs_corked--;
- /* Release the tag info */
- tag_info = H5FL_FREE(H5C_tag_info_t, tag_info);
- } /* end if */
- else
- HDassert(NULL != tag_info->head);
- } /* end else */
- } /* end else */
+ /* Remove the tag info from the tag list, if there's no more entries with this tag */
+ if (0 == tag_info->entry_cnt) {
+ /* Sanity check */
+ HDassert(NULL == tag_info->head);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C_cork() */
+ if (H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list")
- /*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_dirty()
- *
- * Purpose: Recursively propagate the flush_dep_ndirty_children flag
- * up the dependency chain in response to entry either
- * becoming dirty or having its flush_dep_ndirty_children
- * increased from 0.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 11/13/12
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry)
- {
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ /* Release the tag info */
+ tag_info = H5FL_FREE(H5C_tag_info_t, tag_info);
+ } /* end if */
+ else
+ HDassert(NULL != tag_info->head);
+ } /* end else */
+ } /* end else */
- FUNC_ENTER_STATIC
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_cork() */
- /* Sanity checks */
- HDassert(entry);
+/*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_dirty()
+ *
+ * Purpose: Recursively propagate the flush_dep_ndirty_children flag
+ * up the dependency chain in response to entry either
+ * becoming dirty or having its flush_dep_ndirty_children
+ * increased from 0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 11/13/12
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Iterate over the parent entries, if any */
- for (u = 0; u < entry->flush_dep_nparents; u++) {
- /* Sanity check */
- HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children <
- entry->flush_dep_parent[u]->flush_dep_nchildren);
+ FUNC_ENTER_STATIC
- /* Adjust the parent's number of dirty children */
- entry->flush_dep_parent[u]->flush_dep_ndirty_children++;
+ /* Sanity checks */
+ HDassert(entry);
- /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
- if (entry->flush_dep_parent[u]->type->notify &&
- (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED,
- entry->flush_dep_parent[u]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry dirty flag set")
- } /* end for */
+ /* Iterate over the parent entries, if any */
+ for (u = 0; u < entry->flush_dep_nparents; u++) {
+ /* Sanity check */
+ HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children <
+ entry->flush_dep_parent[u]->flush_dep_nchildren);
+
+ /* Adjust the parent's number of dirty children */
+ entry->flush_dep_parent[u]->flush_dep_ndirty_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if (entry->flush_dep_parent[u]->type->notify &&
+ (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED,
+ entry->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag set")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__mark_flush_dep_dirty() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__mark_flush_dep_dirty() */
- /*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_clean()
- *
- * Purpose: Recursively propagate the flush_dep_ndirty_children flag
- * up the dependency chain in response to entry either
- * becoming clean or having its flush_dep_ndirty_children
- * reduced to 0.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 11/13/12
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry)
- {
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_clean()
+ *
+ * Purpose: Recursively propagate the flush_dep_ndirty_children flag
+ * up the dependency chain in response to entry either
+ * becoming clean or having its flush_dep_ndirty_children
+ * reduced to 0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 11/13/12
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry)
+{
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(entry);
+ /* Sanity checks */
+ HDassert(entry);
- /* Iterate over the parent entries, if any */
- /* Note reverse iteration order, in case the callback removes the flush
- * dependency - QAK, 2017/08/12
- */
- for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) {
- /* Sanity check */
- HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0);
+ /* Iterate over the parent entries, if any */
+ /* Note reverse iteration order, in case the callback removes the flush
+ * dependency - QAK, 2017/08/12
+ */
+ for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) {
+ /* Sanity check */
+ HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0);
- /* Adjust the parent's number of dirty children */
- entry->flush_dep_parent[i]->flush_dep_ndirty_children--;
+ /* Adjust the parent's number of dirty children */
+ entry->flush_dep_parent[i]->flush_dep_ndirty_children--;
- /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
- if (entry->flush_dep_parent[i]->type->notify &&
- (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED,
- entry->flush_dep_parent[i]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry dirty flag reset")
- } /* end for */
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if (entry->flush_dep_parent[i]->type->notify &&
+ (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED,
+ entry->flush_dep_parent[i]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag reset")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__mark_flush_dep_clean() */
-
- /*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_serialized()
- *
- * Purpose: Decrement the flush_dep_nunser_children fields of all the
- * target entry's flush dependency parents in response to
- * the target entry becoming serialized.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 8/30/16
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr)
- {
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__mark_flush_dep_clean() */
- /* Sanity checks */
- HDassert(entry_ptr);
+/*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_serialized()
+ *
+ * Purpose: Decrement the flush_dep_nunser_children fields of all the
+ * target entry's flush dependency parents in response to
+ * the target entry becoming serialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 8/30/16
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry_ptr)
+{
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Iterate over the parent entries, if any */
- /* Note reverse iteration order, in case the callback removes the flush
- * dependency - QAK, 2017/08/12
- */
- for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) {
- /* Sanity checks */
- HDassert(entry_ptr->flush_dep_parent);
- HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0);
+ FUNC_ENTER_STATIC
- /* decrement the parents number of unserialized children */
- entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--;
+ /* Sanity checks */
+ HDassert(entry_ptr);
- /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
- if (entry_ptr->flush_dep_parent[i]->type->notify &&
- (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED,
- entry_ptr->flush_dep_parent[i]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry serialized flag set")
- } /* end for */
+ /* Iterate over the parent entries, if any */
+ /* Note reverse iteration order, in case the callback removes the flush
+ * dependency - QAK, 2017/08/12
+ */
+ for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) {
+ /* Sanity checks */
+ HDassert(entry_ptr->flush_dep_parent);
+ HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0);
+
+ /* decrement the parents number of unserialized children */
+ entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--;
+
+ /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
+ if (entry_ptr->flush_dep_parent[i]->type->notify &&
+ (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED,
+ entry_ptr->flush_dep_parent[i]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag set")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__mark_flush_dep_serialized() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__mark_flush_dep_serialized() */
- /*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_unserialized()
- *
- * Purpose: Increment the flush_dep_nunser_children fields of all the
- * target entry's flush dependency parents in response to
- * the target entry becoming unserialized.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 8/30/16
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr)
- {
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_unserialized()
+ *
+ * Purpose: Increment the flush_dep_nunser_children fields of all the
+ * target entry's flush dependency parents in response to
+ * the target entry becoming unserialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 8/30/16
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C__mark_flush_dep_unserialized(H5C_cache_entry_t *entry_ptr)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(entry_ptr);
+ /* Sanity checks */
+ HDassert(entry_ptr);
- /* Iterate over the parent entries, if any */
- for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
- /* Sanity check */
- HDassert(entry_ptr->flush_dep_parent);
- HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children <
- entry_ptr->flush_dep_parent[u]->flush_dep_nchildren);
-
- /* increment parents number of usserialized children */
- entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++;
-
- /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
- if (entry_ptr->flush_dep_parent[u]->type->notify &&
- (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED,
- entry_ptr->flush_dep_parent[u]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
- "can't notify parent about child entry serialized flag reset")
- } /* end for */
+ /* Iterate over the parent entries, if any */
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ /* Sanity check */
+ HDassert(entry_ptr->flush_dep_parent);
+ HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children <
+ entry_ptr->flush_dep_parent[u]->flush_dep_nchildren);
+
+ /* increment parents number of usserialized children */
+ entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
+ if (entry_ptr->flush_dep_parent[u]->type->notify &&
+ (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED,
+ entry_ptr->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag reset")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__mark_flush_dep_unserialized() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__mark_flush_dep_unserialized() */
#ifndef NDEBUG
- /*-------------------------------------------------------------------------
- * Function: H5C__assert_flush_dep_nocycle()
- *
- * Purpose: Assert recursively that base_entry is not the same as
- * entry, and perform the same assertion on all of entry's
- * flush dependency parents. This is used to detect cycles
- * created by flush dependencies.
- *
- * Return: void
- *
- * Programmer: Neil Fortner
- * 12/10/12
- *
- *-------------------------------------------------------------------------
- */
- static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry,
- const H5C_cache_entry_t *base_entry)
- {
- unsigned u; /* Local index variable */
+/*-------------------------------------------------------------------------
+ * Function: H5C__assert_flush_dep_nocycle()
+ *
+ * Purpose: Assert recursively that base_entry is not the same as
+ * entry, and perform the same assertion on all of entry's
+ * flush dependency parents. This is used to detect cycles
+ * created by flush dependencies.
+ *
+ * Return: void
+ *
+ * Programmer: Neil Fortner
+ * 12/10/12
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, const H5C_cache_entry_t *base_entry)
+{
+ unsigned u; /* Local index variable */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* Sanity checks */
- HDassert(entry);
- HDassert(base_entry);
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(base_entry);
- /* Make sure the entries are not the same */
- HDassert(base_entry != entry);
+ /* Make sure the entries are not the same */
+ HDassert(base_entry != entry);
- /* Iterate over entry's parents (if any) */
- for (u = 0; u < entry->flush_dep_nparents; u++)
- H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry);
+ /* Iterate over entry's parents (if any) */
+ for (u = 0; u < entry->flush_dep_nparents; u++)
+ H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry);
- FUNC_LEAVE_NOAPI_VOID
- } /* H5C__assert_flush_dep_nocycle() */
+ FUNC_LEAVE_NOAPI_VOID
+} /* H5C__assert_flush_dep_nocycle() */
#endif /* NDEBUG */
- /*-------------------------------------------------------------------------
- * Function: H5C__serialize_cache
- *
- * Purpose: Serialize (i.e. construct an on disk image) for all entries
- * in the metadata cache including clean entries.
- *
- * Note that flush dependencies and "flush me last" flags
- * must be observed in the serialization process.
- *
- * Note also that entries may be loaded, flushed, evicted,
- * expunged, relocated, resized, or removed from the cache
- * during this process, just as these actions may occur during
- * a regular flush.
- *
- * However, we are given that the cache will contain no protected
- * entries on entry to this routine (although entries may be
- * briefly protected and then unprotected during the serialize
- * process).
- *
- * The objective of this routine is serialize all entries and
- * to force all entries into their actual locations on disk.
- *
- * The initial need for this routine is to settle all entries
- * in the cache prior to construction of the metadata cache
- * image so that the size of the cache image can be calculated.
- * However, I gather that other uses for the routine are
- * under consideration.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 7/22/15
- *
- *-------------------------------------------------------------------------
- */
- herr_t H5C__serialize_cache(H5F_t * f)
- {
+/*-------------------------------------------------------------------------
+ * Function: H5C__serialize_cache
+ *
+ * Purpose: Serialize (i.e. construct an on disk image) for all entries
+ * in the metadata cache including clean entries.
+ *
+ * Note that flush dependencies and "flush me last" flags
+ * must be observed in the serialization process.
+ *
+ * Note also that entries may be loaded, flushed, evicted,
+ * expunged, relocated, resized, or removed from the cache
+ * during this process, just as these actions may occur during
+ * a regular flush.
+ *
+ * However, we are given that the cache will contain no protected
+ * entries on entry to this routine (although entries may be
+ * briefly protected and then unprotected during the serialize
+ * process).
+ *
+ * The objective of this routine is serialize all entries and
+ * to force all entries into their actual locations on disk.
+ *
+ * The initial need for this routine is to settle all entries
+ * in the cache prior to construction of the metadata cache
+ * image so that the size of the cache image can be calculated.
+ * However, I gather that other uses for the routine are
+ * under consideration.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 7/22/15
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C__serialize_cache(H5F_t *f)
+{
#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_t * cache_ptr;
- herr_t ret_value = SUCCEED;
+ H5C_ring_t ring;
+ H5C_t * cache_ptr;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE
- /* 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->slist_ptr);
+ /* 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->slist_ptr);
#if H5C_DO_SANITY_CHECKS
- HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ 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++) {
- 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];
- dirty_index_size += cache_ptr->dirty_index_ring_size[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];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
- slist_len += cache_ptr->slist_ring_len[i];
- slist_size += cache_ptr->slist_ring_size[i];
- } /* end for */
+ 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);
- HDassert(cache_ptr->index_size == index_size);
- HDassert(cache_ptr->clean_index_size == clean_index_size);
- HDassert(cache_ptr->dirty_index_size == dirty_index_size);
- HDassert(cache_ptr->slist_len == slist_len);
- HDassert(cache_ptr->slist_size == slist_size);
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
#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))
- 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 */
#ifndef NDEBUG
- /* if this is a debug build, set the serialization_count field of
- * each entry in the cache to zero before we start the serialization.
- * This allows us to detect the case in which any entry is serialized
- * more than once (a performance issues), and more importantly, the
- * case is which any flush depencency parent is serializes more than
- * once (a correctness issue).
- */
- {
- H5C_cache_entry_t *scan_ptr = NULL;
-
- scan_ptr = cache_ptr->il_head;
- while (scan_ptr != NULL) {
- HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- scan_ptr->serialization_count = 0;
- scan_ptr = scan_ptr->il_next;
- } /* end while */
- } /* end block */
-#endif /* NDEBUG */
-
- /* set cache_ptr->serialization_in_progress to TRUE, and back
- * to FALSE at the end of the function. Must maintain this flag
- * to support H5C_get_serialization_in_progress(), which is in
- * turn required to support sanity checking in some cache
- * clients.
- */
- HDassert(!cache_ptr->serialization_in_progress);
- cache_ptr->serialization_in_progress = TRUE;
+ /* if this is a debug build, set the serialization_count field of
+ * each entry in the cache to zero before we start the serialization.
+ * This allows us to detect the case in which any entry is serialized
+ * more than once (a performance issues), and more importantly, the
+ * case is which any flush depencency parent is serializes more than
+ * once (a correctness issue).
+ */
+ {
+ H5C_cache_entry_t *scan_ptr = NULL;
- /* Serialize each ring, starting from the outermost ring and
- * working inward.
- */
- ring = H5C_RING_USER;
- while (ring < H5C_RING_NTYPES) {
- HDassert(cache_ptr->close_warning_received);
- switch (ring) {
- case H5C_RING_USER:
- break;
+ scan_ptr = cache_ptr->il_head;
+ while (scan_ptr != NULL) {
+ HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ scan_ptr->serialization_count = 0;
+ scan_ptr = scan_ptr->il_next;
+ } /* end while */
+ } /* end block */
+#endif /* NDEBUG */
- case H5C_RING_RDFSM:
- /* Settle raw data FSM */
- if (!cache_ptr->rdfsm_settled)
- if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed")
- break;
+ /* set cache_ptr->serialization_in_progress to TRUE, and back
+ * to FALSE at the end of the function. Must maintain this flag
+ * to support H5C_get_serialization_in_progress(), which is in
+ * turn required to support sanity checking in some cache
+ * clients.
+ */
+ HDassert(!cache_ptr->serialization_in_progress);
+ cache_ptr->serialization_in_progress = TRUE;
- case H5C_RING_MDFSM:
- /* Settle metadata FSM */
- if (!cache_ptr->mdfsm_settled)
- if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed")
- break;
+ /* Serialize each ring, starting from the outermost ring and
+ * working inward.
+ */
+ ring = H5C_RING_USER;
+ while (ring < H5C_RING_NTYPES) {
+ HDassert(cache_ptr->close_warning_received);
+ switch (ring) {
+ case H5C_RING_USER:
+ break;
- case H5C_RING_SBE:
- case H5C_RING_SB:
- break;
+ case H5C_RING_RDFSM:
+ /* Settle raw data FSM */
+ if (!cache_ptr->rdfsm_settled)
+ if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed")
+ break;
- default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!")
- break;
- } /* end switch */
+ case H5C_RING_MDFSM:
+ /* Settle metadata FSM */
+ if (!cache_ptr->mdfsm_settled)
+ if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed")
+ break;
- if (H5C__serialize_ring(f, ring) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed")
+ case H5C_RING_SBE:
+ case H5C_RING_SB:
+ break;
- ring++;
- } /* end while */
+ default:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!")
+ break;
+ } /* end switch */
+
+ if (H5C__serialize_ring(f, ring) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed")
+
+ ring++;
+ } /* end while */
#ifndef NDEBUG
- /* Verify that no entry has been serialized more than once.
- * FD parents with multiple serializations should have been caught
- * elsewhere, so no specific check for them here.
- */
- {
- H5C_cache_entry_t *scan_ptr = NULL;
+ /* Verify that no entry has been serialized more than once.
+ * FD parents with multiple serializations should have been caught
+ * elsewhere, so no specific check for them here.
+ */
+ {
+ H5C_cache_entry_t *scan_ptr = NULL;
- scan_ptr = cache_ptr->il_head;
- while (scan_ptr != NULL) {
- HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(scan_ptr->serialization_count <= 1);
+ scan_ptr = cache_ptr->il_head;
+ while (scan_ptr != NULL) {
+ HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(scan_ptr->serialization_count <= 1);
- scan_ptr = scan_ptr->il_next;
- } /* end while */
- } /* end block */
-#endif /* NDEBUG */
+ scan_ptr = scan_ptr->il_next;
+ } /* end while */
+ } /* end block */
+#endif /* NDEBUG */
done:
- cache_ptr->serialization_in_progress = FALSE;
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__serialize_cache() */
+ cache_ptr->serialization_in_progress = FALSE;
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__serialize_cache() */
- /*-------------------------------------------------------------------------
- * Function: H5C__serialize_ring
- *
- * Purpose: Serialize the entries contained in the specified cache and
- * ring. All entries in rings outside the specified ring
- * must have been serialized on entry.
- *
- * If the cache contains protected entries in the specified
- * ring, the function will fail, as protected entries cannot
- * be serialized. However all unprotected entries in the
- * target ring should be serialized before the function
- * returns failure.
- *
- * If flush dependencies appear in the target ring, the
- * function makes repeated passes through the index list
- * serializing entries in flush dependency order.
- *
- * All entries outside the H5C_RING_SBE are marked for
- * inclusion in the cache image. Entries in H5C_RING_SBE
- * and below are marked for exclusion from the image.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 9/11/15
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__serialize_ring(H5F_t * f, H5C_ring_t ring)
- {
- hbool_t done = FALSE;
- H5C_t * cache_ptr;
- H5C_cache_entry_t *entry_ptr;
- herr_t ret_value = SUCCEED;
+/*-------------------------------------------------------------------------
+ * Function: H5C__serialize_ring
+ *
+ * Purpose: Serialize the entries contained in the specified cache and
+ * ring. All entries in rings outside the specified ring
+ * must have been serialized on entry.
+ *
+ * If the cache contains protected entries in the specified
+ * ring, the function will fail, as protected entries cannot
+ * be serialized. However all unprotected entries in the
+ * target ring should be serialized before the function
+ * returns failure.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the index list
+ * serializing entries in flush dependency order.
+ *
+ * All entries outside the H5C_RING_SBE are marked for
+ * inclusion in the cache image. Entries in H5C_RING_SBE
+ * and below are marked for exclusion from the image.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/11/15
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__serialize_ring(H5F_t *f, H5C_ring_t ring)
+{
+ hbool_t done = FALSE;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
-
- HDassert(cache_ptr->serialization_in_progress);
-
- /* The objective here is to serialize all entries in the cache ring
- * in flush dependency order.
- *
- * The basic algorithm is to scan the cache index list looking for
- * unserialized entries that are either not in a flush dependency
- * relationship, or which have no unserialized children. Any such
- * entry is serialized and its flush dependency parents (if any) are
- * informed -- allowing them to decrement their userialized child counts.
- *
- * However, this algorithm is complicated by the ability
- * of client serialization callbacks to perform operations on
- * on the cache which can result in the insertion, deletion,
- * relocation, resize, dirty, flush, eviction, or removal (via the
- * take ownership flag) of entries. Changes in the flush dependency
- * structure are also possible.
- *
- * On the other hand, the algorithm is simplified by the fact that
- * we are serializing, not flushing. Thus, as long as all entries
- * are serialized correctly, it doesn't matter if we have to go back
- * and serialize an entry a second time.
- *
- * These possible actions result in the following modfications to
- * tha basic algorithm:
- *
- * 1) In the event of an entry expunge, eviction or removal, we must
- * restart the scan as it is possible that the next entry in our
- * scan is no longer in the cache. Were we to examine this entry,
- * we would be accessing deallocated memory.
- *
- * 2) A resize, dirty, or insertion of an entry may result in the
- * the increment of a flush dependency parent's dirty and/or
- * unserialized child count. In the context of serializing the
- * the cache, this is a non-issue, as even if we have already
- * serialized the parent, it will be marked dirty and its image
- * marked out of date if appropriate when the child is serialized.
- *
- * However, this is a major issue for a flush, as were this to happen
- * in a flush, it would violate the invariant that the flush dependency
- * feature is intended to enforce. As the metadata cache has no
- * control over the behavior of cache clients, it has no way of
- * preventing this behaviour. However, it should detect it if at all
- * possible.
- *
- * Do this by maintaining a count of the number of times each entry is
- * serialized during a cache serialization. If any flush dependency
- * parent is serialized more than once, throw an assertion failure.
- *
- * 3) An entry relocation will typically change the location of the
- * entry in the index list. This shouldn't cause problems as we
- * will scan the index list until we make a complete pass without
- * finding anything to serialize -- making relocations of either
- * the current or next entries irrelevant.
- *
- * Note that since a relocation may result in our skipping part of
- * the index list, we must always do at least one more pass through
- * the index list after an entry relocation.
- *
- * 4) Changes in the flush dependency structure are possible on
- * entry insertion, load, expunge, evict, or remove. Destruction
- * of a flush dependency has no effect, as it can only relax the
- * flush dependencies. Creation of a flush dependency can create
- * an unserialized child of a flush dependency parent where all
- * flush dependency children were previously serialized. Should
- * this child dirty the flush dependency parent when it is serialized,
- * the parent will be re-serialized.
- *
- * Per the discussion of 2) above, this is a non issue for cache
- * serialization, and a major problem for cache flush. Using the
- * same detection mechanism, throw an assertion failure if this
- * condition appears.
- *
- * Observe that either eviction or removal of entries as a result of
- * a serialization is not a problem as long as the flush depencency
- * tree does not change beyond the removal of a leaf.
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
+
+ HDassert(cache_ptr->serialization_in_progress);
+
+ /* The objective here is to serialize all entries in the cache ring
+ * in flush dependency order.
+ *
+ * The basic algorithm is to scan the cache index list looking for
+ * unserialized entries that are either not in a flush dependency
+ * relationship, or which have no unserialized children. Any such
+ * entry is serialized and its flush dependency parents (if any) are
+ * informed -- allowing them to decrement their userialized child counts.
+ *
+ * However, this algorithm is complicated by the ability
+ * of client serialization callbacks to perform operations on
+ * on the cache which can result in the insertion, deletion,
+ * relocation, resize, dirty, flush, eviction, or removal (via the
+ * take ownership flag) of entries. Changes in the flush dependency
+ * structure are also possible.
+ *
+ * On the other hand, the algorithm is simplified by the fact that
+ * we are serializing, not flushing. Thus, as long as all entries
+ * are serialized correctly, it doesn't matter if we have to go back
+ * and serialize an entry a second time.
+ *
+ * These possible actions result in the following modfications to
+ * tha basic algorithm:
+ *
+ * 1) In the event of an entry expunge, eviction or removal, we must
+ * restart the scan as it is possible that the next entry in our
+ * scan is no longer in the cache. Were we to examine this entry,
+ * we would be accessing deallocated memory.
+ *
+ * 2) A resize, dirty, or insertion of an entry may result in the
+ * the increment of a flush dependency parent's dirty and/or
+ * unserialized child count. In the context of serializing the
+ * the cache, this is a non-issue, as even if we have already
+ * serialized the parent, it will be marked dirty and its image
+ * marked out of date if appropriate when the child is serialized.
+ *
+ * However, this is a major issue for a flush, as were this to happen
+ * in a flush, it would violate the invariant that the flush dependency
+ * feature is intended to enforce. As the metadata cache has no
+ * control over the behavior of cache clients, it has no way of
+ * preventing this behaviour. However, it should detect it if at all
+ * possible.
+ *
+ * Do this by maintaining a count of the number of times each entry is
+ * serialized during a cache serialization. If any flush dependency
+ * parent is serialized more than once, throw an assertion failure.
+ *
+ * 3) An entry relocation will typically change the location of the
+ * entry in the index list. This shouldn't cause problems as we
+ * will scan the index list until we make a complete pass without
+ * finding anything to serialize -- making relocations of either
+ * the current or next entries irrelevant.
+ *
+ * Note that since a relocation may result in our skipping part of
+ * the index list, we must always do at least one more pass through
+ * the index list after an entry relocation.
+ *
+ * 4) Changes in the flush dependency structure are possible on
+ * entry insertion, load, expunge, evict, or remove. Destruction
+ * of a flush dependency has no effect, as it can only relax the
+ * flush dependencies. Creation of a flush dependency can create
+ * an unserialized child of a flush dependency parent where all
+ * flush dependency children were previously serialized. Should
+ * this child dirty the flush dependency parent when it is serialized,
+ * the parent will be re-serialized.
+ *
+ * Per the discussion of 2) above, this is a non issue for cache
+ * serialization, and a major problem for cache flush. Using the
+ * same detection mechanism, throw an assertion failure if this
+ * condition appears.
+ *
+ * Observe that either eviction or removal of entries as a result of
+ * a serialization is not a problem as long as the flush depencency
+ * tree does not change beyond the removal of a leaf.
+ */
+ while (!done) {
+ /* Reset the counters so that we can detect insertions, loads,
+ * moves, and flush dependency height changes caused by the pre_serialize
+ * and serialize callbacks.
*/
- while (!done) {
- /* Reset the counters so that we can detect insertions, loads,
- * moves, and flush dependency height changes caused by the pre_serialize
- * and serialize callbacks.
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+
+ done = TRUE; /* set to FALSE if any activity in inner loop */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+
+ /* Verify that either the entry is already serialized, or
+ * that it is assigned to either the target or an inner
+ * ring.
*/
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
-
- done = TRUE; /* set to FALSE if any activity in inner loop */
- entry_ptr = cache_ptr->il_head;
- while (entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
-
- /* Verify that either the entry is already serialized, or
- * that it is assigned to either the target or an inner
- * ring.
- */
- HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
+ HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
- /* Skip flush me last entries or inner ring entries */
- if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) {
+ /* Skip flush me last entries or inner ring entries */
+ if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) {
- /* if we encounter an unserialized entry in the current
- * ring that is not marked flush me last, we are not done.
- */
- if (!entry_ptr->image_up_to_date)
- done = FALSE;
+ /* if we encounter an unserialized entry in the current
+ * ring that is not marked flush me last, we are not done.
+ */
+ if (!entry_ptr->image_up_to_date)
+ done = FALSE;
- /* Serialize the entry if its image is not up to date
- * and it has no unserialized flush dependency children.
- */
- if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) {
- HDassert(entry_ptr->serialization_count == 0);
+ /* Serialize the entry if its image is not up to date
+ * and it has no unserialized flush dependency children.
+ */
+ if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) {
+ HDassert(entry_ptr->serialization_count == 0);
- /* Serialize the entry */
- if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
+ /* Serialize the entry */
+ if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
- HDassert(entry_ptr->serialization_count == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ HDassert(entry_ptr->serialization_count == 0);
#ifndef NDEBUG
- /* Increment serialization counter (to detect multiple serializations) */
- entry_ptr->serialization_count++;
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
+ /* Increment serialization counter (to detect multiple serializations) */
+ entry_ptr->serialization_count++;
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
- /* Check for the cache being perturbed during the entry serialize */
- if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) ||
- (cache_ptr->entries_relocated_counter > 0)) {
+ /* Check for the cache being perturbed during the entry serialize */
+ if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) ||
+ (cache_ptr->entries_relocated_counter > 0)) {
#if H5C_COLLECT_CACHE_STATS
- H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr);
+ H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
- /* Reset the counters */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ /* Reset the counters */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
- /* Restart scan */
- entry_ptr = cache_ptr->il_head;
- } /* end if */
- else
- /* Advance to next entry */
- entry_ptr = entry_ptr->il_next;
- } /* while ( entry_ptr != NULL ) */
- } /* while ( ! done ) */
+ /* Restart scan */
+ entry_ptr = cache_ptr->il_head;
+ } /* end if */
+ else
+ /* Advance to next entry */
+ entry_ptr = entry_ptr->il_next;
+ } /* while ( entry_ptr != NULL ) */
+ } /* while ( ! done ) */
- /* Reset the counters so that we can detect insertions, loads,
- * moves, and flush dependency height changes caused by the pre_serialize
- * and serialize callbacks.
- */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ /* Reset the counters so that we can detect insertions, loads,
+ * moves, and flush dependency height changes caused by the pre_serialize
+ * and serialize callbacks.
+ */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+
+ /* At this point, all entries not marked "flush me last" and in
+ * the current ring or outside it should be serialized and have up
+ * to date images. Scan the index list again to serialize the
+ * "flush me last" entries (if they are in the current ring) and to
+ * verify that all other entries have up to date images.
+ */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring > H5C_RING_UNDEFINED);
+ HDassert(entry_ptr->ring < H5C_RING_NTYPES);
+ HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
+
+ if (entry_ptr->ring == ring) {
+ if (entry_ptr->flush_me_last) {
+ if (!entry_ptr->image_up_to_date) {
+ HDassert(entry_ptr->serialization_count == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- /* At this point, all entries not marked "flush me last" and in
- * the current ring or outside it should be serialized and have up
- * to date images. Scan the index list again to serialize the
- * "flush me last" entries (if they are in the current ring) and to
- * verify that all other entries have up to date images.
- */
- entry_ptr = cache_ptr->il_head;
- while (entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring > H5C_RING_UNDEFINED);
- HDassert(entry_ptr->ring < H5C_RING_NTYPES);
- HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
+ /* Serialize the entry */
+ if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
+
+ /* Check for the cache changing */
+ if ((cache_ptr->entries_loaded_counter > 0) ||
+ (cache_ptr->entries_inserted_counter > 0) ||
+ (cache_ptr->entries_relocated_counter > 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flush_me_last entry serialization triggered restart")
- if (entry_ptr->ring == ring) {
- if (entry_ptr->flush_me_last) {
- if (!entry_ptr->image_up_to_date) {
- HDassert(entry_ptr->serialization_count == 0);
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
-
- /* Serialize the entry */
- if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
-
- /* Check for the cache changing */
- if ((cache_ptr->entries_loaded_counter > 0) ||
- (cache_ptr->entries_inserted_counter > 0) ||
- (cache_ptr->entries_relocated_counter > 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
- "flush_me_last entry serialization triggered restart")
-
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
- HDassert(entry_ptr->serialization_count == 0);
-#ifndef NDEBUG
- /* Increment serialization counter (to detect multiple serializations) */
- entry_ptr->serialization_count++;
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
- else {
- HDassert(entry_ptr->image_up_to_date);
- HDassert(entry_ptr->serialization_count <= 1);
HDassert(entry_ptr->flush_dep_nunser_children == 0);
- } /* end else */
- } /* if ( entry_ptr->ring == ring ) */
+ HDassert(entry_ptr->serialization_count == 0);
+#ifndef NDEBUG
+ /* Increment serialization counter (to detect multiple serializations) */
+ entry_ptr->serialization_count++;
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->serialization_count <= 1);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ } /* end else */
+ } /* if ( entry_ptr->ring == ring ) */
- entry_ptr = entry_ptr->il_next;
- } /* while ( entry_ptr != NULL ) */
+ entry_ptr = entry_ptr->il_next;
+ } /* while ( entry_ptr != NULL ) */
done:
- HDassert(cache_ptr->serialization_in_progress);
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__serialize_ring() */
+ HDassert(cache_ptr->serialization_in_progress);
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__serialize_ring() */
- /*-------------------------------------------------------------------------
- * Function: H5C__serialize_single_entry
- *
- * Purpose: Serialize the cache entry pointed to by the entry_ptr
- * parameter.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer, 7/24/15
- *
- *-------------------------------------------------------------------------
- */
- static herr_t H5C__serialize_single_entry(H5F_t * f, H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr)
- {
- herr_t ret_value = SUCCEED; /* Return value */
+/*-------------------------------------------------------------------------
+ * Function: H5C__serialize_single_entry
+ *
+ * Purpose: Serialize the cache entry pointed to by the entry_ptr
+ * parameter.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer, 7/24/15
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!entry_ptr->prefetched);
- HDassert(!entry_ptr->image_up_to_date);
- HDassert(entry_ptr->is_dirty);
- HDassert(!entry_ptr->is_protected);
- HDassert(!entry_ptr->flush_in_progress);
- HDassert(entry_ptr->type);
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!entry_ptr->prefetched);
+ HDassert(!entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(!entry_ptr->is_protected);
+ HDassert(!entry_ptr->flush_in_progress);
+ HDassert(entry_ptr->type);
- /* Set entry_ptr->flush_in_progress to TRUE so the the target entry
- * will not be evicted out from under us. Must set it back to FALSE
- * when we are done.
- */
- entry_ptr->flush_in_progress = TRUE;
+ /* Set entry_ptr->flush_in_progress to TRUE so the the target entry
+ * will not be evicted out from under us. Must set it back to FALSE
+ * when we are done.
+ */
+ entry_ptr->flush_in_progress = TRUE;
- /* Allocate buffer for the entry image if required. */
- if (NULL == entry_ptr->image_ptr) {
- HDassert(entry_ptr->size > 0);
- 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")
+ /* Allocate buffer for the entry image if required. */
+ if (NULL == entry_ptr->image_ptr) {
+ HDassert(entry_ptr->size > 0);
+ 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) + image_size, H5C_IMAGE_SANITY_VALUE,
- H5C_IMAGE_EXTRA_SPACE);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ } /* end if */
- /* Generate image for entry */
- if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry")
+ /* Generate image for entry */
+ if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry")
- /* Reset the flush_in progress flag */
- entry_ptr->flush_in_progress = FALSE;
+ /* Reset the flush_in progress flag */
+ entry_ptr->flush_in_progress = FALSE;
done:
- HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress));
- HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date));
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__serialize_single_entry() */
+ HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress));
+ HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date));
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__serialize_single_entry() */
- /*-------------------------------------------------------------------------
- * Function: H5C__generate_image
- *
- * Purpose: Serialize an entry and generate its image.
- *
- * 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
- * until we we finish the write, we must touch up these
- * data structures for size and location changes even if we
- * are about to delete the entry from the cache (i.e. on a
- * flush destroy).
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * 2/10/16
- *
- *-------------------------------------------------------------------------
- */
- 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;
- unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
- herr_t ret_value = SUCCEED;
+/*-------------------------------------------------------------------------
+ * Function: H5C__generate_image
+ *
+ * Purpose: Serialize an entry and generate its image.
+ *
+ * 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
+ * until we we finish the write, we must touch up these
+ * data structures for size and location changes even if we
+ * are about to delete the entry from the cache (i.e. on a
+ * flush destroy).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * 2/10/16
+ *
+ * Changes: Updated sanity checks for the possibility that the skip
+ * list is disabled.
+ * JRM 5/16/20
+ *
+ *-------------------------------------------------------------------------
+ */
+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;
+ unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
- /* Sanity check */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!entry_ptr->image_up_to_date);
- HDassert(entry_ptr->is_dirty);
- HDassert(!entry_ptr->is_protected);
- HDassert(entry_ptr->type);
+ /* Sanity check */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(!entry_ptr->is_protected);
+ HDassert(entry_ptr->type);
+
+ /* make note of the entry's current address */
+ old_addr = entry_ptr->addr;
- /* make note of the entry's current address */
- 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))
- /* 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")
+ 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) {
- /* 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)")
+ /* Check for any flags set in the pre-serialize callback */
+ 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)")
#ifdef H5_HAVE_PARALLEL
- /* In the parallel case, resizes and moves in
- * the serialize operation can cause problems.
- * If they occur, scream and die.
- *
- * At present, in the parallel case, the aux_ptr
- * will only be set if there is more than one
- * process. Thus we can use this to detect
- * the parallel case.
- *
- * This works for now, but if we start using the
- * aux_ptr for other purposes, we will have to
- * change this test accordingly.
- *
- * NB: While this test detects entryies that attempt
- * to resize or move themselves during a flush
- * in the parallel case, it will not detect an
- * entry that dirties, resizes, and/or moves
- * other entries during its flush.
- *
- * From what Quincey tells me, this test is
- * sufficient for now, as any flush routine that
- * does the latter will also do the former.
- *
- * 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")
+ /* In the parallel case, resizes and moves in
+ * the serialize operation can cause problems.
+ * If they occur, scream and die.
+ *
+ * At present, in the parallel case, the aux_ptr
+ * will only be set if there is more than one
+ * process. Thus we can use this to detect
+ * the parallel case.
+ *
+ * This works for now, but if we start using the
+ * aux_ptr for other purposes, we will have to
+ * change this test accordingly.
+ *
+ * NB: While this test detects entryies that attempt
+ * to resize or move themselves during a flush
+ * in the parallel case, it will not detect an
+ * entry that dirties, resizes, and/or moves
+ * other entries during its flush.
+ *
+ * From what Quincey tells me, this test is
+ * sufficient for now, as any flush routine that
+ * does the latter will also do the former.
+ *
+ * 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")
#endif
- /* If required, resize the buffer and update the entry and the cache
- * data structures */
- if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
- /* Sanity check */
- HDassert(new_len > 0);
+ /* If required, resize the buffer and update the entry and the cache
+ * 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")
- /* 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 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);
+ /* Update statistics for resizing the entry */
+ 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));
+ /* 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));
- /* The entry can't be protected since we are in the process of
- * flushing it. Thus we must update the replacement policy data
- * structures for the size change. The macro deals with the pinned
- * case.
- */
- H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
+ /* The entry can't be protected since we are in the process of
+ * flushing it. Thus we must update the replacement policy data
+ * structures for the size change. The macro deals with the pinned
+ * case.
+ */
+ H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
- /* 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.
- */
- HDassert(entry_ptr->is_dirty);
- HDassert(entry_ptr->in_slist);
- H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len);
+ /* As we haven't updated the cache data structures for
+ * for the flush or flush destroy yet, the entry should
+ * 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) || (!cache_ptr->slist_enabled));
- /* Finally, update the entry for its new size */
- entry_ptr->size = new_len;
- } /* end if */
+ H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len);
- /* If required, udate the entry and the cache data structures
- * for a move
- */
- 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) {
- /* 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);
+ /* Finally, update the entry for its new size */
+ entry_ptr->size = new_len;
- /* Update the entry for its new address */
- entry_ptr->addr = new_addr;
+ } /* end if */
- /* 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 */
- HDassert(entry_ptr->addr == new_addr);
- } /* end if */
- } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */
+ /* If required, udate the entry and the cache data structures
+ * for a move
+ */
+ 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) {
+
+ /* 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);
+
+ /* Update the entry for its new address */
+ entry_ptr->addr = new_addr;
+
+ /* 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 */
+
+ 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)
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry")
- /* Serialize object into buffer */
- 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
- * flush dependency chain if appropriate. Since the image must
- * have been out of date for this function to have been called
- * (see assertion on entry), no need to check that -- only check
- * 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")
-done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__generate_image */
+ entry_ptr->image_up_to_date = TRUE;
- /*-------------------------------------------------------------------------
- *
- * Function: H5C_remove_entry
- *
- * Purpose: Remove an entry from the cache. Must be not protected, pinned,
- * dirty, involved in flush dependencies, etc.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * September 17, 2016
- *
- *-------------------------------------------------------------------------
+ /* Propagate the fact that the entry is serialized up the
+ * flush dependency chain if appropriate. Since the image must
+ * have been out of date for this function to have been called
+ * (see assertion on entry), no need to check that -- only check
+ * for flush dependency parents.
*/
- herr_t H5C_remove_entry(void *_entry)
- {
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */
- H5C_t * cache; /* Cache for file */
- herr_t ret_value = SUCCEED; /* Return value */
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- FUNC_ENTER_NOAPI(FAIL)
+ if (entry_ptr->flush_dep_nparents > 0) {
- /* Sanity checks */
- HDassert(entry);
- HDassert(entry->ring != H5C_RING_UNDEFINED);
- cache = entry->cache_ptr;
- HDassert(cache);
- HDassert(cache->magic == H5C__H5C_T_MAGIC);
-
- /* Check for error conditions */
- if (entry->is_dirty)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache")
- if (entry->is_protected)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache")
- if (entry->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache")
- /* NOTE: If these two errors are getting tripped because the entry is
- * in a flush dependency with a freedspace entry, move the checks
- * after the "before evict" message is sent, and add the
- * "child being evicted" message to the "before evict" notify
- * section below. QAK - 2017/08/03
- */
- if (entry->flush_dep_nparents > 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
- "can't remove entry with flush dependency parents from cache")
- if (entry->flush_dep_nchildren > 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
- "can't remove entry with flush dependency children from cache")
-
- /* Additional internal cache consistency checks */
- HDassert(!entry->in_slist);
- HDassert(!entry->flush_marker);
- HDassert(!entry->flush_in_progress);
-
- /* Note that the algorithm below is (very) similar to the set of operations
- * in H5C__flush_single_entry() and should be kept in sync with changes
- * to that code. - QAK, 2016/11/30
- */
+ if (H5C__mark_flush_dep_serialized(entry_ptr) < 0)
- /* Update stats, as if we are "destroying" and taking ownership of the entry */
- H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents")
+ }
- /* If the entry's type has a 'notify' callback, send a 'before eviction'
- * notice while the entry is still fully integrated in the cache.
- */
- if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict")
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__generate_image */
- /* Update the cache internal data structures as appropriate for a destroy.
- * Specifically:
- * 1) Delete it from the index
- * 2) Delete it from the collective read access list
- * 3) Update the replacement policy for eviction
- * 4) Remove it from the tag list for this object
- */
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_remove_entry
+ *
+ * Purpose: Remove an entry from the cache. Must be not protected, pinned,
+ * dirty, involved in flush dependencies, etc.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 17, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_remove_entry(void *_entry)
+{
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */
+ H5C_t * cache; /* Cache for file */
+ herr_t ret_value = SUCCEED; /* Return value */
- H5C__DELETE_FROM_INDEX(cache, entry, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(entry->ring != H5C_RING_UNDEFINED);
+ cache = entry->cache_ptr;
+ HDassert(cache);
+ HDassert(cache->magic == H5C__H5C_T_MAGIC);
+
+ /* Check for error conditions */
+ if (entry->is_dirty)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache")
+ if (entry->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache")
+ if (entry->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache")
+ /* NOTE: If these two errors are getting tripped because the entry is
+ * in a flush dependency with a freedspace entry, move the checks
+ * after the "before evict" message is sent, and add the
+ * "child being evicted" message to the "before evict" notify
+ * section below. QAK - 2017/08/03
+ */
+ if (entry->flush_dep_nparents > 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove entry with flush dependency parents from cache")
+ if (entry->flush_dep_nchildren > 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove entry with flush dependency children from cache")
+
+ /* Additional internal cache consistency checks */
+ HDassert(!entry->in_slist);
+ HDassert(!entry->flush_marker);
+ HDassert(!entry->flush_in_progress);
+
+ /* Note that the algorithm below is (very) similar to the set of operations
+ * in H5C__flush_single_entry() and should be kept in sync with changes
+ * to that code. - QAK, 2016/11/30
+ */
+
+ /* Update stats, as if we are "destroying" and taking ownership of the entry */
+ H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE)
+
+ /* If the entry's type has a 'notify' callback, send a 'before eviction'
+ * notice while the entry is still fully integrated in the cache.
+ */
+ if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 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:
+ * 1) Delete it from the index
+ * 2) Delete it from the collective read access list
+ * 3) Update the replacement policy for eviction
+ * 4) Remove it from the tag list for this object
+ */
+
+ H5C__DELETE_FROM_INDEX(cache, entry, FAIL)
#ifdef H5_HAVE_PARALLEL
- /* Check for collective read access flag */
- if (entry->coll_access) {
- entry->coll_access = FALSE;
- H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ /* Check for collective read access flag */
+ if (entry->coll_access) {
+ entry->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL)
+ H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL)
- /* Remove entry from tag list */
- if (H5C__untag_entry(cache, entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
+ /* Remove entry from tag list */
+ if (H5C__untag_entry(cache, entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
- /* Increment entries_removed_counter and set last_entry_removed_ptr.
- * As we me be about to free the entry, recall that last_entry_removed_ptr
- * must NEVER be dereferenced.
- *
- * Recall that these fields are maintained to allow functions that perform
- * scans of lists of entries to detect the unexpected removal of entries
- * (via expunge, eviction, or take ownership at present), so that they can
- * re-start their scans if necessary.
- *
- * Also check if the entry we are watching for removal is being
- * removed (usually the 'next' entry for an iteration) and reset
- * it to indicate that it was removed.
- */
- cache->entries_removed_counter++;
- cache->last_entry_removed_ptr = entry;
- if (entry == cache->entry_watched_for_removal)
- cache->entry_watched_for_removal = NULL;
+ /* Increment entries_removed_counter and set last_entry_removed_ptr.
+ * As we me be about to free the entry, recall that last_entry_removed_ptr
+ * must NEVER be dereferenced.
+ *
+ * Recall that these fields are maintained to allow functions that perform
+ * scans of lists of entries to detect the unexpected removal of entries
+ * (via expunge, eviction, or take ownership at present), so that they can
+ * re-start their scans if necessary.
+ *
+ * Also check if the entry we are watching for removal is being
+ * removed (usually the 'next' entry for an iteration) and reset
+ * it to indicate that it was removed.
+ */
+ cache->entries_removed_counter++;
+ cache->last_entry_removed_ptr = entry;
+ if (entry == cache->entry_watched_for_removal)
+ cache->entry_watched_for_removal = NULL;
- /* Internal cache data structures should now be up to date, and
- * consistent with the status of the entry.
- *
- * Now clean up internal cache fields if appropriate.
- */
+ /* Internal cache data structures should now be up to date, and
+ * consistent with the status of the entry.
+ *
+ * Now clean up internal cache fields if appropriate.
+ */
- /* Free the buffer for the on disk image */
- if (entry->image_ptr != NULL)
- entry->image_ptr = H5MM_xfree(entry->image_ptr);
+ /* Free the buffer for the on disk image */
+ if (entry->image_ptr != NULL)
+ entry->image_ptr = H5MM_xfree(entry->image_ptr);
- /* Reset the pointer to the cache the entry is within */
- entry->cache_ptr = NULL;
+ /* Reset the pointer to the cache the entry is within */
+ entry->cache_ptr = NULL;
- /* Client is taking ownership of the entry. Set bad magic here so the
- * cache will choke unless the entry is re-inserted properly
- */
- entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
+ /* Client is taking ownership of the entry. Set bad magic here so the
+ * cache will choke unless the entry is re-inserted properly
+ */
+ entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
done:
- FUNC_LEAVE_NOAPI(ret_value)
- } /* H5C__remove_entry() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__remove_entry() */
diff --git a/src/H5CS.c b/src/H5CS.c
index f4da804..6510c25 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -122,8 +122,6 @@ H5CS__get_stack(void)
* Programmer: Quincey Koziol
* Thursday, February 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -144,11 +142,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g);
/* try show the process or thread id in multiple processes cases*/
-#ifdef H5_HAVE_THREADSAFE
- HDfprintf(stream, "thread %lu.", HDpthread_self_ulong());
-#else /* H5_HAVE_THREADSAFE */
- HDfprintf(stream, "thread 0.");
-#endif /* H5_HAVE_THREADSAFE */
+ HDfprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id());
if (fstack && fstack->nused > 0)
HDfprintf(stream, " Back trace follows.");
HDfputc('\n', stream);
@@ -215,8 +209,6 @@ H5CS_push(const char *func_name)
* Programmer: Quincey Koziol
* Thursday, February 6, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h
index c86b209..a238ec7 100644
--- a/src/H5CSprivate.h
+++ b/src/H5CSprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* Header file for function stacks, etc.
*/
-#ifndef _H5CSprivate_H
-#define _H5CSprivate_H
+#ifndef H5CSprivate_H
+#define H5CSprivate_H
#ifdef NOT_YET
#include "H5CSpublic.h"
@@ -32,4 +32,4 @@ H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream)
H5_DLL struct H5CS_t *H5CS_copy_stack(void);
H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack);
-#endif /* _H5CSprivate_H */
+#endif /* H5CSprivate_H */
diff --git a/src/H5CX.c b/src/H5CX.c
index 917b5ff..ff3620e 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -5,13 +5,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@lbl.gov>
+ * Programmer: Quincey Koziol
* Monday, February 19, 2018
*
* Purpose:
@@ -31,11 +31,11 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -932,9 +932,11 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
/* Keep a reference to the current VOL wrapping context */
(*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
- if (NULL != (*api_state)->vol_wrap_ctx)
+ if (NULL != (*api_state)->vol_wrap_ctx) {
+ HDassert((*head)->ctx.vol_wrap_ctx_valid);
if (H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context")
+ } /* end if */
/* Keep a copy of the VOL connector property, if there is one */
if ((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
@@ -1023,6 +1025,8 @@ H5CX_restore_state(const H5CX_state_t *api_state)
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
+ if (NULL != (*head)->ctx.vol_wrap_ctx)
+ (*head)->ctx.vol_wrap_ctx_valid = TRUE;
/* Restore the VOL connector info */
if (api_state->vol_connector_prop.connector_id) {
diff --git a/src/H5CXmodule.h b/src/H5CXmodule.h
index cbf23a0..9fbaab4 100644
--- a/src/H5CXmodule.h
+++ b/src/H5CXmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@lbl.gov>
+ * Programmer: Quincey Koziol
* Sunday, February 25, 2018
*
* Purpose: This file contains declarations which define macros for the
* H5CX package. Including this header means that the source file
* is part of the H5CX package.
*/
-#ifndef _H5CXmodule_H
-#define _H5CXmodule_H
+#ifndef H5CXmodule_H
+#define H5CXmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_CONTEXT
#define H5_MY_PKG_INIT YES
-#endif /* _H5CXmodule_H */
+#endif /* H5CXmodule_H */
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 767ccf1..f9289cb 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -13,8 +13,8 @@
/*
* Header file for API contexts, etc.
*/
-#ifndef _H5CXprivate_H
-#define _H5CXprivate_H
+#ifndef H5CXprivate_H
+#define H5CXprivate_H
/* Include package's public header */
#ifdef NOT_YET
@@ -61,10 +61,10 @@ typedef struct H5CX_state_t {
/***************************************/
/* Library private routines */
-#ifndef _H5private_H
+#ifndef H5private_H
H5_DLL herr_t H5CX_push(void);
H5_DLL herr_t H5CX_pop(void);
-#endif /* _H5private_H */
+#endif /* H5private_H */
H5_DLL void H5CX_push_special(void);
H5_DLL hbool_t H5CX_is_def_dxpl(void);
@@ -177,4 +177,4 @@ H5_DLL herr_t H5CX_test_set_mpio_coll_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
-#endif /* _H5CXprivate_H */
+#endif /* H5CXprivate_H */
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 436dfc2..104f1af 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -28,15 +28,13 @@
#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5AC_FRIEND
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata Cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error Handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata Cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error Handling */
/****************/
/* Local Macros */
@@ -250,17 +248,24 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
#endif /* NDEBUG */
/*-------------------------------------------------------------------------
+ *
* 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
@@ -279,109 +284,29 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn)
HDassert(calling_fcn != NULL);
HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn);
- 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 %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled");
+ HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len);
+ HDfprintf(stdout, " slist size = %zu.\n", 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.
*/
HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n");
- i = 0;
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- if (node_ptr != NULL)
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- else
- entry_ptr = NULL;
-
- while (entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
-
- HDfprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i,
- (long long)(entry_ptr->addr), (long long)(entry_ptr->size),
- (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty),
- entry_ptr->type->name);
-
- HDfprintf(stdout, " node_ptr = %p, item = %p\n", node_ptr, H5SL_item(node_ptr));
-
- /* increment node_ptr before we delete its target */
- node_ptr = H5SL_next(node_ptr);
- if (node_ptr != NULL)
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- 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 */
-
-/*-------------------------------------------------------------------------
- * Function: H5C_dump_coll_write_list
- *
- * Purpose: Debugging routine that prints a summary of the contents of
- * the collective write skip list used by the metadata cache
- * in the parallel case to maintain a list of entries to write
- * collectively at a sync point.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 4/1/17
- *
- *-------------------------------------------------------------------------
- */
-#ifdef H5_HAVE_PARALLEL
-#ifndef NDEBUG
-herr_t
-H5C_dump_coll_write_list(H5C_t *cache_ptr, char *calling_fcn)
-{
- herr_t ret_value = SUCCEED; /* Return value */
- int i;
- int list_len;
- H5AC_aux_t * aux_ptr = NULL;
- H5C_cache_entry_t *entry_ptr = NULL;
- H5SL_node_t * node_ptr = NULL;
-
- FUNC_ENTER_NOAPI_NOERR
-
- HDassert(cache_ptr != NULL);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->aux_ptr);
-
- aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
-
- HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
-
- HDassert(calling_fcn != NULL);
-
- list_len = (int)H5SL_count(cache_ptr->coll_write_list);
-
- HDfprintf(stdout, "\n\nDumping MDC coll write list from %d:%s.\n", aux_ptr->mpi_rank, calling_fcn);
- HDfprintf(stdout, " slist len = %u.\n", cache_ptr->slist_len);
-
- if (list_len > 0) {
-
- /* scan the collective write list generating the desired output */
- HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n");
-
i = 0;
- node_ptr = H5SL_first(cache_ptr->coll_write_list);
+ 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) {
@@ -392,15 +317,20 @@ H5C_dump_coll_write_list(H5C_t *cache_ptr, char *calling_fcn)
(int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty),
entry_ptr->type->name);
+ HDfprintf(stdout, " node_ptr = %p, item = %p\n", (void *)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++;
@@ -411,9 +341,8 @@ H5C_dump_coll_write_list(H5C_t *cache_ptr, char *calling_fcn)
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_dump_coll_write_list() */
+} /* H5C_dump_cache_skip_list() */
#endif /* NDEBUG */
-#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: H5C_set_prefix
@@ -500,11 +429,11 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
int32_t aggregate_max_pins = 0;
double hit_rate;
double prefetch_use_rate;
- double average_successful_search_depth = 0.0f;
- double average_failed_search_depth = 0.0f;
- double average_entries_skipped_per_calls_to_msic = 0.0f;
- double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
- double average_entries_scanned_per_calls_to_msic = 0.0f;
+ double average_successful_search_depth = 0.0;
+ double average_failed_search_depth = 0.0;
+ double average_entries_skipped_per_calls_to_msic = 0.0;
+ double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0;
+ double average_entries_scanned_per_calls_to_msic = 0.0;
#endif /* H5C_COLLECT_CACHE_STATS */
herr_t ret_value = SUCCEED; /* Return value */
@@ -563,9 +492,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->successful_ht_searches > 0)
average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) /
@@ -688,8 +617,8 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
(long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts),
(long long)(cache_ptr->index_scan_restarts));
- HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %Hu\n", cache_ptr->prefix,
- cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded,
+ HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n",
+ cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded,
cache_ptr->last_image_size);
HDfprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix,
@@ -701,10 +630,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
(long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]));
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate);
@@ -729,10 +657,10 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
((cache_ptr->class_table_ptr))[i]->name);
if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
- hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) /
+ hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) /
((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
(long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate);
@@ -903,81 +831,8 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr)
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
#endif /* H5C_COLLECT_CACHE_STATS */
-
- 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/H5Cepoch.c b/src/H5Cepoch.c
index 4d15632..3434fed 100644
--- a/src/H5Cepoch.c
+++ b/src/H5Cepoch.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index ebd6427..f17ff48 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -423,36 +423,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
@@ -685,15 +689,20 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t
*
* 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);
+
+ 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)
@@ -853,53 +862,6 @@ H5C__free_image_entries_array(H5C_t *cache_ptr)
} /* H5C__free_image_entries_array() */
/*-------------------------------------------------------------------------
- * 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
@@ -971,15 +933,14 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
if (print_header) {
HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n");
@@ -1196,7 +1157,8 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Set information needed to load cache image */
- cache_ptr->image_addr = addr, cache_ptr->image_len = len;
+ cache_ptr->image_addr = addr;
+ cache_ptr->image_len = len;
cache_ptr->load_image = TRUE;
cache_ptr->delete_image = rw;
@@ -1810,7 +1772,7 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t *
p = *buf;
/* Check signature */
- if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN))
+ if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature")
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;
diff --git a/src/H5Clog.c b/src/H5Clog.c
index d48b7b1..14b37d4 100644
--- a/src/H5Clog.c
+++ b/src/H5Clog.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -269,8 +269,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
- /*OUT*/ hbool_t *is_currently_logging)
+H5C_get_logging_status(const H5C_t *cache, hbool_t *is_enabled, hbool_t *is_currently_logging)
{
FUNC_ENTER_NOAPI_NOERR
diff --git a/src/H5Clog.h b/src/H5Clog.h
index e49c453..790a073 100644
--- a/src/H5Clog.h
+++ b/src/H5Clog.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
* Purpose: Cache logging header file
*/
-#ifndef _H5Clog_H
-#define _H5Clog_H
+#ifndef H5Clog_H
+#define H5Clog_H
/* Get package's private header */
#include "H5Cprivate.h" /* Cache */
@@ -79,10 +79,10 @@ typedef struct H5C_log_class_t {
/* Logging information */
struct H5C_log_info_t {
- hbool_t enabled; /* Was the logging set up? */
- hbool_t logging; /* Are we currently logging? */
- H5C_log_class_t *cls; /* Callbacks for writing log messages */
- void * udata; /* Log-specific data */
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ const H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void * udata; /* Log-specific data */
};
/*****************************/
@@ -136,4 +136,4 @@ H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry
H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
-#endif /* _H5Clog_H */
+#endif /* H5Clog_H */
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index b77ab63..18323ca 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -118,32 +118,32 @@ static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_json_log_class_g = {"json",
- H5C__json_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- H5C__json_write_start_log_msg,
- H5C__json_write_stop_log_msg,
- H5C__json_write_create_cache_log_msg,
- H5C__json_write_destroy_cache_log_msg,
- H5C__json_write_evict_cache_log_msg,
- H5C__json_write_expunge_entry_log_msg,
- H5C__json_write_flush_cache_log_msg,
- H5C__json_write_insert_entry_log_msg,
- H5C__json_write_mark_entry_dirty_log_msg,
- H5C__json_write_mark_entry_clean_log_msg,
- H5C__json_write_mark_unserialized_entry_log_msg,
- H5C__json_write_mark_serialized_entry_log_msg,
- H5C__json_write_move_entry_log_msg,
- H5C__json_write_pin_entry_log_msg,
- H5C__json_write_create_fd_log_msg,
- H5C__json_write_protect_entry_log_msg,
- H5C__json_write_resize_entry_log_msg,
- H5C__json_write_unpin_entry_log_msg,
- H5C__json_write_destroy_fd_log_msg,
- H5C__json_write_unprotect_entry_log_msg,
- H5C__json_write_set_cache_config_log_msg,
- H5C__json_write_remove_entry_log_msg};
+static const H5C_log_class_t H5C_json_log_class_g = {"json",
+ H5C__json_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ H5C__json_write_start_log_msg,
+ H5C__json_write_stop_log_msg,
+ H5C__json_write_create_cache_log_msg,
+ H5C__json_write_destroy_cache_log_msg,
+ H5C__json_write_evict_cache_log_msg,
+ H5C__json_write_expunge_entry_log_msg,
+ H5C__json_write_flush_cache_log_msg,
+ H5C__json_write_insert_entry_log_msg,
+ H5C__json_write_mark_entry_dirty_log_msg,
+ H5C__json_write_mark_entry_clean_log_msg,
+ H5C__json_write_mark_unserialized_entry_log_msg,
+ H5C__json_write_mark_serialized_entry_log_msg,
+ H5C__json_write_move_entry_log_msg,
+ H5C__json_write_pin_entry_log_msg,
+ H5C__json_write_create_fd_log_msg,
+ H5C__json_write_protect_entry_log_msg,
+ H5C__json_write_resize_entry_log_msg,
+ H5C__json_write_unpin_entry_log_msg,
+ H5C__json_write_destroy_fd_log_msg,
+ H5C__json_write_unprotect_entry_log_msg,
+ H5C__json_write_set_cache_config_log_msg,
+ H5C__json_write_remove_entry_log_msg};
/*-------------------------------------------------------------------------
* Function: H5C__json_write_log_message
@@ -173,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
/* Write the log message and flush */
n_chars = HDstrlen(json_udata->message);
- if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
+ if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index 002b3f9..d33d1b0 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -113,32 +113,32 @@ static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_trace_log_class_g = {"trace",
- H5C__trace_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- NULL, /* write start message */
- NULL, /* write stop message */
- NULL, /* write create cache message */
- NULL, /* write destroy cache message */
- NULL, /* write evict cache message */
- H5C__trace_write_expunge_entry_log_msg,
- H5C__trace_write_flush_cache_log_msg,
- H5C__trace_write_insert_entry_log_msg,
- H5C__trace_write_mark_entry_dirty_log_msg,
- H5C__trace_write_mark_entry_clean_log_msg,
- H5C__trace_write_mark_unserialized_entry_log_msg,
- H5C__trace_write_mark_serialized_entry_log_msg,
- H5C__trace_write_move_entry_log_msg,
- H5C__trace_write_pin_entry_log_msg,
- H5C__trace_write_create_fd_log_msg,
- H5C__trace_write_protect_entry_log_msg,
- H5C__trace_write_resize_entry_log_msg,
- H5C__trace_write_unpin_entry_log_msg,
- H5C__trace_write_destroy_fd_log_msg,
- H5C__trace_write_unprotect_entry_log_msg,
- H5C__trace_write_set_cache_config_log_msg,
- H5C__trace_write_remove_entry_log_msg};
+static const H5C_log_class_t H5C_trace_log_class_g = {"trace",
+ H5C__trace_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ NULL, /* write start message */
+ NULL, /* write stop message */
+ NULL, /* write create cache message */
+ NULL, /* write destroy cache message */
+ NULL, /* write evict cache message */
+ H5C__trace_write_expunge_entry_log_msg,
+ H5C__trace_write_flush_cache_log_msg,
+ H5C__trace_write_insert_entry_log_msg,
+ H5C__trace_write_mark_entry_dirty_log_msg,
+ H5C__trace_write_mark_entry_clean_log_msg,
+ H5C__trace_write_mark_unserialized_entry_log_msg,
+ H5C__trace_write_mark_serialized_entry_log_msg,
+ H5C__trace_write_move_entry_log_msg,
+ H5C__trace_write_pin_entry_log_msg,
+ H5C__trace_write_create_fd_log_msg,
+ H5C__trace_write_protect_entry_log_msg,
+ H5C__trace_write_resize_entry_log_msg,
+ H5C__trace_write_unpin_entry_log_msg,
+ H5C__trace_write_destroy_fd_log_msg,
+ H5C__trace_write_unprotect_entry_log_msg,
+ H5C__trace_write_set_cache_config_log_msg,
+ H5C__trace_write_remove_entry_log_msg};
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_log_message
@@ -168,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
/* Write the log message and flush */
n_chars = HDstrlen(trace_udata->message);
- if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
+ if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));
diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h
index ecd9921..26216ec 100644
--- a/src/H5Cmodule.h
+++ b/src/H5Cmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5C package. Including this header means that the source file
* is part of the H5C package.
*/
-#ifndef _H5Cmodule_H
-#define _H5Cmodule_H
+#ifndef H5Cmodule_H
+#define H5Cmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_CACHE
#define H5_MY_PKG_INIT NO
-#endif /* _H5Cmodule_H */
+#endif /* H5Cmodule_H */
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index abcd3c0..66c6601 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,7 +18,7 @@
* Quincey Koziol
*
* Purpose: Functions in this file implement support for parallel I/O for
- * generic cache code.
+ * generic cache code.
*
*-------------------------------------------------------------------------
*/
@@ -28,19 +28,19 @@
/****************/
#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* 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
/****************/
@@ -78,74 +78,74 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned
*
* 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
*
@@ -160,9 +160,6 @@ herr_t
H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr,
int mpi_rank, int mpi_size)
{
- int i;
- int m;
- unsigned n;
unsigned first_entry_to_flush;
unsigned last_entry_to_flush;
unsigned total_entries_to_clear = 0;
@@ -177,7 +174,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
char tbl_buf[1024];
-#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
+#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
+ unsigned m, n;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -187,7 +185,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
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);
@@ -219,9 +217,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
} /* end if */
n = num_candidates / (unsigned)mpi_size;
- if (num_candidates % (unsigned)mpi_size > INT_MAX)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow")
- m = (int)(num_candidates % (unsigned)mpi_size);
+ m = num_candidates % (unsigned)mpi_size;
if (NULL ==
(candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
@@ -232,31 +228,31 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
candidate_assignment_table[mpi_size] = num_candidates;
if (m == 0) { /* mpi_size is an even divisor of num_candidates */
- for (i = 1; i < mpi_size; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
+ for (u = 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end if */
else {
- for (i = 1; i <= m; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;
+ for (u = 1; u <= m; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n + 1;
if (num_candidates < (unsigned)mpi_size) {
- for (i = m + 1; i < mpi_size; i++)
- candidate_assignment_table[i] = num_candidates;
+ for (u = m + 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = num_candidates;
} /* end if */
else {
- for (i = m + 1; i < mpi_size; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
+ for (u = m + 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end else */
} /* end else */
HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates);
#if H5C_DO_SANITY_CHECKS
/* Verify that the candidate assignment table has the expected form */
- for (i = 1; i < mpi_size - 1; i++) {
+ for (u = 1; u < (unsigned)(mpi_size - 1); u++) {
unsigned a, b;
- a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
- b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];
+ a = candidate_assignment_table[u] - candidate_assignment_table[u - 1];
+ b = candidate_assignment_table[u + 1] - candidate_assignment_table[u];
HDassert(n + 1 >= a);
HDassert(a >= b);
@@ -268,11 +264,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- for (i = 0; i < 1024; i++)
- tbl_buf[i] = '\0';
+ for (u = 0; u < 1024; u++)
+ tbl_buf[u] = '\0';
HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
- for (i = 0; i <= mpi_size; i++)
- HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]);
+ for (u = 0; u <= (unsigned)mpi_size; u++)
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]);
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
@@ -347,9 +343,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#if H5C_DO_SANITY_CHECKS
m = 0;
n = 0;
- for (i = 0; i < H5C_RING_NTYPES; i++) {
- m += (int)entries_to_flush[i];
- n += entries_to_clear[i];
+ for (u = 0; u < H5C_RING_NTYPES; u++) {
+ m += entries_to_flush[u];
+ n += entries_to_clear[u];
} /* end if */
HDassert((unsigned)m == total_entries_to_flush);
@@ -397,13 +393,14 @@ done:
} /* H5C_apply_candidate_list() */
/*-------------------------------------------------------------------------
+ *
* 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
*
@@ -412,6 +409,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
@@ -425,56 +432,72 @@ 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 <= (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->dirty_index_size <= (cache_ptr->dLRU_list_size + cache_ptr->pel_size));
+ 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) &&
+
+ 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")
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) &&
+
+ 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);
@@ -482,32 +505,39 @@ 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")
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() */
/*-------------------------------------------------------------------------
* 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
*
@@ -516,6 +546,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
@@ -533,50 +569,69 @@ 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)
+ 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) &&
+
+ 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")
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 */
@@ -589,24 +644,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
*
@@ -679,13 +734,14 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr
if (entry_ptr == NULL) {
#if H5C_DO_SANITY_CHECKS
- HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %a not in cache.\n", u, addr);
+ HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u,
+ addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?")
} /* end if */
else if (!entry_ptr->is_dirty) {
#if H5C_DO_SANITY_CHECKS
- HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %a is not dirty!?!\n", addr);
+ HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?")
} /* end else-if */
@@ -737,7 +793,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr
* 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;
@@ -885,15 +941,16 @@ H5C__collective_write(H5F_t *f)
{
H5AC_t * cache_ptr;
H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE;
+ void * base_buf;
int count;
int * length_array = NULL;
MPI_Aint * buf_array = NULL;
MPI_Aint * offset_array = NULL;
- MPI_Datatype btype;
- hbool_t btype_created = FALSE;
- MPI_Datatype ftype;
- hbool_t ftype_created = FALSE;
+ MPI_Datatype btype = MPI_BYTE;
+ MPI_Datatype ftype = MPI_BYTE;
int mpi_code;
+ char unused = 0; /* Unused, except for non-NULL pointer value */
+ size_t buf_count;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -908,20 +965,17 @@ H5C__collective_write(H5F_t *f)
if (H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
+ /* Set transfer mode */
+ if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
+
/* Get number of entries in collective write list */
count = (int)H5SL_count(cache_ptr->coll_write_list);
-
if (count > 0) {
- H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE;
H5SL_node_t * node;
H5C_cache_entry_t *entry_ptr;
- void * base_buf;
int i;
- /* Set new transfer mode */
- if (H5CX_set_io_xfer_mode(xfer_mode) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
-
/* Allocate arrays */
if (NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
@@ -948,7 +1002,6 @@ H5C__collective_write(H5F_t *f)
node = H5SL_next(node);
i = 1;
while (node) {
-
if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node)))
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item")
@@ -966,9 +1019,6 @@ H5C__collective_write(H5F_t *f)
if (MPI_SUCCESS !=
(mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
-
- btype_created = TRUE;
-
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -976,61 +1026,27 @@ H5C__collective_write(H5F_t *f)
if (MPI_SUCCESS !=
(mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
-
- ftype_created = TRUE;
-
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- /* Pass buf type, file type to the file driver */
- if (H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
-
- /* Write data */
- if (H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, base_buf) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively")
-
+ /* MPI count to write */
+ buf_count = 1;
} /* end if */
else {
- MPI_Status mpi_stat;
- MPI_File * mpi_fh_p;
- MPI_File mpi_fh;
- MPI_Info * info_p;
- MPI_Info info;
-
- /* This should be rewritten to call H5F_block_write, with the correct
- * buffer and file datatypes (null ones). -QAK, 2018/02/21
- */
- if (H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get mpi file handle")
-
- mpi_fh = *(MPI_File *)mpi_fh_p;
-
- if (H5F_get_mpi_info(f, &info_p) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file info")
+ /* Set non-NULL pointer for I/O operation */
+ base_buf = &unused;
- info = *info_p;
-
- /* just to match up with the 1st MPI_File_set_view from
- * H5FD_mpio_write()
- */
- if (MPI_SUCCESS !=
- (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* MPI count to write */
+ buf_count = 0;
+ } /* end else */
- /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */
- HDmemset(&mpi_stat, 0, sizeof(MPI_Status));
- if (MPI_SUCCESS !=
- (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
+ /* Pass buf type, file type to the file driver */
+ if (H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
- /* just to match up with the 2nd MPI_File_set_view (reset) in
- * H5FD_mpio_write()
- */
- if (MPI_SUCCESS !=
- (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", info)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- } /* end else */
+ /* Write data */
+ if (H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, buf_count, base_buf) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries collectively")
done:
/* Free arrays */
@@ -1039,9 +1055,9 @@ done:
offset_array = (MPI_Aint *)H5MM_xfree(offset_array);
/* Free MPI Types */
- if (btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
+ if (MPI_BYTE != btype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if (ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
+ if (MPI_BYTE != ftype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
/* Reset transfer mode in API context, if changed */
@@ -1055,7 +1071,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.
*
@@ -1084,9 +1100,9 @@ done:
* Return: Non-negative on success/Negative on failure.
*
* Programmer: John Mainzer
- * 2/10/17
+ * 2/10/17
*
- * Changes: None.
+ * Changes: None.
*
*-------------------------------------------------------------------------
*/
@@ -1175,7 +1191,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.
@@ -1204,7 +1220,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 dd09813..99ed4f8 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,43 +17,55 @@
* Purpose: This file contains declarations which are normally visible
* only within the H5C package.
*
- * Source files outside the H5C package should include
- * H5Cprivate.h instead.
+ * Source files outside the H5C package should include
+ * H5Cprivate.h instead.
*
- * The one exception to this rule is test/cache.c. The test
- * code is easier to write if it can look at the cache's
- * internal data structures. Indeed, this is the main
- * reason why this file was created.
+ * The one exception to this rule is test/cache.c. The test
+ * code is easier to write if it can look at the cache's
+ * internal data structures. Indeed, this is the main
+ * reason why this file was created.
*/
+/* clang-format off */
+/* Maintain current format by disabling format for this file */
+
#if !(defined H5C_FRIEND || defined H5C_MODULE)
#error "Do not include this file outside the H5C package!"
#endif
-#ifndef _H5Cpkg_H
-#define _H5Cpkg_H
+#ifndef H5Cpkg_H
+#define H5Cpkg_H
/* Get package's private header */
#include "H5Cprivate.h"
/* Other private headers needed by this file */
-#include "H5Clog.h" /* Cache logging */
-#include "H5SLprivate.h" /* Skip lists */
+#include "H5Clog.h" /* Cache logging */
+#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
/**************************/
/* Number of epoch markers active */
-#define H5C__MAX_EPOCH_MARKERS 10
+#define H5C__MAX_EPOCH_MARKERS 10
+
/* Cache configuration settings */
-#define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */
+#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
@@ -72,7 +84,7 @@
* to the HGOTO_ERROR macro, which may not be appropriate in all cases.
* If so, we will need versions of the insertion and deletion macros which
* do not reference the sanity checking macros.
- * JRM - 5/5/04
+ * JRM - 5/5/04
*
* Changes:
*
@@ -147,59 +159,96 @@
* sanity checking macros. These macro are used to update the size of
* a DLL when one of its entries changes size.
*
- * JRM - 9/8/05
+ * JRM - 9/8/05
*
* - Added macros supporting the index list -- a doubly liked list of
* all entries in the index. This list is necessary to reduce the
* cost of visiting all entries in the cache, which was previously
* done via a scan of the hash table.
*
- * JRM - 10/15/15
+ * JRM - 10/15/15
*
****************************************************************************/
#if H5C_DO_SANITY_CHECKS
-#define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- if (((head_ptr) == NULL) || ((tail_ptr) == NULL) || ((entry_ptr) == NULL) || ((len) <= 0) || \
- ((Size) < (entry_ptr)->size) || (((entry_ptr)->prev == NULL) && ((head_ptr) != (entry_ptr))) || \
- (((entry_ptr)->next == NULL) && ((tail_ptr) != (entry_ptr))) || \
- (((len) == 1) && \
- (!(((head_ptr) == (entry_ptr)) && ((tail_ptr) == (entry_ptr)) && ((entry_ptr)->next == NULL) && \
- ((entry_ptr)->prev == NULL) && ((Size) == (entry_ptr)->size))))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre remove SC failed") \
- }
-
-#define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
- if (((((head_ptr) == NULL) || ((tail_ptr) == NULL)) && ((head_ptr) != (tail_ptr))) || ((len) < 0) || \
- ((Size) < 0) || \
- (((len) == 1) && \
- (((head_ptr) != (tail_ptr)) || ((head_ptr) == NULL) || ((head_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((head_ptr) == NULL) || ((head_ptr)->prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->next != NULL)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL sanity check failed") \
- }
-
-#define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- if (((entry_ptr) == NULL) || ((entry_ptr)->next != NULL) || ((entry_ptr)->prev != NULL) || \
- ((((head_ptr) == NULL) || ((tail_ptr) == NULL)) && ((head_ptr) != (tail_ptr))) || \
- (((len) == 1) && \
- (((head_ptr) != (tail_ptr)) || ((head_ptr) == NULL) || ((head_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((head_ptr) == NULL) || ((head_ptr)->prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->next != NULL)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre insert SC failed") \
- }
-
-#define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
- if (((dll_len) <= 0) || ((dll_size) <= 0) || ((old_size) <= 0) || ((old_size) > (dll_size)) || \
- ((new_size) <= 0) || (((dll_len) == 1) && ((old_size) != (dll_size)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL pre size update SC failed") \
- }
-
-#define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
- if (((new_size) > (dll_size)) || (((dll_len) == 1) && ((new_size) != (dll_size)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL post size update SC failed") \
- }
+#define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+if ( ( (head_ptr) == NULL ) || \
+ ( (tail_ptr) == NULL ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (len) <= 0 ) || \
+ ( (Size) < (entry_ptr)->size ) || \
+ ( ( (entry_ptr)->prev == NULL ) && ( (head_ptr) != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
+ ( ( (len) == 1 ) && \
+ ( ! ( ( (head_ptr) == (entry_ptr) ) && \
+ ( (tail_ptr) == (entry_ptr) ) && \
+ ( (entry_ptr)->next == NULL ) && \
+ ( (entry_ptr)->prev == NULL ) && \
+ ( (Size) == (entry_ptr)->size ) \
+ ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre remove SC failed") \
+}
+
+#define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( (len) < 0 ) || \
+ ( (Size) < 0 ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL sanity check failed") \
+}
+
+#define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+if ( ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->next != NULL ) || \
+ ( (entry_ptr)->prev != NULL ) || \
+ ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre insert SC failed") \
+}
+
+#define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
+if ( ( (dll_len) <= 0 ) || \
+ ( (dll_size) <= 0 ) || \
+ ( (old_size) <= 0 ) || \
+ ( (old_size) > (dll_size) ) || \
+ ( (new_size) <= 0 ) || \
+ ( ( (dll_len) == 1 ) && ( (old_size) != (dll_size) ) ) ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL pre size update SC failed") \
+}
+
+#define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
+if ( ( (new_size) > (dll_size) ) || \
+ ( ( (dll_len) == 1 ) && ( (new_size) != (dll_size) ) ) ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL post size update SC failed") \
+}
#else /* H5C_DO_SANITY_CHECKS */
@@ -211,103 +260,144 @@
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (tail_ptr)->next = (entry_ptr); \
- (entry_ptr)->prev = (tail_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += (entry_ptr)->size; \
- } /* H5C__DLL_APPEND() */
-
-#define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (head_ptr)->prev = (entry_ptr); \
- (entry_ptr)->next = (head_ptr); \
- (head_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- } /* H5C__DLL_PREPEND() */
-
-#define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- if ((head_ptr) == (entry_ptr)) { \
- (head_ptr) = (entry_ptr)->next; \
- if ((head_ptr) != NULL) \
- (head_ptr)->prev = NULL; \
- } \
- else \
- (entry_ptr)->prev->next = (entry_ptr)->next; \
- if ((tail_ptr) == (entry_ptr)) { \
- (tail_ptr) = (entry_ptr)->prev; \
- if ((tail_ptr) != NULL) \
- (tail_ptr)->next = NULL; \
- } \
- else \
- (entry_ptr)->next->prev = (entry_ptr)->prev; \
- entry_ptr->next = NULL; \
- entry_ptr->prev = NULL; \
- (len)--; \
- (Size) -= entry_ptr->size; \
- } \
- } /* H5C__DLL_REMOVE() */
-
-#define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \
- { \
- H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
- (dll_size) -= (old_size); \
- (dll_size) += (new_size); \
- H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
- } /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */
+
+#define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
+{ \
+ H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (tail_ptr)->next = (entry_ptr); \
+ (entry_ptr)->prev = (tail_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += (entry_ptr)->size; \
+} /* H5C__DLL_APPEND() */
+
+#define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
+{ \
+ H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (head_ptr)->prev = (entry_ptr); \
+ (entry_ptr)->next = (head_ptr); \
+ (head_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__DLL_PREPEND() */
+
+#define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
+{ \
+ H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ { \
+ if ( (head_ptr) == (entry_ptr) ) \
+ { \
+ (head_ptr) = (entry_ptr)->next; \
+ if ( (head_ptr) != NULL ) \
+ (head_ptr)->prev = NULL; \
+ } \
+ else \
+ (entry_ptr)->prev->next = (entry_ptr)->next; \
+ if ( (tail_ptr) == (entry_ptr) ) \
+ { \
+ (tail_ptr) = (entry_ptr)->prev; \
+ if ( (tail_ptr) != NULL ) \
+ (tail_ptr)->next = NULL; \
+ } \
+ else \
+ (entry_ptr)->next->prev = (entry_ptr)->prev; \
+ entry_ptr->next = NULL; \
+ entry_ptr->prev = NULL; \
+ (len)--; \
+ (Size) -= entry_ptr->size; \
+ } \
+} /* H5C__DLL_REMOVE() */
+
+#define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \
+{ \
+ H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
+ (dll_size) -= (old_size); \
+ (dll_size) += (new_size); \
+ H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
+} /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */
#if H5C_DO_SANITY_CHECKS
-#define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((hd_ptr) == NULL) || ((tail_ptr) == NULL) || ((entry_ptr) == NULL) || ((len) <= 0) || \
- ((Size) < (entry_ptr)->size) || (((Size) == (entry_ptr)->size) && (!((len) == 1))) || \
- (((entry_ptr)->aux_prev == NULL) && ((hd_ptr) != (entry_ptr))) || \
- (((entry_ptr)->aux_next == NULL) && ((tail_ptr) != (entry_ptr))) || \
- (((len) == 1) && \
- (!(((hd_ptr) == (entry_ptr)) && ((tail_ptr) == (entry_ptr)) && ((entry_ptr)->aux_next == NULL) && \
- ((entry_ptr)->aux_prev == NULL) && ((Size) == (entry_ptr)->size))))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "aux DLL pre remove SC failed") \
- }
-
-#define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
- if (((((head_ptr) == NULL) || ((tail_ptr) == NULL)) && ((head_ptr) != (tail_ptr))) || ((len) < 0) || \
- ((Size) < 0) || \
- (((len) == 1) && (((head_ptr) != (tail_ptr)) || ((Size) <= 0) || ((head_ptr) == NULL) || \
- ((head_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((head_ptr) == NULL) || ((head_ptr)->aux_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->aux_next != NULL)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL sanity check failed") \
- }
-
-#define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((entry_ptr) == NULL) || ((entry_ptr)->aux_next != NULL) || ((entry_ptr)->aux_prev != NULL) || \
- ((((hd_ptr) == NULL) || ((tail_ptr) == NULL)) && ((hd_ptr) != (tail_ptr))) || \
- (((len) == 1) && \
- (((hd_ptr) != (tail_ptr)) || ((Size) <= 0) || ((hd_ptr) == NULL) || ((hd_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((hd_ptr) == NULL) || ((hd_ptr)->aux_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->aux_next != NULL)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL pre insert SC failed") \
- }
+#define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (hd_ptr) == NULL ) || \
+ ( (tail_ptr) == NULL ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (len) <= 0 ) || \
+ ( (Size) < (entry_ptr)->size ) || \
+ ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \
+ ( ( (entry_ptr)->aux_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->aux_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
+ ( ( (len) == 1 ) && \
+ ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \
+ ( (entry_ptr)->aux_next == NULL ) && \
+ ( (entry_ptr)->aux_prev == NULL ) && \
+ ( (Size) == (entry_ptr)->size ) \
+ ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "aux DLL pre remove SC failed") \
+}
+
+#define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( (len) < 0 ) || \
+ ( (Size) < 0 ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->aux_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL sanity check failed") \
+}
+
+#define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->aux_next != NULL ) || \
+ ( (entry_ptr)->aux_prev != NULL ) || \
+ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (hd_ptr) != (tail_ptr) ) \
+ ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->aux_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL pre insert SC failed") \
+}
#else /* H5C_DO_SANITY_CHECKS */
@@ -317,97 +407,135 @@
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (tail_ptr)->aux_next = (entry_ptr); \
- (entry_ptr)->aux_prev = (tail_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- } /* H5C__AUX_DLL_APPEND() */
-
-#define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (head_ptr)->aux_prev = (entry_ptr); \
- (entry_ptr)->aux_next = (head_ptr); \
- (head_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- } /* H5C__AUX_DLL_PREPEND() */
-
-#define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- if ((head_ptr) == (entry_ptr)) { \
- (head_ptr) = (entry_ptr)->aux_next; \
- if ((head_ptr) != NULL) \
- (head_ptr)->aux_prev = NULL; \
- } \
- else \
- (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \
- if ((tail_ptr) == (entry_ptr)) { \
- (tail_ptr) = (entry_ptr)->aux_prev; \
- if ((tail_ptr) != NULL) \
- (tail_ptr)->aux_next = NULL; \
- } \
- else \
- (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \
- entry_ptr->aux_next = NULL; \
- entry_ptr->aux_prev = NULL; \
- (len)--; \
- (Size) -= entry_ptr->size; \
- } \
- } /* H5C__AUX_DLL_REMOVE() */
-#if H5C_DO_SANITY_CHECKS
+#define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\
+{ \
+ H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (tail_ptr)->aux_next = (entry_ptr); \
+ (entry_ptr)->aux_prev = (tail_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__AUX_DLL_APPEND() */
+
+#define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (head_ptr)->aux_prev = (entry_ptr); \
+ (entry_ptr)->aux_next = (head_ptr); \
+ (head_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__AUX_DLL_PREPEND() */
+
+#define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+ { \
+ if ( (head_ptr) == (entry_ptr) ) \
+ { \
+ (head_ptr) = (entry_ptr)->aux_next; \
+ if ( (head_ptr) != NULL ) \
+ (head_ptr)->aux_prev = NULL; \
+ } \
+ else \
+ (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \
+ if ( (tail_ptr) == (entry_ptr) ) \
+ { \
+ (tail_ptr) = (entry_ptr)->aux_prev; \
+ if ( (tail_ptr) != NULL ) \
+ (tail_ptr)->aux_next = NULL; \
+ } \
+ else \
+ (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \
+ entry_ptr->aux_next = NULL; \
+ entry_ptr->aux_prev = NULL; \
+ (len)--; \
+ (Size) -= entry_ptr->size; \
+ } \
+} /* H5C__AUX_DLL_REMOVE() */
-#define H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((hd_ptr) == NULL) || ((tail_ptr) == NULL) || ((entry_ptr) == NULL) || ((len) <= 0) || \
- ((Size) < (entry_ptr)->size) || (((Size) == (entry_ptr)->size) && (!((len) == 1))) || \
- (((entry_ptr)->il_prev == NULL) && ((hd_ptr) != (entry_ptr))) || \
- (((entry_ptr)->il_next == NULL) && ((tail_ptr) != (entry_ptr))) || \
- (((len) == 1) && \
- (!(((hd_ptr) == (entry_ptr)) && ((tail_ptr) == (entry_ptr)) && ((entry_ptr)->il_next == NULL) && \
- ((entry_ptr)->il_prev == NULL) && ((Size) == (entry_ptr)->size))))) { \
- HDassert(0 && "il DLL pre remove SC failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "il DLL pre remove SC failed") \
- }
-
-#define H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((entry_ptr) == NULL) || ((entry_ptr)->il_next != NULL) || ((entry_ptr)->il_prev != NULL) || \
- ((((hd_ptr) == NULL) || ((tail_ptr) == NULL)) && ((hd_ptr) != (tail_ptr))) || \
- (((len) == 1) && \
- (((hd_ptr) != (tail_ptr)) || ((Size) <= 0) || ((hd_ptr) == NULL) || ((hd_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((hd_ptr) == NULL) || ((hd_ptr)->il_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->il_next != NULL)))) { \
- HDassert(0 && "IL DLL pre insert SC failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL pre insert SC failed") \
- }
+#if H5C_DO_SANITY_CHECKS
-#define H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
- if (((((head_ptr) == NULL) || ((tail_ptr) == NULL)) && ((head_ptr) != (tail_ptr))) || \
- (((len) == 1) && \
- (((head_ptr) != (tail_ptr)) || ((head_ptr) == NULL) || ((head_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((head_ptr) == NULL) || ((head_ptr)->il_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->il_next != NULL)))) { \
- HDassert(0 && "IL DLL sanity check failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL sanity check failed") \
- }
+#define H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (hd_ptr) == NULL ) || \
+ ( (tail_ptr) == NULL ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (len) <= 0 ) || \
+ ( (Size) < (entry_ptr)->size ) || \
+ ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \
+ ( ( (entry_ptr)->il_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->il_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
+ ( ( (len) == 1 ) && \
+ ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \
+ ( (entry_ptr)->il_next == NULL ) && \
+ ( (entry_ptr)->il_prev == NULL ) && \
+ ( (Size) == (entry_ptr)->size ) \
+ ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "il DLL pre remove SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "il DLL pre remove SC failed") \
+}
+
+#define H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->il_next != NULL ) || \
+ ( (entry_ptr)->il_prev != NULL ) || \
+ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (hd_ptr) != (tail_ptr) ) \
+ ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->il_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->il_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "IL DLL pre insert SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL pre insert SC failed") \
+}
+
+#define H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->il_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->il_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "IL DLL sanity check failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL sanity check failed") \
+}
#else /* H5C_DO_SANITY_CHECKS */
@@ -417,48 +545,55 @@
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__IL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (tail_ptr)->il_next = (entry_ptr); \
- (entry_ptr)->il_prev = (tail_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fail_val) \
- } /* H5C__IL_DLL_APPEND() */
-
-#define H5C__IL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- if ((head_ptr) == (entry_ptr)) { \
- (head_ptr) = (entry_ptr)->il_next; \
- if ((head_ptr) != NULL) \
- (head_ptr)->il_prev = NULL; \
- } \
- else \
- (entry_ptr)->il_prev->il_next = (entry_ptr)->il_next; \
- if ((tail_ptr) == (entry_ptr)) { \
- (tail_ptr) = (entry_ptr)->il_prev; \
- if ((tail_ptr) != NULL) \
- (tail_ptr)->il_next = NULL; \
- } \
- else \
- (entry_ptr)->il_next->il_prev = (entry_ptr)->il_prev; \
- entry_ptr->il_next = NULL; \
- entry_ptr->il_prev = NULL; \
- (len)--; \
- (Size) -= entry_ptr->size; \
- } \
- H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
- } /* H5C__IL_DLL_REMOVE() */
+
+#define H5C__IL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\
+{ \
+ H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (tail_ptr)->il_next = (entry_ptr); \
+ (entry_ptr)->il_prev = (tail_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+ H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fail_val) \
+} /* H5C__IL_DLL_APPEND() */
+
+#define H5C__IL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+ { \
+ if ( (head_ptr) == (entry_ptr) ) \
+ { \
+ (head_ptr) = (entry_ptr)->il_next; \
+ if ( (head_ptr) != NULL ) \
+ (head_ptr)->il_prev = NULL; \
+ } \
+ else \
+ (entry_ptr)->il_prev->il_next = (entry_ptr)->il_next; \
+ if ( (tail_ptr) == (entry_ptr) ) \
+ { \
+ (tail_ptr) = (entry_ptr)->il_prev; \
+ if ( (tail_ptr) != NULL ) \
+ (tail_ptr)->il_next = NULL; \
+ } \
+ else \
+ (entry_ptr)->il_next->il_prev = (entry_ptr)->il_prev; \
+ entry_ptr->il_next = NULL; \
+ entry_ptr->il_prev = NULL; \
+ (len)--; \
+ (Size) -= entry_ptr->size; \
+ } \
+ H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+} /* H5C__IL_DLL_REMOVE() */
+
/***********************************************************************
*
@@ -473,297 +608,323 @@
*
***********************************************************************/
-#define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \
- (cache_ptr->cache_accesses)++; \
- if (hit) { \
- (cache_ptr->cache_hits)++; \
- }
+#define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \
+ (cache_ptr->cache_accesses)++; \
+ if ( hit ) { \
+ (cache_ptr->cache_hits)++; \
+ } \
#if H5C_COLLECT_CACHE_STATS
-#define H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->index_size > (cache_ptr)->max_index_size) \
- (cache_ptr)->max_index_size = (cache_ptr)->index_size; \
- if ((cache_ptr)->clean_index_size > (cache_ptr)->max_clean_index_size) \
- (cache_ptr)->max_clean_index_size = (cache_ptr)->clean_index_size; \
- if ((cache_ptr)->dirty_index_size > (cache_ptr)->max_dirty_index_size) \
- (cache_ptr)->max_dirty_index_size = (cache_ptr)->dirty_index_size;
-
-#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \
+#define H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->index_size > (cache_ptr)->max_index_size ) \
+ (cache_ptr)->max_index_size = (cache_ptr)->index_size; \
+ if ( (cache_ptr)->clean_index_size > \
+ (cache_ptr)->max_clean_index_size ) \
+ (cache_ptr)->max_clean_index_size = \
+ (cache_ptr)->clean_index_size; \
+ if ( (cache_ptr)->dirty_index_size > \
+ (cache_ptr)->max_dirty_index_size ) \
+ (cache_ptr)->max_dirty_index_size = \
+ (cache_ptr)->dirty_index_size;
+
+#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \
(((cache_ptr)->dirty_pins)[(entry_ptr)->type->id])++;
-#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \
- if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \
- (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
- if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \
- (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
- if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \
- (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
- if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \
+#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \
+ if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
+ (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
+ if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
+ (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
+ if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
+ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
+ if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
(cache_ptr)->max_pel_size = (cache_ptr)->pel_size;
-#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \
- if (cache_ptr->flush_in_progress) \
- ((cache_ptr)->cache_flush_moves[(entry_ptr)->type->id])++; \
- if (entry_ptr->flush_in_progress) \
- ((cache_ptr)->entry_flush_moves[(entry_ptr)->type->id])++; \
- (((cache_ptr)->moves)[(entry_ptr)->type->id])++; \
- (cache_ptr)->entries_relocated_counter++;
-
-#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
- if (cache_ptr->flush_in_progress) \
- ((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \
- if (entry_ptr->flush_in_progress) \
- ((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->size < (new_size)) { \
- ((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \
- H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \
- (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
- if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \
- (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
- } \
- else if ((entry_ptr)->size > (new_size)) { \
- ((cache_ptr)->size_decreases[(entry_ptr)->type->id])++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) (cache_ptr)->total_ht_insertions++;
-
-#define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) (cache_ptr)->total_ht_deletions++;
-
-#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \
- if (success) { \
- (cache_ptr)->successful_ht_searches++; \
- (cache_ptr)->total_successful_ht_search_depth += depth; \
- } \
- else { \
- (cache_ptr)->failed_ht_searches++; \
- (cache_ptr)->total_failed_ht_search_depth += depth; \
- }
-
-#define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) ((cache_ptr)->unpins)[(entry_ptr)->type->id]++;
-
-#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) ((cache_ptr)->slist_scan_restarts)++;
-
-#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) ((cache_ptr)->LRU_scan_restarts)++;
-
-#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) ((cache_ptr)->index_scan_restarts)++;
-
-#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \
- { \
- (cache_ptr)->images_created++; \
+#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \
+ if ( cache_ptr->flush_in_progress ) \
+ ((cache_ptr)->cache_flush_moves[(entry_ptr)->type->id])++; \
+ if ( entry_ptr->flush_in_progress ) \
+ ((cache_ptr)->entry_flush_moves[(entry_ptr)->type->id])++; \
+ (((cache_ptr)->moves)[(entry_ptr)->type->id])++; \
+ (cache_ptr)->entries_relocated_counter++;
+
+#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)\
+ if ( cache_ptr->flush_in_progress ) \
+ ((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \
+ if ( entry_ptr->flush_in_progress ) \
+ ((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \
+ if ( (entry_ptr)->size < (new_size) ) { \
+ ((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \
+ H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
+ (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
+ if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
+ (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
+ } else if ( (entry_ptr)->size > (new_size) ) { \
+ ((cache_ptr)->size_decreases[(entry_ptr)->type->id])++; \
}
-#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \
- { \
- /* make sure image len is still good */ \
- HDassert((cache_ptr)->image_len > 0); \
- (cache_ptr)->images_read++; \
- }
+#define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
+ (cache_ptr)->total_ht_insertions++;
-#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \
- { \
- /* make sure image len is still good */ \
- HDassert((cache_ptr)->image_len > 0); \
- (cache_ptr)->images_loaded++; \
- (cache_ptr)->last_image_size = (cache_ptr)->image_len; \
- }
+#define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
+ (cache_ptr)->total_ht_deletions++;
-#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \
- { \
- (cache_ptr)->prefetches++; \
- if (dirty) \
- (cache_ptr)->dirty_prefetches++; \
+#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \
+ if ( success ) { \
+ (cache_ptr)->successful_ht_searches++; \
+ (cache_ptr)->total_successful_ht_search_depth += depth; \
+ } else { \
+ (cache_ptr)->failed_ht_searches++; \
+ (cache_ptr)->total_failed_ht_search_depth += depth; \
}
-#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \
- { \
- (cache_ptr)->prefetch_hits++; \
- }
+#define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) \
+ ((cache_ptr)->unpins)[(entry_ptr)->type->id]++;
+
+#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) \
+ ((cache_ptr)->slist_scan_restarts)++;
+
+#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) \
+ ((cache_ptr)->LRU_scan_restarts)++;
+
+#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \
+ ((cache_ptr)->index_scan_restarts)++;
+
+#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \
+{ \
+ (cache_ptr)->images_created++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \
+{ \
+ /* make sure image len is still good */ \
+ HDassert((cache_ptr)->image_len > 0); \
+ (cache_ptr)->images_read++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \
+{ \
+ /* make sure image len is still good */ \
+ HDassert((cache_ptr)->image_len > 0); \
+ (cache_ptr)->images_loaded++; \
+ (cache_ptr)->last_image_size = (cache_ptr)->image_len; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \
+{ \
+ (cache_ptr)->prefetches++; \
+ if ( dirty ) \
+ (cache_ptr)->dirty_prefetches++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \
+{ \
+ (cache_ptr)->prefetch_hits++; \
+}
#if H5C_COLLECT_CACHE_ENTRY_STATS
-#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \
- { \
- (entry_ptr)->accesses = 0; \
- (entry_ptr)->clears = 0; \
- (entry_ptr)->flushes = 0; \
- (entry_ptr)->pins = 0; \
- }
-
-#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) \
- (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
- ((entry_ptr)->clears)++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) \
- (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
- ((entry_ptr)->flushes)++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \
- { \
- if (take_ownership) \
- (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \
- else \
- (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->accesses > ((cache_ptr)->max_accesses)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] = (entry_ptr)->accesses; \
- if ((entry_ptr)->accesses < ((cache_ptr)->min_accesses)[(entry_ptr)->type->id]) \
- ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] = (entry_ptr)->accesses; \
- if ((entry_ptr)->clears > ((cache_ptr)->max_clears)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_clears)[(entry_ptr)->type->id] = (entry_ptr)->clears; \
- if ((entry_ptr)->flushes > ((cache_ptr)->max_flushes)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] = (entry_ptr)->flushes; \
- if ((entry_ptr)->size > ((cache_ptr)->max_size)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \
- if ((entry_ptr)->pins > ((cache_ptr)->max_pins)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_pins)[(entry_ptr)->type->id] = (entry_ptr)->pins; \
- }
-
-#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) { \
- (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
- ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
- (entry_ptr)->pins++; \
- if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \
- (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
- if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \
- (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
- } \
- if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \
- (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
- H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \
- (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
- if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \
- (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
- if ((entry_ptr)->size > ((cache_ptr)->max_size)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \
- cache_ptr->entries_inserted_counter++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
- { \
- if (hit) \
- ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
- else \
- ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
- if (!((entry_ptr)->is_read_only)) { \
- ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
- } \
- else { \
- ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
- if (((entry_ptr)->ro_ref_count) > ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = ((entry_ptr)->ro_ref_count); \
- } \
- if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \
- (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
- H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->pl_len > (cache_ptr)->max_pl_len) \
- (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
- if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \
- (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
- if ((entry_ptr)->size > ((cache_ptr)->max_size)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \
- ((entry_ptr)->accesses)++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
- { \
- ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
- (entry_ptr)->pins++; \
- if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \
- (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
- if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \
- (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
- }
+#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \
+{ \
+ (entry_ptr)->accesses = 0; \
+ (entry_ptr)->clears = 0; \
+ (entry_ptr)->flushes = 0; \
+ (entry_ptr)->pins = 0; \
+}
+
+#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \
+ if((entry_ptr)->is_pinned) \
+ (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
+ ((entry_ptr)->clears)++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
+ if((entry_ptr)->is_pinned) \
+ (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
+ ((entry_ptr)->flushes)++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \
+{ \
+ if ( take_ownership ) \
+ (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \
+ else \
+ (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \
+ if ( (entry_ptr)->accesses > \
+ ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] = \
+ (entry_ptr)->accesses; \
+ if ( (entry_ptr)->accesses < \
+ ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] = \
+ (entry_ptr)->accesses; \
+ if ( (entry_ptr)->clears > \
+ ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \
+ = (entry_ptr)->clears; \
+ if ( (entry_ptr)->flushes > \
+ ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \
+ = (entry_ptr)->flushes; \
+ if ( (entry_ptr)->size > \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] \
+ = (entry_ptr)->size; \
+ if ( (entry_ptr)->pins > \
+ ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \
+ = (entry_ptr)->pins; \
+}
+
+#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
+ if ( (entry_ptr)->is_pinned ) { \
+ (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
+ ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
+ (entry_ptr)->pins++; \
+ if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
+ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
+ if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
+ (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
+ } \
+ if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
+ (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
+ H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
+ (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
+ if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
+ (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
+ if ( (entry_ptr)->size > \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] \
+ = (entry_ptr)->size; \
+ cache_ptr->entries_inserted_counter++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
+{ \
+ if ( hit ) \
+ ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
+ else \
+ ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
+ if ( ! ((entry_ptr)->is_read_only) ) { \
+ ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
+ } else { \
+ ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
+ if ( ((entry_ptr)->ro_ref_count) > \
+ ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \
+ ((entry_ptr)->ro_ref_count); \
+ } \
+ if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
+ (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
+ H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \
+ (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
+ if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
+ (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
+ if ( (entry_ptr)->size > \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \
+ ((entry_ptr)->accesses)++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
+{ \
+ ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
+ (entry_ptr)->pins++; \
+ if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
+ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
+ if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
+ (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
+}
#else /* H5C_COLLECT_CACHE_ENTRY_STATS */
#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
-#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) \
- (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) \
- (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \
- { \
- if (take_ownership) \
- (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \
- else \
- (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
- { \
- (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
- if ((entry_ptr)->is_pinned) { \
- (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
- ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
- if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \
- (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
- if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \
- (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
- } \
- if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \
- (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
- H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \
- (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
- if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \
- (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
- cache_ptr->entries_inserted_counter++; \
- }
-
-#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
- { \
- if (hit) \
- ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
- else \
- ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
- if (!((entry_ptr)->is_read_only)) \
- ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
- else { \
- ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
- if (((entry_ptr)->ro_ref_count) > ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id]) \
- ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = ((entry_ptr)->ro_ref_count); \
- } \
- if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \
- (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
- H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
- if ((cache_ptr)->pl_len > (cache_ptr)->max_pl_len) \
- (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
- if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \
- (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
- }
-
-#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
- { \
- ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
- if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \
- (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
- if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \
- (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
- }
+#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \
+ if((entry_ptr)->is_pinned) \
+ (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
+ if ( (entry_ptr)->is_pinned ) \
+ (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \
+{ \
+ if ( take_ownership ) \
+ (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \
+ else \
+ (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
+{ \
+ (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
+ if ( (entry_ptr)->is_pinned ) { \
+ (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
+ ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
+ if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
+ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
+ if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
+ (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
+ } \
+ if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
+ (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
+ H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
+ (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
+ if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
+ (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
+ cache_ptr->entries_inserted_counter++; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
+{ \
+ if ( hit ) \
+ ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
+ else \
+ ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
+ if ( ! ((entry_ptr)->is_read_only) ) \
+ ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
+ else { \
+ ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
+ if ( ((entry_ptr)->ro_ref_count) > \
+ ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \
+ ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \
+ ((entry_ptr)->ro_ref_count); \
+ } \
+ if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
+ (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
+ H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
+ if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \
+ (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
+ if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
+ (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
+}
+
+#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
+{ \
+ ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
+ if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
+ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
+ if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
+ (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
+}
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
@@ -795,6 +956,7 @@
#endif /* H5C_COLLECT_CACHE_STATS */
+
/***********************************************************************
*
* Hash table access and manipulation macros:
@@ -811,13 +973,13 @@
* the clean_index_size and dirty_index_size fields of H5C_t. Also
* added macros to allow us to track entry cleans and dirties.
*
- * JRM -- 11/5/08
+ * JRM -- 11/5/08
*
* - Updated existing index macros and sanity check macros to maintain
* the index_ring_len, index_ring_size, clean_index_ring_size, and
* dirty_index_ring_size fields of H5C_t.
*
- * JRM -- 9/1/15
+ * JRM -- 9/1/15
*
* - Updated existing index macros and sanity checks macros to
* maintain an doubly linked list of all entries in the index.
@@ -831,230 +993,323 @@
/* H5C__HASH_TABLE_LEN is defined in H5Cpkg.h. It mut be a power of two. */
-#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
+#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
-#define H5C__HASH_FCN(x) (int)((unsigned)((x)&H5C__HASH_MASK) >> 3)
+#define H5C__HASH_FCN(x) (int)((unsigned)((x) & H5C__HASH_MASK) >> 3)
#if H5C_DO_SANITY_CHECKS
-#define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((entry_ptr) == NULL) || \
- (!H5F_addr_defined((entry_ptr)->addr)) || ((entry_ptr)->ht_next != NULL) || \
- ((entry_ptr)->ht_prev != NULL) || ((entry_ptr)->size <= 0) || \
- (H5C__HASH_FCN((entry_ptr)->addr) < 0) || \
- (H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((entry_ptr)->ring <= H5C_RING_UNDEFINED) || ((entry_ptr)->ring >= H5C_RING_NTYPES) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT insert SC failed") \
- }
-
-#define H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT insert SC failed") \
- }
-
-#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((cache_ptr)->index_len < 1) || \
- ((entry_ptr) == NULL) || ((cache_ptr)->index_size < (entry_ptr)->size) || \
- (!H5F_addr_defined((entry_ptr)->addr)) || ((entry_ptr)->size <= 0) || \
- (H5C__HASH_FCN((entry_ptr)->addr) < 0) || \
- (H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN) || \
- (((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == NULL) || \
- ((((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] != (entry_ptr)) && \
- ((entry_ptr)->ht_prev == NULL)) || \
- ((((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == (entry_ptr)) && \
- ((entry_ptr)->ht_prev != NULL)) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((entry_ptr)->ring <= H5C_RING_UNDEFINED) || ((entry_ptr)->ring >= H5C_RING_NTYPES) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] < (entry_ptr)->size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT remove SC failed") \
- }
-
-#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((entry_ptr) == NULL) || \
- (!H5F_addr_defined((entry_ptr)->addr)) || ((entry_ptr)->size <= 0) || \
- ((entry_ptr)->ht_prev != NULL) || ((entry_ptr)->ht_prev != NULL) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT remove SC failed") \
- }
+#define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( ! H5F_addr_defined((entry_ptr)->addr) ) || \
+ ( (entry_ptr)->ht_next != NULL ) || \
+ ( (entry_ptr)->ht_prev != NULL ) || \
+ ( (entry_ptr)->size <= 0 ) || \
+ ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \
+ ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT insert SC failed") \
+}
+
+#define H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT insert SC failed") \
+}
+
+#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_len < 1 ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( ! H5F_addr_defined((entry_ptr)->addr) ) || \
+ ( (entry_ptr)->size <= 0 ) || \
+ ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \
+ ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \
+ ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \
+ == NULL ) || \
+ ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \
+ != (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev == NULL ) ) || \
+ ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == \
+ (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev != NULL ) ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] < \
+ (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT remove SC failed") \
+}
+
+#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( ! H5F_addr_defined((entry_ptr)->addr) ) || \
+ ( (entry_ptr)->size <= 0 ) || \
+ ( (entry_ptr)->ht_prev != NULL ) || \
+ ( (entry_ptr)->ht_prev != NULL ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT remove SC failed") \
+}
/* (Keep in sync w/H5C_TEST__PRE_HT_SEARCH_SC macro in test/cache_common.h -QAK) */
-#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- (!H5F_addr_defined(Addr)) || (H5C__HASH_FCN(Addr) < 0) || \
- (H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN)) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT search SC failed") \
- }
+#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( ! H5F_addr_defined(Addr) ) || \
+ ( H5C__HASH_FCN(Addr) < 0 ) || \
+ ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT search SC failed") \
+}
/* (Keep in sync w/H5C_TEST__POST_SUC_HT_SEARCH_SC macro in test/cache_common.h -QAK) */
-#define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || ((cache_ptr)->index_len < 1) || \
- ((entry_ptr) == NULL) || ((cache_ptr)->index_size < (entry_ptr)->size) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((entry_ptr)->size <= 0) || (((cache_ptr)->index)[k] == NULL) || \
- ((((cache_ptr)->index)[k] != (entry_ptr)) && ((entry_ptr)->ht_prev == NULL)) || \
- ((((cache_ptr)->index)[k] == (entry_ptr)) && ((entry_ptr)->ht_prev != NULL)) || \
- (((entry_ptr)->ht_prev != NULL) && ((entry_ptr)->ht_prev->ht_next != (entry_ptr))) || \
- (((entry_ptr)->ht_next != NULL) && ((entry_ptr)->ht_next->ht_prev != (entry_ptr)))) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post successful HT search SC failed") \
- }
+#define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_len < 1 ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->size <= 0 ) || \
+ ( ((cache_ptr)->index)[k] == NULL ) || \
+ ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev == NULL ) ) || \
+ ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \
+ ( (entry_ptr)->ht_prev != NULL ) ) || \
+ ( ( (entry_ptr)->ht_prev != NULL ) && \
+ ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->ht_next != NULL ) && \
+ ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post successful HT search SC failed") \
+}
/* (Keep in sync w/H5C_TEST__POST_HT_SHIFT_TO_FRONT macro in test/cache_common.h -QAK) */
-#define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
- if (((cache_ptr) == NULL) || (((cache_ptr)->index)[k] != (entry_ptr)) || \
- ((entry_ptr)->ht_prev != NULL)) { \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT shift to front SC failed") \
- }
-
-#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr, was_clean) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->index_len <= 0) || ((cache_ptr)->index_size <= 0) || \
- ((new_size) <= 0) || ((old_size) > (cache_ptr)->index_size) || \
- (((cache_ptr)->index_len == 1) && ((cache_ptr)->index_size != (old_size))) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((!(was_clean) || ((cache_ptr)->clean_index_size < (old_size))) && \
- (((was_clean)) || ((cache_ptr)->dirty_index_size < (old_size)))) || \
- ((entry_ptr) == NULL) || ((entry_ptr)->ring <= H5C_RING_UNDEFINED) || \
- ((entry_ptr)->ring >= H5C_RING_NTYPES) || ((cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT entry size change SC failed") \
- }
-
-#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->index_len <= 0) || ((cache_ptr)->index_size <= 0) || \
- ((new_size) > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((!((entry_ptr)->is_dirty) || ((cache_ptr)->dirty_index_size < (new_size))) && \
- ((((entry_ptr)->is_dirty)) || ((cache_ptr)->clean_index_size < (new_size)))) || \
- (((cache_ptr)->index_len == 1) && ((cache_ptr)->index_size != (new_size))) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring])) || \
- ((cache_ptr)->index_len != (cache_ptr)->il_len) || \
- ((cache_ptr)->index_size != (cache_ptr)->il_size)) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT entry size change SC failed") \
- }
-
-#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \
- ((cache_ptr)->index_len <= 0) || ((entry_ptr) == NULL) || ((entry_ptr)->is_dirty != FALSE) || \
- ((cache_ptr)->index_size < (entry_ptr)->size) || \
- ((cache_ptr)->dirty_index_size < (entry_ptr)->size) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((entry_ptr)->ring <= H5C_RING_UNDEFINED) || ((entry_ptr)->ring >= H5C_RING_NTYPES) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]))) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry clean SC failed") \
- }
-
-#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr) == NULL) || ((cache_ptr)->magic != H5C__H5C_T_MAGIC) || \
- ((cache_ptr)->index_len <= 0) || ((entry_ptr) == NULL) || ((entry_ptr)->is_dirty != TRUE) || \
- ((cache_ptr)->index_size < (entry_ptr)->size) || \
- ((cache_ptr)->clean_index_size < (entry_ptr)->size) || \
- ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((entry_ptr)->ring <= H5C_RING_UNDEFINED) || ((entry_ptr)->ring >= H5C_RING_NTYPES) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]))) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry dirty SC failed") \
- }
-
-#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]))) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry clean SC failed") \
- }
-
-#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
- if (((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->clean_index_size)) || \
- ((cache_ptr)->index_size < ((cache_ptr)->dirty_index_size)) || \
- ((cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size) || \
- ((cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
- ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
- (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]))) { \
- HDassert(FALSE); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry dirty SC failed") \
- }
+#define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
+ ( (entry_ptr)->ht_prev != NULL ) ) { \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT shift to front SC failed") \
+}
+
+#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->index_len <= 0 ) || \
+ ( (cache_ptr)->index_size <= 0 ) || \
+ ( (new_size) <= 0 ) || \
+ ( (old_size) > (cache_ptr)->index_size ) || \
+ ( ( (cache_ptr)->index_len == 1 ) && \
+ ( (cache_ptr)->index_size != (old_size) ) ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( ( !( was_clean ) || \
+ ( (cache_ptr)->clean_index_size < (old_size) ) ) && \
+ ( ( (was_clean) ) || \
+ ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT entry size change SC failed") \
+}
+
+#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->index_len <= 0 ) || \
+ ( (cache_ptr)->index_size <= 0 ) || \
+ ( (new_size) > (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + \
+ (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( ( !((entry_ptr)->is_dirty ) || \
+ ( (cache_ptr)->dirty_index_size < (new_size) ) ) && \
+ ( ( ((entry_ptr)->is_dirty) ) || \
+ ( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \
+ ( ( (cache_ptr)->index_len == 1 ) && \
+ ( (cache_ptr)->index_size != (new_size) ) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \
+ ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \
+ ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT entry size change SC failed") \
+}
+
+#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
+if ( \
+ ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_len <= 0 ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->is_dirty != FALSE ) || \
+ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->dirty_index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry clean SC failed") \
+}
+
+#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
+if ( \
+ ( (cache_ptr) == NULL ) || \
+ ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_len <= 0 ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->is_dirty != TRUE ) || \
+ ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->clean_index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry dirty SC failed") \
+}
+
+#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
+if ( ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry clean SC failed") \
+}
+
+#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
+if ( ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry dirty SC failed") \
+}
#else /* H5C_DO_SANITY_CHECKS */
@@ -1067,181 +1322,198 @@
#define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val)
#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr)
#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr)
-#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr, was_clean)
-#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr)
+#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean)
+#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr)
#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr)
#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr)
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \
- { \
- int k; \
- H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
- k = H5C__HASH_FCN((entry_ptr)->addr); \
- if (((cache_ptr)->index)[k] != NULL) { \
- (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr); \
- } \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- (cache_ptr)->index_len++; \
- (cache_ptr)->index_size += (entry_ptr)->size; \
- ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \
- ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (entry_ptr)->size; \
- if ((entry_ptr)->is_dirty) { \
- (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) += (entry_ptr)->size; \
- } \
- else { \
- (cache_ptr)->clean_index_size += (entry_ptr)->size; \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) += (entry_ptr)->size; \
- } \
- if ((entry_ptr)->flush_me_last) { \
- (cache_ptr)->num_last_entries++; \
- HDassert((cache_ptr)->num_last_entries <= 2); \
- } \
- H5C__IL_DLL_APPEND((entry_ptr), (cache_ptr)->il_head, (cache_ptr)->il_tail, (cache_ptr)->il_len, \
- (cache_ptr)->il_size, fail_val) \
- H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
- H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
- }
-#define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, fail_val) \
- { \
- int k; \
- H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
- k = H5C__HASH_FCN((entry_ptr)->addr); \
- if ((entry_ptr)->ht_next) \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
- if ((entry_ptr)->ht_prev) \
- (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
- if (((cache_ptr)->index)[k] == (entry_ptr)) \
- ((cache_ptr)->index)[k] = (entry_ptr)->ht_next; \
- (entry_ptr)->ht_next = NULL; \
- (entry_ptr)->ht_prev = NULL; \
- (cache_ptr)->index_len--; \
- (cache_ptr)->index_size -= (entry_ptr)->size; \
- ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \
- ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (entry_ptr)->size; \
- if ((entry_ptr)->is_dirty) { \
- (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) -= (entry_ptr)->size; \
- } \
- else { \
- (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) -= (entry_ptr)->size; \
- } \
- if ((entry_ptr)->flush_me_last) { \
- (cache_ptr)->num_last_entries--; \
- HDassert((cache_ptr)->num_last_entries <= 1); \
- } \
- H5C__IL_DLL_REMOVE((entry_ptr), (cache_ptr)->il_head, (cache_ptr)->il_tail, (cache_ptr)->il_len, \
- (cache_ptr)->il_size, fail_val) \
- H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
- H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \
- }
-
-#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \
- { \
- int k; \
- int depth = 0; \
- H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
- k = H5C__HASH_FCN(Addr); \
- entry_ptr = ((cache_ptr)->index)[k]; \
- while (entry_ptr) { \
- if (H5F_addr_eq(Addr, (entry_ptr)->addr)) { \
- H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
- if (entry_ptr != ((cache_ptr)->index)[k]) { \
- if ((entry_ptr)->ht_next) \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
- HDassert((entry_ptr)->ht_prev != NULL); \
- (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
- ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
- (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
- (entry_ptr)->ht_prev = NULL; \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
- } \
- break; \
- } \
- (entry_ptr) = (entry_ptr)->ht_next; \
- (depth)++; \
- } \
- H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \
- }
-
-#define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \
- { \
- int k; \
- H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
- k = H5C__HASH_FCN(Addr); \
- entry_ptr = ((cache_ptr)->index)[k]; \
- while (entry_ptr) { \
- if (H5F_addr_eq(Addr, (entry_ptr)->addr)) { \
- H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
- if (entry_ptr != ((cache_ptr)->index)[k]) { \
- if ((entry_ptr)->ht_next) \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
- HDassert((entry_ptr)->ht_prev != NULL); \
- (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
- ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
- (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
- (entry_ptr)->ht_prev = NULL; \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
- } \
- break; \
- } \
- (entry_ptr) = (entry_ptr)->ht_next; \
- } \
- }
+#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \
+{ \
+ int k; \
+ H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
+ k = H5C__HASH_FCN((entry_ptr)->addr); \
+ if(((cache_ptr)->index)[k] != NULL) { \
+ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr); \
+ } \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ (cache_ptr)->index_len++; \
+ (cache_ptr)->index_size += (entry_ptr)->size; \
+ ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ if((entry_ptr)->is_dirty) { \
+ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ } else { \
+ (cache_ptr)->clean_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ } \
+ if((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries++; \
+ HDassert((cache_ptr)->num_last_entries <= 2); \
+ } \
+ H5C__IL_DLL_APPEND((entry_ptr), (cache_ptr)->il_head, \
+ (cache_ptr)->il_tail, (cache_ptr)->il_len, \
+ (cache_ptr)->il_size, fail_val) \
+ H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
+ H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
+}
+
+#define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, fail_val) \
+{ \
+ int k; \
+ H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
+ k = H5C__HASH_FCN((entry_ptr)->addr); \
+ if((entry_ptr)->ht_next) \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
+ if((entry_ptr)->ht_prev) \
+ (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
+ if(((cache_ptr)->index)[k] == (entry_ptr)) \
+ ((cache_ptr)->index)[k] = (entry_ptr)->ht_next; \
+ (entry_ptr)->ht_next = NULL; \
+ (entry_ptr)->ht_prev = NULL; \
+ (cache_ptr)->index_len--; \
+ (cache_ptr)->index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ if((entry_ptr)->is_dirty) { \
+ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ } else { \
+ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ } \
+ if((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries--; \
+ HDassert((cache_ptr)->num_last_entries <= 1); \
+ } \
+ H5C__IL_DLL_REMOVE((entry_ptr), (cache_ptr)->il_head, \
+ (cache_ptr)->il_tail, (cache_ptr)->il_len, \
+ (cache_ptr)->il_size, fail_val) \
+ H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
+ H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \
+}
+
+#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \
+{ \
+ int k; \
+ int depth = 0; \
+ H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
+ k = H5C__HASH_FCN(Addr); \
+ entry_ptr = ((cache_ptr)->index)[k]; \
+ while(entry_ptr) { \
+ if(H5F_addr_eq(Addr, (entry_ptr)->addr)) { \
+ H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
+ if(entry_ptr != ((cache_ptr)->index)[k]) { \
+ if((entry_ptr)->ht_next) \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
+ HDassert((entry_ptr)->ht_prev != NULL); \
+ (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
+ ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
+ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
+ (entry_ptr)->ht_prev = NULL; \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
+ } \
+ break; \
+ } \
+ (entry_ptr) = (entry_ptr)->ht_next; \
+ (depth)++; \
+ } \
+ H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \
+}
+
+#define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \
+{ \
+ int k; \
+ H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
+ k = H5C__HASH_FCN(Addr); \
+ entry_ptr = ((cache_ptr)->index)[k]; \
+ while(entry_ptr) { \
+ if(H5F_addr_eq(Addr, (entry_ptr)->addr)) { \
+ H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \
+ if(entry_ptr != ((cache_ptr)->index)[k]) { \
+ if((entry_ptr)->ht_next) \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
+ HDassert((entry_ptr)->ht_prev != NULL); \
+ (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
+ ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
+ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
+ (entry_ptr)->ht_prev = NULL; \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
+ } \
+ break; \
+ } \
+ (entry_ptr) = (entry_ptr)->ht_next; \
+ } \
+}
+
+#define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) \
+{ \
+ H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
+ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ (cache_ptr)->clean_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
+}
+
+#define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) \
+{ \
+ H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
+ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
+}
+
+#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean) \
+{ \
+ H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean) \
+ (cache_ptr)->index_size -= (old_size); \
+ (cache_ptr)->index_size += (new_size); \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \
+ if(was_clean) { \
+ (cache_ptr)->clean_index_size -= (old_size); \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])-= (old_size); \
+ } else { \
+ (cache_ptr)->dirty_index_size -= (old_size); \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])-= (old_size); \
+ } \
+ if((entry_ptr)->is_dirty) { \
+ (cache_ptr)->dirty_index_size += (new_size); \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])+= (new_size); \
+ } else { \
+ (cache_ptr)->clean_index_size += (new_size); \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])+= (new_size); \
+ } \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->il_len, \
+ (cache_ptr)->il_size, \
+ (old_size), (new_size)) \
+ H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr) \
+}
-#define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) \
- { \
- H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
- (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) -= (entry_ptr)->size; \
- (cache_ptr)->clean_index_size += (entry_ptr)->size; \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) += (entry_ptr)->size; \
- H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
- }
-
-#define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) \
- { \
- H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
- (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) -= (entry_ptr)->size; \
- (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) += (entry_ptr)->size; \
- H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
- }
-
-#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, entry_ptr, was_clean) \
- { \
- H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr, was_clean) \
- (cache_ptr)->index_size -= (old_size); \
- (cache_ptr)->index_size += (new_size); \
- ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \
- ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \
- if (was_clean) { \
- (cache_ptr)->clean_index_size -= (old_size); \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) -= (old_size); \
- } \
- else { \
- (cache_ptr)->dirty_index_size -= (old_size); \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) -= (old_size); \
- } \
- if ((entry_ptr)->is_dirty) { \
- (cache_ptr)->dirty_index_size += (new_size); \
- ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) += (new_size); \
- } \
- else { \
- (cache_ptr)->clean_index_size += (new_size); \
- ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) += (new_size); \
- } \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->il_len, (cache_ptr)->il_size, (old_size), (new_size)) \
- H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr) \
- }
/**************************************************************************
*
@@ -1254,11 +1526,11 @@
/*-------------------------------------------------------------------------
*
- * Macro: H5C__INSERT_ENTRY_IN_SLIST
+ * Macro: H5C__INSERT_ENTRY_IN_SLIST
*
* Purpose: Insert the specified instance of H5C_cache_entry_t into
- * the skip list in the specified instance of H5C_t. Update
- * the associated length and size fields.
+ * the skip list in the specified instance of H5C_t. Update
+ * the associated length and size fields.
*
* Return: N/A
*
@@ -1266,209 +1538,317 @@
*
* Modifications:
*
- * JRM -- 7/21/04
- * Updated function to set the in_tree flag when inserting
- * an entry into the tree. Also modified the function to
- * update the tree size and len fields instead of the similar
- * index fields.
+ * JRM -- 7/21/04
+ * Updated function to set the in_tree flag when inserting
+ * an entry into the tree. Also modified the function to
+ * update the tree size and len fields instead of the similar
+ * index fields.
*
- * All of this is part of the modifications to support the
- * hash table.
+ * All of this is part of the modifications to support the
+ * hash table.
*
- * JRM -- 7/27/04
- * Converted the function H5C_insert_entry_in_tree() into
- * the macro H5C__INSERT_ENTRY_IN_TREE in the hopes of
- * wringing a little more speed out of the cache.
+ * JRM -- 7/27/04
+ * Converted the function H5C_insert_entry_in_tree() into
+ * the macro H5C__INSERT_ENTRY_IN_TREE in the hopes of
+ * wringing a little more speed out of the cache.
*
- * Note that we don't bother to check if the entry is already
- * in the tree -- if it is, H5SL_insert() will fail.
+ * Note that we don't bother to check if the entry is already
+ * in the tree -- if it is, H5SL_insert() will fail.
*
- * QAK -- 11/27/04
- * Switched over to using skip list routines.
+ * QAK -- 11/27/04
+ * Switched over to using skip list routines.
*
- * JRM -- 6/27/06
- * Added fail_val parameter.
+ * JRM -- 6/27/06
+ * Added fail_val parameter.
*
- * JRM -- 8/25/06
- * Added the H5C_DO_SANITY_CHECKS version of the macro.
+ * JRM -- 8/25/06
+ * Added the H5C_DO_SANITY_CHECKS version of the macro.
*
- * This version maintains the slist_len_increase and
- * slist_size_increase fields that are used in sanity
- * checks in the flush routines.
+ * This version maintains the slist_len_increase and
+ * slist_size_increase fields 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
- * Added code to set cache_ptr->slist_changed to TRUE
- * when an entry is inserted in the slist.
+ * JRM -- 12/13/14
+ * Added code to set cache_ptr->slist_changed to TRUE
+ * when an entry is inserted in the slist.
*
- * 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.
*
*-------------------------------------------------------------------------
*/
+/* 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))
+
+#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") \
- \
- (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); \
- \
- } /* H5C__INSERT_ENTRY_IN_SLIST */
+#define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ \
+ 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); \
+ \
+ 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 */
-#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") \
- \
- (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); \
- \
- } /* H5C__INSERT_ENTRY_IN_SLIST */
+#define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ \
+ 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;\
+ \
+ 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 */
+
/*-------------------------------------------------------------------------
*
* 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; \
- } /* H5C__REMOVE_ENTRY_FROM_SLIST */
+#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; \
- } /* H5C__REMOVE_ENTRY_FROM_SLIST */
+#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 */
+
/*-------------------------------------------------------------------------
*
* 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
*
@@ -1476,87 +1856,123 @@
*
* 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.
*
*-------------------------------------------------------------------------
*/
#if H5C_DO_SANITY_CHECKS
-#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_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); \
- \
- 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); \
- \
- (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))); \
- } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */
+#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ \
+ 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); \
+ \
+ (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 */
-#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_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); \
- \
- 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))); \
- } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */
+#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ \
+ 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( (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 */
+
/**************************************************************************
*
* Replacement policy update macros:
@@ -1568,18 +1984,18 @@
/*-------------------------------------------------------------------------
*
- * Macro: H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS
+ * Macro: H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS
*
* Purpose: For efficiency, we sometimes change the order of flushes --
- * but doing so can confuse the replacement policy. This
- * macro exists to allow us to specify an entry as the
- * most recently touched so we can repair any such
- * confusion.
+ * but doing so can confuse the replacement policy. This
+ * macro exists to allow us to specify an entry as the
+ * most recently touched so we can repair any such
+ * confusion.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the macro
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the macro
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -1587,113 +2003,129 @@
*
* Modifications:
*
- * JRM -- 3/20/06
- * Modified macro to ignore pinned entries. Pinned entries
- * do not appear in the data structures maintained by the
- * replacement policy code, and thus this macro has nothing
- * to do if called for such an entry.
+ * JRM -- 3/20/06
+ * Modified macro to ignore pinned entries. Pinned entries
+ * do not appear in the data structures maintained by the
+ * replacement policy code, and thus this macro has nothing
+ * to do if called for such an entry.
*
- * JRM -- 3/28/07
- * Added sanity checks using the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM -- 3/28/07
+ * Added sanity checks using the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if (!((entry_ptr)->is_pinned)) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head. \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* Use the dirty flag to infer whether the entry is on the clean or \
- * dirty LRU list, and remove it. Then insert it at the head of \
- * the same LRU list. \
- * \
- * At least initially, all entries should be clean. That may \
- * change, so we may as well deal with both cases now. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */
+#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( ! ((entry_ptr)->is_pinned) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head.\
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* Use the dirty flag to infer whether the entry is on the clean or \
+ * dirty LRU list, and remove it. Then insert it at the head of \
+ * the same LRU list. \
+ * \
+ * At least initially, all entries should be clean. That may \
+ * change, so we may as well deal with both cases now. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ } else { \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if (!((entry_ptr)->is_pinned)) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */
+#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( ! ((entry_ptr)->is_pinned) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head \
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_EVICTION
+ * Macro: H5C__UPDATE_RP_FOR_EVICTION
*
* Purpose: Update the replacement policy data structures for an
- * eviction of the specified cache entry.
+ * eviction of the specified cache entry.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: Non-negative on success/Negative on failure.
*
@@ -1701,104 +2133,110 @@
*
* Modifications:
*
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_eviction() to the
- * macro H5C__UPDATE_RP_FOR_EVICTION in an effort to squeeze
- * a bit more performance out of the cache.
+ * JRM - 7/27/04
+ * Converted the function H5C_update_rp_for_eviction() to the
+ * macro H5C__UPDATE_RP_FOR_EVICTION in an effort to squeeze
+ * a bit more performance out of the cache.
*
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause difficulties with
- * the pre-processor, I'll have to remove them.
+ * At least for the first cut, I am leaving the comments and
+ * white space in the macro. If they cause difficulties with
+ * the pre-processor, I'll have to remove them.
*
- * JRM - 7/28/04
- * Split macro into two version, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
+ * JRM - 7/28/04
+ * Split macro into two version, one supporting the clean and
+ * dirty LRU lists, and the other not. Yet another attempt
+ * at optimization.
*
- * JRM - 3/20/06
- * Pinned entries can't be evicted, so this entry should never
- * be called on a pinned entry. Added assert to verify this.
+ * JRM - 3/20/06
+ * Pinned entries can't be evicted, so this entry should never
+ * be called on a pinned entry. Added assert to verify this.
*
- * JRM -- 3/28/07
- * Added sanity checks for the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM -- 3/28/07
+ * Added sanity checks for the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert(!((entry_ptr)->is_pinned)); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* If the entry is clean when it is evicted, it should be on the \
- * clean LRU list, if it was dirty, it should be on the dirty LRU list. \
- * Remove it from the appropriate list according to the value of the \
- * dirty flag. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- } /* H5C__UPDATE_RP_FOR_EVICTION */
+#define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( !((entry_ptr)->is_pinned) ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* If the entry is clean when it is evicted, it should be on the \
+ * clean LRU list, if it was dirty, it should be on the dirty LRU list. \
+ * Remove it from the appropriate list according to the value of the \
+ * dirty flag. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ } else { \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+} /* H5C__UPDATE_RP_FOR_EVICTION */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert(!((entry_ptr)->is_pinned)); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- } /* H5C__UPDATE_RP_FOR_EVICTION */
+#define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( !((entry_ptr)->is_pinned) ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+} /* H5C__UPDATE_RP_FOR_EVICTION */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_FLUSH
+ * Macro: H5C__UPDATE_RP_FOR_FLUSH
*
* Purpose: Update the replacement policy data structures for a flush
- * of the specified cache entry.
+ * of the specified cache entry.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -1806,137 +2244,151 @@
*
* Modifications:
*
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_flush() to the
- * macro H5C__UPDATE_RP_FOR_FLUSH in an effort to squeeze
- * a bit more performance out of the cache.
+ * JRM - 7/27/04
+ * Converted the function H5C_update_rp_for_flush() to the
+ * macro H5C__UPDATE_RP_FOR_FLUSH in an effort to squeeze
+ * a bit more performance out of the cache.
*
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause difficulties with
- * pre-processor, I'll have to remove them.
+ * At least for the first cut, I am leaving the comments and
+ * white space in the macro. If they cause difficulties with
+ * pre-processor, I'll have to remove them.
*
- * JRM - 7/28/04
- * Split macro into two versions, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
+ * JRM - 7/28/04
+ * Split macro into two versions, one supporting the clean and
+ * dirty LRU lists, and the other not. Yet another attempt
+ * at optimization.
*
- * JRM - 3/20/06
- * While pinned entries can be flushed, they don't reside in
- * the replacement policy data structures when unprotected.
- * Thus I modified this macro to do nothing if the entry is
- * pinned.
+ * JRM - 3/20/06
+ * While pinned entries can be flushed, they don't reside in
+ * the replacement policy data structures when unprotected.
+ * Thus I modified this macro to do nothing if the entry is
+ * pinned.
*
- * JRM - 3/28/07
- * Added sanity checks based on the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM - 3/28/07
+ * Added sanity checks based on the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if (!((entry_ptr)->is_pinned)) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the \
- * head. \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* since the entry is being flushed or cleared, one would think \
- * that it must be dirty -- but that need not be the case. Use the \
- * dirty flag to infer whether the entry is on the clean or dirty \
- * LRU list, and remove it. Then insert it at the head of the \
- * clean LRU list. \
- * \
- * The function presumes that a dirty entry will be either cleared \
- * or flushed shortly, so it is OK if we put a dirty entry on the \
- * clean LRU list. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__UPDATE_RP_FOR_FLUSH */
+#define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( ! ((entry_ptr)->is_pinned) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the \
+ * head. \
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* since the entry is being flushed or cleared, one would think \
+ * that it must be dirty -- but that need not be the case. Use the \
+ * dirty flag to infer whether the entry is on the clean or dirty \
+ * LRU list, and remove it. Then insert it at the head of the \
+ * clean LRU list. \
+ * \
+ * The function presumes that a dirty entry will be either cleared \
+ * or flushed shortly, so it is OK if we put a dirty entry on the \
+ * clean LRU list. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ } else { \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__UPDATE_RP_FOR_FLUSH */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if (!((entry_ptr)->is_pinned)) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the \
- * head. \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__UPDATE_RP_FOR_FLUSH */
+#define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( ! ((entry_ptr)->is_pinned) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the \
+ * head. \
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__UPDATE_RP_FOR_FLUSH */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_INSERT_APPEND
+ * Macro: H5C__UPDATE_RP_FOR_INSERT_APPEND
*
* Purpose: Update the replacement policy data structures for an
- * insertion of the specified cache entry.
+ * insertion of the specified cache entry.
*
- * Unlike H5C__UPDATE_RP_FOR_INSERTION below, mark the
- * new entry as the LEAST recently used entry, not the
- * most recently used.
+ * Unlike H5C__UPDATE_RP_FOR_INSERTION below, mark the
+ * new entry as the LEAST recently used entry, not the
+ * most recently used.
*
- * For now at least, this macro should only be used in
- * the reconstruction of the metadata cache from a cache
- * image block.
+ * For now at least, this macro should only be used in
+ * the reconstruction of the metadata cache from a cache
+ * image block.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -1947,90 +2399,102 @@
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the tail of the LRU list. */ \
- \
- H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* insert the entry at the tail of the clean or dirty LRU list as \
- * appropriate. \
- */ \
- \
- if (entry_ptr->is_dirty) { \
- H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- }
+#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the tail of the LRU list. */ \
+ \
+ H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* insert the entry at the tail of the clean or dirty LRU list as \
+ * appropriate. \
+ */ \
+ \
+ if ( entry_ptr->is_dirty ) { \
+ H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ } else { \
+ H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+}
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the tail of the LRU list. */ \
- \
- H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- }
+#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the tail of the LRU list. */ \
+ \
+ H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+}
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_INSERTION
+ * Macro: H5C__UPDATE_RP_FOR_INSERTION
*
* Purpose: Update the replacement policy data structures for an
- * insertion of the specified cache entry.
+ * insertion of the specified cache entry.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2038,125 +2502,137 @@
*
* Modifications:
*
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_insertion() to the
- * macro H5C__UPDATE_RP_FOR_INSERTION in an effort to squeeze
- * a bit more performance out of the cache.
+ * JRM - 7/27/04
+ * Converted the function H5C_update_rp_for_insertion() to the
+ * macro H5C__UPDATE_RP_FOR_INSERTION in an effort to squeeze
+ * a bit more performance out of the cache.
*
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause difficulties with
- * pre-processor, I'll have to remove them.
+ * At least for the first cut, I am leaving the comments and
+ * white space in the macro. If they cause difficulties with
+ * pre-processor, I'll have to remove them.
*
- * JRM - 7/28/04
- * Split macro into two version, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
+ * JRM - 7/28/04
+ * Split macro into two version, one supporting the clean and
+ * dirty LRU lists, and the other not. Yet another attempt
+ * at optimization.
*
- * JRM - 3/10/06
- * This macro should never be called on a pinned entry.
- * Inserted an assert to verify this.
+ * JRM - 3/10/06
+ * This macro should never be called on a pinned entry.
+ * Inserted an assert to verify this.
*
- * JRM - 8/9/06
- * Not any more. We must now allow insertion of pinned
- * entries. Updated macro to support this.
+ * JRM - 8/9/06
+ * Not any more. We must now allow insertion of pinned
+ * entries. Updated macro to support this.
*
- * JRM - 3/28/07
- * Added sanity checks using the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM - 3/28/07
+ * Added sanity checks using the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* insert the entry at the head of the clean or dirty LRU list as \
- * appropriate. \
- */ \
- \
- if (entry_ptr->is_dirty) { \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- }
+#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* insert the entry at the head of the clean or dirty LRU list as \
+ * appropriate. \
+ */ \
+ \
+ if ( entry_ptr->is_dirty ) { \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ } else { \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+}
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- }
+#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+}
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_PROTECT
+ * Macro: H5C__UPDATE_RP_FOR_PROTECT
*
* Purpose: Update the replacement policy data structures for a
- * protect of the specified cache entry.
+ * protect of the specified cache entry.
*
- * To do this, unlink the specified entry from any data
- * structures used by the replacement policy, and add the
- * entry to the protected list.
+ * To do this, unlink the specified entry from any data
+ * structures used by the replacement policy, and add the
+ * entry to the protected list.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2164,134 +2640,151 @@
*
* Modifications:
*
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_protect() to the
- * macro H5C__UPDATE_RP_FOR_PROTECT in an effort to squeeze
- * a bit more performance out of the cache.
+ * JRM - 7/27/04
+ * Converted the function H5C_update_rp_for_protect() to the
+ * macro H5C__UPDATE_RP_FOR_PROTECT in an effort to squeeze
+ * a bit more performance out of the cache.
*
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause difficulties with
- * pre-processor, I'll have to remove them.
+ * At least for the first cut, I am leaving the comments and
+ * white space in the macro. If they cause difficulties with
+ * pre-processor, I'll have to remove them.
*
- * JRM - 7/28/04
- * Split macro into two version, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
+ * JRM - 7/28/04
+ * Split macro into two version, one supporting the clean and
+ * dirty LRU lists, and the other not. Yet another attempt
+ * at optimization.
*
- * JRM - 3/17/06
- * Modified macro to attempt to remove pinned entriese from
- * the pinned entry list instead of from the data structures
- * maintained by the replacement policy.
+ * JRM - 3/17/06
+ * Modified macro to attempt to remove pinned entriese from
+ * the pinned entry list instead of from the data structures
+ * maintained by the replacement policy.
*
- * JRM - 3/28/07
- * Added sanity checks based on the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM - 3/28/07
+ * Added sanity checks based on the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* Similarly, remove the entry from the clean or dirty LRU list \
- * as appropriate. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- \
- /* Regardless of the replacement policy, or whether the entry is \
- * pinned, now add the entry to the protected list. \
- */ \
- \
- H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, (cache_ptr)->pl_tail_ptr, \
- (cache_ptr)->pl_len, (cache_ptr)->pl_size, (fail_val)) \
- } /* H5C__UPDATE_RP_FOR_PROTECT */
+#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* Similarly, remove the entry from the clean or dirty LRU list \
+ * as appropriate. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+ \
+ /* Regardless of the replacement policy, or whether the entry is \
+ * pinned, now add the entry to the protected list. \
+ */ \
+ \
+ H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \
+ (cache_ptr)->pl_tail_ptr, \
+ (cache_ptr)->pl_len, \
+ (cache_ptr)->pl_size, (fail_val)) \
+} /* H5C__UPDATE_RP_FOR_PROTECT */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- \
- /* Regardless of the replacement policy, or whether the entry is \
- * pinned, now add the entry to the protected list. \
- */ \
- \
- H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, (cache_ptr)->pl_tail_ptr, \
- (cache_ptr)->pl_len, (cache_ptr)->pl_size, (fail_val)) \
- } /* H5C__UPDATE_RP_FOR_PROTECT */
+#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+ \
+ /* Regardless of the replacement policy, or whether the entry is \
+ * pinned, now add the entry to the protected list. \
+ */ \
+ \
+ H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \
+ (cache_ptr)->pl_tail_ptr, \
+ (cache_ptr)->pl_len, \
+ (cache_ptr)->pl_size, (fail_val)) \
+} /* H5C__UPDATE_RP_FOR_PROTECT */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_MOVE
+ * Macro: H5C__UPDATE_RP_FOR_MOVE
*
* Purpose: Update the replacement policy data structures for a
- * move of the specified cache entry.
+ * move of the specified cache entry.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2302,109 +2795,134 @@
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \
- { \
- 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); \
- \
- if (!((entry_ptr)->is_pinned) && !((entry_ptr->is_protected))) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head. \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* remove the entry from either the clean or dirty LUR list as \
- * indicated by the was_dirty parameter \
- */ \
- if (was_dirty) { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* insert the entry at the head of either the clean or dirty \
- * LRU list as appropriate. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__UPDATE_RP_FOR_MOVE */
+#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \
+{ \
+ 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 ); \
+ \
+ if ( ! ( (entry_ptr)->is_pinned ) && ! ( (entry_ptr->is_protected ) ) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head. \
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* remove the entry from either the clean or dirty LUR list as \
+ * indicated by the was_dirty parameter \
+ */ \
+ if ( was_dirty ) { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), \
+ (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, \
+ (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), \
+ (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, \
+ (fail_val)) \
+ } \
+ \
+ /* insert the entry at the head of either the clean or dirty \
+ * LRU list as appropriate. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), \
+ (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, \
+ (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), \
+ (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, \
+ (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__UPDATE_RP_FOR_MOVE */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \
- { \
- 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); \
- \
- if (!((entry_ptr)->is_pinned) && !((entry_ptr->is_protected))) { \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head. \
- */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__UPDATE_RP_FOR_MOVE */
+#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \
+{ \
+ 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 ); \
+ \
+ if ( ! ( (entry_ptr)->is_pinned ) && ! ( (entry_ptr->is_protected ) ) ) { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head. \
+ */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__UPDATE_RP_FOR_MOVE */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_SIZE_CHANGE
+ * Macro: H5C__UPDATE_RP_FOR_SIZE_CHANGE
*
* Purpose: Update the replacement policy data structures for a
- * size change of the specified cache entry.
+ * size change of the specified cache entry.
*
- * To do this, determine if the entry is pinned. If it is,
- * update the size of the pinned entry list.
+ * To do this, determine if the entry is pinned. If it is,
+ * update the size of the pinned entry list.
*
- * If it isn't pinned, the entry must handled by the
- * replacement policy. Update the appropriate replacement
- * policy data structures.
+ * If it isn't pinned, the entry must handled by the
+ * replacement policy. Update the appropriate replacement
+ * policy data structures.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2412,116 +2930,132 @@
*
* Modifications:
*
- * JRM -- 3/28/07
- * Added sanity checks based on the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM -- 3/28/07
+ * Added sanity checks based on the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- HDassert(new_size > 0); \
- \
- if ((entry_ptr)->coll_access) { \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, (cache_ptr)->coll_list_size, \
- (entry_ptr)->size, (new_size)); \
- } \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, (cache_ptr)->pel_size, (entry_ptr)->size, \
- (new_size)); \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* Update the size of the LRU list */ \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, \
- (entry_ptr)->size, (new_size)); \
- \
- /* Similarly, update the size of the clean or dirty LRU list as \
- * appropriate. At present, the entry must be clean, but that \
- * could change. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, \
- (entry_ptr)->size, (new_size)); \
- } \
- else { \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, \
- (entry_ptr)->size, (new_size)); \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- \
- } /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */
+#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ HDassert( new_size > 0 ); \
+ \
+ if ( (entry_ptr)->coll_access ) { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ } \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* Update the size of the LRU list */ \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ /* Similarly, update the size of the clean or dirty LRU list as \
+ * appropriate. At present, the entry must be clean, but that \
+ * could change. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ } else { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+ \
+} /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->size > 0); \
- HDassert(new_size > 0); \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, (cache_ptr)->pel_size, (entry_ptr)->size, \
- (new_size)); \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* Update the size of the LRU list */ \
- \
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, \
- (entry_ptr)->size, (new_size)); \
- \
- /* End modified LRU specific code. */ \
- } \
- \
- } /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */
+#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ HDassert( new_size > 0 ); \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* Update the size of the LRU list */ \
+ \
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, \
+ (entry_ptr)->size, \
+ (new_size)); \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+ \
+} /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_UNPIN
+ * Macro: H5C__UPDATE_RP_FOR_UNPIN
*
* Purpose: Update the replacement policy data structures for an
- * unpin of the specified cache entry.
+ * unpin of the specified cache entry.
*
- * To do this, unlink the specified entry from the protected
- * entry list, and re-insert it in the data structures used
- * by the current replacement policy.
+ * To do this, unlink the specified entry from the protected
+ * entry list, and re-insert it in the data structures used
+ * by the current replacement policy.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the macro
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the macro
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2529,105 +3063,120 @@
*
* Modifications:
*
- * JRM -- 3/28/07
- * Added sanity checks based on the new is_read_only and
- * ro_ref_count fields of struct H5C_cache_entry_t.
+ * JRM -- 3/28/07
+ * Added sanity checks based on the new is_read_only and
+ * ro_ref_count fields of struct H5C_cache_entry_t.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->is_pinned); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* Regardless of the replacement policy, remove the entry from the \
- * pinned entry list. \
- */ \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* Similarly, insert the entry at the head of either the clean \
- * or dirty LRU list as appropriate. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- \
- } /* H5C__UPDATE_RP_FOR_UNPIN */
+#define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->is_pinned); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* Regardless of the replacement policy, remove the entry from the \
+ * pinned entry list. \
+ */ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* Similarly, insert the entry at the head of either the clean \
+ * or dirty LRU list as appropriate. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), \
+ (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, \
+ (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), \
+ (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, \
+ (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ \
+} /* H5C__UPDATE_RP_FOR_UNPIN */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert(!((entry_ptr)->is_protected)); \
- HDassert(!((entry_ptr)->is_read_only)); \
- HDassert(((entry_ptr)->ro_ref_count) == 0); \
- HDassert((entry_ptr)->is_pinned); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* Regardless of the replacement policy, remove the entry from the \
- * pinned entry list. \
- */ \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- \
- } /* H5C__UPDATE_RP_FOR_UNPIN */
+#define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->is_pinned); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* Regardless of the replacement policy, remove the entry from the \
+ * pinned entry list. \
+ */ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ \
+} /* H5C__UPDATE_RP_FOR_UNPIN */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__UPDATE_RP_FOR_UNPROTECT
+ * Macro: H5C__UPDATE_RP_FOR_UNPROTECT
*
* Purpose: Update the replacement policy data structures for an
- * unprotect of the specified cache entry.
+ * unprotect of the specified cache entry.
*
- * To do this, unlink the specified entry from the protected
- * list, and re-insert it in the data structures used by the
- * current replacement policy.
+ * To do this, unlink the specified entry from the protected
+ * list, and re-insert it in the data structures used by the
+ * current replacement policy.
*
- * At present, we only support the modified LRU policy, so
- * this function deals with that case unconditionally. If
- * we ever support other replacement policies, the function
- * should switch on the current policy and act accordingly.
+ * At present, we only support the modified LRU policy, so
+ * this function deals with that case unconditionally. If
+ * we ever support other replacement policies, the function
+ * should switch on the current policy and act accordingly.
*
* Return: N/A
*
@@ -2635,111 +3184,125 @@
*
* Modifications:
*
- * JRM - 7/27/04
- * Converted the function H5C_update_rp_for_unprotect() to
- * the macro H5C__UPDATE_RP_FOR_UNPROTECT in an effort to
- * squeeze a bit more performance out of the cache.
+ * JRM - 7/27/04
+ * Converted the function H5C_update_rp_for_unprotect() to
+ * the macro H5C__UPDATE_RP_FOR_UNPROTECT in an effort to
+ * squeeze a bit more performance out of the cache.
*
- * At least for the first cut, I am leaving the comments and
- * white space in the macro. If they cause difficulties with
- * pre-processor, I'll have to remove them.
+ * At least for the first cut, I am leaving the comments and
+ * white space in the macro. If they cause difficulties with
+ * pre-processor, I'll have to remove them.
*
- * JRM - 7/28/04
- * Split macro into two version, one supporting the clean and
- * dirty LRU lists, and the other not. Yet another attempt
- * at optimization.
+ * JRM - 7/28/04
+ * Split macro into two version, one supporting the clean and
+ * dirty LRU lists, and the other not. Yet another attempt
+ * at optimization.
*
- * JRM - 3/17/06
- * Modified macro to put pinned entries on the pinned entry
- * list instead of inserting them in the data structures
- * maintained by the replacement policy.
+ * JRM - 3/17/06
+ * Modified macro to put pinned entries on the pinned entry
+ * list instead of inserting them in the data structures
+ * maintained by the replacement policy.
*
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert((entry_ptr)->is_protected); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* Regardless of the replacement policy, remove the entry from the \
- * protected list. \
- */ \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, (cache_ptr)->pl_tail_ptr, \
- (cache_ptr)->pl_len, (cache_ptr)->pl_size, (fail_val)) \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* Similarly, insert the entry at the head of either the clean or \
- * dirty LRU list as appropriate. \
- */ \
- \
- if ((entry_ptr)->is_dirty) { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, (cache_ptr)->dLRU_list_size, (fail_val)) \
- } \
- else { \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- } \
- \
- } /* H5C__UPDATE_RP_FOR_UNPROTECT */
+#define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( (entry_ptr)->is_protected); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* Regardless of the replacement policy, remove the entry from the \
+ * protected list. \
+ */ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \
+ (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \
+ (cache_ptr)->pl_size, (fail_val)) \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* Similarly, insert the entry at the head of either the clean or \
+ * dirty LRU list as appropriate. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+ \
+} /* H5C__UPDATE_RP_FOR_UNPROTECT */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- HDassert((entry_ptr)->is_protected); \
- HDassert((entry_ptr)->size > 0); \
- \
- /* Regardless of the replacement policy, remove the entry from the \
- * protected list. \
- */ \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, (cache_ptr)->pl_tail_ptr, \
- (cache_ptr)->pl_len, (cache_ptr)->pl_size, (fail_val)) \
- \
- if ((entry_ptr)->is_pinned) { \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, (cache_ptr)->pel_tail_ptr, \
- (cache_ptr)->pel_len, (cache_ptr)->pel_size, (fail_val)) \
- } \
- else { \
- \
- /* modified LRU specific code */ \
- \
- /* insert the entry at the head of the LRU list. */ \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- } \
- } /* H5C__UPDATE_RP_FOR_UNPROTECT */
+#define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( (entry_ptr)->is_protected); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* Regardless of the replacement policy, remove the entry from the \
+ * protected list. \
+ */ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \
+ (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \
+ (cache_ptr)->pl_size, (fail_val)) \
+ \
+ if ( (entry_ptr)->is_pinned ) { \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
+ (cache_ptr)->pel_tail_ptr, \
+ (cache_ptr)->pel_len, \
+ (cache_ptr)->pel_size, (fail_val)) \
+ \
+ } else { \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* insert the entry at the head of the LRU list. */ \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, \
+ (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ } \
+} /* H5C__UPDATE_RP_FOR_UNPROTECT */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
@@ -2747,39 +3310,70 @@
#if H5C_DO_SANITY_CHECKS
-#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((hd_ptr) == NULL) || ((tail_ptr) == NULL) || ((entry_ptr) == NULL) || ((len) <= 0) || \
- ((Size) < (entry_ptr)->size) || (((Size) == (entry_ptr)->size) && (!((len) == 1))) || \
- (((entry_ptr)->coll_prev == NULL) && ((hd_ptr) != (entry_ptr))) || \
- (((entry_ptr)->coll_next == NULL) && ((tail_ptr) != (entry_ptr))) || \
- (((len) == 1) && \
- (!(((hd_ptr) == (entry_ptr)) && ((tail_ptr) == (entry_ptr)) && ((entry_ptr)->coll_next == NULL) && \
- ((entry_ptr)->coll_prev == NULL) && ((Size) == (entry_ptr)->size))))) { \
- HDassert(0 && "coll DLL pre remove SC failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \
- }
-
-#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
- if (((((head_ptr) == NULL) || ((tail_ptr) == NULL)) && ((head_ptr) != (tail_ptr))) || ((len) < 0) || \
- ((Size) < 0) || \
- (((len) == 1) && (((head_ptr) != (tail_ptr)) || ((Size) <= 0) || ((head_ptr) == NULL) || \
- ((head_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((head_ptr) == NULL) || ((head_ptr)->coll_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->coll_next != NULL)))) { \
- HDassert(0 && "COLL DLL sanity check failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \
- }
-
-#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
- if (((entry_ptr) == NULL) || ((entry_ptr)->coll_next != NULL) || ((entry_ptr)->coll_prev != NULL) || \
- ((((hd_ptr) == NULL) || ((tail_ptr) == NULL)) && ((hd_ptr) != (tail_ptr))) || \
- (((len) == 1) && \
- (((hd_ptr) != (tail_ptr)) || ((Size) <= 0) || ((hd_ptr) == NULL) || ((hd_ptr)->size != (Size)))) || \
- (((len) >= 1) && (((hd_ptr) == NULL) || ((hd_ptr)->coll_prev != NULL) || ((tail_ptr) == NULL) || \
- ((tail_ptr)->coll_next != NULL)))) { \
- HDassert(0 && "COLL DLL pre insert SC failed"); \
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \
- }
+#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (hd_ptr) == NULL ) || \
+ ( (tail_ptr) == NULL ) || \
+ ( (entry_ptr) == NULL ) || \
+ ( (len) <= 0 ) || \
+ ( (Size) < (entry_ptr)->size ) || \
+ ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \
+ ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \
+ ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
+ ( ( (len) == 1 ) && \
+ ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \
+ ( (entry_ptr)->coll_next == NULL ) && \
+ ( (entry_ptr)->coll_prev == NULL ) && \
+ ( (Size) == (entry_ptr)->size ) \
+ ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "coll DLL pre remove SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \
+}
+
+#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
+if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (head_ptr) != (tail_ptr) ) \
+ ) || \
+ ( (len) < 0 ) || \
+ ( (Size) < 0 ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "COLL DLL sanity check failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \
+}
+
+#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
+if ( ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->coll_next != NULL ) || \
+ ( (entry_ptr)->coll_prev != NULL ) || \
+ ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
+ ( (hd_ptr) != (tail_ptr) ) \
+ ) || \
+ ( ( (len) == 1 ) && \
+ ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \
+ ) \
+ ) || \
+ ( ( (len) >= 1 ) && \
+ ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \
+ ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \
+ ) \
+ ) \
+ ) { \
+ HDassert(0 && "COLL DLL pre insert SC failed"); \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \
+}
#else /* H5C_DO_SANITY_CHECKS */
@@ -2789,67 +3383,77 @@
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- { \
- H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (tail_ptr)->coll_next = (entry_ptr); \
- (entry_ptr)->coll_prev = (tail_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- } /* H5C__COLL_DLL_APPEND() */
-
-#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- if ((head_ptr) == NULL) { \
- (head_ptr) = (entry_ptr); \
- (tail_ptr) = (entry_ptr); \
- } \
- else { \
- (head_ptr)->coll_prev = (entry_ptr); \
- (entry_ptr)->coll_next = (head_ptr); \
- (head_ptr) = (entry_ptr); \
- } \
- (len)++; \
- (Size) += entry_ptr->size; \
- } /* H5C__COLL_DLL_PREPEND() */
-
-#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
- { \
- if ((head_ptr) == (entry_ptr)) { \
- (head_ptr) = (entry_ptr)->coll_next; \
- if ((head_ptr) != NULL) \
- (head_ptr)->coll_prev = NULL; \
- } \
- else { \
- (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \
- } \
- if ((tail_ptr) == (entry_ptr)) { \
- (tail_ptr) = (entry_ptr)->coll_prev; \
- if ((tail_ptr) != NULL) \
- (tail_ptr)->coll_next = NULL; \
- } \
- else \
- (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \
- entry_ptr->coll_next = NULL; \
- entry_ptr->coll_prev = NULL; \
- (len)--; \
- (Size) -= entry_ptr->size; \
- } \
- } /* H5C__COLL_DLL_REMOVE() */
+
+#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
+{ \
+ H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
+ fail_val) \
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (tail_ptr)->coll_next = (entry_ptr); \
+ (entry_ptr)->coll_prev = (tail_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__COLL_DLL_APPEND() */
+
+#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\
+ if ( (head_ptr) == NULL ) \
+ { \
+ (head_ptr) = (entry_ptr); \
+ (tail_ptr) = (entry_ptr); \
+ } \
+ else \
+ { \
+ (head_ptr)->coll_prev = (entry_ptr); \
+ (entry_ptr)->coll_next = (head_ptr); \
+ (head_ptr) = (entry_ptr); \
+ } \
+ (len)++; \
+ (Size) += entry_ptr->size; \
+} /* H5C__COLL_DLL_PREPEND() */
+
+#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
+{ \
+ H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\
+ { \
+ if ( (head_ptr) == (entry_ptr) ) \
+ { \
+ (head_ptr) = (entry_ptr)->coll_next; \
+ if ( (head_ptr) != NULL ) \
+ (head_ptr)->coll_prev = NULL; \
+ } \
+ else \
+ { \
+ (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \
+ } \
+ if ( (tail_ptr) == (entry_ptr) ) \
+ { \
+ (tail_ptr) = (entry_ptr)->coll_prev; \
+ if ( (tail_ptr) != NULL ) \
+ (tail_ptr)->coll_next = NULL; \
+ } \
+ else \
+ (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \
+ entry_ptr->coll_next = NULL; \
+ entry_ptr->coll_prev = NULL; \
+ (len)--; \
+ (Size) -= entry_ptr->size; \
+ } \
+} /* H5C__COLL_DLL_REMOVE() */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__INSERT_IN_COLL_LIST
+ * Macro: H5C__INSERT_IN_COLL_LIST
*
* Purpose: Insert entry into collective entries list
*
@@ -2860,22 +3464,26 @@
*-------------------------------------------------------------------------
*/
-#define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- \
- /* insert the entry at the head of the list. */ \
- \
- H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, (cache_ptr)->coll_tail_ptr, \
- (cache_ptr)->coll_list_len, (cache_ptr)->coll_list_size, (fail_val)) \
- \
- } /* H5C__INSERT_IN_COLL_LIST */
+#define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* insert the entry at the head of the list. */ \
+ \
+ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__INSERT_IN_COLL_LIST */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__REMOVE_FROM_COLL_LIST
+ * Macro: H5C__REMOVE_FROM_COLL_LIST
*
* Purpose: Remove entry from collective entries list
*
@@ -2886,22 +3494,26 @@
*-------------------------------------------------------------------------
*/
-#define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- \
- /* remove the entry from the list. */ \
- \
- H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, (cache_ptr)->coll_tail_ptr, \
- (cache_ptr)->coll_list_len, (cache_ptr)->coll_list_size, (fail_val)) \
- \
- } /* H5C__REMOVE_FROM_COLL_LIST */
+#define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* remove the entry from the list. */ \
+ \
+ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__REMOVE_FROM_COLL_LIST */
+
/*-------------------------------------------------------------------------
*
- * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST
+ * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST
*
* Purpose: Update entry position in collective entries list
*
@@ -2912,22 +3524,29 @@
*-------------------------------------------------------------------------
*/
-#define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
- { \
- HDassert((cache_ptr)); \
- HDassert((cache_ptr)->magic == H5C__H5C_T_MAGIC); \
- HDassert((entry_ptr)); \
- \
- /* Remove entry and insert at the head of the list. */ \
- H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, (cache_ptr)->coll_tail_ptr, \
- (cache_ptr)->coll_list_len, (cache_ptr)->coll_list_size, (fail_val)) \
- \
- H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, (cache_ptr)->coll_tail_ptr, \
- (cache_ptr)->coll_list_len, (cache_ptr)->coll_list_size, (fail_val)) \
- \
- } /* H5C__MOVE_TO_TOP_IN_COLL_LIST */
+#define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ \
+ /* Remove entry and insert at the head of the list. */ \
+ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \
+ (cache_ptr)->coll_tail_ptr, \
+ (cache_ptr)->coll_list_len, \
+ (cache_ptr)->coll_list_size, \
+ (fail_val)) \
+ \
+} /* H5C__MOVE_TO_TOP_IN_COLL_LIST */
#endif /* H5_HAVE_PARALLEL */
+
/****************************/
/* Package Private Typedefs */
/****************************/
@@ -2947,7 +3566,7 @@
*
* The fields of this structure are discussed individually below:
*
- * tag: Address (i.e. "tag") of the object header for all the entries
+ * tag: Address (i.e. "tag") of the object header for all the entries
* corresponding to parts of that object.
*
* head: Head of doubly-linked list of all entries belonging to the tag.
@@ -2955,16 +3574,17 @@
* entry_cnt: Number of entries on linked list of entries for this tag.
*
* corked: Boolean flag indicating whether entries for this object can be
- * evicted.
+ * evicted.
*
****************************************************************************/
typedef struct H5C_tag_info_t {
- haddr_t tag; /* Tag (address) of the entries (must be first, for skiplist) */
- H5C_cache_entry_t *head; /* Head of the list of entries for this tag */
- size_t entry_cnt; /* Number of entries on list */
- hbool_t corked; /* Whether this object is corked */
+ haddr_t tag; /* Tag (address) of the entries (must be first, for skiplist) */
+ H5C_cache_entry_t *head; /* Head of the list of entries for this tag */
+ size_t entry_cnt; /* Number of entries on list */
+ hbool_t corked; /* Whether this object is corked */
} H5C_tag_info_t;
+
/****************************************************************************
*
* structure H5C_t
@@ -2996,32 +3616,32 @@ typedef struct H5C_tag_info_t {
* Note that index_size and index_len now refer to the total size of
* and number of entries in the hash table.
*
- * JRM - 7/19/04
+ * JRM - 7/19/04
*
* The TBBT has since been replaced with a skip list. This change
* greatly predates this note.
*
- * JRM - 9/26/05
+ * JRM - 9/26/05
*
- * magic: Unsigned 32 bit integer always set to H5C__H5C_T_MAGIC.
- * This field is used to validate pointers to instances of
- * H5C_t.
+ * magic: Unsigned 32 bit integer always set to H5C__H5C_T_MAGIC.
+ * This field is used to validate pointers to instances of
+ * H5C_t.
*
* flush_in_progress: Boolean flag indicating whether a flush is in
- * progress.
+ * progress.
*
* log_info: Information used by the MDC logging functionality.
* Described in H5Clog.h.
*
- * aux_ptr: Pointer to void used to allow wrapper code to associate
- * its data with an instance of H5C_t. The H5C cache code
- * sets this field to NULL, and otherwise leaves it alone.
+ * aux_ptr: Pointer to void used to allow wrapper code to associate
+ * its data with an instance of H5C_t. The H5C cache code
+ * sets this field to NULL, and otherwise leaves it alone.
*
- * max_type_id: Integer field containing the maximum type id number assigned
- * to a type of entry in the cache. All type ids from 0 to
- * max_type_id inclusive must be defined. The names of the
- * types are stored in the type_name_table discussed below, and
- * indexed by the ids.
+ * max_type_id: Integer field containing the maximum type id number assigned
+ * to a type of entry in the cache. All type ids from 0 to
+ * max_type_id inclusive must be defined. The names of the
+ * types are stored in the type_name_table discussed below, and
+ * indexed by the ids.
*
* class_table_ptr: Pointer to an array of H5C_class_t of length
* max_type_id + 1. Entry classes for the cache.
@@ -3037,19 +3657,19 @@ typedef struct H5C_tag_info_t {
* to reduce its size as entries are unprotected.
*
* b) When running in parallel mode, the cache may not be
- * permitted to flush a dirty entry in response to a read.
- * If there are no clean entries available to evict, the
- * cache will exceed its maximum size. Again the cache
+ * permitted to flush a dirty entry in response to a read.
+ * If there are no clean entries available to evict, the
+ * cache will exceed its maximum size. Again the cache
* will attempt to reduce its size to the max_cache_size
* limit on the next cache write.
*
- * c) When an entry increases in size, the cache may exceed
- * the max_cache_size limit until the next time the cache
- * attempts to load or insert an entry.
+ * c) When an entry increases in size, the cache may exceed
+ * the max_cache_size limit until the next time the cache
+ * attempts to load or insert an entry.
*
- * d) When the evictions_enabled field is false (see below),
- * the cache size will increase without limit until the
- * field is set to true.
+ * d) When the evictions_enabled field is false (see below),
+ * the cache size will increase without limit until the
+ * field is set to true.
*
* min_clean_size: Nominal minimum number of clean bytes in the cache.
* The cache attempts to maintain this number of bytes of
@@ -3057,7 +3677,7 @@ typedef struct H5C_tag_info_t {
* a soft limit.
*
* close_warning_received: Boolean flag indicating that a file closing
- * warning has been received.
+ * warning has been received.
*
*
* In addition to the call back functions required for each entry, the
@@ -3065,19 +3685,19 @@ typedef struct H5C_tag_info_t {
* the cache as a whole:
*
* check_write_permitted: In certain applications, the cache may not
- * be allowed to write to disk at certain time. If specified,
- * the check_write_permitted function is used to determine if
- * a write is permissible at any given point in time.
+ * be allowed to write to disk at certain time. If specified,
+ * the check_write_permitted function is used to determine if
+ * a write is permissible at any given point in time.
*
- * If no such function is specified (i.e. this field is NULL),
- * the cache uses the following write_permitted field to
- * determine whether writes are permitted.
+ * If no such function is specified (i.e. this field is NULL),
+ * the cache uses the following write_permitted field to
+ * determine whether writes are permitted.
*
* write_permitted: If check_write_permitted is NULL, this boolean flag
- * indicates whether writes are permitted.
+ * indicates whether writes are permitted.
*
- * log_flush: If provided, this function is called whenever a dirty
- * entry is flushed to disk.
+ * log_flush: If provided, this function is called whenever a dirty
+ * entry is flushed to disk.
*
*
* In cases where memory is plentiful, and performance is an issue, it may
@@ -3085,11 +3705,11 @@ typedef struct H5C_tag_info_t {
* writes. The following field is used to implement this.
*
* evictions_enabled: Boolean flag that is initialized to TRUE. When
- * this flag is set to FALSE, the metadata cache will not
- * attempt to evict entries to make space for newly protected
- * entries, and instead the will grow without limit.
+ * this flag is set to FALSE, the metadata cache will not
+ * attempt to evict entries to make space for newly protected
+ * entries, and instead the will grow without limit.
*
- * Needless to say, this feature must be used with care.
+ * Needless to say, this feature must be used with care.
*
*
* The cache requires an index to facilitate searching for entries. The
@@ -3107,7 +3727,7 @@ typedef struct H5C_tag_info_t {
* index, and must have the same length and size as the index proper.
*
* index_len: Number of entries currently in the hash table used to index
- * the cache.
+ * the cache.
*
* index_size: Number of bytes of cache entries currently stored in the
* hash table used to index the cache.
@@ -3119,84 +3739,84 @@ typedef struct H5C_tag_info_t {
* of the cache's memory footprint.
*
* index_ring_len: Array of integer of length H5C_RING_NTYPES used to
- * maintain a count of entries in the index by ring. Note
- * that the sum of all the cells in this array must equal
- * the value stored in index_len above.
+ * maintain a count of entries in the index by ring. Note
+ * that the sum of all the cells in this array must equal
+ * the value stored in index_len above.
*
* index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
- * maintain the sum of the sizes of all entries in the index
- * by ring. Note that the sum of all cells in this array must
- * equal the value stored in index_size above.
+ * maintain the sum of the sizes of all entries in the index
+ * by ring. Note that the sum of all cells in this array must
+ * equal the value stored in index_size above.
*
* clean_index_size: Number of bytes of clean entries currently stored in
- * the hash table. Note that the index_size field (above)
- * is also the sum of the sizes of all entries in the cache.
- * Thus we should have the invariant that clean_index_size +
- * dirty_index_size == index_size.
+ * the hash table. Note that the index_size field (above)
+ * is also the sum of the sizes of all entries in the cache.
+ * Thus we should have the invariant that clean_index_size +
+ * dirty_index_size == index_size.
*
- * WARNING:
+ * WARNING:
*
- * The value of the clean_index_size must not be mistaken
- * for the current clean size of the cache. Rather, the
- * clean size of the cache is the current value of
- * clean_index_size plus the amount of empty space (if any)
+ * The value of the clean_index_size must not be mistaken
+ * for the current clean size of the cache. Rather, the
+ * clean size of the cache is the current value of
+ * clean_index_size plus the amount of empty space (if any)
* in the cache.
*
* clean_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
- * maintain the sum of the sizes of all clean entries in the
- * index by ring. Note that the sum of all cells in this array
- * must equal the value stored in clean_index_size above.
+ * maintain the sum of the sizes of all clean entries in the
+ * index by ring. Note that the sum of all cells in this array
+ * must equal the value stored in clean_index_size above.
*
* dirty_index_size: Number of bytes of dirty entries currently stored in
- * the hash table. Note that the index_size field (above)
- * is also the sum of the sizes of all entries in the cache.
- * Thus we should have the invariant that clean_index_size +
- * dirty_index_size == index_size.
+ * the hash table. Note that the index_size field (above)
+ * is also the sum of the sizes of all entries in the cache.
+ * Thus we should have the invariant that clean_index_size +
+ * dirty_index_size == index_size.
*
* dirty_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
- * maintain the sum of the sizes of all dirty entries in the
- * index by ring. Note that the sum of all cells in this array
- * must equal the value stored in dirty_index_size above.
- *
- * index: Array of pointer to H5C_cache_entry_t of size
- * H5C__HASH_TABLE_LEN. At present, this value is a power
- * of two, not the usual prime number.
- *
- * I hope that the variable size of cache elements, the large
- * hash table size, and the way in which HDF5 allocates space
- * will combine to avoid problems with periodicity. If so, we
- * can use a trivial hash function (a bit-and and a 3 bit left
- * shift) with some small savings.
- *
- * If not, it will become evident in the statistics. Changing
- * to the usual prime number length hash table will require
- * changing the H5C__HASH_FCN macro and the deletion of the
- * H5C__HASH_MASK #define. No other changes should be required.
- *
- * il_len: Number of entries on the index list.
- *
- * This must always be equal to index_len. As such, this
- * field is redundant. However, the existing linked list
- * management macros expect to maintain a length field, so
- * this field exists primarily to avoid adding complexity to
- * these macros.
- *
- * il_size: Number of bytes of cache entries currently stored in the
- * index list.
- *
- * This must always be equal to index_size. As such, this
- * field is redundant. However, the existing linked list
- * management macros expect to maintain a size field, so
- * this field exists primarily to avoid adding complexity to
- * these macros.
- *
- * il_head: Pointer to the head of the doubly linked list of entries in
+ * maintain the sum of the sizes of all dirty entries in the
+ * index by ring. Note that the sum of all cells in this array
+ * must equal the value stored in dirty_index_size above.
+ *
+ * index: Array of pointer to H5C_cache_entry_t of size
+ * H5C__HASH_TABLE_LEN. At present, this value is a power
+ * of two, not the usual prime number.
+ *
+ * I hope that the variable size of cache elements, the large
+ * hash table size, and the way in which HDF5 allocates space
+ * will combine to avoid problems with periodicity. If so, we
+ * can use a trivial hash function (a bit-and and a 3 bit left
+ * shift) with some small savings.
+ *
+ * If not, it will become evident in the statistics. Changing
+ * to the usual prime number length hash table will require
+ * changing the H5C__HASH_FCN macro and the deletion of the
+ * H5C__HASH_MASK #define. No other changes should be required.
+ *
+ * il_len: Number of entries on the index list.
+ *
+ * This must always be equal to index_len. As such, this
+ * field is redundant. However, the existing linked list
+ * management macros expect to maintain a length field, so
+ * this field exists primarily to avoid adding complexity to
+ * these macros.
+ *
+ * il_size: Number of bytes of cache entries currently stored in the
+ * index list.
+ *
+ * This must always be equal to index_size. As such, this
+ * field is redundant. However, the existing linked list
+ * management macros expect to maintain a size field, so
+ * this field exists primarily to avoid adding complexity to
+ * these macros.
+ *
+ * il_head: Pointer to the head of the doubly linked list of entries in
* the index list. Note that cache entries on this list are
- * linked by their il_next and il_prev fields.
+ * linked by their il_next and il_prev fields.
*
* This field is NULL if the index is empty.
*
- * il_tail: Pointer to the tail of the doubly linked list of entries in
+ * il_tail: Pointer to the tail of the doubly linked list of entries in
* the index list. Note that cache entries on this list are
* linked by their il_next and il_prev fields.
*
@@ -3213,32 +3833,33 @@ typedef struct H5C_tag_info_t {
*
* The following fields are maintained to facilitate this.
*
- * entries_removed_counter: Counter that is incremented each time an
- * entry is removed from the cache by any means (eviction,
- * expungement, or take ownership at this point in time).
- * Functions that perform scans on lists may set this field
- * to zero prior to calling H5C__flush_single_entry().
- * Unexpected changes to the counter indicate that an entry
- * was removed from the cache as a side effect of the flush.
- *
- * last_entry_removed_ptr: Pointer to the instance of H5C_cache_entry_t
- * which contained the last entry to be removed from the cache,
- * or NULL if there either is no such entry, or if a function
- * performing a scan of a list has set this field to NULL prior
- * to calling H5C__flush_single_entry().
- *
- * WARNING!!! This field must NEVER be dereferenced. It is
- * maintained to allow functions that perform scans of lists
- * to compare this pointer with their pointers to next, thus
- * allowing them to avoid unnecessary restarts of scans if the
- * pointers don't match, and if entries_removed_counter is
- * one.
- *
- * entry_watched_for_removal: Pointer to an instance of H5C_cache_entry_t
- * which contains the 'next' entry for an iteration. Removing
+ * entries_removed_counter: Counter that is incremented each time an
+ * entry is removed from the cache by any means (eviction,
+ * expungement, or take ownership at this point in time).
+ * Functions that perform scans on lists may set this field
+ * to zero prior to calling H5C__flush_single_entry().
+ * Unexpected changes to the counter indicate that an entry
+ * was removed from the cache as a side effect of the flush.
+ *
+ * last_entry_removed_ptr: Pointer to the instance of H5C_cache_entry_t
+ * which contained the last entry to be removed from the cache,
+ * or NULL if there either is no such entry, or if a function
+ * performing a scan of a list has set this field to NULL prior
+ * to calling H5C__flush_single_entry().
+ *
+ * WARNING!!! This field must NEVER be dereferenced. It is
+ * maintained to allow functions that perform scans of lists
+ * to compare this pointer with their pointers to next, thus
+ * allowing them to avoid unnecessary restarts of scans if the
+ * pointers don't match, and if entries_removed_counter is
+ * one.
+ *
+ * entry_watched_for_removal: Pointer to an instance of H5C_cache_entry_t
+ * 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")
*
*
@@ -3252,12 +3873,42 @@ 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
- * conditions in which pre-serialize or serialize callbacks
- * have modified the slist -- which obliges us to restart
- * the scan of the slist from the beginning.
+ * the slist has changed since the last time this flag was
+ * reset. This is used in the cache flush code to detect
+ * conditions in which pre-serialize or serialize callbacks
+ * have modified the slist -- which obliges us to restart
+ * the scan of the slist from the beginning.
*
* slist_len: Number of entries currently in the skip list
* used to maintain a sorted list of dirty entries in the
@@ -3268,14 +3919,14 @@ typedef struct H5C_tag_info_t {
* dirty entries in the cache.
*
* slist_ring_len: Array of integer of length H5C_RING_NTYPES used to
- * maintain a count of entries in the slist by ring. Note
- * that the sum of all the cells in this array must equal
- * the value stored in slist_len above.
+ * maintain a count of entries in the slist by ring. Note
+ * that the sum of all the cells in this array must equal
+ * the value stored in slist_len above.
*
* slist_ring_size: Array of size_t of length H5C_RING_NTYPES used to
* maintain the sum of the sizes of all entries in the
- * slist by ring. Note that the sum of all cells in this
- * array must equal the value stored in slist_size above.
+ * slist by ring. Note that the sum of all cells in this
+ * array must equal the value stored in slist_size above.
*
* slist_ptr: pointer to the instance of H5SL_t used maintain a sorted
* list of dirty entries in the cache. This sorted list has
@@ -3290,7 +3941,7 @@ typedef struct H5C_tag_info_t {
* some optimizations when I get to it.
*
* num_last_entries: The number of entries in the cache that can only be
- * flushed after all other entries in the cache have
+ * flushed after all other entries in the cache have
* been flushed. At this time, this will only ever be
* one entry (the superblock), and the code has been
* protected with HDasserts to enforce this. This restraint
@@ -3299,10 +3950,10 @@ typedef struct H5C_tag_info_t {
* explicit tests for that case should be added when said
* HDasserts are removed.
*
- * Update: There are now two possible last entries
- * (superblock and file driver info message). This
- * number will probably increase as we add superblock
- * messages. JRM -- 11/18/14
+ * Update: There are now two possible last entries
+ * (superblock and file driver info message). This
+ * number will probably increase as we add superblock
+ * messages. JRM -- 11/18/14
*
* With the addition of the fractal heap, the cache must now deal with
* the case in which entries may be dirtied, moved, or have their sizes
@@ -3311,12 +3962,12 @@ typedef struct H5C_tag_info_t {
* H5C_DO_SANITY_CHECKS is TRUE.
*
* slist_len_increase: Number of entries that have been added to the
- * slist since the last time this field was set to zero.
- * Note that this value can be negative.
+ * slist since the last time this field was set to zero.
+ * Note that this value can be negative.
*
* slist_size_increase: Total size of all entries that have been added
- * to the slist since the last time this field was set to
- * zero. Note that this value can be negative.
+ * to the slist since the last time this field was set to
+ * zero. Note that this value can be negative.
*
* Cache entries belonging to a particular object are "tagged" with that
* object's base object header address.
@@ -3333,7 +3984,7 @@ typedef struct H5C_tag_info_t {
* freelist, as well as shared entries like global
* heaps and shared object header messages, are not tagged.
*
- * ignore_tags: Boolean flag to disable tag validation during entry insertion.
+ * ignore_tags: Boolean flag to disable tag validation during entry insertion.
*
* num_objs_corked: Unsigned integer field containing the number of objects
* that are "corked". The "corked" status of an object is
@@ -3372,15 +4023,15 @@ typedef struct H5C_tag_info_t {
*
* Pinning an entry has the following implications:
*
- * 1) A pinned entry cannot be evicted. Thus unprotected
+ * 1) A pinned entry cannot be evicted. Thus unprotected
* pinned entries reside in the pinned entry list, instead
* of the LRU list(s) (or other lists maintained by the current
* replacement policy code).
*
* 2) A pinned entry can be accessed or modified at any time.
* This places an additional burden on the associated pre-serialize
- * and serialize callbacks, which must ensure the the entry is in
- * a consistent state before creating an image of it.
+ * and serialize callbacks, which must ensure the the entry is in
+ * a consistent state before creating an image of it.
*
* 3) A pinned entry can be marked as dirty (and possibly
* change size) while it is unprotected.
@@ -3395,21 +4046,21 @@ typedef struct H5C_tag_info_t {
*
* Maintaining the pinned entry list requires the following fields:
*
- * pel_len: Number of entries currently residing on the pinned
- * entry list.
+ * pel_len: Number of entries currently residing on the pinned
+ * entry list.
*
- * pel_size: Number of bytes of cache entries currently residing on
- * the pinned entry list.
+ * pel_size: Number of bytes of cache entries currently residing on
+ * the pinned entry list.
*
* pel_head_ptr: Pointer to the head of the doubly linked list of pinned
- * but not protected entries. Note that cache entries on
- * this list are linked by their next and prev fields.
+ * but not protected entries. Note that cache entries on
+ * this list are linked by their next and prev fields.
*
* This field is NULL if the list is empty.
*
* pel_tail_ptr: Pointer to the tail of the doubly linked list of pinned
- * but not protected entries. Note that cache entries on
- * this list are linked by their next and prev fields.
+ * but not protected entries. Note that cache entries on
+ * this list are linked by their next and prev fields.
*
* This field is NULL if the list is empty.
*
@@ -3467,13 +4118,13 @@ typedef struct H5C_tag_info_t {
* LRU_list_len: Number of cache entries currently on the LRU list.
*
* Observe that LRU_list_len + pl_len + pel_len must always
- * equal index_len.
+ * equal index_len.
*
* LRU_list_size: Number of bytes of cache entries currently residing on the
* LRU list.
*
* Observe that LRU_list_size + pl_size + pel_size must always
- * equal index_size.
+ * equal index_size.
*
* LRU_head_ptr: Pointer to the head of the doubly linked LRU list. Cache
* entries on this list are linked by their next and prev fields.
@@ -3542,10 +4193,10 @@ typedef struct H5C_tag_info_t {
* the structure described below:
*
* size_increase_possible: Depending on the configuration data given
- * in the resize_ctl field, it may or may not be possible
- * to increase the size of the cache. Rather than test for
- * all the ways this can happen, we simply set this flag when
- * we receive a new configuration.
+ * in the resize_ctl field, it may or may not be possible
+ * to increase the size of the cache. Rather than test for
+ * all the ways this can happen, we simply set this flag when
+ * we receive a new configuration.
*
* flash_size_increase_possible: Depending on the configuration data given
* in the resize_ctl field, it may or may not be possible
@@ -3566,37 +4217,37 @@ typedef struct H5C_tag_info_t {
* we receive a new configuration.
*
* resize_enabled: This is another convenience flag which is set whenever
- * a new set of values for resize_ctl are provided. Very
- * simply,
+ * a new set of values for resize_ctl are provided. Very
+ * simply,
*
- * resize_enabled = size_increase_possible ||
+ * resize_enabled = size_increase_possible ||
* size_decrease_possible;
*
- * cache_full: Boolean flag used to keep track of whether the cache is
- * full, so we can refrain from increasing the size of a
- * cache which hasn't used up the space allotted to it.
+ * cache_full: Boolean flag used to keep track of whether the cache is
+ * full, so we can refrain from increasing the size of a
+ * cache which hasn't used up the space allotted to it.
*
- * The field is initialized to FALSE, and then set to TRUE
- * whenever we attempt to make space in the cache.
+ * The field is initialized to FALSE, and then set to TRUE
+ * whenever we attempt to make space in the cache.
*
* size_decreased: Boolean flag set to TRUE whenever the maximum cache
- * size is decreased. The flag triggers a call to
- * H5C__make_space_in_cache() on the next call to H5C_protect().
+ * size is decreased. The flag triggers a call to
+ * H5C__make_space_in_cache() on the next call to H5C_protect().
*
* resize_in_progress: As the metadata cache has become re-entrant, it is
- * possible that a protect may trigger a call to
- * H5C__auto_adjust_cache_size(), which may trigger a flush,
- * which may trigger a protect, which will result in another
- * call to H5C__auto_adjust_cache_size().
+ * possible that a protect may trigger a call to
+ * H5C__auto_adjust_cache_size(), which may trigger a flush,
+ * which may trigger a protect, which will result in another
+ * call to H5C__auto_adjust_cache_size().
*
- * The resize_in_progress boolean flag is used to detect this,
- * and to prevent the infinite recursion that would otherwise
- * occur.
+ * The resize_in_progress boolean flag is used to detect this,
+ * and to prevent the infinite recursion that would otherwise
+ * occur.
*
- * Note that this issue is not hypothetical -- this field
- * was added 12/29/15 to fix a bug exposed in the testing
- * of changes to the file driver info superblock extension
- * management code needed to support rings.
+ * Note that this issue is not hypothetical -- this field
+ * was added 12/29/15 to fix a bug exposed in the testing
+ * of changes to the file driver info superblock extension
+ * management code needed to support rings.
*
* msic_in_progress: As the metadata cache has become re-entrant, and as
* the free space manager code has become more tightly
@@ -3615,62 +4266,62 @@ typedef struct H5C_tag_info_t {
* exposed by modifications to test/fheap.c to cause it to
* use paged allocation.
*
- * resize_ctl: Instance of H5C_auto_size_ctl_t containing configuration
- * data for automatic cache resizing.
+ * resize_ctl: Instance of H5C_auto_size_ctl_t containing configuration
+ * data for automatic cache resizing.
*
* epoch_markers_active: Integer field containing the number of epoch
- * markers currently in use in the LRU list. This value
- * must be in the range [0, H5C__MAX_EPOCH_MARKERS - 1].
+ * markers currently in use in the LRU list. This value
+ * must be in the range [0, H5C__MAX_EPOCH_MARKERS - 1].
*
* epoch_marker_active: Array of boolean of length H5C__MAX_EPOCH_MARKERS.
- * This array is used to track which epoch markers are currently
- * in use.
+ * This array is used to track which epoch markers are currently
+ * in use.
*
* epoch_marker_ringbuf: Array of int of length H5C__MAX_EPOCH_MARKERS + 1.
*
- * To manage the epoch marker cache entries, it is necessary
- * to track their order in the LRU list. This is done with
- * epoch_marker_ringbuf. When markers are inserted at the
- * head of the LRU list, the index of the marker in the
- * epoch_markers array is inserted at the tail of the ring
- * buffer. When it becomes the epoch_marker_active'th marker
- * in the LRU list, it will have worked its way to the head
- * of the ring buffer as well. This allows us to remove it
- * without scanning the LRU list if such is required.
+ * To manage the epoch marker cache entries, it is necessary
+ * to track their order in the LRU list. This is done with
+ * epoch_marker_ringbuf. When markers are inserted at the
+ * head of the LRU list, the index of the marker in the
+ * epoch_markers array is inserted at the tail of the ring
+ * buffer. When it becomes the epoch_marker_active'th marker
+ * in the LRU list, it will have worked its way to the head
+ * of the ring buffer as well. This allows us to remove it
+ * without scanning the LRU list if such is required.
*
* epoch_marker_ringbuf_first: Integer field containing the index of the
- * first entry in the ring buffer.
+ * first entry in the ring buffer.
*
* epoch_marker_ringbuf_last: Integer field containing the index of the
- * last entry in the ring buffer.
+ * last entry in the ring buffer.
*
* epoch_marker_ringbuf_size: Integer field containing the number of entries
- * in the ring buffer.
+ * in the ring buffer.
*
* epoch_markers: Array of instances of H5C_cache_entry_t of length
- * H5C__MAX_EPOCH_MARKERS. The entries are used as markers
- * in the LRU list to identify cache entries that haven't
- * been accessed for some (small) specified number of
- * epochs. These entries (if any) can then be evicted and
- * the cache size reduced -- ideally without evicting any
- * of the current working set. Needless to say, the epoch
- * length and the number of epochs before an unused entry
- * must be chosen so that all, or almost all, the working
- * set will be accessed before the limit.
- *
- * Epoch markers only appear in the LRU list, never in
- * the index or slist. While they are of type
- * H5C__EPOCH_MARKER_TYPE, and have associated class
- * functions, these functions should never be called.
- *
- * The addr fields of these instances of H5C_cache_entry_t
- * are set to the index of the instance in the epoch_markers
- * array, the size is set to 0, and the type field points
- * to the constant structure epoch_marker_class defined
- * in H5C.c. The next and prev fields are used as usual
- * to link the entry into the LRU list.
- *
- * All other fields are unused.
+ * H5C__MAX_EPOCH_MARKERS. The entries are used as markers
+ * in the LRU list to identify cache entries that haven't
+ * been accessed for some (small) specified number of
+ * epochs. These entries (if any) can then be evicted and
+ * the cache size reduced -- ideally without evicting any
+ * of the current working set. Needless to say, the epoch
+ * length and the number of epochs before an unused entry
+ * must be chosen so that all, or almost all, the working
+ * set will be accessed before the limit.
+ *
+ * Epoch markers only appear in the LRU list, never in
+ * the index or slist. While they are of type
+ * H5C__EPOCH_MARKER_TYPE, and have associated class
+ * functions, these functions should never be called.
+ *
+ * The addr fields of these instances of H5C_cache_entry_t
+ * are set to the index of the instance in the epoch_markers
+ * array, the size is set to 0, and the type field points
+ * to the constant structure epoch_marker_class defined
+ * in H5C.c. The next and prev fields are used as usual
+ * to link the entry into the LRU list.
+ *
+ * All other fields are unused.
*
*
* Cache hit rate collection fields:
@@ -3680,62 +4331,62 @@ typedef struct H5C_tag_info_t {
* collection is enabled. The following fields support this capability.
*
* cache_hits: Number of cache hits since the last time the cache hit
- * rate statistics were reset. Note that when automatic cache
- * re-sizing is enabled, this field will be reset every automatic
- * resize epoch.
+ * rate statistics were reset. Note that when automatic cache
+ * re-sizing is enabled, this field will be reset every automatic
+ * resize epoch.
*
* cache_accesses: Number of times the cache has been accessed while
- * since the last since the last time the cache hit rate statistics
- * were reset. Note that when automatic cache re-sizing is enabled,
- * this field will be reset every automatic resize epoch.
+ * since the last since the last time the cache hit rate statistics
+ * were reset. Note that when automatic cache re-sizing is enabled,
+ * this field will be reset every automatic resize epoch.
*
*
* Metadata cache image management related fields.
*
- * image_ctl: Instance of H5C_cache_image_ctl_t containing configuration
- * data for generation of a cache image on file close.
+ * image_ctl: Instance of H5C_cache_image_ctl_t containing configuration
+ * data for generation of a cache image on file close.
*
* serialization_in_progress: Boolean field that is set to TRUE iff
- * the cache is in the process of being serialized. This
- * field is needed to support the H5C_serialization_in_progress()
- * call, which is in turn required for sanity checks in some
- * cache clients.
+ * the cache is in the process of being serialized. This
+ * field is needed to support the H5C_serialization_in_progress()
+ * call, which is in turn required for sanity checks in some
+ * cache clients.
*
- * load_image: Boolean flag indicating that the metadata cache image
- * superblock extension message exists and should be
- * read, and the image block read and decoded on the next
- * call to H5C_protect().
+ * load_image: Boolean flag indicating that the metadata cache image
+ * superblock extension message exists and should be
+ * read, and the image block read and decoded on the next
+ * call to H5C_protect().
*
* image_loaded: Boolean flag indicating that the metadata cache has
* loaded the metadata cache image as directed by the
* MDC cache image superblock extension message.
*
* delete_image: Boolean flag indicating whether the metadata cache image
- * superblock message should be deleted and the cache image
- * file space freed after they have been read and decoded.
+ * superblock message should be deleted and the cache image
+ * file space freed after they have been read and decoded.
*
- * This flag should be set to TRUE iff the file is opened
- * R/W and there is a cache image to be read.
+ * This flag should be set to TRUE iff the file is opened
+ * R/W and there is a cache image to be read.
*
* image_addr: haddr_t containing the base address of the on disk
- * metadata cache image, or HADDR_UNDEF if that value is
- * undefined. Note that this field is used both in the
- * construction and write, and the read and decode of
- * metadata cache image blocks.
+ * metadata cache image, or HADDR_UNDEF if that value is
+ * undefined. Note that this field is used both in the
+ * construction and write, and the read and decode of
+ * metadata cache image blocks.
*
- * image_len: hsize_t containing the size of the on disk metadata cache
- * image, or zero if that value is undefined. Note that this
- * field is used both in the construction and write, and the
- * read and decode of metadata cache image blocks.
+ * image_len: hsize_t containing the size of the on disk metadata cache
+ * image, or zero if that value is undefined. Note that this
+ * field is used both in the construction and write, and the
+ * read and decode of metadata cache image blocks.
*
* image_data_len: size_t containing the number of bytes of data in the
- * on disk metadata cache image, or zero if that value is
- * undefined.
+ * on disk metadata cache image, or zero if that value is
+ * undefined.
*
- * In most cases, this value is the same as the image_len
- * above. It exists to allow for metadata cache image blocks
- * that are larger than the actual image. Thus in all
- * cases image_data_len <= image_len.
+ * In most cases, this value is the same as the image_len
+ * above. It exists to allow for metadata cache image blocks
+ * that are larger than the actual image. Thus in all
+ * cases image_data_len <= image_len.
*
* To create the metadata cache image, we must first serialize all the
* entries in the metadata cache. This is done by a scan of the index.
@@ -3762,35 +4413,35 @@ typedef struct H5C_tag_info_t {
* Note that all these new fields would work just as well as booleans.
*
* entries_loaded_counter: Number of entries loaded into the cache
- * since the last time this field was reset.
+ * since the last time this field was reset.
*
* entries_inserted_counter: Number of entries inserted into the cache
- * since the last time this field was reset.
+ * since the last time this field was reset.
*
* entries relocated_counter: Number of entries whose base address has
- * been changed since the last time this field was reset.
+ * been changed since the last time this field was reset.
*
* entry_fd_height_change_counter: Number of entries whose flush dependency
- * height has changed since the last time this field was reset.
+ * height has changed since the last time this field was reset.
*
* The following fields are used assemble the cache image prior to
* writing it to disk.
*
* num_entries_in_image: Unsigned integer field containing the number of entries
- * to be copied into the metadata cache image. Note that
- * this value will be less than the number of entries in
- * the cache, and the superblock and its related entries
- * are not written to the metadata cache image.
+ * to be copied into the metadata cache image. Note that
+ * this value will be less than the number of entries in
+ * the cache, and the superblock and its related entries
+ * are not written to the metadata cache image.
*
* image_entries: Pointer to a dynamically allocated array of instance of
- * H5C_image_entry_t of length num_entries_in_image, or NULL
- * if that array does not exist. This array is used to
- * assemble entry data to be included in the image, and to
- * sort them by flush dependency height and LRU rank.
+ * H5C_image_entry_t of length num_entries_in_image, or NULL
+ * if that array does not exist. This array is used to
+ * assemble entry data to be included in the image, and to
+ * sort them by flush dependency height and LRU rank.
*
* image_buffer: Pointer to the dynamically allocated buffer of length
- * image_len in which the metadata cache image is assembled,
- * or NULL if that buffer does not exist.
+ * image_len in which the metadata cache image is assembled,
+ * or NULL if that buffer does not exist.
*
*
* Free Space Manager Related fields:
@@ -3812,13 +4463,13 @@ typedef struct H5C_tag_info_t {
* flush is complete.
*
* rdfsm_settled: Boolean flag indicating whether the raw data free space
- * manager is settled -- i.e. whether the correct space has
- * been allocated for it in the file.
+ * manager is settled -- i.e. whether the correct space has
+ * been allocated for it in the file.
*
- * Note that the name of this field is deceptive. In the
- * multi file case, the flag applies to all free space
- * managers that are not involved in allocating space for
- * free space manager metadata.
+ * Note that the name of this field is deceptive. In the
+ * multi file case, the flag applies to all free space
+ * managers that are not involved in allocating space for
+ * free space manager metadata.
*
* mdfsm_settled: Boolean flag indicating whether the meta data free space
* manager is settled -- i.e. whether the correct space has
@@ -3826,8 +4477,8 @@ typedef struct H5C_tag_info_t {
*
* Note that the name of this field is deceptive. In the
* multi file case, the flag applies only to free space
- * managers that are involved in allocating space for free
- * space managers.
+ * managers that are involved in allocating space for free
+ * space managers.
*
*
* Statistics collection fields:
@@ -3837,144 +4488,144 @@ typedef struct H5C_tag_info_t {
* is true.
*
* hits: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type id
- * equal to the array index has been in cache when requested in
- * the current epoch.
+ * are used to record the number of times an entry with type id
+ * equal to the array index has been in cache when requested in
+ * the current epoch.
*
* misses: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type id
- * equal to the array index has not been in cache when
- * requested in the current epoch.
+ * are used to record the number of times an entry with type id
+ * equal to the array index has not been in cache when
+ * requested in the current epoch.
*
* write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
- * cells are used to record the number of times an entry with
- * type id equal to the array index has been write protected
- * in the current epoch.
+ * cells are used to record the number of times an entry with
+ * type id equal to the array index has been write protected
+ * in the current epoch.
*
- * Observe that (hits + misses) = (write_protects + read_protects).
+ * Observe that (hits + misses) = (write_protects + read_protects).
*
* read_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
- * cells are used to record the number of times an entry with
- * type id equal to the array index has been read protected in
- * the current epoch.
+ * cells are used to record the number of times an entry with
+ * type id equal to the array index has been read protected in
+ * the current epoch.
*
* Observe that (hits + misses) = (write_protects + read_protects).
*
* max_read_protects: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to maximum number of simultaneous read
- * protects on any entry with type id equal to the array index
- * in the current epoch.
+ * The cells are used to maximum number of simultaneous read
+ * protects on any entry with type id equal to the array index
+ * in the current epoch.
*
* insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type
- * id equal to the array index has been inserted into the
- * cache in the current epoch.
+ * are used to record the number of times an entry with type
+ * id equal to the array index has been inserted into the
+ * cache in the current epoch.
*
* pinned_insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to record the number of times an entry
- * with type id equal to the array index has been inserted
- * pinned into the cache in the current epoch.
+ * The cells are used to record the number of times an entry
+ * with type id equal to the array index has been inserted
+ * pinned into the cache in the current epoch.
*
* clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times a dirty entry with type
- * id equal to the array index has been cleared in the current
- * epoch.
+ * are used to record the number of times a dirty entry with type
+ * id equal to the array index has been cleared in the current
+ * epoch.
*
* flushes: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type id
- * equal to the array index has been written to disk in the
+ * are used to record the number of times an entry with type id
+ * equal to the array index has been written to disk in the
* current epoch.
*
* evictions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type id
- * equal to the array index has been evicted from the cache in
- * the current epoch.
+ * are used to record the number of times an entry with type id
+ * equal to the array index has been evicted from the cache in
+ * the current epoch.
*
* take_ownerships: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
- * cells are used to record the number of times an entry with
- * type id equal to the array index has been removed from the
- * cache via the H5C__TAKE_OWNERSHIP_FLAG in the current epoch.
+ * cells are used to record the number of times an entry with
+ * type id equal to the array index has been removed from the
+ * cache via the H5C__TAKE_OWNERSHIP_FLAG in the current epoch.
*
* moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type
- * id equal to the array index has been moved in the current
- * epoch.
+ * are used to record the number of times an entry with type
+ * id equal to the array index has been moved in the current
+ * epoch.
*
* entry_flush_moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to record the number of times an entry
- * with type id equal to the array index has been moved
- * during its pre-serialize callback in the current epoch.
+ * The cells are used to record the number of times an entry
+ * with type id equal to the array index has been moved
+ * during its pre-serialize callback in the current epoch.
*
* cache_flush_moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to record the number of times an entry
- * with type id equal to the array index has been moved
- * during a cache flush in the current epoch.
+ * The cells are used to record the number of times an entry
+ * with type id equal to the array index has been moved
+ * during a cache flush in the current epoch.
*
* pins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type
- * id equal to the array index has been pinned in the current
- * epoch.
+ * are used to record the number of times an entry with type
+ * id equal to the array index has been pinned in the current
+ * epoch.
*
* unpins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type
- * id equal to the array index has been unpinned in the current
- * epoch.
+ * are used to record the number of times an entry with type
+ * id equal to the array index has been unpinned in the current
+ * epoch.
*
- * dirty_pins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the number of times an entry with type
- * id equal to the array index has been marked dirty while pinned
- * in the current epoch.
+ * dirty_pins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
+ * are used to record the number of times an entry with type
+ * id equal to the array index has been marked dirty while pinned
+ * in the current epoch.
*
* pinned_flushes: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
- * cells are used to record the number of times an entry
- * with type id equal to the array index has been flushed while
- * pinned in the current epoch.
+ * cells are used to record the number of times an entry
+ * with type id equal to the array index has been flushed while
+ * pinned in the current epoch.
*
* pinned_clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
- * cells are used to record the number of times an entry
- * with type id equal to the array index has been cleared while
- * pinned in the current epoch.
+ * cells are used to record the number of times an entry
+ * with type id equal to the array index has been cleared while
+ * pinned in the current epoch.
*
* size_increases: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to record the number of times an entry
- * with type id equal to the array index has increased in
- * size in the current epoch.
+ * The cells are used to record the number of times an entry
+ * with type id equal to the array index has increased in
+ * size in the current epoch.
*
* size_decreases: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
- * The cells are used to record the number of times an entry
- * with type id equal to the array index has decreased in
- * size in the current epoch.
+ * The cells are used to record the number of times an entry
+ * with type id equal to the array index has decreased in
+ * size in the current epoch.
*
* entry_flush_size_changes: Array of int64 of length
- * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
- * the number of times an entry with type id equal to the
- * array index has changed size while in its pre-serialize
- * callback.
+ * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
+ * the number of times an entry with type id equal to the
+ * array index has changed size while in its pre-serialize
+ * callback.
*
* cache_flush_size_changes: Array of int64 of length
- * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
- * the number of times an entry with type id equal to the
- * array index has changed size during a cache flush
+ * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
+ * the number of times an entry with type id equal to the
+ * array index has changed size during a cache flush
*
* total_ht_insertions: Number of times entries have been inserted into the
- * hash table in the current epoch.
+ * hash table in the current epoch.
*
* total_ht_deletions: Number of times entries have been deleted from the
* hash table in the current epoch.
*
* successful_ht_searches: int64 containing the total number of successful
- * searches of the hash table in the current epoch.
+ * searches of the hash table in the current epoch.
*
* total_successful_ht_search_depth: int64 containing the total number of
- * entries other than the targets examined in successful
- * searches of the hash table in the current epoch.
+ * entries other than the targets examined in successful
+ * searches of the hash table in the current epoch.
*
* failed_ht_searches: int64 containing the total number of unsuccessful
* searches of the hash table in the current epoch.
*
* total_failed_ht_search_depth: int64 containing the total number of
* entries examined in unsuccessful searches of the hash
- * table in the current epoch.
+ * table in the current epoch.
*
* max_index_len: Largest value attained by the index_len field in the
* current epoch.
@@ -3983,10 +4634,10 @@ typedef struct H5C_tag_info_t {
* current epoch.
*
* max_clean_index_size: Largest value attained by the clean_index_size field
- * in the current epoch.
+ * in the current epoch.
*
* max_dirty_index_size: Largest value attained by the dirty_index_size field
- * in the current epoch.
+ * in the current epoch.
*
* max_slist_len: Largest value attained by the slist_len field in the
* current epoch.
@@ -4037,11 +4688,11 @@ typedef struct H5C_tag_info_t {
* The following fields track statistics on cache images.
*
* images_created: Integer field containing the number of cache images
- * created since the last time statistics were reset.
+ * created since the last time statistics were reset.
*
- * At present, this field must always be either 0 or 1.
- * Further, since cache images are only created at file
- * close, this field should only be set at that time.
+ * At present, this field must always be either 0 or 1.
+ * Further, since cache images are only created at file
+ * close, this field should only be set at that time.
*
* images_read: Integer field containing the number of cache images
* read from file. Note that reading an image is different
@@ -4056,12 +4707,12 @@ typedef struct H5C_tag_info_t {
* from process 0.
*
* images_loaded: Integer field containing the number of cache images
- * loaded since the last time statistics were reset.
+ * loaded since the last time statistics were reset.
*
- * At present, this field must always be either 0 or 1.
- * Further, since cache images are only loaded at the
- * time of the first protect or on file close, this value
- * should only change on those events.
+ * At present, this field must always be either 0 or 1.
+ * Further, since cache images are only loaded at the
+ * time of the first protect or on file close, this value
+ * should only change on those events.
*
* last_image_size: Size of the most recently loaded metadata cache image
* loaded into the cache, or zero if no image has been
@@ -4077,11 +4728,11 @@ typedef struct H5C_tag_info_t {
* of prefetched entries are tracked in the flushes and evictions arrays
* discused above.
*
- * prefetches: Number of prefetched entries that are loaded to the
- * cache.
+ * prefetches: Number of prefetched entries that are loaded to the
+ * cache.
*
* dirty_prefetches: Number of dirty prefetched entries that are loaded
- * into the cache.
+ * into the cache.
*
* prefetch_hits: Number of prefetched entries that are actually used.
*
@@ -4097,9 +4748,9 @@ typedef struct H5C_tag_info_t {
* obtain estimates of how frequently these restarts occur.
*
* slist_scan_restarts: Number of times a scan of the slist (that contains
- * calls to H5C__flush_single_entry()) has been restarted to
- * avoid potential issues with change of status of the next
- * entry in the scan.
+ * calls to H5C__flush_single_entry()) has been restarted to
+ * avoid potential issues with change of status of the next
+ * entry in the scan.
*
* LRU_scan_restarts: Number of times a scan of the LRU list (that contains
* calls to H5C__flush_single_entry()) has been restarted to
@@ -4107,43 +4758,43 @@ typedef struct H5C_tag_info_t {
* entry in the scan.
*
* index_scan_restarts: Number of times a scan of the index has been
- * restarted to avoid potential issues with load, insertion
- * or change in flush dependency height of an entry other
- * than the target entry as the result of call(s) to the
- * pre_serialize or serialize callbacks.
+ * restarted to avoid potential issues with load, insertion
+ * or change in flush dependency height of an entry other
+ * than the target entry as the result of call(s) to the
+ * pre_serialize or serialize callbacks.
*
- * Note that at present, this condition can only be triggered
- * by a call to H5C_serialize_single_entry().
+ * Note that at present, this condition can only be triggered
+ * by a call to H5C_serialize_single_entry().
*
* The remaining stats are collected only when both H5C_COLLECT_CACHE_STATS
* and H5C_COLLECT_CACHE_ENTRY_STATS are true.
*
* max_accesses: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the maximum number of times any single
- * entry with type id equal to the array index has been
- * accessed in the current epoch.
+ * are used to record the maximum number of times any single
+ * entry with type id equal to the array index has been
+ * accessed in the current epoch.
*
* min_accesses: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the minimum number of times any single
- * entry with type id equal to the array index has been
- * accessed in the current epoch.
+ * are used to record the minimum number of times any single
+ * entry with type id equal to the array index has been
+ * accessed in the current epoch.
*
* max_clears: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the maximum number of times any single
- * entry with type id equal to the array index has been cleared
- * in the current epoch.
+ * are used to record the maximum number of times any single
+ * entry with type id equal to the array index has been cleared
+ * in the current epoch.
*
* max_flushes: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
- * are used to record the maximum number of times any single
- * entry with type id equal to the array index has been
- * flushed in the current epoch.
+ * are used to record the maximum number of times any single
+ * entry with type id equal to the array index has been
+ * flushed in the current epoch.
*
- * max_size: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
+ * max_size: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
* are used to record the maximum size of any single entry
- * with type id equal to the array index that has resided in
- * the cache in the current epoch.
+ * with type id equal to the array index that has resided in
+ * the cache in the current epoch.
*
- * max_pins: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
+ * max_pins: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
* are used to record the maximum number of times that any single
* entry with type id equal to the array index that has been
* marked as pinned in the cache in the current epoch.
@@ -4151,9 +4802,9 @@ typedef struct H5C_tag_info_t {
*
* Fields supporting testing:
*
- * prefix Array of char used to prefix debugging output. The
- * field is intended to allow marking of output of with
- * the processes mpi rank.
+ * prefix Array of char used to prefix debugging output. The
+ * field is intended to allow marking of output of with
+ * the processes mpi rank.
*
* get_entry_ptr_from_addr_counter: Counter used to track the number of
* times the H5C_get_entry_ptr_from_addr() function has been
@@ -4161,270 +4812,277 @@ typedef struct H5C_tag_info_t {
* NDEBUG is not #defined.
*
****************************************************************************/
+
struct H5C_t {
- uint32_t magic;
- hbool_t flush_in_progress;
- H5C_log_info_t * log_info;
- void * aux_ptr;
- int32_t max_type_id;
- const H5C_class_t *const * class_table_ptr;
- size_t max_cache_size;
- size_t min_clean_size;
- H5C_write_permitted_func_t check_write_permitted;
- hbool_t write_permitted;
- H5C_log_flush_func_t log_flush;
- hbool_t evictions_enabled;
- hbool_t close_warning_received;
-
- /* Fields for maintaining [hash table] index of entries */
- uint32_t index_len;
- size_t index_size;
- uint32_t index_ring_len[H5C_RING_NTYPES];
- size_t index_ring_size[H5C_RING_NTYPES];
+ uint32_t magic;
+ hbool_t flush_in_progress;
+ H5C_log_info_t *log_info;
+ void * aux_ptr;
+ int32_t max_type_id;
+ const H5C_class_t * const *class_table_ptr;
+ size_t max_cache_size;
+ size_t min_clean_size;
+ H5C_write_permitted_func_t check_write_permitted;
+ hbool_t write_permitted;
+ H5C_log_flush_func_t log_flush;
+ hbool_t evictions_enabled;
+ hbool_t close_warning_received;
+
+ /* 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];
+ size_t index_ring_size[H5C_RING_NTYPES];
size_t clean_index_size;
- size_t clean_index_ring_size[H5C_RING_NTYPES];
- size_t dirty_index_size;
- size_t dirty_index_ring_size[H5C_RING_NTYPES];
- H5C_cache_entry_t *index[H5C__HASH_TABLE_LEN];
- uint32_t il_len;
- size_t il_size;
- H5C_cache_entry_t *il_head;
- H5C_cache_entry_t *il_tail;
+ size_t clean_index_ring_size[H5C_RING_NTYPES];
+ size_t dirty_index_size;
+ size_t dirty_index_ring_size[H5C_RING_NTYPES];
+ H5C_cache_entry_t * index[H5C__HASH_TABLE_LEN];
+ uint32_t il_len;
+ size_t il_size;
+ H5C_cache_entry_t * il_head;
+ H5C_cache_entry_t * il_tail;
/* Fields to detect entries removed during scans */
int64_t entries_removed_counter;
- H5C_cache_entry_t *last_entry_removed_ptr;
- H5C_cache_entry_t *entry_watched_for_removal;
+ H5C_cache_entry_t * last_entry_removed_ptr;
+ H5C_cache_entry_t * entry_watched_for_removal;
/* Fields for maintaining list of in-order entries, for flushing */
- hbool_t slist_changed;
- uint32_t slist_len;
- size_t slist_size;
- uint32_t slist_ring_len[H5C_RING_NTYPES];
- size_t slist_ring_size[H5C_RING_NTYPES];
- H5SL_t * slist_ptr;
- uint32_t num_last_entries;
+ hbool_t slist_enabled;
+ hbool_t slist_changed;
+ uint32_t slist_len;
+ size_t slist_size;
+ uint32_t slist_ring_len[H5C_RING_NTYPES];
+ size_t slist_ring_size[H5C_RING_NTYPES];
+ H5SL_t * slist_ptr;
+ uint32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
- int32_t slist_len_increase;
- int64_t slist_size_increase;
+ int32_t slist_len_increase;
+ int64_t slist_size_increase;
#endif /* H5C_DO_SANITY_CHECKS */
/* Fields for maintaining list of tagged entries */
- H5SL_t * tag_list;
- hbool_t ignore_tags;
- uint32_t num_objs_corked;
+ H5SL_t * tag_list;
+ hbool_t ignore_tags;
+ uint32_t num_objs_corked;
/* Fields for tracking protected entries */
- uint32_t pl_len;
- size_t pl_size;
- H5C_cache_entry_t *pl_head_ptr;
- H5C_cache_entry_t *pl_tail_ptr;
+ uint32_t pl_len;
+ size_t pl_size;
+ H5C_cache_entry_t * pl_head_ptr;
+ H5C_cache_entry_t * pl_tail_ptr;
/* Fields for tracking pinned entries */
- uint32_t pel_len;
- size_t pel_size;
- H5C_cache_entry_t *pel_head_ptr;
- H5C_cache_entry_t *pel_tail_ptr;
+ uint32_t pel_len;
+ size_t pel_size;
+ H5C_cache_entry_t * pel_head_ptr;
+ H5C_cache_entry_t * pel_tail_ptr;
/* Fields for complete LRU list of entries */
- uint32_t LRU_list_len;
- size_t LRU_list_size;
- H5C_cache_entry_t *LRU_head_ptr;
- H5C_cache_entry_t *LRU_tail_ptr;
+ uint32_t LRU_list_len;
+ size_t LRU_list_size;
+ H5C_cache_entry_t * LRU_head_ptr;
+ H5C_cache_entry_t * LRU_tail_ptr;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
/* Fields for clean LRU list of entries */
- uint32_t cLRU_list_len;
- size_t cLRU_list_size;
- H5C_cache_entry_t *cLRU_head_ptr;
- H5C_cache_entry_t *cLRU_tail_ptr;
+ uint32_t cLRU_list_len;
+ size_t cLRU_list_size;
+ H5C_cache_entry_t * cLRU_head_ptr;
+ H5C_cache_entry_t * cLRU_tail_ptr;
/* Fields for dirty LRU list of entries */
- uint32_t dLRU_list_len;
- size_t dLRU_list_size;
- H5C_cache_entry_t *dLRU_head_ptr;
- H5C_cache_entry_t *dLRU_tail_ptr;
+ uint32_t dLRU_list_len;
+ size_t dLRU_list_size;
+ H5C_cache_entry_t * dLRU_head_ptr;
+ H5C_cache_entry_t * dLRU_tail_ptr;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
#ifdef H5_HAVE_PARALLEL
/* Fields for collective metadata reads */
- uint32_t coll_list_len;
- size_t coll_list_size;
- H5C_cache_entry_t *coll_head_ptr;
- H5C_cache_entry_t *coll_tail_ptr;
+ uint32_t coll_list_len;
+ size_t coll_list_size;
+ H5C_cache_entry_t * coll_head_ptr;
+ H5C_cache_entry_t * coll_tail_ptr;
/* Fields for collective metadata writes */
- H5SL_t *coll_write_list;
+ H5SL_t * coll_write_list;
#endif /* H5_HAVE_PARALLEL */
/* Fields for automatic cache size adjustment */
- hbool_t size_increase_possible;
- hbool_t flash_size_increase_possible;
- size_t flash_size_increase_threshold;
- hbool_t size_decrease_possible;
- hbool_t resize_enabled;
- hbool_t cache_full;
- hbool_t size_decreased;
- hbool_t resize_in_progress;
- hbool_t msic_in_progress;
- H5C_auto_size_ctl_t resize_ctl;
+ hbool_t size_increase_possible;
+ hbool_t flash_size_increase_possible;
+ size_t flash_size_increase_threshold;
+ hbool_t size_decrease_possible;
+ hbool_t resize_enabled;
+ hbool_t cache_full;
+ hbool_t size_decreased;
+ hbool_t resize_in_progress;
+ hbool_t msic_in_progress;
+ H5C_auto_size_ctl_t resize_ctl;
/* Fields for epoch markers used in automatic cache size adjustment */
- int32_t epoch_markers_active;
- hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS];
- int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS + 1];
- int32_t epoch_marker_ringbuf_first;
- int32_t epoch_marker_ringbuf_last;
- int32_t epoch_marker_ringbuf_size;
- H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS];
+ int32_t epoch_markers_active;
+ hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS];
+ int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS+1];
+ int32_t epoch_marker_ringbuf_first;
+ int32_t epoch_marker_ringbuf_last;
+ int32_t epoch_marker_ringbuf_size;
+ H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS];
/* Fields for cache hit rate collection */
- int64_t cache_hits;
- int64_t cache_accesses;
+ int64_t cache_hits;
+ int64_t cache_accesses;
/* fields supporting generation of a cache image on file close */
- H5C_cache_image_ctl_t image_ctl;
- hbool_t serialization_in_progress;
- hbool_t load_image;
- hbool_t image_loaded;
- hbool_t delete_image;
- haddr_t image_addr;
- hsize_t image_len;
- hsize_t image_data_len;
- int64_t entries_loaded_counter;
- int64_t entries_inserted_counter;
- int64_t entries_relocated_counter;
- int64_t entry_fd_height_change_counter;
- uint32_t num_entries_in_image;
- H5C_image_entry_t * image_entries;
- void * image_buffer;
+ H5C_cache_image_ctl_t image_ctl;
+ hbool_t serialization_in_progress;
+ hbool_t load_image;
+ hbool_t image_loaded;
+ hbool_t delete_image;
+ haddr_t image_addr;
+ hsize_t image_len;
+ hsize_t image_data_len;
+ int64_t entries_loaded_counter;
+ int64_t entries_inserted_counter;
+ int64_t entries_relocated_counter;
+ int64_t entry_fd_height_change_counter;
+ uint32_t num_entries_in_image;
+ H5C_image_entry_t * image_entries;
+ void * image_buffer;
/* Free Space Manager Related fields */
- hbool_t rdfsm_settled;
- hbool_t mdfsm_settled;
+ hbool_t rdfsm_settled;
+ hbool_t mdfsm_settled;
#if H5C_COLLECT_CACHE_STATS
/* stats fields */
- int64_t hits[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t misses[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t write_protects[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
- int32_t max_read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t insertions[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t pinned_insertions[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t clears[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t flushes[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t evictions[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t take_ownerships[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t moves[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t entry_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t cache_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t pins[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t unpins[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t dirty_pins[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t pinned_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t pinned_clears[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t size_increases[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t size_decreases[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t entry_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1];
- int64_t cache_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t hits[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t misses[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t write_protects[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t max_read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t insertions[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t pinned_insertions[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t clears[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t flushes[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t evictions[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t take_ownerships[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t moves[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t entry_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t cache_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t pins[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t unpins[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t dirty_pins[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t pinned_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t pinned_clears[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t size_increases[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t size_decreases[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t entry_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1];
+ int64_t cache_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1];
/* Fields for hash table operations */
- int64_t total_ht_insertions;
- int64_t total_ht_deletions;
- int64_t successful_ht_searches;
- int64_t total_successful_ht_search_depth;
- int64_t failed_ht_searches;
- int64_t total_failed_ht_search_depth;
- uint32_t max_index_len;
- size_t max_index_size;
- size_t max_clean_index_size;
- size_t max_dirty_index_size;
+ int64_t total_ht_insertions;
+ int64_t total_ht_deletions;
+ int64_t successful_ht_searches;
+ int64_t total_successful_ht_search_depth;
+ int64_t failed_ht_searches;
+ int64_t total_failed_ht_search_depth;
+ uint32_t max_index_len;
+ size_t max_index_size;
+ size_t max_clean_index_size;
+ size_t max_dirty_index_size;
/* Fields for in-order skip list */
- uint32_t max_slist_len;
- size_t max_slist_size;
+ uint32_t max_slist_len;
+ size_t max_slist_size;
/* Fields for protected entry list */
- uint32_t max_pl_len;
- size_t max_pl_size;
+ uint32_t max_pl_len;
+ size_t max_pl_size;
/* Fields for pinned entry list */
- uint32_t max_pel_len;
- size_t max_pel_size;
+ uint32_t max_pel_len;
+ size_t max_pel_size;
/* Fields for tracking 'make space in cache' (msic) operations */
- int64_t calls_to_msic;
- int64_t total_entries_skipped_in_msic;
- int64_t total_dirty_pf_entries_skipped_in_msic;
- int64_t total_entries_scanned_in_msic;
- int32_t max_entries_skipped_in_msic;
- int32_t max_dirty_pf_entries_skipped_in_msic;
- int32_t max_entries_scanned_in_msic;
- int64_t entries_scanned_to_make_space;
+ int64_t calls_to_msic;
+ int64_t total_entries_skipped_in_msic;
+ int64_t total_dirty_pf_entries_skipped_in_msic;
+ int64_t total_entries_scanned_in_msic;
+ int32_t max_entries_skipped_in_msic;
+ int32_t max_dirty_pf_entries_skipped_in_msic;
+ int32_t max_entries_scanned_in_msic;
+ int64_t entries_scanned_to_make_space;
/* Fields for tracking skip list scan restarts */
- int64_t slist_scan_restarts;
- int64_t LRU_scan_restarts;
- int64_t index_scan_restarts;
+ int64_t slist_scan_restarts;
+ int64_t LRU_scan_restarts;
+ int64_t index_scan_restarts;
/* Fields for tracking cache image operations */
- int32_t images_created;
- int32_t images_read;
- int32_t images_loaded;
- hsize_t last_image_size;
+ int32_t images_created;
+ int32_t images_read;
+ int32_t images_loaded;
+ hsize_t last_image_size;
/* Fields for tracking prefetched entries */
- int64_t prefetches;
- int64_t dirty_prefetches;
- int64_t prefetch_hits;
+ int64_t prefetches;
+ int64_t dirty_prefetches;
+ int64_t prefetch_hits;
#if H5C_COLLECT_CACHE_ENTRY_STATS
- int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
- int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
- int32_t max_clears[H5C__MAX_NUM_TYPE_IDS + 1];
- int32_t max_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
- size_t max_size[H5C__MAX_NUM_TYPE_IDS + 1];
- int32_t max_pins[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t max_clears[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t max_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
+ size_t max_size[H5C__MAX_NUM_TYPE_IDS + 1];
+ int32_t max_pins[H5C__MAX_NUM_TYPE_IDS + 1];
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
#endif /* H5C_COLLECT_CACHE_STATS */
- char prefix[H5C__PREFIX_LEN];
+ char prefix[H5C__PREFIX_LEN];
#ifndef NDEBUG
- int64_t get_entry_ptr_from_addr_counter;
+ 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);
+
/*****************************/
/* Package Private Variables */
/*****************************/
+
/******************************/
/* Package Private Prototypes */
/******************************/
H5_DLL herr_t H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated);
-H5_DLL herr_t 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);
+H5_DLL herr_t 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);
/* General routines */
-H5_DLL herr_t H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags);
+H5_DLL herr_t H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr,
+ unsigned flags);
H5_DLL herr_t H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr);
H5_DLL herr_t H5C__load_cache_image(H5F_t *f);
-H5_DLL herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry_ptr);
-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__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr);
+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__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);
+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);
/* Routines for operating on entry tags */
-H5_DLL herr_t H5C__tag_entry(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr);
+H5_DLL herr_t H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr);
H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry);
/* Testing functions */
@@ -4432,4 +5090,5 @@ H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry);
H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status);
#endif /* H5C_TESTING */
-#endif /* _H5Cpkg_H */
+#endif /* H5Cpkg_H */
+/* clang-format on */
diff --git a/src/H5Cprefetched.c b/src/H5Cprefetched.c
index 53002b0..07fca2b 100644
--- a/src/H5Cprefetched.c
+++ b/src/H5Cprefetched.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 8c1cdfc..27a24c4 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -6,33 +6,31 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5Cprivate.h
- * 6/3/04
- * John Mainzer
+ * Created: H5Cprivate.h
+ * 6/3/04
+ * John Mainzer
*
- * Purpose: Constants and typedefs available to the rest of the
- * library.
- *
- * Modifications:
+ * Purpose: Constants and typedefs available to the rest of the
+ * library.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Cprivate_H
-#define _H5Cprivate_H
+#ifndef H5Cprivate_H
+#define H5Cprivate_H
-#include "H5Cpublic.h" /* public prototypes */
+#include "H5Cpublic.h" /* public prototypes */
/* Private headers needed by this header */
-#include "H5private.h" /* Generic Functions */
-#include "H5Fprivate.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Fprivate.h" /* File access */
/**************************/
/* Library Private Macros */
@@ -46,7 +44,7 @@
* or decrease it if appropriate. Its purposes is to detect corrupt
* object sizes, so it probably doesn't matter if it is a bit big.
*
- * JRM - 5/17/04
+ * JRM - 5/17/04
*/
#define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024))
@@ -101,9 +99,15 @@
#define H5C_RESIZE_CFG__VALIDATE_INCREMENT 0x2
#define H5C_RESIZE_CFG__VALIDATE_DECREMENT 0x4
#define H5C_RESIZE_CFG__VALIDATE_INTERACTIONS 0x8
-#define H5C_RESIZE_CFG__VALIDATE_ALL \
- (H5C_RESIZE_CFG__VALIDATE_GENERAL | H5C_RESIZE_CFG__VALIDATE_INCREMENT | \
- H5C_RESIZE_CFG__VALIDATE_DECREMENT | H5C_RESIZE_CFG__VALIDATE_INTERACTIONS)
+/* clang-format off */
+#define H5C_RESIZE_CFG__VALIDATE_ALL \
+( \
+ H5C_RESIZE_CFG__VALIDATE_GENERAL | \
+ H5C_RESIZE_CFG__VALIDATE_INCREMENT | \
+ H5C_RESIZE_CFG__VALIDATE_DECREMENT | \
+ H5C_RESIZE_CFG__VALIDATE_INTERACTIONS \
+)
+/* clang-format on */
/* Cache configuration versions */
#define H5C__CURR_AUTO_SIZE_CTL_VER 1
@@ -111,20 +115,20 @@
#define H5C__CURR_CACHE_IMAGE_CTL_VER 1
/* Default configuration settings */
-#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
-#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
+#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999
+#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9
#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
#define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
-#define H5C__DEF_AR_INCREMENT 2.0f
+#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5
+#define H5C__DEF_AR_INCREMENT 2.0
#define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024))
-#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
-#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
-#define H5C__DEF_AR_DECREMENT 0.9f
+#define H5C__DEF_AR_FLASH_MULTIPLE 1.0
+#define H5C__DEV_AR_FLASH_THRESHOLD 0.25
+#define H5C__DEF_AR_DECREMENT 0.9
#define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_EPCHS_B4_EVICT 3
-#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
+#define H5C__DEF_AR_EMPTY_RESERVE 0.05
#define H5C__MIN_AR_EPOCH_LENGTH 100
#define H5C__DEF_AR_EPOCH_LENGTH 50000
#define H5C__MAX_AR_EPOCH_LENGTH 1000000
@@ -135,51 +139,51 @@
* function are ignored in that function.
*
* These flags apply to all function calls:
- * H5C__NO_FLAGS_SET (generic "no flags set" for all fcn calls)
+ * H5C__NO_FLAGS_SET (generic "no flags set" for all fcn calls)
*
*
* These flags apply to H5C_insert_entry():
- * H5C__SET_FLUSH_MARKER_FLAG
- * H5C__PIN_ENTRY_FLAG
- * H5C__FLUSH_LAST_FLAG ; super block only
- * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
+ * H5C__SET_FLUSH_MARKER_FLAG
+ * H5C__PIN_ENTRY_FLAG
+ * H5C__FLUSH_LAST_FLAG ; super block only
+ * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
*
* These flags apply to H5C_protect()
- * H5C__READ_ONLY_FLAG
- * H5C__FLUSH_LAST_FLAG ; super block only
- * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
+ * H5C__READ_ONLY_FLAG
+ * H5C__FLUSH_LAST_FLAG ; super block only
+ * H5C__FLUSH_COLLECTIVELY_FLAG ; super block only
*
* These flags apply to H5C_unprotect():
- * H5C__SET_FLUSH_MARKER_FLAG
- * H5C__DELETED_FLAG
- * H5C__DIRTIED_FLAG
- * H5C__PIN_ENTRY_FLAG
- * H5C__UNPIN_ENTRY_FLAG
- * H5C__FREE_FILE_SPACE_FLAG
- * H5C__TAKE_OWNERSHIP_FLAG
+ * H5C__SET_FLUSH_MARKER_FLAG
+ * H5C__DELETED_FLAG
+ * H5C__DIRTIED_FLAG
+ * H5C__PIN_ENTRY_FLAG
+ * H5C__UNPIN_ENTRY_FLAG
+ * H5C__FREE_FILE_SPACE_FLAG
+ * H5C__TAKE_OWNERSHIP_FLAG
*
* These flags apply to H5C_expunge_entry():
- * H5C__FREE_FILE_SPACE_FLAG
+ * H5C__FREE_FILE_SPACE_FLAG
*
* These flags apply to H5C_evict():
- * H5C__EVICT_ALLOW_LAST_PINS_FLAG
+ * H5C__EVICT_ALLOW_LAST_PINS_FLAG
*
* These flags apply to H5C_flush_cache():
- * H5C__FLUSH_INVALIDATE_FLAG
- * H5C__FLUSH_CLEAR_ONLY_FLAG
- * H5C__FLUSH_MARKED_ENTRIES_FLAG
- * H5C__FLUSH_IGNORE_PROTECTED_FLAG (can't use this flag in combination
- * with H5C__FLUSH_INVALIDATE_FLAG)
- * H5C__DURING_FLUSH_FLAG
+ * H5C__FLUSH_INVALIDATE_FLAG
+ * H5C__FLUSH_CLEAR_ONLY_FLAG
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG
+ * H5C__FLUSH_IGNORE_PROTECTED_FLAG (can't use this flag in combination
+ * with H5C__FLUSH_INVALIDATE_FLAG)
+ * H5C__DURING_FLUSH_FLAG
*
* These flags apply to H5C_flush_single_entry():
- * H5C__FLUSH_INVALIDATE_FLAG
- * H5C__FLUSH_CLEAR_ONLY_FLAG
- * H5C__FLUSH_MARKED_ENTRIES_FLAG
- * H5C__TAKE_OWNERSHIP_FLAG
- * H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG
- * H5C__GENERATE_IMAGE_FLAG
- * H5C__UPDATE_PAGE_BUFFER_FLAG
+ * H5C__FLUSH_INVALIDATE_FLAG
+ * H5C__FLUSH_CLEAR_ONLY_FLAG
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG
+ * H5C__TAKE_OWNERSHIP_FLAG
+ * H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG
+ * H5C__GENERATE_IMAGE_FLAG
+ * H5C__UPDATE_PAGE_BUFFER_FLAG
*/
#define H5C__NO_FLAGS_SET 0x00000
#define H5C__SET_FLUSH_MARKER_FLAG 0x00001
@@ -271,204 +275,204 @@ typedef struct H5C_t H5C_t;
* used by the metadata cache for each class of metadata cache entry.
* The fields of the structure are discussed below:
*
- * id: Integer field containing the unique ID of the class of metadata
- * cache entries.
+ * id: Integer field containing the unique ID of the class of metadata
+ * cache entries.
*
* name: Pointer to a string containing the name of the class of metadata
- * cache entries.
+ * cache entries.
*
* mem_type: Instance of H5FD_mem_t, that is used to supply the
- * mem type passed into H5F_block_read().
+ * mem type passed into H5F_block_read().
*
* flags: Flags indicating class-specific behavior.
*
- * Possible flags are:
+ * Possible flags are:
*
- * H5C__CLASS_NO_FLAGS_SET: No special processing.
+ * H5C__CLASS_NO_FLAGS_SET: No special processing.
*
- * H5C__CLASS_SPECULATIVE_LOAD_FLAG: This flag is used only in
+ * H5C__CLASS_SPECULATIVE_LOAD_FLAG: This flag is used only in
* H5C_load_entry(). When it is set, entries are
- * permitted to change their sizes on the first attempt
- * to load.
- *
- * If the new size is larger than the old, the read buffer
- * is reallocated to the new size, loaded from file, and the
- * deserialize routine is called a second time on the
- * new buffer. The entry returned by the first call to
- * the deserialize routine is discarded (via the free_icr
- * call) after the new size is retrieved (via the image_len
- * call). Note that the new size is used as the size of the
- * entry in the cache.
- *
- * If the new size is smaller than the old, no new loads
- * or deserializes are performed, but the new size becomes
- * the size of the entry in the cache.
- *
- * When this flag is set, an attempt to read past the
- * end of file could occur. In this case, if the size
- * returned get_load_size callback would result in a
- * read past the end of file, the size is truncated to
- * avoid this, and processing proceeds as normal.
+ * permitted to change their sizes on the first attempt
+ * to load.
+ *
+ * If the new size is larger than the old, the read buffer
+ * is reallocated to the new size, loaded from file, and the
+ * deserialize routine is called a second time on the
+ * new buffer. The entry returned by the first call to
+ * the deserialize routine is discarded (via the free_icr
+ * call) after the new size is retrieved (via the image_len
+ * call). Note that the new size is used as the size of the
+ * entry in the cache.
+ *
+ * If the new size is smaller than the old, no new loads
+ * or deserializes are performed, but the new size becomes
+ * the size of the entry in the cache.
+ *
+ * When this flag is set, an attempt to read past the
+ * end of file could occur. In this case, if the size
+ * returned get_load_size callback would result in a
+ * read past the end of file, the size is truncated to
+ * avoid this, and processing proceeds as normal.
*
* The following flags may only appear in test code.
*
- * H5C__CLASS_SKIP_READS: This flags is intended only for use in test
- * code. When it is set, reads on load will be skipped,
- * and an uninitialize buffer will be passed to the
- * deserialize function.
+ * H5C__CLASS_SKIP_READS: This flags is intended only for use in test
+ * code. When it is set, reads on load will be skipped,
+ * and an uninitialize buffer will be passed to the
+ * deserialize function.
*
- * H5C__CLASS_SKIP_WRITES: This flags is intended only for use in test
- * code. When it is set, writes of buffers prepared by the
- * serialize callback will be skipped.
+ * H5C__CLASS_SKIP_WRITES: This flags is intended only for use in test
+ * code. When it is set, writes of buffers prepared by the
+ * serialize callback will be skipped.
*
* GET_INITIAL_LOAD_SIZE: Pointer to the 'get initial load size' function.
*
- * This function determines the size based on the information in the
- * parameter "udata" or an initial speculative guess. The size is
- * returned in the parameter "image_len_ptr".
+ * This function determines the size based on the information in the
+ * parameter "udata" or an initial speculative guess. The size is
+ * returned in the parameter "image_len_ptr".
*
- * For an entry with H5C__CLASS_NO_FLAGS_SET:
- * This function returns in "image_len_ptr" the on disk size of the
+ * For an entry with H5C__CLASS_NO_FLAGS_SET:
+ * This function returns in "image_len_ptr" the on disk size of the
* entry.
*
- * For an entry with H5C__CLASS_SPECULATIVE_LOAD_FLAG:
- * This function returns in "image_len_ptr" an initial guess of the
+ * For an entry with H5C__CLASS_SPECULATIVE_LOAD_FLAG:
+ * This function returns in "image_len_ptr" an initial guess of the
* entry's on disk size. This many bytes will be loaded from
* the file and then passed to 'get_final_load_size' callback
* for the actual (final) image length to be determined.
*
- * The typedef for the get_initial_load_size callback is as follows:
+ * The typedef for the get_initial_load_size callback is as follows:
*
- * typedef herr_t (*H5C_get_initial_load_size_func_t)(void *udata_ptr,
- * size_t *image_len_ptr);
+ * typedef herr_t (*H5C_get_initial_load_size_func_t)(void *udata_ptr,
+ * size_t *image_len_ptr);
*
- * The parameters of the get_initial_load_size callback are as follows:
+ * The parameters of the get_initial_load_size callback are as follows:
*
- * udata_ptr: Pointer to user data provided in the protect call, which
- * will also be passed through to the 'get_final_load_size',
+ * udata_ptr: Pointer to user data provided in the protect call, which
+ * will also be passed through to the 'get_final_load_size',
* 'verify_chksum', and 'deserialize' callbacks.
*
- * image_len_ptr: Pointer to the length in bytes of the in-file image to
+ * image_len_ptr: Pointer to the length in bytes of the in-file image to
* be deserialized is to be returned.
*
* This value is used by the cache to determine the size of
* the disk image for the metadata, in order to read the disk
* image from the file.
*
- * Processing in the get_load_size function should proceed as follows:
+ * Processing in the get_load_size function should proceed as follows:
*
- * If successful, the function will place the length in the *image_len_ptr
+ * If successful, the function will place the length in the *image_len_ptr
* associated with supplied user data and then return SUCCEED.
*
- * On failure, the function must return FAIL and push error information
- * onto the error stack with the error API routines, without modifying
+ * On failure, the function must return FAIL and push error information
+ * onto the error stack with the error API routines, without modifying
* the value pointed to by image_len_ptr.
*
*
* GET_FINAL_LOAD_SIZE: Pointer to the 'get final load size' function.
*
- * This function determines the final size of a speculatively loaded
+ * This function determines the final size of a speculatively loaded
* metadata cache entry based on the parameter "image" and the "udata"
* parameters. This callback _must_ be implemented for cache clients
* which set the H5C__CLASS_SPECULATIVE_LOAD_FLAG and must return the
* actual length of on-disk image after being called once.
*
- * This function might deserialize the needed metadata information to
- * determine the actual size. The size is returned in the parameter
+ * This function might deserialize the needed metadata information to
+ * determine the actual size. The size is returned in the parameter
* "actual_len_ptr".
*
- * The typedef for the get_load_size callback is as follows:
+ * The typedef for the get_load_size callback is as follows:
*
- * typedef herr_t (*H5C_get_final_load_size_func_t)(const void *image_ptr,
- * size_t image_len,
- * void *udata_ptr,
- * size_t *actual_len_ptr);
+ * typedef herr_t (*H5C_get_final_load_size_func_t)(const void *image_ptr,
+ * size_t image_len,
+ * void *udata_ptr,
+ * size_t *actual_len_ptr);
*
- * The parameters of the get_load_size callback are as follows:
+ * The parameters of the get_load_size callback are as follows:
*
- * image_ptr: Pointer to a buffer containing the (possibly partial)
+ * image_ptr: Pointer to a buffer containing the (possibly partial)
* metadata read in.
*
- * image_len: The length in bytes of the (possibly partial) in-file image
+ * image_len: The length in bytes of the (possibly partial) in-file image
* to be queried for an actual length.
*
- * udata_ptr: Pointer to user data provided in the protect call, which
- * will also be passed through to the 'verify_chksum' and
+ * udata_ptr: Pointer to user data provided in the protect call, which
+ * will also be passed through to the 'verify_chksum' and
* 'deserialize' callbacks.
*
- * actual_len_ptr: Pointer to the location containing the actual length
- * of the metadata entry on disk.
+ * actual_len_ptr: Pointer to the location containing the actual length
+ * of the metadata entry on disk.
*
- * Processing in the get_final_load_size function should proceed as follows:
+ * Processing in the get_final_load_size function should proceed as follows:
*
- * If successful, the function will place the length in the *actual_len_ptr
+ * If successful, the function will place the length in the *actual_len_ptr
* associated with supplied image and/or user data and then return SUCCEED.
*
- * On failure, the function must return FAIL and push error information
- * onto the error stack with the error API routines, without modifying
+ * On failure, the function must return FAIL and push error information
+ * onto the error stack with the error API routines, without modifying
* the value pointed to by actual_len_ptr.
*
*
* VERIFY_CHKSUM: Pointer to the verify_chksum function.
*
- * This function verifies the checksum computed for the metadata is
- * the same as the checksum stored in the metadata.
+ * This function verifies the checksum computed for the metadata is
+ * the same as the checksum stored in the metadata.
*
- * It computes the checksum based on the metadata stored in the
- * parameter "image_ptr" and the actual length of the metadata in the
- * parameter "len" which is obtained from the "get_load_size" callback.
+ * It computes the checksum based on the metadata stored in the
+ * parameter "image_ptr" and the actual length of the metadata in the
+ * parameter "len" which is obtained from the "get_load_size" callback.
*
- * The typedef for the verify_chksum callback is as follows:
+ * The typedef for the verify_chksum callback is as follows:
*
- * typedef htri_t (*H5C_verify_chksum_func_t)(const void *image_ptr,
- * size_t len,
- * void *udata_ptr);
+ * typedef htri_t (*H5C_verify_chksum_func_t)(const void *image_ptr,
+ * size_t len,
+ * void *udata_ptr);
*
- * The parameters of the verify_chksum callback are as follows:
+ * The parameters of the verify_chksum callback are as follows:
*
- * image_ptr: Pointer to a buffer containing the metadata read in.
+ * image_ptr: Pointer to a buffer containing the metadata read in.
*
- * len: The actual length of the metadata.
+ * len: The actual length of the metadata.
*
- * udata_ptr: Pointer to user data.
+ * udata_ptr: Pointer to user data.
*
*
* DESERIALIZE: Pointer to the deserialize function.
*
- * This function must be able to deserialize a buffer containing the
+ * This function must be able to deserialize a buffer containing the
* on-disk image of a metadata cache entry, allocate and initialize the
* equivalent in core representation, and return a pointer to that
* representation.
*
- * The typedef for the deserialize callback is as follows:
+ * The typedef for the deserialize callback is as follows:
*
- * typedef void *(*H5C_deserialize_func_t)(const void * image_ptr,
- * size_t len,
+ * typedef void *(*H5C_deserialize_func_t)(const void * image_ptr,
+ * size_t len,
* void * udata_ptr,
* boolean * dirty_ptr);
*
- * The parameters of the deserialize callback are as follows:
+ * The parameters of the deserialize callback are as follows:
*
- * image_ptr: Pointer to a buffer of length len containing the
- * contents of the file starting at addr and continuing
- * for len bytes.
+ * image_ptr: Pointer to a buffer of length len containing the
+ * contents of the file starting at addr and continuing
+ * for len bytes.
*
- * len: Length in bytes of the in file image to be deserialized.
+ * len: Length in bytes of the in file image to be deserialized.
*
* This parameter is supplied mainly for sanity checking.
* Sanity checks should be performed when compiled in debug
* mode, but the parameter may be unused when compiled in
* production mode.
*
- * udata_ptr: Pointer to user data provided in the protect call, which
- * must be passed through to the deserialize callback.
+ * udata_ptr: Pointer to user data provided in the protect call, which
+ * must be passed through to the deserialize callback.
*
* dirty_ptr: Pointer to boolean which the deserialize function
- * must use to mark the entry dirty if it has to modify
- * the entry to clean up file corruption left over from
- * an old bug in the HDF5 library.
+ * must use to mark the entry dirty if it has to modify
+ * the entry to clean up file corruption left over from
+ * an old bug in the HDF5 library.
*
- * Processing in the deserialize function should proceed as follows:
+ * Processing in the deserialize function should proceed as follows:
*
* If the image contains valid data, and is of the correct length,
* the deserialize function must allocate space for an in-core
@@ -496,7 +500,7 @@ typedef struct H5C_t H5C_t;
*
* IMAGE_LEN: Pointer to the image length callback.
*
- * The image_len callback is used to obtain the size of newly inserted
+ * The image_len callback is used to obtain the size of newly inserted
* entries and assert verification.
*
* The typedef for the image_len callback is as follows:
@@ -504,58 +508,58 @@ typedef struct H5C_t H5C_t;
* typedef herr_t (*H5C_image_len_func_t)(void *thing,
* size_t *image_len_ptr);
*
- * The parameters of the image_len callback are as follows:
+ * The parameters of the image_len callback are as follows:
*
- * thing: Pointer to the in core representation of the entry.
+ * thing: Pointer to the in core representation of the entry.
*
- * image_len_ptr: Pointer to size_t in which the callback will return
- * the length (in bytes) of the cache entry.
+ * image_len_ptr: Pointer to size_t in which the callback will return
+ * the length (in bytes) of the cache entry.
*
- * Processing in the image_len function should proceed as follows:
+ * Processing in the image_len function should proceed as follows:
*
- * If successful, the function will place the length of the on disk
- * image associated with the in core representation provided in the
- * thing parameter in *image_len_ptr, and then return SUCCEED.
+ * If successful, the function will place the length of the on disk
+ * image associated with the in core representation provided in the
+ * thing parameter in *image_len_ptr, and then return SUCCEED.
*
- * If the function fails, it must return FAIL and push error information
+ * If the function fails, it must return FAIL and push error information
* onto the error stack with the error API routines, and return without
* modifying the values pointed to by the image_len_ptr parameter.
*
*
* PRE_SERIALIZE: Pointer to the pre-serialize callback.
*
- * The pre-serialize callback is invoked by the metadata cache before
- * it needs a current on-disk image of the metadata entry for purposes
- * either constructing a journal or flushing the entry to disk.
- *
- * If the client needs to change the address or length of the entry prior
- * to flush, the pre-serialize callback is responsible for these actions,
- * so that the actual serialize callback (described below) is only
- * responsible for serializing the data structure, not moving it on disk
- * or resizing it.
- *
- * In addition, the client may use the pre-serialize callback to
- * ensure that the entry is ready to be flushed -- in particular,
- * if the entry contains references to other entries that are in
- * temporary file space, the pre-serialize callback must move those
- * entries into real file space so that the serialzed entry will
- * contain no invalid data.
- *
- * One would think that the base address and length of
- * the length of the entry's image on disk would be well known.
- * However, that need not be the case as free space section info
- * entries will change size (and possibly location) depending on the
- * number of blocks of free space being manages, and fractal heap
- * direct blocks can change compressed size (and possibly location)
- * on serialization if compression is enabled. Similarly, it may
- * be necessary to move entries from temporary to real file space.
- *
- * The pre-serialize callback must report any such changes to the
- * cache, which must then update its internal structures as needed.
- *
- * The typedef for the pre-serialize callback is as follows:
- *
- * typedef herr_t (*H5C_pre_serialize_func_t)(H5F_t *f,
+ * The pre-serialize callback is invoked by the metadata cache before
+ * it needs a current on-disk image of the metadata entry for purposes
+ * either constructing a journal or flushing the entry to disk.
+ *
+ * If the client needs to change the address or length of the entry prior
+ * to flush, the pre-serialize callback is responsible for these actions,
+ * so that the actual serialize callback (described below) is only
+ * responsible for serializing the data structure, not moving it on disk
+ * or resizing it.
+ *
+ * In addition, the client may use the pre-serialize callback to
+ * ensure that the entry is ready to be flushed -- in particular,
+ * if the entry contains references to other entries that are in
+ * temporary file space, the pre-serialize callback must move those
+ * entries into real file space so that the serialzed entry will
+ * contain no invalid data.
+ *
+ * One would think that the base address and length of
+ * the length of the entry's image on disk would be well known.
+ * However, that need not be the case as free space section info
+ * entries will change size (and possibly location) depending on the
+ * number of blocks of free space being manages, and fractal heap
+ * direct blocks can change compressed size (and possibly location)
+ * on serialization if compression is enabled. Similarly, it may
+ * be necessary to move entries from temporary to real file space.
+ *
+ * The pre-serialize callback must report any such changes to the
+ * cache, which must then update its internal structures as needed.
+ *
+ * The typedef for the pre-serialize callback is as follows:
+ *
+ * typedef herr_t (*H5C_pre_serialize_func_t)(H5F_t *f,
* void * thing,
* haddr_t addr,
* size_t len,
@@ -563,154 +567,154 @@ typedef struct H5C_t H5C_t;
* size_t * new_len_ptr,
* unsigned * flags_ptr);
*
- * The parameters of the pre-serialize callback are as follows:
+ * The parameters of the pre-serialize callback are as follows:
*
- * f: File pointer -- needed if other metadata cache entries
- * must be modified in the process of serializing the
- * target entry.
+ * f: File pointer -- needed if other metadata cache entries
+ * must be modified in the process of serializing the
+ * target entry.
*
- * thing: Pointer to void containing the address of the in core
- * representation of the target metadata cache entry.
- * This is the same pointer returned by a protect of the
- * addr and len given above.
+ * thing: Pointer to void containing the address of the in core
+ * representation of the target metadata cache entry.
+ * This is the same pointer returned by a protect of the
+ * addr and len given above.
*
- * addr: Base address in file of the entry to be serialized.
+ * addr: Base address in file of the entry to be serialized.
*
- * This parameter is supplied mainly for sanity checking.
- * Sanity checks should be performed when compiled in debug
- * mode, but the parameter may be unused when compiled in
- * production mode.
+ * This parameter is supplied mainly for sanity checking.
+ * Sanity checks should be performed when compiled in debug
+ * mode, but the parameter may be unused when compiled in
+ * production mode.
*
- * len: Length in bytes of the in file image of the entry to be
- * serialized. Also the size the image passed to the
- * serialize callback (discussed below) unless that
- * value is altered by this function.
+ * len: Length in bytes of the in file image of the entry to be
+ * serialized. Also the size the image passed to the
+ * serialize callback (discussed below) unless that
+ * value is altered by this function.
*
- * This parameter is supplied mainly for sanity checking.
- * Sanity checks should be performed when compiled in debug
- * mode, but the parameter may be unused when compiled in
- * production mode.
+ * This parameter is supplied mainly for sanity checking.
+ * Sanity checks should be performed when compiled in debug
+ * mode, but the parameter may be unused when compiled in
+ * production mode.
*
- * new_addr_ptr: Pointer to haddr_t. If the entry is moved by
- * the serialize function, the new on disk base address must
- * be stored in *new_addr_ptr, and the appropriate flag set
- * in *flags_ptr.
+ * new_addr_ptr: Pointer to haddr_t. If the entry is moved by
+ * the serialize function, the new on disk base address must
+ * be stored in *new_addr_ptr, and the appropriate flag set
+ * in *flags_ptr.
*
- * If the entry is not moved by the serialize function,
- * *new_addr_ptr is undefined on pre-serialize callback
- * return.
+ * If the entry is not moved by the serialize function,
+ * *new_addr_ptr is undefined on pre-serialize callback
+ * return.
*
- * new_len_ptr: Pointer to size_t. If the entry is resized by the
- * serialize function, the new length of the on disk image
- * must be stored in *new_len_ptr, and the appropriate flag set
+ * new_len_ptr: Pointer to size_t. If the entry is resized by the
+ * serialize function, the new length of the on disk image
+ * must be stored in *new_len_ptr, and the appropriate flag set
* in *flags_ptr.
*
- * If the entry is not resized by the pre-serialize function,
- * *new_len_ptr is undefined on pre-serialize callback
- * return.
+ * If the entry is not resized by the pre-serialize function,
+ * *new_len_ptr is undefined on pre-serialize callback
+ * return.
*
- * flags_ptr: Pointer to an unsigned integer used to return flags
- * indicating whether the preserialize function resized or moved
- * the entry. If the entry was neither resized or moved, the
+ * flags_ptr: Pointer to an unsigned integer used to return flags
+ * indicating whether the preserialize function resized or moved
+ * the entry. If the entry was neither resized or moved, the
* serialize function must set *flags_ptr to zero. The
* H5C__SERIALIZE_RESIZED_FLAG or H5C__SERIALIZE_MOVED_FLAG must
* be set to indicate a resize or move respectively.
*
- * If the H5C__SERIALIZE_RESIZED_FLAG is set, the new length
- * must be stored in *new_len_ptr.
+ * If the H5C__SERIALIZE_RESIZED_FLAG is set, the new length
+ * must be stored in *new_len_ptr.
*
- * If the H5C__SERIALIZE_MOVED_FLAG flag is set, the
- * new image base address must be stored in *new_addr_ptr.
+ * If the H5C__SERIALIZE_MOVED_FLAG flag is set, the
+ * new image base address must be stored in *new_addr_ptr.
*
- * Processing in the pre-serialize function should proceed as follows:
+ * Processing in the pre-serialize function should proceed as follows:
*
- * The pre-serialize function must examine the in core representation
- * indicated by the thing parameter, if the pre-serialize function does
+ * The pre-serialize function must examine the in core representation
+ * indicated by the thing parameter, if the pre-serialize function does
* not need to change the size or location of the on-disk image, it must
* set *flags_ptr to zero.
*
- * If the size of the on-disk image must be changed, the pre-serialize
+ * If the size of the on-disk image must be changed, the pre-serialize
* function must load the length of the new image into *new_len_ptr, and
* set the H5C__SERIALIZE_RESIZED_FLAG in *flags_ptr.
*
- * If the base address of the on disk image must be changed, the
+ * If the base address of the on disk image must be changed, the
* pre-serialize function must set *new_addr_ptr to the new base address,
* and set the H5C__SERIALIZE_MOVED_FLAG in *flags_ptr.
*
- * In addition, the pre-serialize callback may perform any other
- * processing required before the entry is written to disk
+ * In addition, the pre-serialize callback may perform any other
+ * processing required before the entry is written to disk
*
- * If it is successful, the function must return SUCCEED.
+ * If it is successful, the function must return SUCCEED.
*
- * If it fails for any reason, the function must return FAIL and
- * push error information on the error stack with the error API
- * routines.
+ * If it fails for any reason, the function must return FAIL and
+ * push error information on the error stack with the error API
+ * routines.
*
*
* SERIALIZE: Pointer to the serialize callback.
*
- * The serialize callback is invoked by the metadata cache whenever
- * it needs a current on disk image of the metadata entry for purposes
- * either constructing a journal entry or flushing the entry to disk.
+ * The serialize callback is invoked by the metadata cache whenever
+ * it needs a current on disk image of the metadata entry for purposes
+ * either constructing a journal entry or flushing the entry to disk.
*
- * At this point, the base address and length of the entry's image on
+ * At this point, the base address and length of the entry's image on
* disk must be well known and not change during the serialization
* process.
*
- * While any size and/or location changes must have been handled
- * by a pre-serialize call, the client may elect to handle any other
- * changes to the entry required to place it in correct form for
- * writing to disk in this call.
+ * While any size and/or location changes must have been handled
+ * by a pre-serialize call, the client may elect to handle any other
+ * changes to the entry required to place it in correct form for
+ * writing to disk in this call.
*
- * The typedef for the serialize callback is as follows:
+ * The typedef for the serialize callback is as follows:
*
- * typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f,
+ * typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f,
* void * image_ptr,
* size_t len,
* void * thing);
*
- * The parameters of the serialize callback are as follows:
+ * The parameters of the serialize callback are as follows:
*
- * f: File pointer -- needed if other metadata cache entries
- * must be modified in the process of serializing the
- * target entry.
+ * f: File pointer -- needed if other metadata cache entries
+ * must be modified in the process of serializing the
+ * target entry.
*
- * image_ptr: Pointer to a buffer of length len bytes into which a
- * serialized image of the target metadata cache entry is
- * to be written.
+ * image_ptr: Pointer to a buffer of length len bytes into which a
+ * serialized image of the target metadata cache entry is
+ * to be written.
*
- * Note that this buffer will not in general be initialized
- * to any particular value. Thus the serialize function may
- * not assume any initial value and must set each byte in
- * the buffer.
+ * Note that this buffer will not in general be initialized
+ * to any particular value. Thus the serialize function may
+ * not assume any initial value and must set each byte in
+ * the buffer.
*
- * len: Length in bytes of the in file image of the entry to be
- * serialized. Also the size of *image_ptr (below).
+ * len: Length in bytes of the in file image of the entry to be
+ * serialized. Also the size of *image_ptr (below).
*
- * This parameter is supplied mainly for sanity checking.
- * Sanity checks should be performed when compiled in debug
- * mode, but the parameter may be unused when compiled in
- * production mode.
+ * This parameter is supplied mainly for sanity checking.
+ * Sanity checks should be performed when compiled in debug
+ * mode, but the parameter may be unused when compiled in
+ * production mode.
*
- * thing: Pointer to void containing the address of the in core
- * representation of the target metadata cache entry.
- * This is the same pointer returned by a protect of the
- * addr and len given above.
+ * thing: Pointer to void containing the address of the in core
+ * representation of the target metadata cache entry.
+ * This is the same pointer returned by a protect of the
+ * addr and len given above.
*
- * Processing in the serialize function should proceed as follows:
+ * Processing in the serialize function should proceed as follows:
*
- * If there are any remaining changes to the entry required before
- * write to disk, they must be dealt with first.
+ * If there are any remaining changes to the entry required before
+ * write to disk, they must be dealt with first.
*
- * The serialize function must then examine the in core
- * representation indicated by the thing parameter, and write a
- * serialized image of its contents into the provided buffer.
+ * The serialize function must then examine the in core
+ * representation indicated by the thing parameter, and write a
+ * serialized image of its contents into the provided buffer.
*
- * If it is successful, the function must return SUCCEED.
+ * If it is successful, the function must return SUCCEED.
*
- * If it fails for any reason, the function must return FAIL and
- * push error information on the error stack with the error API
- * routines.
+ * If it fails for any reason, the function must return FAIL and
+ * push error information on the error stack with the error API
+ * routines.
*
*
* NOTIFY: Pointer to the notify callback.
@@ -719,98 +723,98 @@ typedef struct H5C_t H5C_t;
* action on an entry has taken/will take place and the client indicates
* it wishes to be notified about the action.
*
- * The typedef for the notify callback is as follows:
+ * The typedef for the notify callback is as follows:
*
- * typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action,
+ * typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action,
* void *thing);
*
- * The parameters of the notify callback are as follows:
+ * The parameters of the notify callback are as follows:
*
- * action: An enum indicating the metadata cache action that has taken/
+ * action: An enum indicating the metadata cache action that has taken/
* will take place.
*
- * thing: Pointer to void containing the address of the in core
- * representation of the target metadata cache entry. This
- * is the same pointer that would be returned by a protect
- * of the addr and len of the entry.
+ * thing: Pointer to void containing the address of the in core
+ * representation of the target metadata cache entry. This
+ * is the same pointer that would be returned by a protect
+ * of the addr and len of the entry.
*
- * Processing in the notify function should proceed as follows:
+ * Processing in the notify function should proceed as follows:
*
- * The notify function may perform any action it would like, including
+ * The notify function may perform any action it would like, including
* metadata cache calls.
*
- * If the function is successful, it must return SUCCEED.
+ * If the function is successful, it must return SUCCEED.
*
- * If it fails for any reason, the function must return FAIL and
- * push error information on the error stack with the error API
- * routines.
+ * If it fails for any reason, the function must return FAIL and
+ * push error information on the error stack with the error API
+ * routines.
*
*
* FREE_ICR: Pointer to the free ICR callback.
*
- * The free ICR callback is invoked by the metadata cache when it
- * wishes to evict an entry, and needs the client to free the memory
- * allocated for the in core representation.
+ * The free ICR callback is invoked by the metadata cache when it
+ * wishes to evict an entry, and needs the client to free the memory
+ * allocated for the in core representation.
*
- * The typedef for the free ICR callback is as follows:
+ * The typedef for the free ICR callback is as follows:
*
- * typedef herr_t (*H5C_free_icr_func_t)(void * thing));
+ * typedef herr_t (*H5C_free_icr_func_t)(void * thing));
*
- * The parameters of the free ICR callback are as follows:
+ * The parameters of the free ICR callback are as follows:
*
- * thing: Pointer to void containing the address of the in core
- * representation of the target metadata cache entry. This
- * is the same pointer that would be returned by a protect
- * of the addr and len of the entry.
+ * thing: Pointer to void containing the address of the in core
+ * representation of the target metadata cache entry. This
+ * is the same pointer that would be returned by a protect
+ * of the addr and len of the entry.
*
- * Processing in the free ICR function should proceed as follows:
+ * Processing in the free ICR function should proceed as follows:
*
- * The free ICR function must free all memory allocated to the
- * in core representation.
+ * The free ICR function must free all memory allocated to the
+ * in core representation.
*
- * If the function is successful, it must return SUCCEED.
+ * If the function is successful, it must return SUCCEED.
*
- * If it fails for any reason, the function must return FAIL and
- * push error information on the error stack with the error API
- * routines.
+ * If it fails for any reason, the function must return FAIL and
+ * push error information on the error stack with the error API
+ * routines.
*
- * At least when compiled with debug, it would be useful if the
- * free ICR call would fail if the in core representation has been
- * modified since the last serialize callback.
+ * At least when compiled with debug, it would be useful if the
+ * free ICR call would fail if the in core representation has been
+ * modified since the last serialize callback.
*
* GET_FSF_SIZE: Pointer to the get file space free size callback.
*
- * In principle, there is no need for the get file space free size
- * callback. However, as an optimization, it is sometimes convenient
- * to allocate and free file space for a number of cache entries
- * simultaneously in a single contiguous block of file space.
+ * In principle, there is no need for the get file space free size
+ * callback. However, as an optimization, it is sometimes convenient
+ * to allocate and free file space for a number of cache entries
+ * simultaneously in a single contiguous block of file space.
*
- * File space allocation is done by the client, so the metadata cache
- * need not be involved. However, since the metadata cache typically
+ * File space allocation is done by the client, so the metadata cache
+ * need not be involved. However, since the metadata cache typically
* handles file space release when an entry is destroyed, some
- * adjustment on the part of the metadata cache is required for this
- * operation.
+ * adjustment on the part of the metadata cache is required for this
+ * operation.
*
* The get file space free size callback exists to support this
- * operation.
+ * operation.
*
- * If a group of cache entries that were allocated as a group are to
- * be discarded and their file space released, the type of the first
- * (i.e. lowest address) entry in the group must implement the
- * get free file space size callback.
+ * If a group of cache entries that were allocated as a group are to
+ * be discarded and their file space released, the type of the first
+ * (i.e. lowest address) entry in the group must implement the
+ * get free file space size callback.
*
- * To free the file space of all entries in the group in a single
- * operation, first expunge all entries other than the first without
- * the free file space flag.
+ * To free the file space of all entries in the group in a single
+ * operation, first expunge all entries other than the first without
+ * the free file space flag.
*
- * Then, to complete the operation, unprotect or expunge the first
- * entry in the block with the free file space flag set. Since
- * the get free file space callback is implemented, the metadata
- * cache will use this callback to get the size of the block to be
- * freed, instead of using the size of the entry as is done otherwise.
+ * Then, to complete the operation, unprotect or expunge the first
+ * entry in the block with the free file space flag set. Since
+ * the get free file space callback is implemented, the metadata
+ * cache will use this callback to get the size of the block to be
+ * freed, instead of using the size of the entry as is done otherwise.
*
- * At present this callback is used only by the H5FA and H5EA dblock
- * and dblock page client classes.
+ * At present this callback is used only by the H5FA and H5EA dblock
+ * and dblock page client classes.
*
* The typedef for the get_fsf_size callback is as follows:
*
@@ -824,15 +828,15 @@ typedef struct H5C_t H5C_t;
* is the same pointer that would be returned by a protect()
* call of the associated addr and len.
*
- * fs_size_ptr: Pointer to hsize_t in which the callback will return
+ * fs_size_ptr: Pointer to hsize_t in which the callback will return
* the size of the piece of file space to be freed. Note
- * that the space to be freed is presumed to have the same
- * base address as the cache entry.
+ * that the space to be freed is presumed to have the same
+ * base address as the cache entry.
*
* The function simply returns the size of the block of file space
- * to be freed in *fsf_size_ptr.
+ * to be freed in *fsf_size_ptr.
*
- * If the function is successful, it must return SUCCEED.
+ * If the function is successful, it must return SUCCEED.
*
* If it fails for any reason, the function must return FAIL and
* push error information on the error stack with the error API
@@ -971,9 +975,9 @@ typedef int H5C_ring_t;
*
* The fields of this structure are discussed individually below:
*
- * JRM - 4/26/04
+ * JRM - 4/26/04
*
- * magic: Unsigned 32 bit integer that must always be set to
+ * magic: Unsigned 32 bit integer that must always be set to
* H5C__H5C_CACHE_ENTRY_T_MAGIC when the entry is valid.
* The field must be set to H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC
* just before the entry is freed.
@@ -992,129 +996,129 @@ typedef int H5C_ring_t;
* detect this case, and re-start its scan from the bottom
* of the LRU when this situation occurs.
*
- * cache_ptr: Pointer to the cache that this entry is contained within.
+ * cache_ptr: Pointer to the cache that this entry is contained within.
*
- * addr: Base address of the cache entry on disk.
+ * addr: Base address of the cache entry on disk.
*
- * size: Length of the cache entry on disk in bytes Note that unlike
+ * size: Length of the cache entry on disk in bytes Note that unlike
* normal caches, the entries in this cache are of arbitrary size.
*
- * The file space allocations for cache entries implied by the
+ * The file space allocations for cache entries implied by the
* addr and size fields must be disjoint.
*
- * image_ptr: Pointer to void. When not NULL, this field points to a
- * dynamically allocated block of size bytes in which the
- * on disk image of the metadata cache entry is stored.
+ * image_ptr: Pointer to void. When not NULL, this field points to a
+ * dynamically allocated block of size bytes in which the
+ * on disk image of the metadata cache entry is stored.
*
- * If the entry is dirty, the pre-serialize and serialize
- * callbacks must be used to update this image before it is
- * written to disk
+ * If the entry is dirty, the pre-serialize and serialize
+ * callbacks must be used to update this image before it is
+ * written to disk
*
* image_up_to_date: Boolean flag that is set to TRUE when *image_ptr
- * is up to date, and set to false when the entry is dirtied.
+ * is up to date, and set to false when the entry is dirtied.
*
- * type: Pointer to the instance of H5C_class_t containing pointers
- * to the methods for cache entries of the current type. This
- * field should be NULL when the instance of H5C_cache_entry_t
- * is not in use.
+ * type: Pointer to the instance of H5C_class_t containing pointers
+ * to the methods for cache entries of the current type. This
+ * field should be NULL when the instance of H5C_cache_entry_t
+ * is not in use.
*
- * The name is not particularly descriptive, but is retained
- * to avoid changes in existing code.
+ * The name is not particularly descriptive, but is retained
+ * to avoid changes in existing code.
*
- * is_dirty: Boolean flag indicating whether the contents of the cache
- * entry has been modified since the last time it was written
- * to disk.
+ * is_dirty: Boolean flag indicating whether the contents of the cache
+ * entry has been modified since the last time it was written
+ * to disk.
*
- * dirtied: Boolean flag used to indicate that the entry has been
- * dirtied while protected.
+ * dirtied: Boolean flag used to indicate that the entry has been
+ * dirtied while protected.
*
- * This field is set to FALSE in the protect call, and may
- * be set to TRUE by the H5C_mark_entry_dirty() call at any
- * time prior to the unprotect call.
+ * This field is set to FALSE in the protect call, and may
+ * be set to TRUE by the H5C_mark_entry_dirty() call at any
+ * time prior to the unprotect call.
*
- * The H5C_mark_entry_dirty() call exists as a convenience
- * function for the fractal heap code which may not know if
- * an entry is protected or pinned, but knows that is either
- * protected or pinned. The dirtied field was added as in
- * the parallel case, it is necessary to know whether a
- * protected entry is dirty prior to the protect call.
+ * The H5C_mark_entry_dirty() call exists as a convenience
+ * function for the fractal heap code which may not know if
+ * an entry is protected or pinned, but knows that is either
+ * protected or pinned. The dirtied field was added as in
+ * the parallel case, it is necessary to know whether a
+ * protected entry is dirty prior to the protect call.
*
* is_protected: Boolean flag indicating whether this entry is protected
- * (or locked, to use more conventional terms). When it is
- * protected, the entry cannot be flushed or accessed until
- * it is unprotected (or unlocked -- again to use more
- * conventional terms).
+ * (or locked, to use more conventional terms). When it is
+ * protected, the entry cannot be flushed or accessed until
+ * it is unprotected (or unlocked -- again to use more
+ * conventional terms).
*
- * Note that protected entries are removed from the LRU lists
- * and inserted on the protected list.
+ * Note that protected entries are removed from the LRU lists
+ * and inserted on the protected list.
*
* is_read_only: Boolean flag that is only meaningful if is_protected is
- * TRUE. In this circumstance, it indicates whether the
- * entry has been protected read-only, or read/write.
+ * TRUE. In this circumstance, it indicates whether the
+ * entry has been protected read-only, or read/write.
*
- * If the entry has been protected read-only (i.e. is_protected
- * and is_read_only are both TRUE), we allow the entry to be
- * protected more than once.
+ * If the entry has been protected read-only (i.e. is_protected
+ * and is_read_only are both TRUE), we allow the entry to be
+ * protected more than once.
*
- * In this case, the number of readers is maintained in the
- * ro_ref_count field (see below), and unprotect calls simply
- * decrement that field until it drops to zero, at which point
- * the entry is actually unprotected.
+ * In this case, the number of readers is maintained in the
+ * ro_ref_count field (see below), and unprotect calls simply
+ * decrement that field until it drops to zero, at which point
+ * the entry is actually unprotected.
*
* ro_ref_count: Integer field used to maintain a count of the number of
- * outstanding read-only protects on this entry. This field
- * must be zero whenever either is_protected or is_read_only
- * are TRUE.
+ * outstanding read-only protects on this entry. This field
+ * must be zero whenever either is_protected or is_read_only
+ * are TRUE.
*
- * is_pinned: Boolean flag indicating whether the entry has been pinned
- * in the cache.
+ * is_pinned: Boolean flag indicating whether the entry has been pinned
+ * in the cache.
*
- * For very hot entries, the protect / unprotect overhead
- * can become excessive. Thus the cache has been extended
- * to allow an entry to be "pinned" in the cache.
+ * For very hot entries, the protect / unprotect overhead
+ * can become excessive. Thus the cache has been extended
+ * to allow an entry to be "pinned" in the cache.
*
- * Pinning an entry in the cache has several implications:
+ * Pinning an entry in the cache has several implications:
*
- * 1) A pinned entry cannot be evicted. Thus unprotected
- * pinned entries must be stored in the pinned entry
- * list, instead of being managed by the replacement
- * policy code (LRU at present).
+ * 1) A pinned entry cannot be evicted. Thus unprotected
+ * pinned entries must be stored in the pinned entry
+ * list, instead of being managed by the replacement
+ * policy code (LRU at present).
*
- * 2) A pinned entry can be accessed or modified at any time.
- * This places an extra burden on the pre-serialize and
- * serialize callbacks, which must ensure that a pinned
- * entry is consistent and ready to write to disk before
- * generating an image.
+ * 2) A pinned entry can be accessed or modified at any time.
+ * This places an extra burden on the pre-serialize and
+ * serialize callbacks, which must ensure that a pinned
+ * entry is consistent and ready to write to disk before
+ * generating an image.
*
- * 3) A pinned entry can be marked as dirty (and possibly
- * change size) while it is unprotected.
+ * 3) A pinned entry can be marked as dirty (and possibly
+ * change size) while it is unprotected.
*
- * 4) The flush-destroy code must allow pinned entries to
- * be unpinned (and possibly unprotected) during the
- * flush.
+ * 4) The flush-destroy code must allow pinned entries to
+ * be unpinned (and possibly unprotected) during the
+ * flush.
*
- * JRM -- 3/16/06
+ * JRM -- 3/16/06
*
- * in_slist: Boolean flag indicating whether the entry is in the skip list
- * As a general rule, entries are placed in the list when they
+ * in_slist: Boolean flag indicating whether the entry is in the skip list
+ * As a general rule, entries are placed in the list when they
* are marked dirty. However they may remain in the list after
* being flushed.
*
* Update: Dirty entries are now removed from the skip list
- * when they are flushed.
+ * when they are flushed.
*
* flush_marker: Boolean flag indicating that the entry is to be flushed
- * the next time H5C_flush_cache() is called with the
- * H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when
- * the entry is flushed for whatever reason.
+ * the next time H5C_flush_cache() is called with the
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when
+ * the entry is flushed for whatever reason.
*
* flush_me_last: Boolean flag indicating that this entry should not be
- * flushed from the cache until all other entries without
+ * flushed from the cache until all other entries without
* the flush_me_last flag set have been flushed.
*
- * Note:
+ * Note:
*
- * At this time, the flush_me_last
+ * At this time, the flush_me_last
* flag will only be applied to one entry, the superblock,
* and the code utilizing these flags is protected with HDasserts
* to enforce this. This restraint can certainly be relaxed in
@@ -1123,37 +1127,37 @@ typedef int H5C_ring_t;
* will need to be expanded and tested appropriately if that
* functionality is desired.
*
- * Update: There are now two possible last entries
- * (superblock and file driver info message). This
- * number will probably increase as we add superblock
- * messages. JRM -- 11/18/14
+ * Update: There are now two possible last entries
+ * (superblock and file driver info message). This
+ * number will probably increase as we add superblock
+ * messages. JRM -- 11/18/14
*
* clear_on_unprotect: Boolean flag used only in PHDF5. When H5C is used
- * to implement the metadata cache In the parallel case, only
- * the cache with mpi rank 0 is allowed to actually write to
- * file -- all other caches must retain dirty entries until they
- * are advised that the entry is clean.
+ * to implement the metadata cache In the parallel case, only
+ * the cache with mpi rank 0 is allowed to actually write to
+ * file -- all other caches must retain dirty entries until they
+ * are advised that the entry is clean.
*
- * This flag is used in the case that such an advisory is
- * received when the entry is protected. If it is set when an
- * entry is unprotected, and the dirtied flag is not set in
- * the unprotect, the entry's is_dirty flag is reset by flushing
- * it with the H5C__FLUSH_CLEAR_ONLY_FLAG.
+ * This flag is used in the case that such an advisory is
+ * received when the entry is protected. If it is set when an
+ * entry is unprotected, and the dirtied flag is not set in
+ * the unprotect, the entry's is_dirty flag is reset by flushing
+ * it with the H5C__FLUSH_CLEAR_ONLY_FLAG.
*
* flush_immediately: Boolean flag used only in Phdf5 -- and then only
- * for H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED.
+ * for H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED.
*
- * When a distributed metadata write is triggered at a
- * sync point, this field is used to mark entries that
- * must be flushed before leaving the sync point. At all
- * other times, this field should be set to FALSE.
+ * When a distributed metadata write is triggered at a
+ * sync point, this field is used to mark entries that
+ * must be flushed before leaving the sync point. At all
+ * other times, this field should be set to FALSE.
*
* flush_in_progress: Boolean flag that is set to true iff the entry
- * is in the process of being flushed. This allows the cache
- * to detect when a call is the result of a flush callback.
+ * is in the process of being flushed. This allows the cache
+ * to detect when a call is the result of a flush callback.
*
* destroy_in_progress: Boolean flag that is set to true iff the entry
- * is in the process of being flushed and destroyed.
+ * is in the process of being flushed and destroyed.
*
*
* Fields supporting rings for flush ordering:
@@ -1171,8 +1175,8 @@ typedef int H5C_ring_t;
* within rings. Unlike rings, flush dependencies are applied to ALL
* writes, not just those triggered by flush or serialize calls.
*
- * ring: Instance of H5C_ring_t indicating the ring to which this
- * entry is assigned.
+ * ring: Instance of H5C_ring_t indicating the ring to which this
+ * entry is assigned.
*
*
* Fields supporting the 'flush dependency' feature:
@@ -1202,18 +1206,18 @@ typedef int H5C_ring_t;
* this field is nonzero, then this entry cannot be flushed.
*
* flush_dep_nunser_children: Number of flush dependency children
- * that are either unserialized, or have a non-zero number of
- * positive number of unserialized children.
+ * that are either unserialized, or have a non-zero number of
+ * positive number of unserialized children.
*
- * Note that since there is no requirement that a clean entry
- * be serialized, it is possible that flush_dep_nunser_children
- * to be greater than flush_dep_ndirty_children.
+ * Note that since there is no requirement that a clean entry
+ * be serialized, it is possible that flush_dep_nunser_children
+ * to be greater than flush_dep_ndirty_children.
*
- * This field exist to facilitate correct ordering of entry
- * serializations when it is necessary to serialize all the
- * entries in the metadata cache. Thus in the cache
- * serialization, no entry can be serialized unless this
- * field contains 0.
+ * This field exist to facilitate correct ordering of entry
+ * serializations when it is necessary to serialize all the
+ * entries in the metadata cache. Thus in the cache
+ * serialization, no entry can be serialized unless this
+ * field contains 0.
*
* Fields supporting the hash table:
*
@@ -1230,25 +1234,25 @@ typedef int H5C_ring_t;
* The il_next and il_prev fields discussed below were added to support
* the index list.
*
- * ht_next: Next pointer used by the hash table to store multiple
- * entries in a single hash bin. This field points to the
- * next entry in the doubly linked list of entries in the
- * hash bin, or NULL if there is no next entry.
+ * ht_next: Next pointer used by the hash table to store multiple
+ * entries in a single hash bin. This field points to the
+ * next entry in the doubly linked list of entries in the
+ * hash bin, or NULL if there is no next entry.
*
* ht_prev: Prev pointer used by the hash table to store multiple
* entries in a single hash bin. This field points to the
* previous entry in the doubly linked list of entries in
- * the hash bin, or NULL if there is no previuos entry.
+ * the hash bin, or NULL if there is no previuos entry.
*
- * il_next: Next pointer used by the index to maintain a doubly linked
- * list of all entries in the index (and thus in the cache).
- * This field contains a pointer to the next entry in the
- * index list, or NULL if there is no next entry.
+ * il_next: Next pointer used by the index to maintain a doubly linked
+ * list of all entries in the index (and thus in the cache).
+ * This field contains a pointer to the next entry in the
+ * index list, or NULL if there is no next entry.
*
- * il_prev: Prev pointer used by the index to maintain a doubly linked
- * list of all entries in the index (and thus in the cache).
- * This field contains a pointer to the previous entry in the
- * index list, or NULL if there is no previous entry.
+ * il_prev: Prev pointer used by the index to maintain a doubly linked
+ * list of all entries in the index (and thus in the cache).
+ * This field contains a pointer to the previous entry in the
+ * index list, or NULL if there is no previous entry.
*
*
* Fields supporting replacement policies:
@@ -1285,43 +1289,43 @@ typedef int H5C_ring_t;
* The use of the replacement policy fields under the Modified LRU policy
* is discussed below:
*
- * next: Next pointer in either the LRU, the protected list, or
- * the pinned list depending on the current values of
- * is_protected and is_pinned. If there is no next entry
- * on the list, this field should be set to NULL.
+ * next: Next pointer in either the LRU, the protected list, or
+ * the pinned list depending on the current values of
+ * is_protected and is_pinned. If there is no next entry
+ * on the list, this field should be set to NULL.
*
- * prev: Prev pointer in either the LRU, the protected list,
- * or the pinned list depending on the current values of
- * is_protected and is_pinned. If there is no previous
- * entry on the list, this field should be set to NULL.
+ * prev: Prev pointer in either the LRU, the protected list,
+ * or the pinned list depending on the current values of
+ * is_protected and is_pinned. If there is no previous
+ * entry on the list, this field should be set to NULL.
*
- * aux_next: Next pointer on either the clean or dirty LRU lists.
- * This entry should be NULL when either is_protected or
- * is_pinned is true.
+ * aux_next: Next pointer on either the clean or dirty LRU lists.
+ * This entry should be NULL when either is_protected or
+ * is_pinned is true.
*
- * When is_protected and is_pinned are false, and is_dirty is
- * true, it should point to the next item on the dirty LRU
- * list.
+ * When is_protected and is_pinned are false, and is_dirty is
+ * true, it should point to the next item on the dirty LRU
+ * list.
*
- * When is_protected and is_pinned are false, and is_dirty is
- * false, it should point to the next item on the clean LRU
- * list. In either case, when there is no next item, it
- * should be NULL.
+ * When is_protected and is_pinned are false, and is_dirty is
+ * false, it should point to the next item on the clean LRU
+ * list. In either case, when there is no next item, it
+ * should be NULL.
*
- * aux_prev: Previous pointer on either the clean or dirty LRU lists.
- * This entry should be NULL when either is_protected or
- * is_pinned is true.
+ * aux_prev: Previous pointer on either the clean or dirty LRU lists.
+ * This entry should be NULL when either is_protected or
+ * is_pinned is true.
*
- * When is_protected and is_pinned are false, and is_dirty is
- * true, it should point to the previous item on the dirty
- * LRU list.
+ * When is_protected and is_pinned are false, and is_dirty is
+ * true, it should point to the previous item on the dirty
+ * LRU list.
*
- * When is_protected and is_pinned are false, and is_dirty
- * is false, it should point to the previous item on the
- * clean LRU list.
+ * When is_protected and is_pinned are false, and is_dirty
+ * is false, it should point to the previous item on the
+ * clean LRU list.
*
- * In either case, when there is no previous item, it should
- * be NULL.
+ * In either case, when there is no previous item, it should
+ * be NULL.
*
* Fields supporting the cache image feature:
*
@@ -1337,170 +1341,170 @@ typedef int H5C_ring_t;
* further details.
*
* include_in_image: Boolean flag indicating whether this entry should
- * be included in the metadata cache image. This field should
- * always be false prior to the H5C_prep_for_file_close() call.
- * During that call, it should be set to TRUE for all entries
- * that are to be included in the metadata cache image. At
- * present, only the superblock, the superblock extension
- * object header and its chunks (if any) are omitted from
- * the image.
+ * be included in the metadata cache image. This field should
+ * always be false prior to the H5C_prep_for_file_close() call.
+ * During that call, it should be set to TRUE for all entries
+ * that are to be included in the metadata cache image. At
+ * present, only the superblock, the superblock extension
+ * object header and its chunks (if any) are omitted from
+ * the image.
*
- * lru_rank: Rank of the entry in the LRU just prior to file close.
+ * lru_rank: Rank of the entry in the LRU just prior to file close.
*
- * Note that the first entry on the LRU has lru_rank 1,
- * and that entries not on the LRU at that time will have
- * either lru_rank -1 (if pinned) or 0 (if loaded during
- * the process of flushing the cache.
+ * Note that the first entry on the LRU has lru_rank 1,
+ * and that entries not on the LRU at that time will have
+ * either lru_rank -1 (if pinned) or 0 (if loaded during
+ * the process of flushing the cache.
*
* image_dirty: Boolean flag indicating whether the entry should be marked
- * as dirty in the metadata cache image. The flag is set to
- * TRUE iff the entry is dirty when H5C_prep_for_file_close()
- * is called.
+ * as dirty in the metadata cache image. The flag is set to
+ * TRUE iff the entry is dirty when H5C_prep_for_file_close()
+ * is called.
*
* fd_parent_count: If the entry is a child in one or more flush dependency
- * relationships, this field contains the number of flush
- * dependency parents.
+ * relationships, this field contains the number of flush
+ * dependency parents.
*
- * In all other cases, the field is set to zero.
+ * In all other cases, the field is set to zero.
*
- * Note that while this count is initially taken from the
- * flush dependency fields above, if the entry is in the
- * cache image (i.e. include_in_image is TRUE), any parents
- * that are not in the image are removed from this count and
- * from the fd_parent_addrs array below.
+ * Note that while this count is initially taken from the
+ * flush dependency fields above, if the entry is in the
+ * cache image (i.e. include_in_image is TRUE), any parents
+ * that are not in the image are removed from this count and
+ * from the fd_parent_addrs array below.
*
- * Finally observe that if the entry is dirty and in the
- * cache image, and its parent is dirty and not in the cache
- * image, then the entry must be removed from the cache image
- * to avoid violating the flush dependency flush ordering.
+ * Finally observe that if the entry is dirty and in the
+ * cache image, and its parent is dirty and not in the cache
+ * image, then the entry must be removed from the cache image
+ * to avoid violating the flush dependency flush ordering.
*
* fd_parent_addrs: If the entry is a child in one or more flush dependency
- * relationship when H5C_prep_for_file_close() is called, this
- * field must contain a pointer to an array of size
- * fd_parent_count containing the on disk addresses of the
- * parent.
+ * relationship when H5C_prep_for_file_close() is called, this
+ * field must contain a pointer to an array of size
+ * fd_parent_count containing the on disk addresses of the
+ * parent.
*
- * In all other cases, the field is set to NULL.
+ * In all other cases, the field is set to NULL.
*
- * Note that while this list of addresses is initially taken
- * from the flush dependency fields above, if the entry is in the
- * cache image (i.e. include_in_image is TRUE), any parents
- * that are not in the image are removed from this list, and
- * and from the fd_parent_count above.
+ * Note that while this list of addresses is initially taken
+ * from the flush dependency fields above, if the entry is in the
+ * cache image (i.e. include_in_image is TRUE), any parents
+ * that are not in the image are removed from this list, and
+ * and from the fd_parent_count above.
*
- * Finally observe that if the entry is dirty and in the
- * cache image, and its parent is dirty and not in the cache
- * image, then the entry must be removed from the cache image
- * to avoid violating the flush dependency flush ordering.
+ * Finally observe that if the entry is dirty and in the
+ * cache image, and its parent is dirty and not in the cache
+ * image, then the entry must be removed from the cache image
+ * to avoid violating the flush dependency flush ordering.
*
* fd_child_count: If the entry is a parent in a flush dependency
- * relationship, this field contains the number of flush
- * dependency children.
+ * relationship, this field contains the number of flush
+ * dependency children.
*
- * In all other cases, the field is set to zero.
+ * In all other cases, the field is set to zero.
*
- * Note that while this count is initially taken from the
- * flush dependency fields above, if the entry is in the
- * cache image (i.e. include_in_image is TRUE), any children
- * that are not in the image are removed from this count.
+ * Note that while this count is initially taken from the
+ * flush dependency fields above, if the entry is in the
+ * cache image (i.e. include_in_image is TRUE), any children
+ * that are not in the image are removed from this count.
*
* fd_dirty_child_count: If the entry is a parent in a flush dependency
- * relationship, this field contains the number of dirty flush
- * dependency children.
+ * relationship, this field contains the number of dirty flush
+ * dependency children.
*
- * In all other cases, the field is set to zero.
+ * In all other cases, the field is set to zero.
*
- * Note that while this count is initially taken from the
- * flush dependency fields above, if the entry is in the
- * cache image (i.e. include_in_image is TRUE), any dirty
- * children that are not in the image are removed from this
- * count.
+ * Note that while this count is initially taken from the
+ * flush dependency fields above, if the entry is in the
+ * cache image (i.e. include_in_image is TRUE), any dirty
+ * children that are not in the image are removed from this
+ * count.
*
* image_fd_height: Flush dependency height of the entry in the cache image.
*
- * The flush dependency height of any entry involved in a
- * flush dependency relationship is defined to be the
- * longest flush dependency path from that entry to an entry
- * with no flush dependency children.
- *
- * Since the image_fd_height is used to order entries in the
- * cache image so that fd parents preceed fd children, for
- * purposes of this field, and entry is at flush dependency
- * level 0 if it either has no children, or if all of its
- * children are not in the cache image.
- *
- * Note that if a child in a flush dependency relationship is
- * dirty and in the cache image, and its parent is dirty and
- * not in the cache image, then the child must be excluded
- * from the cache image to maintain flush ordering.
- *
- * prefetched: Boolean flag indicating that the on disk image of the entry
- * has been loaded into the cache prior any request for the
- * entry by the rest of the library.
- *
- * As of this writing (8/10/15), this can only happen through
- * the load of a cache image block, although other scenarios
- * are contemplated for the use of this feature. Note that
- * unlike the usual prefetch situation, this means that a
- * prefetched entry can be dirty, and/or can be a party to
- * flush dependency relationship(s). This complicates matters
- * somewhat.
- *
- * The essential feature of a prefetched entry is that it
- * consists only of a buffer containing the on disk image of
- * the entry. Thus it must be deserialized before it can
- * be passed back to the library on a protect call. This
- * task is handled by H5C_deserialized_prefetched_entry().
- * In essence, this routine calls the deserialize callback
- * provided in the protect call with the on disk image,
- * deletes the prefetched entry from the cache, and replaces
- * it with the deserialized entry returned by the deserialize
- * callback.
- *
- * Further, if the prefetched entry is a flush dependency parent,
- * all its flush dependency children (which must also be
- * prefetched entries), must be transferred to the new cache
- * entry returned by the deserialization callback.
- *
- * Finally, if the prefetched entry is a flush dependency child,
- * this flush dependency must be destroyed prior to the
- * deserialize call.
- *
- * In addition to the above special processing on the first
- * protect call on a prefetched entry (after which is no longer
- * a prefetched entry), prefetched entries also require special
- * tretment on flush and evict.
- *
- * On flush, a dirty prefetched entry must simply be written
- * to disk and marked clean without any call to any client
- * callback.
- *
- * On eviction, if a prefetched entry is a flush dependency
- * child, that flush dependency relationship must be destroyed
- * just prior to the eviction. If the flush dependency code
- * is working properly, it should be impossible for any entry
- * that is a flush dependency parent to be evicted.
+ * The flush dependency height of any entry involved in a
+ * flush dependency relationship is defined to be the
+ * longest flush dependency path from that entry to an entry
+ * with no flush dependency children.
+ *
+ * Since the image_fd_height is used to order entries in the
+ * cache image so that fd parents preceed fd children, for
+ * purposes of this field, and entry is at flush dependency
+ * level 0 if it either has no children, or if all of its
+ * children are not in the cache image.
+ *
+ * Note that if a child in a flush dependency relationship is
+ * dirty and in the cache image, and its parent is dirty and
+ * not in the cache image, then the child must be excluded
+ * from the cache image to maintain flush ordering.
+ *
+ * prefetched: Boolean flag indicating that the on disk image of the entry
+ * has been loaded into the cache prior any request for the
+ * entry by the rest of the library.
+ *
+ * As of this writing (8/10/15), this can only happen through
+ * the load of a cache image block, although other scenarios
+ * are contemplated for the use of this feature. Note that
+ * unlike the usual prefetch situation, this means that a
+ * prefetched entry can be dirty, and/or can be a party to
+ * flush dependency relationship(s). This complicates matters
+ * somewhat.
+ *
+ * The essential feature of a prefetched entry is that it
+ * consists only of a buffer containing the on disk image of
+ * the entry. Thus it must be deserialized before it can
+ * be passed back to the library on a protect call. This
+ * task is handled by H5C_deserialized_prefetched_entry().
+ * In essence, this routine calls the deserialize callback
+ * provided in the protect call with the on disk image,
+ * deletes the prefetched entry from the cache, and replaces
+ * it with the deserialized entry returned by the deserialize
+ * callback.
+ *
+ * Further, if the prefetched entry is a flush dependency parent,
+ * all its flush dependency children (which must also be
+ * prefetched entries), must be transferred to the new cache
+ * entry returned by the deserialization callback.
+ *
+ * Finally, if the prefetched entry is a flush dependency child,
+ * this flush dependency must be destroyed prior to the
+ * deserialize call.
+ *
+ * In addition to the above special processing on the first
+ * protect call on a prefetched entry (after which is no longer
+ * a prefetched entry), prefetched entries also require special
+ * tretment on flush and evict.
+ *
+ * On flush, a dirty prefetched entry must simply be written
+ * to disk and marked clean without any call to any client
+ * callback.
+ *
+ * On eviction, if a prefetched entry is a flush dependency
+ * child, that flush dependency relationship must be destroyed
+ * just prior to the eviction. If the flush dependency code
+ * is working properly, it should be impossible for any entry
+ * that is a flush dependency parent to be evicted.
*
* prefetch_type_id: Integer field containing the type ID of the prefetched
- * entry. This ID must match the ID of the type provided in any
- * protect call on the prefetched entry.
+ * entry. This ID must match the ID of the type provided in any
+ * protect call on the prefetched entry.
*
- * The value of this field is undefined in prefetched is FALSE.
+ * The value of this field is undefined in prefetched is FALSE.
*
- * age: Number of times a prefetched entry has appeared in
- * subsequent cache images. The field exists to allow
- * imposition of a limit on how many times a prefetched
- * entry can appear in subsequent cache images without being
- * converted to a regular entry.
+ * age: Number of times a prefetched entry has appeared in
+ * subsequent cache images. The field exists to allow
+ * imposition of a limit on how many times a prefetched
+ * entry can appear in subsequent cache images without being
+ * converted to a regular entry.
*
- * This field must be zero if prefetched is FALSE.
+ * This field must be zero if prefetched is FALSE.
*
* prefetched_dirty: Boolean field that must be set to FALSE unless the
- * following conditions hold:
+ * following conditions hold:
*
- * 1) The file has been opened R/O.
+ * 1) The file has been opened R/O.
*
- * 2) The entry is either a prefetched entry, or was
+ * 2) The entry is either a prefetched entry, or was
* re-constructed from a prefetched entry.
*
* 3) The base prefetched entry was marked dirty.
@@ -1536,14 +1540,14 @@ typedef int H5C_ring_t;
* we deal with this by disabling EOC in the R/O case.
*
* serialization_count: Integer field used to maintain a count of the
- * number of times each entry is serialized during cache
- * serialization. While no entry should be serialized more than
- * once in any serialization call, throw an assertion if any
- * flush depencency parent is serialized more than once during
- * a single cache serialization.
+ * number of times each entry is serialized during cache
+ * serialization. While no entry should be serialized more than
+ * once in any serialization call, throw an assertion if any
+ * flush depencency parent is serialized more than once during
+ * a single cache serialization.
*
- * This is a debugging field, and thus is maintained only if
- * NDEBUG is undefined.
+ * This is a debugging field, and thus is maintained only if
+ * NDEBUG is undefined.
*
* Fields supporting tagged entries:
*
@@ -1554,15 +1558,15 @@ typedef int H5C_ring_t;
* not tagged. Tagged entries have a pointer to the tag info for the object,
* which is shared state for all the entries for that object.
*
- * tl_next: Pointer to the next entry in the tag list for an object.
- * NULL for the tail entry in the list, as well as untagged
- * entries.
+ * tl_next: Pointer to the next entry in the tag list for an object.
+ * NULL for the tail entry in the list, as well as untagged
+ * entries.
*
- * tl_prev: Pointer to the previous entry in the tag list for an object.
- * NULL for the head entry in the list, as well as untagged
- * entries.
+ * tl_prev: Pointer to the previous entry in the tag list for an object.
+ * NULL for the head entry in the list, as well as untagged
+ * entries.
*
- * tag_info: Pointer to the common tag state for all entries belonging to
+ * tag_info: Pointer to the common tag state for all entries belonging to
* an object. NULL for untagged entries.
*
*
@@ -1572,17 +1576,17 @@ typedef int H5C_ring_t;
* and H5C_COLLECT_CACHE_ENTRY_STATS are true. When present, they allow
* collection of statistics on individual cache entries.
*
- * accesses: int32_t containing the number of times this cache entry has
- * been referenced in its lifetime.
+ * accesses: int32_t containing the number of times this cache entry has
+ * been referenced in its lifetime.
*
- * clears: int32_t containing the number of times this cache entry has
- * been cleared in its life time.
+ * clears: int32_t containing the number of times this cache entry has
+ * been cleared in its life time.
*
- * flushes: int32_t containing the number of times this cache entry has
- * been flushed to file in its life time.
+ * flushes: int32_t containing the number of times this cache entry has
+ * been flushed to file in its life time.
*
- * pins: int32_t containing the number of times this cache entry has
- * been pinned in cache in its life time.
+ * pins: int32_t containing the number of times this cache entry has
+ * been pinned in cache in its life time.
*
****************************************************************************/
typedef struct H5C_cache_entry_t {
@@ -1684,43 +1688,43 @@ typedef struct H5C_cache_entry_t {
*
* The fields of this structure are discussed individually below:
*
- * JRM - 8/5/15
+ * JRM - 8/5/15
*
- * magic: Unsigned 32 bit integer that must always be set to
+ * magic: Unsigned 32 bit integer that must always be set to
* H5C_IMAGE_ENTRY_T_MAGIC when the entry is valid.
* The field must be set to H5C_IMAGE_ENTRY_T_BAD_MAGIC
* just before the entry is freed.
*
- * addr: Base address of the cache entry on disk.
+ * addr: Base address of the cache entry on disk.
*
- * size: Length of the cache entry on disk in bytes.
+ * size: Length of the cache entry on disk in bytes.
*
- * ring: Instance of H5C_ring_t indicating the flush ordering ring
- * to which this entry is assigned.
+ * ring: Instance of H5C_ring_t indicating the flush ordering ring
+ * to which this entry is assigned.
*
- * age: Number of times this prefetech entry has appeared in
- * the current sequence of cache images. This field is
- * initialized to 0 if the instance of H5C_image_entry_t
- * is constructed from a regular entry.
+ * age: Number of times this prefetech entry has appeared in
+ * the current sequence of cache images. This field is
+ * initialized to 0 if the instance of H5C_image_entry_t
+ * is constructed from a regular entry.
*
- * If the instance is constructed from a prefetched entry
- * currently residing in the metadata cache, the field is
- * set to 1 + the age of the prefetched entry, or to
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX if that sum exceeds
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX.
+ * If the instance is constructed from a prefetched entry
+ * currently residing in the metadata cache, the field is
+ * set to 1 + the age of the prefetched entry, or to
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX if that sum exceeds
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX.
*
- * type_id: Integer field containing the type ID of the entry.
+ * type_id: Integer field containing the type ID of the entry.
*
- * lru_rank: Rank of the entry in the LRU just prior to file close.
+ * lru_rank: Rank of the entry in the LRU just prior to file close.
*
- * Note that the first entry on the LRU has lru_rank 1,
- * and that entries not on the LRU at that time will have
- * either lru_rank -1 (if pinned) or 0 (if loaded during
- * the process of flushing the cache.
+ * Note that the first entry on the LRU has lru_rank 1,
+ * and that entries not on the LRU at that time will have
+ * either lru_rank -1 (if pinned) or 0 (if loaded during
+ * the process of flushing the cache.
*
- * is_dirty: Boolean flag indicating whether the contents of the cache
- * entry has been modified since the last time it was written
- * to disk as a regular piece of metadata.
+ * is_dirty: Boolean flag indicating whether the contents of the cache
+ * entry has been modified since the last time it was written
+ * to disk as a regular piece of metadata.
*
* image_fd_height: Flush dependency height of the entry in the cache image.
*
@@ -1748,17 +1752,17 @@ typedef struct H5C_cache_entry_t {
*
* Note that while this count is initially taken from the
* flush dependency fields in the associated instance of
- * H5C_cache_entry_t, if the entry is in the cache image
- * (i.e. include_in_image is TRUE), any parents that are
- * not in the image are removed from this count and
+ * H5C_cache_entry_t, if the entry is in the cache image
+ * (i.e. include_in_image is TRUE), any parents that are
+ * not in the image are removed from this count and
* from the fd_parent_addrs array below.
*
* Finally observe that if the entry is dirty and in the
* cache image, and its parent is dirty and not in the cache
* image, then the entry must be removed from the cache image
* to avoid violating the flush dependency flush ordering.
- * This should have happened before the construction of
- * the instance of H5C_image_entry_t.
+ * This should have happened before the construction of
+ * the instance of H5C_image_entry_t.
*
* fd_parent_addrs: If the entry is a child in one or more flush dependency
* relationship when H5C_prep_for_file_close() is called, this
@@ -1771,27 +1775,27 @@ typedef struct H5C_cache_entry_t {
* Note that while this list of addresses is initially taken
* from the flush dependency fields in the associated instance of
* H5C_cache_entry_t, if the entry is in the cache image
- * (i.e. include_in_image is TRUE), any parents that are not
- * in the image are removed from this list, and from the
- * fd_parent_count above.
+ * (i.e. include_in_image is TRUE), any parents that are not
+ * in the image are removed from this list, and from the
+ * fd_parent_count above.
*
* Finally observe that if the entry is dirty and in the
* cache image, and its parent is dirty and not in the cache
* image, then the entry must be removed from the cache image
* to avoid violating the flush dependency flush ordering.
- * This should have happened before the construction of
- * the instance of H5C_image_entry_t.
+ * This should have happened before the construction of
+ * the instance of H5C_image_entry_t.
*
* fd_child_count: If the entry is a parent in a flush dependency
- * relationship, this field contains the number of flush
- * dependency children.
+ * relationship, this field contains the number of flush
+ * dependency children.
*
- * In all other cases, the field is set to zero.
+ * In all other cases, the field is set to zero.
*
* Note that while this count is initially taken from the
* flush dependency fields in the associated instance of
* H5C_cache_entry_t, if the entry is in the cache image
- * (i.e. include_in_image is TRUE), any children
+ * (i.e. include_in_image is TRUE), any children
* that are not in the image are removed from this count.
*
* fd_dirty_child_count: If the entry is a parent in a flush dependency
@@ -1803,16 +1807,16 @@ typedef struct H5C_cache_entry_t {
* Note that while this count is initially taken from the
* flush dependency fields in the associated instance of
* H5C_cache_entry_t, if the entry is in the cache image
- * (i.e. include_in_image is TRUE), any dirty children
- * that are not in the image are removed from this count.
+ * (i.e. include_in_image is TRUE), any dirty children
+ * that are not in the image are removed from this count.
*
- * image_ptr: Pointer to void. When not NULL, this field points to a
- * dynamically allocated block of size bytes in which the
- * on disk image of the metadata cache entry is stored.
+ * image_ptr: Pointer to void. When not NULL, this field points to a
+ * dynamically allocated block of size bytes in which the
+ * on disk image of the metadata cache entry is stored.
*
- * If the entry is dirty, the pre-serialize and serialize
- * callbacks must be used to update this image before it is
- * written to disk
+ * If the entry is dirty, the pre-serialize and serialize
+ * callbacks must be used to update this image before it is
+ * written to disk
*
*
****************************************************************************/
@@ -1844,95 +1848,95 @@ typedef struct H5C_image_entry_t {
* The fields of the structure are discussed individually below:
*
* version: Integer field containing the version number of this version
- * of the H5C_auto_size_ctl_t structure. Any instance of
- * H5C_auto_size_ctl_t passed to the cache must have a known
- * version number, or an error will be flagged.
+ * of the H5C_auto_size_ctl_t structure. Any instance of
+ * H5C_auto_size_ctl_t passed to the cache must have a known
+ * version number, or an error will be flagged.
*
* report_fcn: Pointer to the function that is to be called to report
- * activities each time the auto cache resize code is executed. If the
- * field is NULL, no call is made.
+ * activities each time the auto cache resize code is executed. If the
+ * field is NULL, no call is made.
*
- * If the field is not NULL, it must contain the address of a function
- * of type H5C_auto_resize_report_fcn.
+ * If the field is not NULL, it must contain the address of a function
+ * of type H5C_auto_resize_report_fcn.
*
* set_initial_size: Boolean flag indicating whether the size of the
- * initial size of the cache is to be set to the value given in
- * the initial_size field. If set_initial_size is FALSE, the
- * initial_size field is ignored.
+ * initial size of the cache is to be set to the value given in
+ * the initial_size field. If set_initial_size is FALSE, the
+ * initial_size field is ignored.
*
* initial_size: If enabled, this field contain the size the cache is
- * to be set to upon receipt of this structure. Needless to say,
- * initial_size must lie in the closed interval [min_size, max_size].
+ * to be set to upon receipt of this structure. Needless to say,
+ * initial_size must lie in the closed interval [min_size, max_size].
*
* min_clean_fraction: double in the range 0 to 1 indicating the fraction
- * of the cache that is to be kept clean. This field is only used
- * in parallel mode. Typical values are 0.1 to 0.5.
+ * of the cache that is to be kept clean. This field is only used
+ * in parallel mode. Typical values are 0.1 to 0.5.
*
* max_size: Maximum size to which the cache can be adjusted. The
- * supplied value must fall in the closed interval
- * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, max_size must
- * be greater than or equal to min_size.
+ * supplied value must fall in the closed interval
+ * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, max_size must
+ * be greater than or equal to min_size.
*
* min_size: Minimum size to which the cache can be adjusted. The
- * supplied value must fall in the closed interval
- * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, min_size must
- * be less than or equal to max_size.
+ * supplied value must fall in the closed interval
+ * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, min_size must
+ * be less than or equal to max_size.
*
* epoch_length: Number of accesses on the cache over which to collect
- * hit rate stats before running the automatic cache resize code,
- * if it is enabled.
+ * hit rate stats before running the automatic cache resize code,
+ * if it is enabled.
*
- * At the end of an epoch, we discard prior hit rate data and start
- * collecting afresh. The epoch_length must lie in the closed
- * interval [H5C__MIN_AR_EPOCH_LENGTH, H5C__MAX_AR_EPOCH_LENGTH].
+ * At the end of an epoch, we discard prior hit rate data and start
+ * collecting afresh. The epoch_length must lie in the closed
+ * interval [H5C__MIN_AR_EPOCH_LENGTH, H5C__MAX_AR_EPOCH_LENGTH].
*
*
* Cache size increase control fields:
*
* incr_mode: Instance of the H5C_cache_incr_mode enumerated type whose
- * value indicates how we determine whether the cache size should be
- * increased. At present there are two possible values:
+ * value indicates how we determine whether the cache size should be
+ * increased. At present there are two possible values:
*
- * H5C_incr__off: Don't attempt to increase the size of the cache
- * automatically.
+ * H5C_incr__off: Don't attempt to increase the size of the cache
+ * automatically.
*
- * When this increment mode is selected, the remaining fields
- * in the cache size increase section ar ignored.
+ * When this increment mode is selected, the remaining fields
+ * in the cache size increase section ar ignored.
*
- * H5C_incr__threshold: Attempt to increase the size of the cache
- * whenever the average hit rate over the last epoch drops
- * below the value supplied in the lower_hr_threshold
- * field.
+ * H5C_incr__threshold: Attempt to increase the size of the cache
+ * whenever the average hit rate over the last epoch drops
+ * below the value supplied in the lower_hr_threshold
+ * field.
*
- * Note that this attempt will fail if the cache is already
- * at its maximum size, or if the cache is not already using
- * all available space.
+ * Note that this attempt will fail if the cache is already
+ * at its maximum size, or if the cache is not already using
+ * all available space.
*
* lower_hr_threshold: Lower hit rate threshold. If the increment mode
- * (incr_mode) is H5C_incr__threshold and the hit rate drops below the
- * value supplied in this field in an epoch, increment the cache size by
- * size_increment. Note that cache size may not be incremented above
- * max_size, and that the increment may be further restricted by the
- * max_increment field if it is enabled.
+ * (incr_mode) is H5C_incr__threshold and the hit rate drops below the
+ * value supplied in this field in an epoch, increment the cache size by
+ * size_increment. Note that cache size may not be incremented above
+ * max_size, and that the increment may be further restricted by the
+ * max_increment field if it is enabled.
*
- * When enabled, this field must contain a value in the range [0.0, 1.0].
- * Depending on the incr_mode selected, it may also have to be less than
- * upper_hr_threshold.
+ * When enabled, this field must contain a value in the range [0.0, 1.0].
+ * Depending on the incr_mode selected, it may also have to be less than
+ * upper_hr_threshold.
*
* increment: Double containing the multiplier used to derive the new
- * cache size from the old if a cache size increment is triggered.
- * The increment must be greater than 1.0, and should not exceed 2.0.
+ * cache size from the old if a cache size increment is triggered.
+ * The increment must be greater than 1.0, and should not exceed 2.0.
*
- * The new cache size is obtained by multiplying the current max cache
- * size by the increment, and then clamping to max_size and to stay
- * within the max_increment as necessary.
+ * The new cache size is obtained by multiplying the current max cache
+ * size by the increment, and then clamping to max_size and to stay
+ * within the max_increment as necessary.
*
* apply_max_increment: Boolean flag indicating whether the max_increment
- * field should be used to limit the maximum cache size increment.
+ * field should be used to limit the maximum cache size increment.
*
* max_increment: If enabled by the apply_max_increment field described
- * above, this field contains the maximum number of bytes by which the
- * cache size can be increased in a single re-size.
+ * above, this field contains the maximum number of bytes by which the
+ * cache size can be increased in a single re-size.
*
* flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated
* type whose value indicates whether and by what algorithm we should
@@ -1981,96 +1985,96 @@ typedef struct H5C_image_entry_t {
* is H5C_flash_incr__add_space.
*
* flash_threshold: Double containing the factor by which current max cache
- * size is multiplied to obtain the size threshold for the add_space
- * flash increment algorithm. The field is ignored unless
- * flash_incr_mode is H5C_flash_incr__add_space.
+ * size is multiplied to obtain the size threshold for the add_space
+ * flash increment algorithm. The field is ignored unless
+ * flash_incr_mode is H5C_flash_incr__add_space.
*
*
* Cache size decrease control fields:
*
* decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose
- * value indicates how we determine whether the cache size should be
- * decreased. At present there are four possibilities.
+ * value indicates how we determine whether the cache size should be
+ * decreased. At present there are four possibilities.
*
- * H5C_decr__off: Don't attempt to decrease the size of the cache
- * automatically.
+ * H5C_decr__off: Don't attempt to decrease the size of the cache
+ * automatically.
*
- * When this increment mode is selected, the remaining fields
- * in the cache size decrease section are ignored.
+ * When this increment mode is selected, the remaining fields
+ * in the cache size decrease section are ignored.
*
- * H5C_decr__threshold: Attempt to decrease the size of the cache
- * whenever the average hit rate over the last epoch rises
- * above the value supplied in the upper_hr_threshold
- * field.
+ * H5C_decr__threshold: Attempt to decrease the size of the cache
+ * whenever the average hit rate over the last epoch rises
+ * above the value supplied in the upper_hr_threshold
+ * field.
*
- * H5C_decr__age_out: At the end of each epoch, search the cache for
- * entries that have not been accessed for at least the number
- * of epochs specified in the epochs_before_eviction field, and
- * evict these entries. Conceptually, the maximum cache size
- * is then decreased to match the new actual cache size. However,
- * this reduction may be modified by the min_size, the
- * max_decrement, and/or the empty_reserve.
+ * H5C_decr__age_out: At the end of each epoch, search the cache for
+ * entries that have not been accessed for at least the number
+ * of epochs specified in the epochs_before_eviction field, and
+ * evict these entries. Conceptually, the maximum cache size
+ * is then decreased to match the new actual cache size. However,
+ * this reduction may be modified by the min_size, the
+ * max_decrement, and/or the empty_reserve.
*
- * H5C_decr__age_out_with_threshold: Same as age_out, but we only
- * attempt to reduce the cache size when the hit rate observed
- * over the last epoch exceeds the value provided in the
- * upper_hr_threshold field.
+ * H5C_decr__age_out_with_threshold: Same as age_out, but we only
+ * attempt to reduce the cache size when the hit rate observed
+ * over the last epoch exceeds the value provided in the
+ * upper_hr_threshold field.
*
* upper_hr_threshold: Upper hit rate threshold. The use of this field
- * varies according to the current decr_mode:
+ * varies according to the current decr_mode:
*
- * H5C_decr__off or H5C_decr__age_out: The value of this field is
- * ignored.
+ * H5C_decr__off or H5C_decr__age_out: The value of this field is
+ * ignored.
*
- * H5C_decr__threshold: If the hit rate exceeds this threshold in any
- * epoch, attempt to decrement the cache size by size_decrement.
+ * H5C_decr__threshold: If the hit rate exceeds this threshold in any
+ * epoch, attempt to decrement the cache size by size_decrement.
*
- * Note that cache size may not be decremented below min_size.
+ * Note that cache size may not be decremented below min_size.
*
- * Note also that if the upper_threshold is 1.0, the cache size
- * will never be reduced.
+ * Note also that if the upper_threshold is 1.0, the cache size
+ * will never be reduced.
*
- * H5C_decr__age_out_with_threshold: If the hit rate exceeds this
- * threshold in any epoch, attempt to reduce the cache size
- * by evicting entries that have not been accessed for more
- * than the specified number of epochs.
+ * H5C_decr__age_out_with_threshold: If the hit rate exceeds this
+ * threshold in any epoch, attempt to reduce the cache size
+ * by evicting entries that have not been accessed for more
+ * than the specified number of epochs.
*
* decrement: This field is only used when the decr_mode is
- * H5C_decr__threshold.
+ * H5C_decr__threshold.
*
- * The field is a double containing the multiplier used to derive the
- * new cache size from the old if a cache size decrement is triggered.
- * The decrement must be in the range 0.0 (in which case the cache will
+ * The field is a double containing the multiplier used to derive the
+ * new cache size from the old if a cache size decrement is triggered.
+ * The decrement must be in the range 0.0 (in which case the cache will
* try to contract to its minimum size) to 1.0 (in which case the
* cache will never shrink).
*
* apply_max_decrement: Boolean flag used to determine whether decrements
- * in cache size are to be limited by the max_decrement field.
+ * in cache size are to be limited by the max_decrement field.
*
* max_decrement: Maximum number of bytes by which the cache size can be
- * decreased in a single re-size. Note that decrements may also be
- * restricted by the min_size of the cache, and (in age out modes) by
- * the empty_reserve field.
+ * decreased in a single re-size. Note that decrements may also be
+ * restricted by the min_size of the cache, and (in age out modes) by
+ * the empty_reserve field.
*
* epochs_before_eviction: Integer field used in H5C_decr__age_out and
- * H5C_decr__age_out_with_threshold decrement modes.
+ * H5C_decr__age_out_with_threshold decrement modes.
*
- * This field contains the number of epochs an entry must remain
- * unaccessed before it is evicted in an attempt to reduce the
- * cache size. If applicable, this field must lie in the range
- * [1, H5C__MAX_EPOCH_MARKERS].
+ * This field contains the number of epochs an entry must remain
+ * unaccessed before it is evicted in an attempt to reduce the
+ * cache size. If applicable, this field must lie in the range
+ * [1, H5C__MAX_EPOCH_MARKERS].
*
* apply_empty_reserve: Boolean field controlling whether the empty_reserve
- * field is to be used in computing the new cache size when the
- * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold.
+ * field is to be used in computing the new cache size when the
+ * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold.
*
* empty_reserve: To avoid a constant racheting down of cache size by small
- * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold
- * modes, this field allows one to require that any cache size
- * reductions leave the specified fraction of unused space in the cache.
+ * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold
+ * modes, this field allows one to require that any cache size
+ * reductions leave the specified fraction of unused space in the cache.
*
- * The value of this field must be in the range [0.0, 1.0]. I would
- * expect typical values to be in the range of 0.01 to 0.1.
+ * The value of this field must be in the range [0.0, 1.0]. I would
+ * expect typical values to be in the range of 0.01 to 0.1.
*
****************************************************************************/
@@ -2136,12 +2140,12 @@ typedef struct H5C_auto_size_ctl_t {
* The fields of the structure are discussed individually below:
*
* version: Integer field containing the version number of this version
- * of the H5C_image_ctl_t structure. Any instance of
- * H5C_image_ctl_t passed to the cache must have a known
- * version number, or an error will be flagged.
+ * of the H5C_image_ctl_t structure. Any instance of
+ * H5C_image_ctl_t passed to the cache must have a known
+ * version number, or an error will be flagged.
*
* generate_image: Boolean flag indicating whether a cache image should
- * be created on file close.
+ * be created on file close.
*
* save_resize_status: Boolean flag indicating whether the cache image
* should include the adaptive cache resize configuration and status.
@@ -2173,11 +2177,11 @@ typedef struct H5C_auto_size_ctl_t {
* equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
*
* flags: Unsigned integer containing flags controlling which aspects of the
- * cache image functinality is actually executed. The primary impetus
- * behind this field is to allow development of tests for partial
- * implementations that will require little if any modification to run
- * with the full implementation. In normal operation, all flags should
- * be set.
+ * cache image functinality is actually executed. The primary impetus
+ * behind this field is to allow development of tests for partial
+ * implementations that will require little if any modification to run
+ * with the full implementation. In normal operation, all flags should
+ * be set.
*
****************************************************************************/
@@ -2194,10 +2198,11 @@ typedef struct H5C_auto_size_ctl_t {
#define H5C__DEFAULT_CACHE_IMAGE_CTL \
{ \
- /* version = */ H5C__CURR_CACHE_IMAGE_CTL_VER, /* generate_image = */ FALSE, \
- /* save_resize_status = */ FALSE, \
- /* entry_ageout = */ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE, \
- /* flags = */ H5C_CI__ALL_FLAGS \
+ H5C__CURR_CACHE_IMAGE_CTL_VER, /* = version */ \
+ FALSE, /* = generate_image */ \
+ FALSE, /* = save_resize_status */ \
+ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE, /* = entry_ageout */ \
+ H5C_CI__ALL_FLAGS /* = flags */ \
}
typedef struct H5C_cache_image_ctl_t {
@@ -2228,7 +2233,6 @@ H5_DLL herr_t H5C_evict(H5F_t *f);
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);
@@ -2266,6 +2270,7 @@ 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_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);
H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
@@ -2308,15 +2313,12 @@ H5_DLL herr_t H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name);
H5_DLL hbool_t H5C_get_serialization_in_progress(const H5C_t *cache_ptr);
H5_DLL hbool_t H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring);
H5_DLL herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn);
-#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5C_dump_coll_write_list(H5C_t *cache_ptr, char *calling_fcn);
-#endif /* H5_HAVE_PARALLEL */
-H5_DLL herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr);
-H5_DLL herr_t H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr,
- hbool_t *fd_exists_ptr);
-H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expected_type,
- hbool_t *in_cache_ptr, hbool_t *type_ok_ptr);
-H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr);
+H5_DLL herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr);
+H5_DLL herr_t H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr,
+ hbool_t *fd_exists_ptr);
+H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expected_type,
+ hbool_t *in_cache_ptr, hbool_t *type_ok_ptr);
+H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr);
#endif /* NDEBUG */
-#endif /* !_H5Cprivate_H */
+#endif /* H5Cprivate_H */
diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h
index d735745..79ece10 100644
--- a/src/H5Cpublic.h
+++ b/src/H5Cpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,12 +19,10 @@
*
* Purpose: Public include file for cache functions.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifndef _H5Cpublic_H
-#define _H5Cpublic_H
+#ifndef H5Cpublic_H
+#define H5Cpublic_H
/* Public headers needed by this file */
#include "H5public.h"
@@ -33,15 +31,34 @@
extern "C" {
#endif
-enum H5C_cache_incr_mode { H5C_incr__off, H5C_incr__threshold };
+enum H5C_cache_incr_mode {
+ H5C_incr__off,
+ /**<Automatic cache size increase is disabled, and the remaining increment fields are ignored.*/
+
+ H5C_incr__threshold
+ /**<Automatic cache size increase is enabled using the hit rate threshold algorithm.*/
+};
+
+enum H5C_cache_flash_incr_mode {
+ H5C_flash_incr__off,
+ /**<Flash cache size increase is disabled.*/
-enum H5C_cache_flash_incr_mode { H5C_flash_incr__off, H5C_flash_incr__add_space };
+ H5C_flash_incr__add_space
+ /**<Flash cache size increase is enabled using the add space algorithm.*/
+};
enum H5C_cache_decr_mode {
H5C_decr__off,
+ /**<Automatic cache size decrease is disabled.*/
+
H5C_decr__threshold,
+ /**<Automatic cache size decrease is enabled using the hit rate threshold algorithm.*/
+
H5C_decr__age_out,
+ /**<Automatic cache size decrease is enabled using the ageout algorithm. */
+
H5C_decr__age_out_with_threshold
+ /**<Automatic cache size decrease is enabled using the ageout with hit rate threshold algorithm.*/
};
#ifdef __cplusplus
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index 56f5289..d8e2a72 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index a3eb173..41abd49 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -883,7 +883,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_tag(const void *thing, haddr_t *tag /*OUT*/)
+H5C_get_tag(const void *thing, haddr_t *tag)
{
const H5C_cache_entry_t *entry = (const H5C_cache_entry_t *)thing; /* Pointer to cache entry */
diff --git a/src/H5Ctest.c b/src/H5Ctest.c
index 8a4f22e..aa06416 100644
--- a/src/H5Ctest.c
+++ b/src/H5Ctest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5D.c b/src/H5D.c
index 66a6dc4..b69391f 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -138,11 +138,11 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t
/* Create the dataset */
if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id,
dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create dataset")
- /* Get an atom for the dataset */
+ /* Get an ID for the dataset */
if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if (H5I_INVALID_HID == ret_value)
@@ -187,9 +187,9 @@ done:
hid_t
H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id)
{
- void * dset = NULL; /* dset object from VOL connector */
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
+ void * dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -303,7 +303,7 @@ done:
* it. It is illegal to subsequently use that same dataset
* ID in calls to other dataset functions.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -369,7 +369,7 @@ done:
*
* Purpose: Returns the status of dataspace allocation.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -750,7 +750,7 @@ done:
* Purpose: Modifies the dimensions of a dataset.
* Can change to a smaller dimension.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -787,7 +787,7 @@ done:
*
* Purpose: Flushes all buffers associated with a dataset.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -825,7 +825,7 @@ done:
*
* Purpose: Refreshes all buffers associated with a dataset.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -865,7 +865,7 @@ done:
* For virtual:
* No conversion
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Vailin Choi
* Feb 2015
@@ -942,7 +942,7 @@ done:
* Intended for use with the H5D(O)read_chunk API call so
* the caller can construct an appropriate buffer.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Matthew Strong (GE Healthcare)
* 20 October 2016
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index f708c02..861b428 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Wednesday, October 8, 1997
*
* Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are
@@ -594,8 +594,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
*
*-------------------------------------------------------------------------
@@ -742,7 +741,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
for (u = 0; u < udata->ndims; u++)
- HDfprintf(stream, "%s%Hd", u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u]));
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u]));
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1371,7 +1370,7 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__btree_idx_dump() */
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index c62a8d7..f9a4a07 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -108,7 +108,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 */
@@ -280,7 +280,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);
@@ -441,11 +441,11 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record,
HDassert(ctx->chunk_size == record->nbytes);
HDassert(0 == record->filter_mask);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
for (u = 0; u < ctx->ndims; u++)
- HDfprintf(stream, "%s%Hd", u ? ", " : "", record->scaled[u] * ctx->dim[u]);
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -555,13 +555,13 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c
HDassert(H5F_addr_defined(record->chunk_addr));
HDassert(0 != record->nbytes);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes);
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
for (u = 0; u < ctx->ndims; u++)
- HDfprintf(stream, "%s%Hd", u ? ", " : "", record->scaled[u] * ctx->dim[u]);
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -814,7 +814,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
@@ -1236,13 +1236,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
@@ -1474,7 +1467,7 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_dump() */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 1017ee1..f335a25 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -6,36 +6,36 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Thursday, April 24, 2008
+/* Programmer: Quincey Koziol
+ * Thursday, April 24, 2008
*
- * Purpose: Abstract indexed (chunked) I/O functions. The logical
- * multi-dimensional dataspace is regularly partitioned into
- * same-sized "chunks", the first of which is aligned with the
- * logical origin. The chunks are indexed by different methods,
- * that map a chunk index to disk address. Each chunk can be
+ * Purpose: Abstract indexed (chunked) I/O functions. The logical
+ * multi-dimensional dataspace is regularly partitioned into
+ * same-sized "chunks", the first of which is aligned with the
+ * logical origin. The chunks are indexed by different methods,
+ * that map a chunk index to disk address. Each chunk can be
* compressed independently and the chunks may move around in the
* file as their storage requirements change.
*
- * Cache: Disk I/O is performed in units of chunks and H5MF_alloc()
- * contains code to optionally align chunks on disk block
- * boundaries for performance.
- *
- * The chunk cache is an extendible hash indexed by a function
- * of storage B-tree address and chunk N-dimensional offset
- * within the dataset. Collisions are not resolved -- one of
- * the two chunks competing for the hash slot must be preempted
- * from the cache. All entries in the hash also participate in
- * a doubly-linked list and entries are penalized by moving them
- * toward the front of the list. When a new chunk is about to
- * be added to the cache the heap is pruned by preempting
- * entries near the front of the list to make room for the new
- * entry which is added to the end of the list.
+ * Cache: Disk I/O is performed in units of chunks and H5MF_alloc()
+ * contains code to optionally align chunks on disk block
+ * boundaries for performance.
+ *
+ * The chunk cache is an extendible hash indexed by a function
+ * of storage B-tree address and chunk N-dimensional offset
+ * within the dataset. Collisions are not resolved -- one of
+ * the two chunks competing for the hash slot must be preempted
+ * from the cache. All entries in the hash also participate in
+ * a doubly-linked list and entries are penalized by moving them
+ * toward the front of the list. When a new chunk is about to
+ * be added to the cache the heap is pruned by preempting
+ * entries near the front of the list to make room for the new
+ * entry which is added to the end of the list.
*/
/****************/
@@ -47,19 +47,19 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_PARALLEL
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#endif /* H5_HAVE_PARALLEL */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File functions */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File functions */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
@@ -82,26 +82,26 @@
/*
* Feature: If this constant is defined then every cache preemption and load
- * causes a character to be printed on the standard error stream:
+ * causes a character to be printed on the standard error stream:
*
* `.': Entry was preempted because it has been completely read or
- * completely written but not partially read and not partially
- * written. This is often a good reason for preemption because such
- * a chunk will be unlikely to be referenced in the near future.
+ * completely written but not partially read and not partially
+ * written. This is often a good reason for preemption because such
+ * a chunk will be unlikely to be referenced in the near future.
*
* `:': Entry was preempted because it hasn't been used recently.
*
* `#': Entry was preempted because another chunk collided with it. This
- * is usually a relatively bad thing. If there are too many of
- * these then the number of entries in the cache can be increased.
+ * is usually a relatively bad thing. If there are too many of
+ * these then the number of entries in the cache can be increased.
*
* c: Entry was preempted because the file is closing.
*
- * w: A chunk read operation was eliminated because the library is
- * about to write new values to the entire chunk. This is a good
- * thing, especially on files where the chunk size is the same as
- * the disk block size, chunks are aligned on disk block boundaries,
- * and the operating system can also eliminate a read operation.
+ * w: A chunk read operation was eliminated because the library is
+ * about to write new values to the entire chunk. This is a good
+ * thing, especially on files where the chunk size is the same as
+ * the disk block size, chunks are aligned on disk block boundaries,
+ * and the operating system can also eliminate a read operation.
*/
/*#define H5D_CHUNK_DEBUG */
@@ -118,19 +118,19 @@
/* Raw data chunks are cached. Each entry in the cache is: */
typedef struct H5D_rdcc_ent_t {
- hbool_t locked; /*entry is locked in cache */
- hbool_t dirty; /*needs to be written to disk? */
- hbool_t deleted; /*chunk about to be deleted */
+ hbool_t locked; /*entry is locked in cache */
+ hbool_t dirty; /*needs to be written to disk? */
+ hbool_t deleted; /*chunk about to be deleted */
unsigned edge_chunk_state; /*states related to edge chunks (see above) */
hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
- uint32_t rd_count; /*bytes remaining to be read */
- uint32_t wr_count; /*bytes remaining to be written */
+ uint32_t rd_count; /*bytes remaining to be read */
+ uint32_t wr_count; /*bytes remaining to be written */
H5F_block_t chunk_block; /*offset/length of chunk in file */
hsize_t chunk_idx; /*index of chunk in dataset */
- uint8_t * chunk; /*the unfiltered chunk data */
- unsigned idx; /*index in hash table */
- struct H5D_rdcc_ent_t *next; /*next item in doubly-linked list */
- struct H5D_rdcc_ent_t *prev; /*previous item in doubly-linked list */
+ uint8_t * chunk; /*the unfiltered chunk data */
+ unsigned idx; /*index in hash table */
+ struct H5D_rdcc_ent_t *next; /*next item in doubly-linked list */
+ struct H5D_rdcc_ent_t *prev; /*previous item in doubly-linked list */
struct H5D_rdcc_ent_t *tmp_next; /*next item in temporary doubly-linked list */
struct H5D_rdcc_ent_t *tmp_prev; /*previous item in temporary doubly-linked list */
} H5D_rdcc_ent_t;
@@ -141,7 +141,7 @@ typedef struct H5D_chunk_it_ud1_t {
H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
const H5D_chk_idx_info_t *idx_info; /* Chunked index info */
const H5D_io_info_t * io_info; /* I/O info for dataset operation */
- const hsize_t * space_dim; /* New dataset dimensions */
+ const hsize_t * space_dim; /* New dataset dimensions */
const hbool_t * shrunk_dim; /* Dimensions which have been shrunk */
H5S_t * chunk_space; /* Dataspace for a chunk */
uint32_t elmts_per_chunk; /* Elements in chunk */
@@ -192,12 +192,12 @@ typedef struct H5D_chunk_it_ud3_t {
/* needed for getting raw data from chunk cache */
hbool_t chunk_in_cache;
- uint8_t *chunk; /* the unfiltered chunk data */
+ uint8_t *chunk; /* the unfiltered chunk data */
} H5D_chunk_it_ud3_t;
/* Callback info for iteration to dump index */
typedef struct H5D_chunk_it_ud4_t {
- FILE * stream; /* Output stream */
+ FILE * stream; /* Output stream */
hbool_t header_displayed; /* Node's header is displayed? */
unsigned ndims; /* Number of dimensions for chunk/dataset */
uint32_t *chunk_dim; /* Chunk dimensions */
@@ -216,6 +216,7 @@ typedef struct H5D_chunk_readvv_ud_t {
const H5D_t * dset; /* Dataset to operate on */
} H5D_chunk_readvv_ud_t;
+/* Typedef for chunk info iterator callback */
typedef struct H5D_chunk_info_iter_ud_t {
hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset of the chunk */
hsize_t ndims; /* Number of dimensions in the dataset */
@@ -275,25 +276,23 @@ static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chun
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 */
-static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims,
- const hsize_t *max_dims);
-static void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
-static void * H5D__chunk_mem_xfree(void *chk, const void *pline);
-static void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline);
-static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
-static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata);
-static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata);
-static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
-static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info);
-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__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims,
+ const hsize_t *max_dims);
+static void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
+static void * H5D__chunk_mem_xfree(void *chk, const void *pline);
+static void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline);
+static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
+static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata);
+static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata);
+static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
+static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info);
+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);
@@ -316,6 +315,7 @@ static herr_t H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_
static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2);
#endif /* H5_HAVE_PARALLEL */
+/* Debugging helper routine callback */
static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
/*********************/
@@ -358,13 +358,13 @@ H5FL_BLK_DEFINE_STATIC(chunk);
H5FL_EXTERN(H5S_sel_iter_t);
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_direct_write
+ * Function: H5D__chunk_direct_write
*
- * Purpose: Internal routine to write a chunk directly into the file.
+ * Purpose: Internal routine to write a chunk directly into the file.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 July 2012
*
*-------------------------------------------------------------------------
@@ -396,7 +396,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui
/* Allocate storage */
if (H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
- } /* end if */
+ }
/* Calculate the index of this chunk */
H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled);
@@ -666,13 +666,13 @@ done:
} /* H5D__get_chunk_storage_size */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_info_real
+ * Function: H5D__chunk_set_info_real
*
- * Purpose: Internal routine to set the information about chunks for a dataset
+ * Purpose: Internal routine to set the information about chunks 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
* Tuesday, June 30, 2009
*
*-------------------------------------------------------------------------
@@ -711,23 +711,21 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize
} /* end for */
/* Get the "down" sizes for each dimension */
- if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
- if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
+ H5VM_array_down(ndims, layout->chunks, layout->down_chunks);
+ H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_info_real() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_info
+ * Function: H5D__chunk_set_info
*
- * Purpose: Sets the information about chunks for a dataset
+ * Purpose: Sets the information about chunks 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
* Tuesday, June 30, 2009
*
*-------------------------------------------------------------------------
@@ -757,13 +755,13 @@ done:
} /* end H5D__chunk_set_info() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_set_sizes
+ * Function: H5D__chunk_set_sizes
*
* Purpose: Sets chunk and type sizes.
*
* Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
+ * Programmer: Dana Robinson
* December 2015
*
*-------------------------------------------------------------------------
@@ -821,13 +819,13 @@ done:
} /* end H5D__chunk_set_sizes */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_construct
+ * Function: H5D__chunk_construct
*
- * Purpose: Constructs new chunked layout information for dataset
+ * Purpose: Constructs new chunked layout information for dataset
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, May 22, 2008
*
*-------------------------------------------------------------------------
@@ -885,14 +883,14 @@ done:
} /* end H5D__chunk_construct() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_init
+ * Function: H5D__chunk_init
*
- * Purpose: Initialize the raw data chunk cache for a dataset. This is
- * called when the dataset is initialized.
+ * Purpose: Initialize the raw data chunk cache for a dataset. This is
+ * called when the dataset is initialized.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, May 18, 1998
*
*-------------------------------------------------------------------------
@@ -989,13 +987,13 @@ done:
} /* end H5D__chunk_init() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_is_space_alloc
+ * Function: H5D__chunk_is_space_alloc
*
- * Purpose: Query if space is allocated for layout
+ * Purpose: Query if space is allocated for layout
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 15, 2009
*
*-------------------------------------------------------------------------
@@ -1042,13 +1040,13 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
} /* end H5D__chunk_is_data_cached() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_init
+ * Function: H5D__chunk_io_init
*
- * Purpose: Performs initialization before any sort of I/O on the raw data
+ * Purpose: Performs initialization before any sort of I/O on the raw data
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2008
*
*-------------------------------------------------------------------------
@@ -1063,7 +1061,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1131,13 +1129,13 @@ done:
} /* end H5D__chunk_io_init() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_init_selections
+ * Function: H5D__chunk_io_init_selections
*
- * Purpose: Initialize the chunk mappings
+ * Purpose: Initialize the chunk mappings
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2008
*
*-------------------------------------------------------------------------
@@ -1152,7 +1150,7 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
H5T_t * file_type = NULL; /* Temporary copy of file datatype for iteration */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
char bogus; /* "bogus" buffer to pass to selection iterator */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1337,15 +1335,15 @@ done:
} /* end H5D__chunk_io_init_selections() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_alloc
+ * Function: H5D__chunk_mem_alloc
*
- * Purpose: Allocate space for a chunk in memory. This routine allocates
+ * Purpose: Allocate space for a chunk in memory. This routine allocates
* memory space for non-filtered chunks from a block free list
* and uses malloc()/free() for filtered chunks.
*
- * Return: Pointer to memory for chunk on success/NULL on failure
+ * Return: Pointer to memory for chunk on success/NULL on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* April 22, 2004
*
*-------------------------------------------------------------------------
@@ -1368,15 +1366,15 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
} /* H5D__chunk_mem_alloc() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_xfree
+ * Function: H5D__chunk_mem_xfree
*
- * Purpose: Free space for a chunk in memory. This routine releases
+ * Purpose: Free space for a chunk in memory. This routine releases
* memory space for non-filtered chunks from a block free list
* and uses malloc()/free() for filtered chunks.
*
- * Return: NULL (never fails)
+ * Return: NULL (never fails)
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* April 22, 2004
*
*-------------------------------------------------------------------------
@@ -1473,14 +1471,14 @@ H5D__free_chunk_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
} /* H5D__free_chunk_info() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_map_single
+ * Function: H5D__create_chunk_map_single
*
- * Purpose: Create chunk selections when appending a single record
+ * Purpose: Create chunk selections when appending a single record
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Tuesday, November 20, 2007
+ * Programmer: Quincey Koziol
+ * Tuesday, November 20, 2007
*
*-------------------------------------------------------------------------
*/
@@ -1558,14 +1556,14 @@ done:
} /* end H5D__create_chunk_map_single() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_file_map_all
+ * Function: H5D__create_chunk_file_map_all
*
- * Purpose: Create all chunk selections in file, for an "all" selection.
+ * Purpose: Create all chunk selections in file, for an "all" selection.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Monday, January 21, 2019
+ * Programmer: Quincey Koziol
+ * Monday, January 21, 2019
*
*-------------------------------------------------------------------------
*/
@@ -1763,14 +1761,14 @@ done:
} /* end H5D__create_chunk_file_map_all() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_file_map_hyper
+ * Function: H5D__create_chunk_file_map_hyper
*
- * Purpose: Create all chunk selections in file, for a hyperslab selection.
+ * Purpose: Create all chunk selections in file, for a hyperslab selection.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, May 29, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 29, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1939,16 +1937,16 @@ done:
} /* end H5D__create_chunk_file_map_hyper() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_chunk_mem_map_hyper
+ * Function: H5D__create_chunk_mem_map_hyper
*
- * Purpose: Create all chunk selections in memory by copying the file
+ * Purpose: Create all chunk selections in memory by copying the file
* chunk selections and adjusting their offsets to be correct
* for the memory.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, May 29, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 29, 2003
*
* Assumptions: That the file and memory selections are the same shape.
*
@@ -2053,10 +2051,8 @@ 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 */
- } /* end for */
+ chunk_adjust[u] = adjust[u] - (hssize_t)coords[u];
+ } /* end for */
/* Adjust the selection */
if (H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0)
@@ -2073,15 +2069,15 @@ done:
} /* end H5D__create_chunk_mem_map_hyper() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_mem_map_1d
+ * Function: H5D__create_mem_map_1d
*
- * Purpose: Create all chunk selections for 1-dimensional regular memory space
+ * Purpose: Create all chunk selections for 1-dimensional regular memory space
* that has only one single block in the selection
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
- * Sept 18, 2019
+ * Programmer: Vailin Choi
+ * Sept 18, 2019
*
*-------------------------------------------------------------------------
*/
@@ -2154,15 +2150,15 @@ done:
} /* end H5D__create_chunk_mem_map_1d() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_file_cb
+ * Function: H5D__chunk_file_cb
*
- * Purpose: Callback routine for file selection iterator. Used when
+ * Purpose: Callback routine for file selection iterator. Used when
* creating selections in file for each point selected.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Wednesday, July 23, 2003
+ * Programmer: Quincey Koziol
+ * Wednesday, July 23, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2177,7 +2173,7 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
hsize_t chunk_index; /* Chunk index */
hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2272,15 +2268,15 @@ done:
} /* end H5D__chunk_file_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_mem_cb
+ * Function: H5D__chunk_mem_cb
*
- * Purpose: Callback routine for file selection iterator. Used when
+ * Purpose: Callback routine for file selection iterator. Used when
* creating selections in memory for each chunk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2292,7 +2288,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
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 chunk_index; /* Chunk index */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2348,15 +2344,15 @@ done:
} /* end H5D__chunk_mem_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cacheable
+ * Function: H5D__chunk_cacheable
*
- * Purpose: A small internal function to if it's possible to load the
+ * Purpose: A small internal function to if it's possible to load the
* chunk into cache.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Raymond Lu
- * 17 July 2007
+ * Programmer: Raymond Lu
+ * 17 July 2007
*
*-------------------------------------------------------------------------
*/
@@ -2438,14 +2434,14 @@ done:
} /* end H5D__chunk_cacheable() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_read
+ * Function: H5D__chunk_read
*
- * Purpose: Read from a chunked dataset.
+ * Purpose: Read from a chunked dataset.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2463,7 +2459,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_
hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */
hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
@@ -2515,7 +2511,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_
chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm);
while (chunk_node) {
H5D_chunk_info_t *chunk_info; /* Chunk information */
- H5D_chunk_ud_t udata; /* Chunk index pass-through */
+ H5D_chunk_ud_t udata; /* Chunk index pass-through */
/* Get the actual chunk information from the skip list node */
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
@@ -2589,14 +2585,14 @@ done:
} /* H5D__chunk_read() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_write
+ * Function: H5D__chunk_write
*
- * Purpose: Writes to a chunked dataset.
+ * Purpose: Writes to a chunked dataset.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
+ * Programmer: Raymond Lu
+ * Thursday, April 10, 2003
*
*-------------------------------------------------------------------------
*/
@@ -2612,7 +2608,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize
H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2646,7 +2642,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize
H5D_chk_idx_info_t idx_info; /* Chunked index info */
H5D_io_info_t * chk_io_info; /* Pointer to I/O info object for this chunk */
void * chunk; /* Pointer to locked chunk buffer */
- H5D_chunk_ud_t udata; /* Index pass-through */
+ H5D_chunk_ud_t udata; /* Index pass-through */
htri_t cacheable; /* Whether the chunk is cacheable */
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
@@ -2753,14 +2749,14 @@ done:
} /* H5D__chunk_write() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_flush
+ * Function: H5D__chunk_flush
*
- * Purpose: Writes all dirty chunks to disk and optionally preempts them
- * from the cache.
+ * Purpose: Writes all dirty chunks to disk and optionally preempts them
+ * from the cache.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -2792,21 +2788,21 @@ done:
} /* end H5D__chunk_flush() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_io_term
+ * Function: H5D__chunk_io_term
*
- * Purpose: Destroy I/O operation information.
+ * Purpose: Destroy I/O operation information.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Saturday, May 17, 2003
+ * Programmer: Quincey Koziol
+ * Saturday, May 17, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__chunk_io_term(const H5D_chunk_map_t *fm)
{
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
@@ -2842,14 +2838,14 @@ done:
} /* end H5D__chunk_io_term() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dest
+ * Function: H5D__chunk_dest
*
- * Purpose: Destroy the entire chunk cache by flushing dirty entries,
- * preempting all entries, and freeing the cache itself.
+ * Purpose: Destroy the entire chunk cache by flushing dirty entries,
+ * preempting all entries, and freeing the cache itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -2901,13 +2897,13 @@ done:
} /* end H5D__chunk_dest() */
/*-------------------------------------------------------------------------
- * Function: H5D_chunk_idx_reset
+ * Function: H5D_chunk_idx_reset
*
- * Purpose: Reset index information
+ * Purpose: Reset index information
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 15, 2009
*
*-------------------------------------------------------------------------
@@ -2933,13 +2929,13 @@ done:
} /* end H5D_chunk_idx_reset() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_reset
+ * Function: H5D__chunk_cinfo_cache_reset
*
- * Purpose: Reset the cached chunk info
+ * Purpose: Reset the cached chunk info
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -2947,7 +2943,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);
@@ -2959,13 +2955,13 @@ H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last)
} /* H5D__chunk_cinfo_cache_reset() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_update
+ * Function: H5D__chunk_cinfo_cache_update
*
- * Purpose: Update the cached chunk info
+ * Purpose: Update the cached chunk info
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -2995,13 +2991,13 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
} /* H5D__chunk_cinfo_cache_update() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cinfo_cache_found
+ * Function: H5D__chunk_cinfo_cache_found
*
- * Purpose: Look for chunk info in cache
+ * Purpose: Look for chunk info in cache
*
- * Return: TRUE/FALSE/FAIL
+ * Return: TRUE/FALSE/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 27, 2007
*
*-------------------------------------------------------------------------
@@ -3043,17 +3039,17 @@ done:
} /* H5D__chunk_cinfo_cache_found() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_create
+ * Function: H5D__chunk_create
*
- * Purpose: Creates a new chunked storage index and initializes the
- * layout information with information about the storage. The
- * layout info should be immediately written to the object header.
+ * Purpose: Creates a new chunked storage index and initializes the
+ * layout information with information about the storage. The
+ * layout info should be immediately written to the object header.
*
- * Return: Non-negative on success (with the layout information initialized
- * and ready to write to an object header). Negative on failure.
+ * Return: Non-negative on success (with the layout information initialized
+ * and ready to write to an object header). Negative on failure.
*
- * Programmer: Quincey Koziol
- * Thursday, May 22, 2008
+ * Programmer: Quincey Koziol
+ * Thursday, May 22, 2008
*
*-------------------------------------------------------------------------
*/
@@ -3097,14 +3093,14 @@ done:
} /* end H5D__chunk_create() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_hash_val
+ * 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
+ * Return: Hash value index
*
- * Programmer: Vailin Choi; Nov 2014
+ * Programmer: Vailin Choi; Nov 2014
*
*-------------------------------------------------------------------------
*/
@@ -3138,14 +3134,14 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
} /* H5D__chunk_hash_val() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_lookup
+ * Function: H5D__chunk_lookup
*
- * Purpose: Loops up a chunk in cache and on disk, and retrieves
+ * Purpose: Loops up a chunk in cache and on disk, and retrieves
* information about that chunk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Albert Cheng
+ * Programmer: Albert Cheng
* June 27, 1998
*
*-------------------------------------------------------------------------
@@ -3153,9 +3149,9 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
herr_t
H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata)
{
- H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- unsigned idx; /* Index of chunk in cache, if present */
+ H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ unsigned idx = 0; /* Index of chunk in cache, if present */
hbool_t found = FALSE; /* In cache? */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3276,16 +3272,16 @@ done:
} /* H5D__chunk_lookup() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_flush_entry
+ * Function: H5D__chunk_flush_entry
*
- * Purpose: Writes a chunk to disk. If RESET is non-zero then the
- * entry is cleared -- it's slightly faster to flush a chunk if
- * the RESET flag is turned on because it results in one fewer
- * memory copy.
+ * Purpose: Writes a chunk to disk. If RESET is non-zero then the
+ * entry is cleared -- it's slightly faster to flush a chunk if
+ * the RESET flag is turned on because it results in one fewer
+ * memory copy.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3293,12 +3289,12 @@ done:
static herr_t
H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
{
- void * buf = NULL; /* Temporary buffer */
+ void * buf = NULL; /* Temporary buffer */
hbool_t point_of_no_return = FALSE;
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_TAG(dset->oloc.addr)
+ FUNC_ENTER_STATIC
HDassert(dset);
HDassert(dset->shared);
@@ -3309,7 +3305,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
buf = ent->chunk;
if (ent->dirty) {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_ud_t udata; /* pass through B-tree */
+ H5D_chunk_ud_t udata; /* pass through B-tree */
hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
@@ -3326,7 +3322,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
if (dset->shared->dcpl_cache.pline.nused && !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) {
H5Z_EDC_t err_detect; /* Error detection info */
H5Z_cb_t filter_cb; /* I/O filter callback function */
- size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
+ size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
size_t nbytes; /* Chunk size (in bytes) */
/* Retrieve filter settings from API context */
@@ -3465,7 +3461,7 @@ done:
? NULL
: &(dset->shared->dcpl_cache.pline)));
- FUNC_LEAVE_NOAPI_TAG(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_flush_entry() */
/*-------------------------------------------------------------------------
@@ -3548,15 +3544,15 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
} /* end H5D__chunk_cache_evict() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_cache_prune
+ * Function: H5D__chunk_cache_prune
*
- * Purpose: Prune the cache by preempting some things until the cache has
- * room for something which is SIZE bytes. Only unlocked
- * entries are considered for preemption.
+ * Purpose: Prune the cache by preempting some things until the cache has
+ * room for something which is SIZE bytes. Only unlocked
+ * entries are considered for preemption.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3566,10 +3562,10 @@ 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 */
+ 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 */
@@ -3656,28 +3652,28 @@ done:
} /* end H5D__chunk_cache_prune() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_lock
+ * Function: H5D__chunk_lock
*
- * Purpose: Return a pointer to a dataset chunk. The pointer points
- * directly into the chunk cache and should not be freed
- * by the caller but will be valid until it is unlocked. The
- * input value IDX_HINT is used to speed up cache lookups and
- * it's output value should be given to H5D__chunk_unlock().
- * IDX_HINT is ignored if it is out of range, and if it points
- * to the wrong entry then we fall back to the normal search
- * method.
+ * Purpose: Return a pointer to a dataset chunk. The pointer points
+ * directly into the chunk cache and should not be freed
+ * by the caller but will be valid until it is unlocked. The
+ * input value IDX_HINT is used to speed up cache lookups and
+ * it's output value should be given to H5D__chunk_unlock().
+ * IDX_HINT is ignored if it is out of range, and if it points
+ * to the wrong entry then we fall back to the normal search
+ * method.
*
- * If RELAX is non-zero and the chunk isn't in the cache then
- * don't try to read it from the file, but just allocate an
- * uninitialized buffer to hold the result. This is intended
- * for output functions that are about to overwrite the entire
- * chunk.
+ * If RELAX is non-zero and the chunk isn't in the cache then
+ * don't try to read it from the file, but just allocate an
+ * uninitialized buffer to hold the result. This is intended
+ * for output functions that are about to overwrite the entire
+ * chunk.
*
- * Return: Success: Ptr to a file chunk.
+ * Return: Success: Ptr to a file chunk.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -3695,10 +3691,10 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
- H5D_rdcc_ent_t * ent; /*cache entry */
- size_t chunk_size; /*size of a chunk */
+ H5D_rdcc_ent_t * ent; /*cache entry */
+ size_t chunk_size; /*size of a chunk */
hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */
- void * chunk = NULL; /*the file chunk */
+ void * chunk = NULL; /*the file chunk */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -3726,7 +3722,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel
#ifndef NDEBUG
{
- unsigned u; /*counters */
+ unsigned u; /*counters */
/* Make sure this is the right chunk */
for (u = 0; u < layout->u.chunk.ndims - 1; u++)
@@ -4060,23 +4056,23 @@ done:
} /* end H5D__chunk_lock() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_unlock
+ * Function: H5D__chunk_unlock
*
- * Purpose: Unlocks a previously locked chunk. The LAYOUT, COMP, and
- * OFFSET arguments should be the same as for H5D__chunk_lock().
- * The DIRTY argument should be set to non-zero if the chunk has
- * been modified since it was locked. The IDX_HINT argument is
- * the returned index hint from the lock operation and BUF is
- * the return value from the lock.
+ * Purpose: Unlocks a previously locked chunk. The LAYOUT, COMP, and
+ * OFFSET arguments should be the same as for H5D__chunk_lock().
+ * The DIRTY argument should be set to non-zero if the chunk has
+ * been modified since it was locked. The IDX_HINT argument is
+ * the returned index hint from the lock operation and BUF is
+ * the return value from the lock.
*
- * The NACCESSED argument should be the number of bytes accessed
- * for reading or writing (depending on the value of DIRTY).
- * It's only purpose is to provide additional information to the
- * preemption policy.
+ * The NACCESSED argument should be the number of bytes accessed
+ * for reading or writing (depending on the value of DIRTY).
+ * It's only purpose is to provide additional information to the
+ * preemption policy.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -4167,14 +4163,14 @@ done:
} /* end H5D__chunk_unlock() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocated_cb
+ * Function: H5D__chunk_allocated_cb
*
- * Purpose: Simply counts the number of chunks for a dataset.
+ * Purpose: Simply counts the number of chunks for a dataset.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
*-------------------------------------------------------------------------
@@ -4192,15 +4188,15 @@ H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* H5D__chunk_allocated_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocated
+ * Function: H5D__chunk_allocated
*
- * Purpose: Return the number of bytes allocated in the file for storage
- * of raw data in the chunked dataset
+ * Purpose: Return the number of bytes allocated in the file for storage
+ * of raw data in the chunked dataset
*
- * Return: Success: Number of bytes stored in all chunks.
- * Failure: 0
+ * Return: Success: Number of bytes stored in all chunks.
+ * Failure: 0
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 20, 2008
*
*-------------------------------------------------------------------------
@@ -4246,21 +4242,21 @@ done:
} /* end H5D__chunk_allocated() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_allocate
+ * Function: H5D__chunk_allocate
*
- * Purpose: Allocate file space for all chunks that are not allocated yet.
- * Return SUCCEED if all needed allocation succeed, otherwise
- * FAIL.
+ * Purpose: Allocate file space for all chunks that are not allocated yet.
+ * Return SUCCEED if all needed allocation succeed, otherwise
+ * FAIL.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Albert Cheng
- * June 26, 1998
+ * Programmer: Albert Cheng
+ * June 26, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
+H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[])
{
const H5D_t * dset = io_info->dset; /* the dataset pointer */
H5D_chk_idx_info_t idx_info; /* Chunked index info */
@@ -4299,11 +4295,11 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
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);
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */
+ H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); /* Convenience variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
@@ -4507,9 +4503,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 */
@@ -4712,7 +4707,7 @@ done:
H5MM_free(chunk_info.addr);
#endif
- FUNC_LEAVE_NOAPI_TAG(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_allocate() */
/*-------------------------------------------------------------------------
@@ -4889,16 +4884,16 @@ done:
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_collective_fill
+ * Function: H5D__chunk_collective_fill
*
* Purpose: Use MPIO collective write to fill the chunks (if number of
* chunks to fill is greater than the number of MPI procs;
* otherwise use independent I/O).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
- * July 30, 2014
+ * Programmer: Mohamad Chaarawi
+ * July 30, 2014
*
*-------------------------------------------------------------------------
*/
@@ -4915,7 +4910,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;
@@ -4941,9 +4936,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 */
@@ -4951,58 +4946,63 @@ 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 */
@@ -5035,10 +5035,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);
@@ -5076,15 +5078,15 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_prune_fill
+ * Function: H5D__chunk_prune_fill
*
- * Purpose: Write the fill value to the parts of the chunk that are no
+ * Purpose: Write the fill value to the parts of the chunk that are no
* longer part of the dataspace
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * March 26, 2002
+ * Programmer: Pedro Vicente
+ * March 26, 2002
*
*-------------------------------------------------------------------------
*/
@@ -5198,16 +5200,16 @@ done:
} /* H5D__chunk_prune_fill */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_prune_by_extent
+ * Function: H5D__chunk_prune_by_extent
*
- * Purpose: This function searches for chunks that are no longer necessary
+ * Purpose: This function searches for chunks that are no longer necessary
* both in the raw data cache and in the chunk index.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Algorithm: Robb Matzke
- * March 27, 2002
+ * Programmer: Pedro Vicente
+ * Algorithm: Robb Matzke
+ * March 27, 2002
*
* The algorithm is:
*
@@ -5628,14 +5630,14 @@ done:
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_addrmap_cb
+ * Function: H5D__chunk_addrmap_cb
*
* Purpose: Callback when obtaining the chunk addresses for all existing chunks
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Kent Yang
+ * Programmer: Kent Yang
* Tuesday, November 15, 2005
*
*-------------------------------------------------------------------------
@@ -5659,12 +5661,12 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* H5D__chunk_addrmap_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_addrmap
+ * Function: H5D__chunk_addrmap
*
* Purpose: Obtain the chunk addresses for all existing chunks
*
- * Return: Success: Non-negative on succeed.
- * Failure: negative value
+ * Return: Success: Non-negative on succeed.
+ * Failure: negative value
*
* Programmer: Kent Yang
* November 15, 2005
@@ -5709,14 +5711,14 @@ done:
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_delete
+ * Function: H5D__chunk_delete
*
- * Purpose: Delete raw data storage for entire dataset (i.e. all chunks)
+ * Purpose: Delete raw data storage for entire dataset (i.e. all chunks)
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
*-------------------------------------------------------------------------
@@ -5785,15 +5787,15 @@ done:
} /* end H5D__chunk_delete() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_update_cache
+ * Function: H5D__chunk_update_cache
*
- * Purpose: Update any cached chunks index values after the dataspace
+ * Purpose: Update any cached chunks index values after the dataspace
* size has changed
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, May 29, 2004
*
*-------------------------------------------------------------------------
@@ -5824,7 +5826,7 @@ H5D__chunk_update_cache(H5D_t *dset)
/* Recompute the index for each cached chunk that is in a dataset */
for (ent = rdcc->head; ent; ent = next) {
- unsigned old_idx; /* Previous index number */
+ unsigned old_idx; /* Previous index number */
/* Get the pointer to the next cache entry */
next = ent->next;
@@ -5948,7 +5950,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
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) {
@@ -5989,7 +5991,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 */
@@ -6022,13 +6024,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
*/
@@ -6142,15 +6144,15 @@ done:
} /* end H5D__chunk_copy_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_copy
+ * Function: H5D__chunk_copy
*
- * Purpose: Copy chunked storage from SRC file to DST file.
+ * Purpose: Copy chunked storage from SRC file to DST file.
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
* Programmer: Peter Cao
- * August 20, 2005
+ * August 20, 2005
*
*-------------------------------------------------------------------------
*/
@@ -6502,16 +6504,16 @@ done:
} /* end H5D__chunk_bh_info() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dump_index_cb
+ * Function: H5D__chunk_dump_index_cb
*
- * Purpose: If the UDATA.STREAM member is non-null then debugging
+ * Purpose: If the UDATA.STREAM member is non-null then debugging
* information is written to that stream.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
*-------------------------------------------------------------------------
@@ -6537,10 +6539,11 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
/* Print information about this chunk */
- HDfprintf(udata->stream, " 0x%08x %8Zu %10a [", chunk_rec->filter_mask, chunk_rec->nbytes,
- chunk_rec->chunk_addr);
+ HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask,
+ chunk_rec->nbytes, chunk_rec->chunk_addr);
for (u = 0; u < udata->ndims; u++)
- HDfprintf(udata->stream, "%s%Hu", (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u]));
+ HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""),
+ (chunk_rec->scaled[u] * udata->chunk_dim[u]));
HDfputs("]\n", udata->stream);
} /* end if */
@@ -6548,15 +6551,15 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* H5D__chunk_dump_index_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_dump_index
+ * Function: H5D__chunk_dump_index
*
- * Purpose: Prints information about the storage index to the specified
- * stream.
+ * Purpose: Prints information about the storage index to the specified
+ * stream.
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 28, 1999
*
*-------------------------------------------------------------------------
@@ -6607,15 +6610,15 @@ done:
#ifdef H5D_CHUNK_DEBUG
/*-------------------------------------------------------------------------
- * Function: H5D__chunk_stats
+ * Function: H5D__chunk_stats
*
- * Purpose: Print raw data cache statistics to the debug stream. If
- * HEADERS is non-zero then print table column headers,
- * otherwise assume that the H5AC layer has already printed them.
+ * Purpose: Print raw data cache statistics to the debug stream. If
+ * HEADERS is non-zero then print table column headers,
+ * otherwise assume that the H5AC layer has already printed them.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 21, 1998
*
*-------------------------------------------------------------------------
@@ -6671,20 +6674,20 @@ done:
#endif /* H5D_CHUNK_DEBUG */
/*-------------------------------------------------------------------------
- * Function: H5D__nonexistent_readvv_cb
+ * Function: H5D__nonexistent_readvv_cb
*
- * Purpose: Callback operation for performing fill value I/O operation
+ * Purpose: Callback operation for performing fill value I/O operation
* on memory buffer.
*
- * Note: This algorithm is pretty inefficient about initializing and
+ * Note: This algorithm is pretty inefficient about initializing and
* terminating the fill buffer info structure and it would be
* faster to refactor this into a "real" initialization routine,
* and a "vectorized fill" routine. -QAK
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * 30 Sep 2010
+ * Programmer: Quincey Koziol
+ * 30 Sep 2010
*
*-------------------------------------------------------------------------
*/
@@ -6718,22 +6721,22 @@ done:
} /* H5D__nonexistent_readvv_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__nonexistent_readvv
+ * Function: H5D__nonexistent_readvv
*
- * Purpose: When the chunk doesn't exist on disk and the chunk is bigger
+ * Purpose: When the chunk doesn't exist on disk and the chunk is bigger
* than the cache size, performs fill value I/O operation on
* memory buffer, advancing through two I/O vectors, until one
* runs out.
*
- * Note: This algorithm is pretty inefficient about initializing and
+ * Note: This algorithm is pretty inefficient about initializing and
* terminating the fill buffer info structure and it would be
* faster to refactor this into a "real" initialization routine,
* and a "vectorized fill" routine. -QAK
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * 6 Feb 2009
+ * Programmer: Raymond Lu
+ * 6 Feb 2009
*
*-------------------------------------------------------------------------
*/
@@ -6812,9 +6815,9 @@ done:
* Function: H5D__chunk_file_alloc()
*
* Purpose: Chunk allocation:
- * Create the chunk if it doesn't exist, or reallocate the
+ * Create the chunk if it doesn't exist, or reallocate the
* chunk if its size changed.
- * The coding is moved and modified from each index structure.
+ * The coding is moved and modified from each index structure.
*
* Return: Non-negative on success/Negative on failure
*
@@ -7044,7 +7047,7 @@ done:
* Function: H5D__chunk_format_convert
*
* Purpose: Iterate over the chunks for the current chunk index and insert the
- * the chunk addresses into v1 B-tree chunk index via callback.
+ * the chunk addresses into v1 B-tree chunk index via callback.
*
* Return: Non-negative on success/Negative on failure
*
@@ -7166,10 +7169,10 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
"unable to retrieve allocated chunk information from index")
*nchunks = num_chunks;
- } /* end else */
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_num_chunks() */
/*-------------------------------------------------------------------------
@@ -7212,7 +7215,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++;
@@ -7308,7 +7311,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
} /* end if H5F_addr_defined */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_chunk_info() */
/*-------------------------------------------------------------------------
@@ -7353,7 +7356,7 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Stop iterating */
ret_value = H5_ITER_STOP;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_chunk_info_by_coord_cb() */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 8bbe1c6..8a2c770 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * 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 4667d1d..57c1502 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
* Purpose:
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 8c10983..d39d357 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -78,7 +78,8 @@ H5Ddebug(hid_t dset_id)
if (H5D_CHUNKED == dset->shared->layout.type)
(void)H5D__chunk_dump_index(dset, stdout);
else if (H5D_CONTIGUOUS == dset->shared->layout.type)
- HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr);
+ HDfprintf(stdout, " %-10s %" PRIuHADDR "\n",
+ "Address:", dset->shared->layout.storage.u.contig.addr);
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 0b8aef5..ec1998f 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ddeprec.c
* April 5 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Deprecated functions from the H5D interface. These
* functions are here for compatibility purposes and may be
@@ -137,13 +137,13 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t
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 eeecfc6..abce233 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -6,15 +6,15 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * 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.
@@ -200,14 +200,14 @@ H5FL_DEFINE_STATIC(H5D_earray_ctx_t);
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
*
*-------------------------------------------------------------------------
@@ -249,14 +249,14 @@ done:
} /* end H5D__earray_crt_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -278,14 +278,14 @@ H5D__earray_dst_context(void *_ctx)
} /* end H5D__earray_dst_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -307,14 +307,14 @@ H5D__earray_fill(void *nat_blk, size_t nelmts)
} /* end H5D__earray_fill() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -350,14 +350,14 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
} /* end H5D__earray_encode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -393,14 +393,14 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
} /* end H5D__earray_decode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -417,21 +417,21 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void
HDassert(elmt);
/* Print element */
- HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
+ HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_debug() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -454,14 +454,14 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts)
} /* end H5D__earray_filt_fill() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -501,14 +501,14 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
} /* end H5D__earray_filt_encode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -547,14 +547,14 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
} /* end H5D__earray_filt_decode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -573,23 +573,23 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const
HDassert(elmt);
/* Print element */
- HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
- HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes,
- elmt->filter_mask);
+ HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
+ elmt->nbytes, elmt->filter_mask);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_filt_debug() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -655,15 +655,15 @@ done:
} /* end H5D__earray_crt_dbg_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -685,16 +685,16 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx)
} /* end H5D__earray_dst_dbg_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -747,20 +747,20 @@ done:
} /* end H5D__earray_idx_depend() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -803,13 +803,13 @@ done:
} /* end H5D__earray_idx_open() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -869,20 +869,20 @@ done:
} /* end H5D__earray_idx_init() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -956,14 +956,14 @@ done:
} /* end H5D__earray_idx_create() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -979,13 +979,13 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
} /* end H5D__earray_idx_is_space_alloc() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -1047,15 +1047,15 @@ done:
} /* H5D__earray_idx_insert() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1145,14 +1145,14 @@ done:
} /* H5D__earray_idx_get_addr() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1160,9 +1160,7 @@ done:
static herr_t
H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(layout);
@@ -1182,8 +1180,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
+ H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks);
/* Get the swizzled max number of chunks in each dimension */
H5MM_memcpy(swizzled_max_chunks, layout->max_chunks,
@@ -1191,23 +1188,20 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks,
- layout->u.earray.swizzled_max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
- } /* end if */
+ H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks);
+ }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_resize() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -1259,18 +1253,18 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
} /* H5D__earray_idx_iterate_cb() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1336,13 +1330,13 @@ done:
} /* end H5D__earray_idx_iterate() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1449,14 +1443,14 @@ done:
} /* H5D__earray_idx_remove() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1485,19 +1479,19 @@ done:
} /* end H5D__earray_idx_delete_cb() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1546,13 +1540,13 @@ done:
} /* end H5D__earray_idx_delete() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1599,13 +1593,13 @@ done:
} /* end H5D__earray_idx_copy_setup() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1692,13 +1686,13 @@ done:
} /* end H5D__earray_idx_size() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1722,13 +1716,13 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
} /* end H5D__earray_idx_reset() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -1742,19 +1736,19 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_dump() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
diff --git a/src/H5Defl.c b/src/H5Defl.c
index f4327e7..85c9dba 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, September 30, 2004
*/
@@ -310,9 +310,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 18b28a3..0741e8f 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -6,17 +6,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
- * Thursday, April 30, 2009
+/* Programmer: Vailin Choi
+ * Thursday, April 30, 2009
*
- * Purpose: Fixed array indexed (chunked) I/O functions.
- * The chunk coordinate is mapped as an index into an array of
- * disk addresses for the chunks.
+ * Purpose: Fixed array indexed (chunked) I/O functions.
+ * The chunk coordinate is mapped as an index into an array of
+ * disk addresses for the chunks.
*
*/
@@ -29,13 +29,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FAprivate.h" /* Fixed arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FAprivate.h" /* Fixed arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
@@ -199,14 +199,14 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_t);
H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
/*-------------------------------------------------------------------------
- * Function: H5D__farray_crt_context
+ * Function: H5D__farray_crt_context
*
- * Purpose: Create context for callbacks
+ * Purpose: Create context for callbacks
*
- * Return: Success: non-NULL
- * Failure: NULL
+ * Return: Success: non-NULL
+ * Failure: NULL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -247,14 +247,14 @@ done:
} /* end H5D__farray_crt_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -276,14 +276,14 @@ H5D__farray_dst_context(void *_ctx)
} /* end H5D__farray_dst_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -305,14 +305,14 @@ H5D__farray_fill(void *nat_blk, size_t nelmts)
} /* end H5D__farray_fill() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -348,14 +348,14 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
} /* end H5D__farray_encode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -391,14 +391,14 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
} /* end H5D__farray_decode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -415,23 +415,23 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void
HDassert(elmt);
/* Print element */
- HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
+ HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_debug() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -496,16 +496,16 @@ done:
} /* end H5D__farray_crt_dbg_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -526,14 +526,14 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx)
} /* end H5D__farray_dst_dbg_context() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -556,14 +556,14 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
} /* end H5D__farray_filt_fill() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -603,14 +603,14 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
} /* end H5D__farray_filt_encode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -649,14 +649,14 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
} /* end H5D__farray_filt_decode() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -675,23 +675,23 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const
HDassert(elmt);
/* Print element */
- HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx);
- HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes,
- elmt->filter_mask);
+ HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
+ elmt->nbytes, elmt->filter_mask);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_debug() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -773,15 +773,15 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU
} /* end H5D__farray_idx_init() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -825,19 +825,19 @@ done:
} /* end H5D__farray_idx_open() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -906,13 +906,13 @@ done:
} /* end H5D__farray_idx_create() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -929,13 +929,13 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
} /* end H5D__farray_idx_is_space_alloc() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
*/
@@ -997,15 +997,15 @@ done:
} /* H5D__farray_idx_insert() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_get_addr
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1077,13 +1077,13 @@ done:
} /* H5D__farray_idx_get_addr() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_iterate_cb
+ * Function: H5D__farray_idx_iterate_cb
*
- * Purpose: Callback routine for fixed array element iteration.
+ * Purpose: Callback routine for fixed array element iteration.
*
- * 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
*
*-------------------------------------------------------------------------
@@ -1136,14 +1136,14 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
} /* H5D__farray_idx_iterate_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_iterate
+ * Function: H5D__farray_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.
*
- * 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
*
*-------------------------------------------------------------------------
@@ -1210,13 +1210,13 @@ done:
} /* end H5D__farray_idx_iterate() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_remove
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1305,14 +1305,14 @@ done:
} /* H5D__farray_idx_remove() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_delete_cb
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1341,15 +1341,15 @@ done:
} /* end H5D__farray_idx_delete_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_delete
+ * Function: H5D__farray_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)
*
- * Return: Success: Non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: negative
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1398,13 +1398,13 @@ done:
} /* end H5D__farray_idx_delete() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_copy_setup
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1451,13 +1451,13 @@ done:
} /* end H5D__farray_idx_copy_setup() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_copy_shutdown
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1495,7 +1495,7 @@ done:
* Return: Success: Non-negative
* Failure: negative
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1543,13 +1543,13 @@ done:
} /* end H5D__farray_idx_size() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_reset
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1571,13 +1571,13 @@ H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
} /* end H5D__farray_idx_reset() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_dump
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
@@ -1591,19 +1591,19 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_dump() */
/*-------------------------------------------------------------------------
- * Function: H5D__farray_idx_dest
+ * Function: H5D__farray_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: Vailin Choi
+ * Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 8bba9dc..b7ecdc9 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Dfill.c
* Jun 19 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Fill value operations for datasets
*
@@ -642,7 +642,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 86b0c68..5782d70 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -74,7 +74,7 @@ typedef struct {
/********************/
/* General stuff */
-static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl, hbool_t creating, hbool_t vl_type);
+static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type);
static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
@@ -92,6 +92,7 @@ static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim
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);
/*********************/
/* Package Variables */
@@ -125,10 +126,10 @@ H5FL_EXTERN(H5D_chunk_info_t);
H5FL_BLK_EXTERN(type_conv);
/* Disable warning for intentional identical branches here -QAK */
-H5_GCC_DIAG_OFF(larger - than =)
+H5_GCC_DIAG_OFF("larger-than=")
/* Define a static "default" dataset structure to use to initialize new datasets */
static H5D_shared_t H5D_def_dset;
-H5_GCC_DIAG_ON(larger - than =)
+H5_GCC_DIAG_ON("larger-than=")
/* Dataset ID class */
static const H5I_class_t H5I_DATASET_CLS[1] = {{
@@ -197,6 +198,9 @@ H5D__init_package(void)
/* Reset the "default dataset" information */
HDmemset(&H5D_def_dset, 0, sizeof(H5D_shared_t));
+ H5D_def_dset.type_id = H5I_INVALID_HID;
+ H5D_def_dset.dapl_id = H5I_INVALID_HID;
+ H5D_def_dset.dcpl_id = H5I_INVALID_HID;
/* Get the default dataset creation property list values and initialize the
* default dataset with them.
@@ -340,11 +344,6 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
done:
- /* XXX: (MSC) Weird thing for datasets and filters:
- * Always decrement the ref count on the VOL for datasets, since
- * the ID is removed even if the close fails.
- */
-
/* Free the VOL object */
if (H5VL_free_object(dset_vol_obj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object");
@@ -721,7 +720,7 @@ H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
HDassert(file);
HDassert(minimize);
@@ -762,7 +761,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
size_t get_value = 0;
size_t ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
HDassert(file);
HDassert(dset);
@@ -880,13 +879,13 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc)
size_t ohdr_size = 0;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
HDassert(file);
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")
@@ -895,7 +894,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:
@@ -924,8 +923,8 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
- hbool_t minimize_header = FALSE;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t use_minimized_header = FALSE; /* Flag to use minimized dataset object headers */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -995,13 +994,13 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
} /* end if */
- if (H5D__use_minimized_dset_headers(file, &minimize_header) == FAIL)
+ if (H5D__use_minimized_dset_headers(file, &use_minimized_header) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings")
- if (TRUE == minimize_header) {
+ 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")
- }
+ } /* 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
@@ -1012,7 +1011,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
/* Create an object header for the dataset */
if (H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
- } /* If use minimum/standard object header space */
+ } /* if using default/minimized object headers */
HDassert(file == dset->oloc.file);
@@ -1143,17 +1142,19 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **
if (H5F_PREFIX_VDS == prefix_type) {
prefix = H5D_prefix_vds_env;
- if (prefix == NULL || *prefix == '\0')
+ if (prefix == NULL || *prefix == '\0') {
if (H5CX_get_vds_prefix(&prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file")
- } /* end if */
+ }
+ }
else if (H5F_PREFIX_EFILE == prefix_type) {
prefix = H5D_prefix_ext_env;
- if (prefix == NULL || *prefix == '\0')
+ if (prefix == NULL || *prefix == '\0') {
if (H5CX_get_ext_file_prefix(&prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file")
- } /* end else-if */
+ }
+ }
else
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible")
@@ -1257,6 +1258,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t
/* Initialize the shared dataset space */
if (NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
/* Copy & initialize datatype for dataset */
if (H5D__init_type(file, new_dset, type_id, type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype")
@@ -1270,18 +1272,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t
/* 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)))
@@ -1305,9 +1313,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t
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)
@@ -1380,7 +1390,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t
ret_value = new_dset;
done:
- if (!ret_value && new_dset && new_dset->shared) {
+ if (!ret_value && new_dset) {
if (new_dset->shared) {
if (layout_init)
if (new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset) < 0)
@@ -1399,8 +1409,18 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info")
if (new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
- if (new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+
+ if (new_dset->shared->type) {
+ if (new_dset->shared->type_id > 0) {
+ if (H5I_dec_ref(new_dset->shared->type_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+ } /* end if */
+ else {
+ if (H5T_close_real(new_dset->shared->type) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
+ } /* end else */
+ } /* end if */
+
if (H5F_addr_defined(new_dset->oloc.addr)) {
if (H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL,
@@ -2008,7 +2028,7 @@ H5D_close(H5D_t *dataset)
if (H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
- /* Release datatype, dataspace and creation and access property lists -- there isn't
+ /* Release datatype, dataspace, and creation and access property lists -- there isn't
* much we can do if one of these fails, so we just continue.
*/
free_failed |=
@@ -2268,7 +2288,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb
* We assume that external storage is already
* allocated by the caller, or at least will be before I/O is performed.
*/
- if (!(H5S_NULL == H5S_GET_EXTENT_TYPE(dset->shared->space) || dset->shared->dcpl_cache.efl.nused > 0)) {
+ if (!(0 == H5S_GET_EXTENT_NPOINTS(dset->shared->space) || dset->shared->dcpl_cache.efl.nused > 0)) {
/* Get a pointer to the dataset's layout information */
layout = &(dset->shared->layout);
@@ -2542,7 +2562,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__get_offset
*
- * Purpose: Private function for H5D__get_offset. Returns the address
+ * Purpose: Private function for H5Dget_offset(). Returns the address
* of dataset in file.
*
* Return: Success: The address of dataset
@@ -2936,13 +2956,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 30570af..355aec1 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -140,7 +140,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
@@ -173,9 +173,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_i
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
- /* Set DXPL for operation */
- H5CX_set_dxpl(dxpl_id);
-
/* Read the data */
if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf,
H5_REQUEST_NULL)) < 0)
@@ -222,9 +219,6 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
- /* Set DXPL for operation */
- H5CX_set_dxpl(dxpl_id);
-
/* Read the raw chunk */
if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset,
filters, buf) < 0)
@@ -258,7 +252,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
@@ -291,9 +285,6 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
- /* Set DXPL for operation */
- H5CX_set_dxpl(dxpl_id);
-
/* Write the data */
if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf,
H5_REQUEST_NULL)) < 0)
@@ -347,9 +338,6 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
- /* Set DXPL for operation */
- H5CX_set_dxpl(dxpl_id);
-
/* Write chunk */
if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters,
offset, data_size_32, buf) < 0)
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 7f4e5cf..c02b89e 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -503,6 +503,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
H5HL_t * heap; /* Pointer to local heap for EFL file names */
size_t heap_size = H5HL_ALIGN(1);
size_t u;
+ size_t name_offset;
/* Determine size of heap needed to stored the file names */
for (u = 0; u < efl->nused; ++u)
@@ -517,24 +518,22 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
+ if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
for (u = 0; u < efl->nused; ++u) {
- size_t offset; /* Offset of file name in heap */
-
/* Insert file name into heap */
- if (UFAIL ==
- (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
+ if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) <
+ 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
/* Store EFL file name offset */
- efl->slot[u].name_offset = offset;
- } /* end for */
+ efl->slot[u].name_offset = name_offset;
+ }
/* Release the heap */
if (H5HL_unprotect(heap) < 0)
@@ -547,11 +546,11 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
} /* end if */
/* Create layout message */
- /* (Don't make layout message constant unless allocation time is early and non-filtered, since space may
- * not be allocated) */
+ /* (Don't make layout message constant unless allocation time is early and
+ * non-filtered and has >0 elements, since space may not be allocated -QAK) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type &&
- !dset->shared->dcpl_cache.pline.nused)
+ !dset->shared->dcpl_cache.pline.nused && (0 != H5S_GET_EXTENT_NPOINTS(dset->shared->space)))
layout_mesg_flags = H5O_MSG_FLAG_CONSTANT;
else
layout_mesg_flags = 0;
@@ -579,13 +578,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -673,13 +672,13 @@ done:
/*-------------------------------------------------------------------------
* 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 9bc0218..595c714 100644
--- a/src/H5Dmodule.h
+++ b/src/H5Dmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5D package. Including this header means that the source file
* is part of the H5D package.
*/
-#ifndef _H5Dmodule_H
-#define _H5Dmodule_H
+#ifndef H5Dmodule_H
+#define H5Dmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,37 @@
#define H5_MY_PKG_ERR H5E_DATASET
#define H5_MY_PKG_INIT YES
-#endif /* _H5Dmodule_H */
+/**\defgroup H5D H5D
+ *
+ * Use the functions in this module to manage HDF5 datasets, including the
+ * transfer of data between memory and disk and the description of dataset
+ * properties. Datasets are used by other HDF5 APIs and referenced either by
+ * name or by a handle. Such handles can be obtained by either creating or
+ * opening the dataset.
+ *
+ * Typical stages in the HDF5 dataset life cycle are shown below in introductory
+ * examples.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5D_examples.c create
+ * </td>
+ * <td>
+ * \snippet H5D_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5D_examples.c update
+ * </td>
+ * <td>
+ * \snippet H5D_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ */
+
+#endif /* H5Dmodule_H */
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 6cfc70e..752c144 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -410,7 +410,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, co
* collective I/O
*/
if (MPI_SUCCESS !=
- (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ (mpi_code = MPI_Allreduce(local_cause, global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
@@ -1091,7 +1091,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
#ifdef H5D_DEBUG
if (H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "total_chunks = %Zu, num_chunk = %Zu\n", total_chunks, num_chunk);
+ HDfprintf(H5DEBUG(D), "total_chunks = %zu, num_chunk = %zu\n", total_chunks, num_chunk);
#endif
/* Set up MPI datatype for chunks selected */
@@ -1571,7 +1571,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
chunk_addr = (haddr_t *)H5MM_calloc(total_chunk * sizeof(haddr_t));
#ifdef H5D_DEBUG
if (H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "total_chunk %Zu\n", total_chunk);
+ HDfprintf(H5DEBUG(D), "total_chunk %zu\n", total_chunk);
#endif
/* Obtain IO option for each chunk */
@@ -1605,7 +1605,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
#ifdef H5D_DEBUG
if (H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "mpi_rank = %d, chunk index = %Zu\n", mpi_rank, u);
+ HDfprintf(H5DEBUG(D), "mpi_rank = %d, chunk index = %zu\n", mpi_rank, u);
#endif
/* Get the chunk info for this chunk, if there are elements selected */
chunk_info = fm->select_chunk[u];
@@ -1625,7 +1625,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
if (chunk_io_option[u] == H5D_CHUNK_IO_MODE_COL) {
#ifdef H5D_DEBUG
if (H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "inside collective chunk IO mpi_rank = %d, chunk index = %Zu\n",
+ HDfprintf(H5DEBUG(D), "inside collective chunk IO mpi_rank = %d, chunk index = %zu\n",
mpi_rank, u);
#endif
@@ -1664,7 +1664,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
else { /* possible independent IO for this chunk */
#ifdef H5D_DEBUG
if (H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "inside independent IO mpi_rank = %d, chunk index = %Zu\n", mpi_rank,
+ HDfprintf(H5DEBUG(D), "inside independent IO mpi_rank = %d, chunk index = %zu\n", mpi_rank,
u);
#endif
@@ -3361,7 +3361,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 a49f3fe..b2dfd1a 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
+/* Programmer: Vailin Choi
* September 2010
*
* Purpose: Implicit (Non Index) chunked I/O functions.
@@ -470,7 +470,7 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_dump() */
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 2c72a64..f6245d5 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index a156d53..64f2c7a 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Monday, April 14, 2003
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5D package!"
#endif
-#ifndef _H5Dpkg_H
-#define _H5Dpkg_H
+#ifndef H5Dpkg_H
+#define H5Dpkg_H
/* Get package's private header */
#include "H5Dprivate.h"
@@ -569,7 +569,6 @@ 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);
@@ -632,7 +631,8 @@ H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata);
H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
-H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite,
+ const hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
@@ -740,4 +740,4 @@ H5_DLL herr_t H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type);
H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused);
#endif /* H5D_TESTING */
-#endif /*_H5Dpkg_H*/
+#endif /*H5Dpkg_H*/
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 6a130b6..f9ef772 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5D module
*/
-#ifndef _H5Dprivate_H
-#define _H5Dprivate_H
+#ifndef H5Dprivate_H
+#define H5Dprivate_H
/* Include package's public header */
#include "H5Dpublic.h"
@@ -186,4 +186,4 @@ H5_DLL herr_t H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_
H5_DLL herr_t H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, unsigned ndims,
const uint32_t *dim);
-#endif /* _H5Dprivate_H */
+#endif /* H5Dprivate_H */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 6a85a95..b73e62d 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5D module.
*/
-#ifndef _H5Dpublic_H
-#define _H5Dpublic_H
+#ifndef H5Dpublic_H
+#define H5Dpublic_H
/* System headers needed by this file */
@@ -39,30 +39,41 @@
/* Public Typedefs */
/*******************/
-/* Values for the H5D_LAYOUT property */
+//! <!-- [H5D_layout_t_snip] -->
+/**
+ * Values for the H5D_LAYOUT property
+ */
typedef enum H5D_layout_t {
H5D_LAYOUT_ERROR = -1,
- H5D_COMPACT = 0, /*raw data is very small */
- H5D_CONTIGUOUS = 1, /*the default */
- H5D_CHUNKED = 2, /*slow and fancy */
- H5D_VIRTUAL = 3, /*actual data is stored in other datasets */
- H5D_NLAYOUTS = 4 /*this one must be last! */
+ H5D_COMPACT = 0, /**< raw data is very small */
+ H5D_CONTIGUOUS = 1, /**< the default */
+ H5D_CHUNKED = 2, /**< slow and fancy */
+ H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
+ H5D_NLAYOUTS = 4 /**< this one must be last! */
} H5D_layout_t;
+//! <!-- [H5D_layout_t_snip] -->
-/* Types of chunk index data structures */
+//! <!-- [H5D_chunk_index_t_snip] -->
+/**
+ * Types of chunk index data structures
+ */
typedef enum H5D_chunk_index_t {
- H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */
+ H5D_CHUNK_IDX_BTREE = 0, /**< v1 B-tree index (default) */
H5D_CHUNK_IDX_SINGLE =
- 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */
- H5D_CHUNK_IDX_NONE = 2, /* Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */
- H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */
- H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */
- H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */
- H5D_CHUNK_IDX_NTYPES /* This one must be last! */
+ 1, /**< Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */
+ H5D_CHUNK_IDX_NONE = 2, /**< Implicit: No Index (#H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */
+ H5D_CHUNK_IDX_FARRAY = 3, /**< Fixed array (for 0 unlimited dims) */
+ H5D_CHUNK_IDX_EARRAY = 4, /**< Extensible array (for 1 unlimited dim) */
+ H5D_CHUNK_IDX_BT2 = 5, /**< v2 B-tree index (for >1 unlimited dims) */
+ H5D_CHUNK_IDX_NTYPES /**< This one must be last! */
} H5D_chunk_index_t;
+//! <!-- [H5D_chunk_index_t_snip] -->
-/* Values for the space allocation time property */
+//! <!-- [H5D_alloc_time_t_snip] -->
+/**
+ * Values for the space allocation time property
+ */
typedef enum H5D_alloc_time_t {
H5D_ALLOC_TIME_ERROR = -1,
H5D_ALLOC_TIME_DEFAULT = 0,
@@ -70,51 +81,84 @@ typedef enum H5D_alloc_time_t {
H5D_ALLOC_TIME_LATE = 2,
H5D_ALLOC_TIME_INCR = 3
} H5D_alloc_time_t;
+//! <!-- [H5D_alloc_time_t_snip] -->
-/* Values for the status of space allocation */
+//! <!-- [H5D_space_status_t_snip] -->
+/**
+ * Values for the status of space allocation
+ */
typedef enum H5D_space_status_t {
H5D_SPACE_STATUS_ERROR = -1,
H5D_SPACE_STATUS_NOT_ALLOCATED = 0,
H5D_SPACE_STATUS_PART_ALLOCATED = 1,
H5D_SPACE_STATUS_ALLOCATED = 2
} H5D_space_status_t;
+//! <!-- [H5D_space_status_t_snip] -->
-/* Values for time of writing fill value property */
+//! <!-- [H5D_fill_time_t_snip] -->
+/**
+ * Values for time of writing fill value property
+ */
typedef enum H5D_fill_time_t {
H5D_FILL_TIME_ERROR = -1,
H5D_FILL_TIME_ALLOC = 0,
H5D_FILL_TIME_NEVER = 1,
H5D_FILL_TIME_IFSET = 2
} H5D_fill_time_t;
+//! <!-- [H5D_fill_time_t_snip] -->
-/* Values for fill value status */
+//! <!-- [H5D_fill_value_t_snip] -->
+/**
+ * Values for fill value status
+ */
typedef enum H5D_fill_value_t {
H5D_FILL_VALUE_ERROR = -1,
H5D_FILL_VALUE_UNDEFINED = 0,
H5D_FILL_VALUE_DEFAULT = 1,
H5D_FILL_VALUE_USER_DEFINED = 2
} H5D_fill_value_t;
+//! <!-- [H5D_fill_value_t_snip] -->
-/* Values for VDS bounds option */
+//! <!-- [H5D_vds_view_t_snip] -->
+/**
+ * Values for VDS bounds option
+ */
typedef enum H5D_vds_view_t {
H5D_VDS_ERROR = -1,
H5D_VDS_FIRST_MISSING = 0,
H5D_VDS_LAST_AVAILABLE = 1
} H5D_vds_view_t;
+//! <!-- [H5D_vds_view_t_snip] -->
-/* Callback for H5Pset_append_flush() in a dataset access property list */
+//! <!-- [H5D_append_cb_t_snip] -->
+/**
+ * Callback for H5Pset_append_flush() in a dataset access property list
+ */
typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data);
+//! <!-- [H5D_append_cb_t_snip] -->
-/* Define the operator function pointer for H5Diterate() */
+//! <!-- [H5D_operator_t_snip] -->
+/**
+ * Define the operator function pointer for H5Diterate()
+ */
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
void *operator_data);
+//! <!-- [H5D_operator_t_snip] -->
-/* Define the operator function pointer for H5Dscatter() */
+//! <!-- [H5D_scatter_func_t_snip] -->
+/**
+ * Define the operator function pointer for H5Dscatter()
+ */
typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/,
void *op_data);
+//! <!-- [H5D_scatter_func_t_snip] -->
-/* Define the operator function pointer for H5Dgather() */
+//! <!-- [H5D_gather_func_t_snip] -->
+/**
+ * Define the operator function pointer for H5Dgather()
+ */
typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_used, void *op_data);
+//! <!-- [H5D_gather_func_t_snip] -->
/********************/
/* Public Variables */
@@ -127,45 +171,1269 @@ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_us
extern "C" {
#endif
-H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id,
- hid_t dcpl_id, hid_t dapl_id);
-H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id, hid_t plist_id, hid_t dapl_id);
-H5_DLL hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id);
-H5_DLL herr_t H5Dclose(hid_t dset_id);
-H5_DLL hid_t H5Dget_space(hid_t dset_id);
-H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
-H5_DLL hid_t H5Dget_type(hid_t dset_id);
-H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
-H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Creates a new dataset and links it into the file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the dataset to create
+ * \type_id
+ * \space_id
+ * \lcpl_id
+ * \dcpl_id
+ * \dapl_id
+ *
+ * \return \hid_t{dataset}
+ *
+ * \details H5Dcreate2() creates a new dataset named \p name at
+ * the location specified by \p loc_id, and associates constant
+ * and initial persistent properties with that dataset, including
+ * the datatype \p dtype_id, the dataspace \p space_id, and
+ * other properties as specified by the dataset creation property
+ * list \p dcpl_id and the access property list \p dapl_id,
+ * respectively. Once created, the dataset is opened for access.
+ *
+ * \p loc_id may specify a file, group, dataset, named datatype,
+ * or attribute. If an attribute, dataset, or named datatype is
+ * specified then the dataset will be created at the location
+ * where the attribute, dataset, or named datatype is attached.
+ *
+ * \p name may be either an absolute path in the file or a relative
+ * path from \p loc_id naming the dataset.
+ *
+ * \p dtype_id specifies the datatype of each data element as stored
+ * in the file. If \p dtype_id is either a fixed-length or
+ * variable-length string, it is important to set the string length
+ * when defining the datatype. String datatypes are derived from
+ * #H5T_C_S1 (or #H5T_FORTRAN_S1 for Fortran codes), which defaults
+ * to 1 character in size.
+ *
+ * If \p dtype_id is a committed datatype, and if the file location
+ * associated with the committed datatype is different from the
+ * file location where the dataset will be created, the datatype
+ * is copied and converted to a transient type.
+ *
+ * The link creation property list, \p lcpl_id, governs creation
+ * of the link(s) by which the new dataset is accessed and the
+ * creation of any * intermediate groups that may be missing.
+ *
+ * The datatype and dataspace properties and the dataset creation
+ * and access property lists are attached to the dataset, so the
+ * caller may derive new datatypes, dataspaces, and creation and
+ * access properties from the old ones and reuse them in calls to
+ * create additional datasets. Once created, the dataset can be
+ * read from or written to. Reading data from a datatset that was
+ * not previously written, the HDF5 library will return default
+ * or user-defined fill values.
+ *
+ * To conserve and release resources, the dataset should be closed
+ * when access is no longer required.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Dopen2(), H5Dclose(), H5Tset_size()
+ *
+ */
+H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id,
+ hid_t dcpl_id, hid_t dapl_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Creates a dataset in a file without linking it into the file
+ * structure
+ *
+ * \fgdta_loc_id
+ * \type_id
+ * \space_id
+ * \dcpl_id
+ * \dapl_id
+ *
+ * \return \hid_t{dataset}
+ *
+ * \details H5Dcreate_anon() creates a dataset in the file specified
+ * by \p loc_id.
+ *
+ * \p loc_id may specify a file, group, dataset, named datatype,
+ * or attribute. If an attribute, dataset, or named datatype is
+ * specified then the dataset will be created at the location
+ * where the attribute, dataset, or named datatype is attached.
+ *
+ * The dataset’s datatype and dataspace are specified by
+ * \p type_id and \p space_id, respectively. These are the
+ * datatype and dataspace of the dataset as it will exist in
+ * the file, which may differ from the datatype and dataspace
+ * in application memory.
+ *
+ * Dataset creation property list and dataset access creation
+ * property list are specified by \p dcpl_id and \p dapl_id.
+ *
+ * H5Dcreate_anon() returns a new dataset identifier. Using
+ * this identifier, the new dataset must be linked into the
+ * HDF5 file structure with H5Olink() or it will be deleted
+ * from the file when the file is closed.
+ *
+ * See H5Dcreate2() for further details and considerations on
+ * the use of H5Dcreate2() and H5Dcreate_anon().
+ *
+ * The differences between this function and H5Dcreate2() are
+ * as follows:
+ * \li H5Dcreate_anon() explicitly includes a dataset access property
+ * list. H5Dcreate() always uses default dataset access properties.
+ *
+ * \li H5Dcreate_anon() neither provides the new dataset’s name nor
+ * links it into the HDF5 file structure; those actions must be
+ * performed separately through a call to H5Olink(), which offers
+ * greater control over linking.
+ *
+ * A dataset created with this function should be closed with
+ * H5Dclose() when the dataset is no longer needed so that resource
+ * leaks will not develop.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Olink(), H5Dcreate(), Using Identifiers
+ *
+ */
+H5_DLL hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Creates a new dataset and links it into the file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the dataset to open
+ * \dapl_id
+ *
+ * \return \hid_t{dataset}
+ *
+ * \details H5Dopen2() opens the existing dataset specified
+ * by a location identifier and name, \p loc_id and \p name,
+ * respectively.
+ *
+ * \p loc_id may specify a file, group, dataset, named datatype,
+ * or attribute. If an attribute, dataset, or named datatype is
+ * specified then the dataset will be opened at the location
+ * where the attribute, dataset, or named datatype is attached.
+ *
+ * The dataset access property list, \p dapl_id, provides
+ * information regarding access to the dataset.
+ *
+ * To conserve and release resources, the dataset should be closed
+ * when access is no longer required.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Dcreate2(), H5Dclose()
+ *
+ */
+H5_DLL hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id);
+
+/**
+ * --------------------------------------------------------------------------
+ *\ingroup H5D
+ *
+ * \brief Returns an identifier for a copy of the dataspace for a dataset
+ *
+ * \dset_id
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details H5Dget_space() makes a copy of the dataspace of
+ * the dataset specified by \p dset_id. The function returns an
+ * identifier for the new copy of the dataspace.
+ *
+ * A dataspace identifier returned from this function should
+ * be released with H5Sclose() when the identifier is no longer
+ * needed so that resource leaks will not occur.
+ *
+ * \see H5Sclose()
+ *
+ */
+H5_DLL hid_t H5Dget_space(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ * \todo Document this function!
+ */
+H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns an identifier for a copy of the datatype for a dataset
+ *
+ * \dset_id
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Dget_type() returns an identifier of a copy of
+ * the datatype for a dataset.
+ *
+ * If a dataset has a named datatype, then an identifier to the
+ * opened datatype is returned. Otherwise, the returned datatype
+ * is read-only. If atomization of the datatype fails, then the
+ * datatype is closed.
+ *
+ * A datatype identifier returned from this function should be
+ * released with H5Tclose() when the identifier is no longer
+ * needed to prevent resource leaks.
+ *
+ * \note Datatype Identifiers
+ *
+ * Please note that the datatype identifier is actually an object
+ * identifier or a handle returned from opening the datatype. It
+ * is not persistent and its value can be different from one HDF5
+ * session to the next.
+ *
+ * H5Tequal() can be used to compare datatypes.
+ *
+ * HDF5 High Level APIs that may also be of interest are:
+ *
+ * H5LTdtype_to_text() creates a text description of a
+ * datatype. H5LTtext_to_dtype() creates an HDF5 datatype
+ * given a text description.
+ *
+ */
+H5_DLL hid_t H5Dget_type(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns an identifier for a copy of the dataset creation
+ * property list for a dataset
+ *
+ * \dset_id
+ *
+ * \return \hid_t{dataset creation property list}
+ *
+ * \details H5Dget_create_plist() returns an identifier for
+ * a copy of the dataset creation property list associated with
+ * the dataset specified by \p dset_id.
+ *
+ * The creation property list identifier should be released
+ * with H5Pclose() to prevent resource leaks.
+ *
+ */
+H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns the dataset access property list associated with
+ * a dataset
+ *
+ * \dset_id
+ *
+ * \return \hid_t{dataset access property list}
+ *
+ * \details H5Dget_access_plist() returns a copy of the
+ * dataset access property list used to open the specified
+ * dataset, \p dset_id. Modifications to the returned property
+ * list will have no effect on the dataset it was retrieved from.
+ *
+ * The chunk cache parameters in the returned property lists will
+ * be those used by the dataset. If the properties in the file
+ * access property list were used to determine the dataset's
+ * chunk cache configuration, then those properties will be
+ * present in the returned dataset access property list. If
+ * the dataset does not use a chunked layout, then the chunk
+ * cache properties will be set to the default. The chunk cache
+ * properties in the returned list are considered to be “set”,
+ * and any use of this list will override the corresponding
+ * properties in the file’s file access property list.
+ *
+ * All link access properties in the returned list will be set
+ * to the default values.
+ *
+ * The access property list identifier should be released with
+ * H5Pclose() when the identifier is no longer needed so that
+ * resource leaks will not develop.
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns the amount of storage allocated for a dataset
+ *
+ * \dset_id
+ *
+ * \return Returns the amount of storage space, in bytes, or 0 (zero).
+ *
+ * \details H5Dget_storage_size() returns the amount of storage,
+ * in bytes, that is allocated in the file for the raw data of
+ * the dataset specified by \p dset_id.
+ *
+ * \note The amount of storage in this case is the storage
+ * allocated in the written file, which will typically differ
+ * from the space required to hold a dataset in working memory.
+ *
+ * \li For contiguous datasets, the returned size equals the current
+ * allocated size of the raw data.
+ * \li For unfiltered chunked datasets, the returned size is the
+ * number of allocated chunks times the chunk size.
+ * \li For filtered chunked datasets, the returned size is the
+ * space required to store the filtered data. For example, if a
+ * compression filter is in use, H5Dget_storage_size() will return
+ * the total space required to store the compressed chunks.
+ *
+ * H5Dget_storage_size() reports only the space required to store
+ * the data, not including that of any metadata.
+ *
+ * \attention H5Dget_storage_size() does not differentiate between 0 (zero),
+ * the value returned for the storage size of a dataset
+ * with no stored values, and 0 (zero), the value returned to
+ * indicate an error.
+ *
+ * \note Note that H5Dget_storage_size() is not generally an
+ * appropriate function to use when determining the amount
+ * of memory required to work with a dataset. In such
+ * circumstances, you must determine the number of data
+ * points in a dataset and the size of an individual data
+ * element. H5Sget_simple_extent_npoints() and H5Tget_size()
+ * can be used to get that information.
+ *
+ */
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
-H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
-H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
-H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask,
- haddr_t *addr, hsize_t *size);
-H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord,
- unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns the amount of storage allocated within the file for a
+ * raw data chunk in a dataset
+ *
+ * \dset_id
+ * \param[in] offset Logical offset in the dataset for the chunk to query
+ * \param[out] chunk_bytes The size in bytes for the chunk
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_chunk_storage_size() returns the size in bytes
+ * allocated in the file for a raw data chunk as specified by
+ * its logical \p offset in the dataset \p dset_id. The size is
+ * returned in \p chunk_nbytes. It is the size of the compressed
+ * data if the chunk is filtered and the size may be zero if no
+ * storage is allocated yet for the dataset.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Retrieves number of chunks that have nonempty intersection with a
+ * specified selection
+ *
+ * \dset_id
+ * \param[in] fspace_id File dataspace selection identifier
+ * \param[out] nchunks Number of chunks in the selection
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_num_chunks() retrieves the number of chunks
+ * nchunks in a set of selected elements specified by \p fspace_id
+ * for a dataset specified by the identifier \p dset_id. If \p
+ * fspace_id is #H5S_ALL, the function will retrieve the total
+ * number of chunks stored for the dataset.
+ *
+ * \p fspace_id specifies the file dataspace selection. It is
+ * intended to take #H5S_ALL for specifying the current selection.
+ *
+ * \note Please be aware that this function currently does not
+ * support non-trivial selections, thus \p fspace_id has no
+ * effect. Also, the implementation does not handle the #H5S_ALL
+ * macro correctly. As a workaround, application can get
+ * the dataspace for the dataset using H5Dget_space() and pass that
+ * in for \p fspace_id. This will be fixed in coming releases.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Retrieves information about a chunk specified by its coordinates
+ *
+ * \dset_id
+ * \param[in] offset Logical position of the chunk’s first element
+ * \param[out] filter_mask Indicating filters used with the chunk when written
+ * \param[out] addr Chunk address in the file
+ * \param[out] size Chunk size in bytes, 0 if chunk doesn’t exist
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_chunk_info_by_coord() retrieves the \p filter_mask, \p size,
+ * and \p addr for a chunk in the dataset specified by \p dset_id,
+ * using the coordinates specified by \p offset.
+ *
+ * If the queried chunk does not exist in the file, \p size will
+ * be set to 0, \p addr to \c HADDR_UNDEF, and the buffer \p
+ * filter_mask will not be modified.
+ *
+ * \p offset is a pointer to a one-dimensional array with a size
+ * equal to the dataset’s rank. Each element is the logical
+ * position of the chunk’s first element in a dimension.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask,
+ haddr_t *addr, hsize_t *size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Retrieves information about a chunk specified by its index
+ *
+ * \dset_id
+ * \param[in] fspace_id File dataspace selection identifier (See Note below)
+ * \param[in] chk_idx Index of the chunk
+ * \param[out] offset Logical position of the chunk’s first element
+ * \param[out] filter_mask Indicating filters used with the chunk when written
+ * \param[out] addr Chunk address in the file
+ * \param[out] size Chunk size in bytes, 0 if chunk doesn’t exist
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_chunk_info() retrieves the offset coordinates
+ * offset, filter mask filter_mask, size size and address addr for
+ * the dataset specified by the identifier dset_id and the chunk
+ * specified by the index index. The chunk belongs to a set of
+ * chunks in the selection specified by fspace_id. If the queried
+ * chunk does not exist in the file, the size will be set to 0 and
+ * address to \c HADDR_UNDEF. The value pointed to by filter_mask will
+ * not be modified. NULL can be passed in for any \p out parameters.
+ *
+ * \p chk_idx is the chunk index in the selection. Index value
+ * may have a value of 0 up to the number of chunks stored in
+ * the file that have a nonempty intersection with the file
+ * dataspace selection
+ *
+ * \note As of 1.10.5, the dataspace intersection is not yet
+ * supported, hence, the index is of all the written chunks.
+ *
+ * \p fspace_id specifies the file dataspace selection. It is
+ * intended to take #H5S_ALL for specifying the current selection.
+ *
+ * \note Please be aware that this function currently does not
+ * support non-trivial selections, thus \p fspace_id has no
+ * effect. Also, the implementation does not handle the #H5S_ALL
+ * macro correctly. As a workaround, application can get
+ * the dataspace for the dataset using H5Dget_space() and pass that
+ * in for \p fspace_id. This will be fixed in coming releases.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *offset,
+ unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Returns dataset address in file
+ *
+ * \dset_id
+ *
+ * \return Returns the offset in bytes; otherwise, returns \c HADDR_UNDEF,
+ * a negative value.
+ *
+ * \details H5Dget_offset() returns the address in the file of
+ * the dataset, \p dset_id. That address is expressed as the
+ * offset in bytes from the beginning of the file.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
-H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t plist_id, void *buf /*out*/);
-H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t plist_id, const void *buf);
-H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
- size_t data_size, const void *buf);
-H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
- void *buf);
-H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data);
-H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
-H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, hid_t buf_type, hid_t space);
-H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
-H5_DLL herr_t H5Dflush(hid_t dset_id);
-H5_DLL herr_t H5Drefresh(hid_t dset_id);
-H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id,
- void *dst_buf);
-H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size,
- void *dst_buf, H5D_gather_func_t op, void *op_data);
-H5_DLL herr_t H5Ddebug(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Reads raw data from a dataset into a provided buffer
+ *
+ * \dset_id Identifier of the dataset to read from
+ * \param[in] mem_type_id Identifier of the memory datatype
+ * \param[in] mem_space_id Identifier of the memory dataspace
+ * \param[in] file_space_id Identifier of the dataset's dataspace in the file
+ * \param[in] dxpl_id Identifier of a transfer property list
+ * \param[out] buf Buffer to receive data read from file
+ *
+ * \return \herr_t
+ *
+ * \details H5Dread() reads a dataset, specified by its identifier
+ * \p dset_id, from the file into an application memory buffer \p
+ * buf. Data transfer properties are defined by the argument \p
+ * dxpl_id. The memory datatype of the (partial) dataset
+ * is identified by the identifier \p mem_type_id. The part
+ * of the dataset to read is defined by \p mem_space_id and \p
+ * file_space_id.
+ *
+ * \p file_space_id is used to specify only the selection within
+ * the file dataset's dataspace. Any dataspace specified in \p
+ * file_space_id is ignored by the library and the dataset's
+ * dataspace is always used. \p file_space_id can be the constant
+ * #H5S_ALL, which indicates that the entire file dataspace,
+ * as defined by the current dimensions of the dataset, is to
+ * be selected.
+ *
+ * \p mem_space_id is used to specify both the memory dataspace
+ * and the selection within that dataspace. \p mem_space_id can
+ * be the constant #H5S_ALL, in which case the file dataspace is
+ * used for the memory dataspace and the selection defined with \p
+ * file_space_id is used for the selection within that dataspace.
+ *
+ * If raw data storage space has not been allocated for the dataset
+ * and a fill value has been defined, the returned buffer \p buf
+ * is filled with the fill value.
+ *
+ * The behavior of the library for the various combinations of
+ * valid dataspace identifiers and #H5S_ALL for the \p mem_space_id
+ * and the \p file_space_id parameters is described below:
+ *
+ * <table>
+ * <tr>
+ * <th>mem_space_id</th>
+ * <th>file_space_id</th>
+ * <th>Behavior</th>
+ * </tr>
+ * <tr>
+ * <td>valid dataspace ID</td>
+ * <td>valid dataspace ID</td>
+ * <td>\p mem_space_id specifies the memory dataspace and the
+ * selection within it. \p file_space_id specifies the
+ * selection within the file dataset's dataspace.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_ALL</td>
+ * <td>valid dataspace ID</td>
+ * <td>The file dataset's dataspace is used for the memory
+ * dataspace and the selection specified with \p file_space_id
+ * specifies the selection within it. The combination of the
+ * file dataset's dataspace and the selection from
+ * \p file_space_id is used for memory also.</td>
+ * </tr>
+ * <tr>
+ * <td>valid dataspace ID</td>
+ * <td>#H5S_ALL</td>
+ * <td>\p mem_space_id specifies the memory dataspace and the
+ * selection within it. The selection within the file
+ * dataset's dataspace is set to the "all" selection.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_ALL</td>
+ * <td>#H5S_ALL</td>
+ * <td>The file dataset's dataspace is used for the memory
+ * dataspace and the selection within the memory dataspace
+ * is set to the "all" selection. The selection within the
+ * file dataset's dataspace is set to the "all" selection.</td>
+ * </tr>
+ * </table>
+ *
+ * \details Setting an #H5S_ALL selection indicates that the entire
+ * dataspace, as defined by the current dimensions of a dataspace,
+ * will be selected. The number of elements selected in the memory
+ * dataspace must match the number of elements selected in the
+ * file dataspace.
+ *
+ * \p dxpl_id can be the constant #H5P_DEFAULT, in which case the
+ * default data transfer properties are used.
+ *
+ */
+H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t dxpl_id, void *buf /*out*/);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Writes raw data from a buffer to a dataset
+ *
+ * \param[in] dset_id Identifier of the dataset to read from
+ * \param[in] mem_type_id Identifier of the memory datatype
+ * \param[in] mem_space_id Identifier of the memory dataspace
+ * \param[in] file_space_id Identifier of the dataset's dataspace in the file
+ * \dxpl_id
+ * \param[out] buf Buffer with data to be written to the file
+ *
+ * \return \herr_t
+ *
+ * \details H5Dwrite() writes a (partial) dataset, specified by
+ * its identifier \p dset_id, from the application memory buffer \p
+ * buf into the file. Data transfer properties are defined by the
+ * argument \p dxpl_id. The memory datatype of the (partial)
+ * dataset is identified by the identifier \p mem_type_id. The
+ * part of the dataset to write is defined by \p mem_space_id
+ * and \p file_space_id.
+ *
+ * If \p mem_type_id is either a fixed-length or variable-length
+ * string, it is important to set the string length when defining
+ * the datatype. String datatypes are derived from #H5T_C_S1
+ * (or #H5T_FORTRAN_S1 for Fortran codes), which defaults
+ * to 1 character in size. See H5Tset_size() and Creating
+ * variable-length string datatypes.
+ *
+ * \p file_space_id is used to specify only the selection within
+ * the file dataset's dataspace. Any dataspace specified in \p
+ * file_space_id is ignored by the library and the dataset's
+ * dataspace is always used. \p file_space_id can be the constant
+ * #H5S_ALL, which indicates that the entire file dataspace,
+ * as defined by the current dimensions of the dataset, is to
+ * be selected.
+ *
+ * \p mem_space_id is used to specify both the memory dataspace
+ * and the selection within that dataspace. mem_space_id can be
+ * the constant #H5S_ALL, in which case the file dataspace is
+ * used for the memory dataspace and the selection defined with \p
+ * file_space_id is used for the selection within that dataspace.
+ *
+ * The behavior of the library for the various combinations of
+ * valid dataspace IDs and #H5S_ALL for the mem_space_id and
+ * thefile_space_id parameters is described below:
+ *
+ * <table>
+ * <tr><th>\c mem_space_id</th>
+ * <th>\c file_space_id</th>
+ * <th>Behavior</th></tr>
+ * <tr><td>valid dataspace ID</td>
+ * <td>valid dataspace ID</td>
+ * <td>\p mem_space_id specifies the memory dataspace and the
+ * selection within it. \p file_space_id specifies the
+ * selection within the file dataset's dataspace.</td></tr>
+ * <tr><td>#H5S_ALL</td>
+ * <td>valid dataspace ID</td>
+ * <td>The file dataset's dataspace is used for the memory
+ * dataspace and the selection specified with \p file_space_id
+ * specifies the selection within it. The combination of the
+ * file dataset's dataspace and the selection from \p
+ * file_space_id is used for memory also. valid dataspace
+ * ID</td></tr>
+ * <tr><td>valid dataspace ID</td>
+ * <td>#H5S_ALL</td>
+ * <td>\p mem_space_id specifies the memory dataspace and the
+ * selection within it. The selection within the file
+ * dataset's dataspace is set to "all" selection.</td></tr>
+ * <tr><td>#H5S_ALL</td>
+ * <td>#H5S_ALL</td>
+ * <td>The file dataset's dataspace is used for the memory
+ * dataspace and the selection within the memory dataspace is
+ * set to the "all" selection. The selection within the file
+ * dataset's dataspace is set to the "all"
+ * selection.</td></tr>
+ * </table>
+ * Setting an "all" selection indicates that the entire dataspace,
+ * as defined by the current dimensions of a dataspace, will
+ * be selected. The number of elements selected in the memory
+ * dataspace must match the number of elements selected in the
+ * file dataspace.
+ *
+ * \p dxpl_id can be the constant #H5P_DEFAULT, in which
+ * case the default data transfer properties are used.
+ *
+ * Writing to a dataset will fail if the HDF5 file was not opened
+ * with write access permissions.
+ *
+ * If the dataset's space allocation time is set to
+ * #H5D_ALLOC_TIME_LATE or #H5D_ALLOC_TIME_INCR and the space for
+ * the dataset has not yet been allocated, that space is allocated
+ * when the first raw data is written to the dataset. Unused space
+ * in the dataset will be written with fill values at the same
+ * time if the dataset's fill time is set to #H5D_FILL_TIME_IFSET
+ * or #H5D_FILL_TIME_ALLOC.
+ *
+ * \attention If a dataset's storage layout is 'compact', care must be
+ * taken when writing data to the dataset in parallel. A compact
+ * dataset's raw data is cached in memory and may be flushed
+ * to the file from any of the parallel processes, so parallel
+ * applications should always attempt to write identical data to
+ * the dataset from all processes.
+ *
+ * \see H5Pset_fill_time(), H5Pset_alloc_time()
+ *
+ */
+H5_DLL 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);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Writes a raw data chunk from a buffer directly to a dataset in a file
+ *
+ * \dset_id
+ * \dxpl_id
+ * \param[in] filters Mask for identifying the filters in use
+ * \param[in] offset Logical position of the chunk’s first element in the
+ * dataspace
+ * \param[in] data_size Size of the actual data to be written in bytes
+ * \param[in] buf Buffer containing data to be written to the chunk
+ *
+ * \return \herr_t
+ *
+ * \details H5Dwrite_chunk() writes a raw data chunk as specified
+ * by its logical offset \p offset in a chunked dataset \p dset_id
+ * from the application memory buffer \p buf to the dataset in
+ * the file. Typically, the data in \p buf is preprocessed in
+ * memory by a custom transformation, such as compression. The
+ * chunk will bypass the library’s internal data transfer
+ * pipeline, including filters, and will be written directly to
+ * the file. Only one chunk can be written with this function.
+ *
+ * H5Dwrite_chunk() replaces the now deprecated H5DOwrite_chunk()
+ * function, which was located in the high level optimization
+ * library. The parameters and behavior are identical to the
+ * original.
+ *
+ * \p filters is a mask providing a record of which filters are
+ * used with the the chunk. The default value of the mask is
+ * zero (0), indicating that all enabled filters are applied. A
+ * filter is skipped if the bit corresponding to the filter’s
+ * position in the pipeline (0 ≤ position < 32) is turned on.
+ * This mask is saved with the chunk in the file.
+ *
+ * \p offset is an array specifying the logical position of the
+ * first element of the chunk in the dataset’s dataspace. The
+ * length of the offset array must equal the number of dimensions,
+ * or rank, of the dataspace. The values in offset must not exceed
+ * the dimension limits and must specify a point that falls on
+ * a dataset chunk boundary.
+ *
+ * \p data_size is the size in bytes of the chunk, representing
+ * the number of bytes to be read from the buffer \p buf. If the
+ * data chunk has been precompressed, \p data_size should be the
+ * size of the compressed data.
+ *
+ * \p buf is the memory buffer containing data to be written to
+ * the chunk in the file.
+ *
+ * \attention Exercise caution when using H5Dread_chunk() and
+ * H5Dwrite_chunk(), as they read and write data chunks directly
+ * in a file. H5Dwrite_chunk() bypasses hyperslab selection, the
+ * conversion of data from one datatype to another, and the filter
+ * pipeline to write the chunk. Developers should have experience
+ * with these processes before using this function. Please see
+ * Using the Direct Chunk Write Function for more information.
+ *
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under
+ * parallel and do not support variable length types.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Reads a raw data chunk directly from a dataset in a file into
+ * a buffer
+ *
+ * \dset_id
+ * \dxpl_id
+ * \param[in] offset Logical position of the chunk’s first element in the
+ * dataspace
+ * \param[in,out] filters Mask for identifying the filters in use
+ * \param[out] buf Buffer containing data to be written to the chunk
+ *
+ * \return \herr_t
+ *
+ * \details H5Dread_chunk() reads a raw data chunk as specified by
+ * its logical offset \p offset in a chunked dataset \p dset_id
+ * from the dataset in the file into the application memory
+ * buffer \p buf. The data in \p buf is read directly from the
+ * file bypassing the library’s internal data transfer pipeline,
+ * including filters.
+ *
+ * \p offset is an array specifying the logical position of the
+ * first element of the chunk in the dataset’s dataspace. The
+ * length of the \p offset array must equal the number of dimensions,
+ * or rank, of the dataspace. The values in \p offset must not exceed
+ * the dimension limits and must specify a point that falls on
+ * a dataset chunk boundary.
+ *
+ * The mask \p filters indicates which filters are used with the
+ * chunk when written. A zero value indicates that all enabled
+ * filters are applied on the chunk. A filter is skipped if the
+ * bit corresponding to the filter’s position in the pipeline
+ * (0 ≤ position < 32) is turned on.
+ *
+ * \p buf is the memory buffer containing the chunk read from
+ * the dataset in the file.
+ *
+ * \attention Exercise caution when using H5Dread_chunk() and
+ * H5Dwrite_chunk(), as they read and write data chunks directly
+ * in a file. H5Dwrite_chunk() bypasses hyperslab selection, the
+ * conversion of data from one datatype to another, and the filter
+ * pipeline to write the chunk. Developers should have experience
+ * with these processes before using this function. Please see
+ * Using the Direct Chunk Write Function for more information.
+ *
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under
+ * parallel and do not support variable length types.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
+ void *buf);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Iterates over all selected elements in a dataspace
+ *
+ * \param[in,out] buf Buffer containing the elements to iterate over
+ * \type_id
+ * \space_id
+ * \param[in] op Function pointer
+ * \param[in,out] operator_data User-defined data
+ *
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \details H5Diterate() iterates over all the data elements
+ * in the memory buffer \p buf, executing the callback function
+ * \p op once for each such data element.
+ *
+ * The prototype of the callback function \p op is as follows
+ * (as defined in the source code file H5Lpublic.h):
+ * \snippet this H5D_operator_t_snip
+ * The parameters of this callback function are:
+ *
+ * <table>
+ * <tr><td>\c elem</td>
+ * <td><tt>[in,out]</tt></td>
+ * <td>Pointer to the memory buffer containing the current
+ * data element</td></tr>
+ * <tr><td>\c type_id</td>
+ * <td><tt>[in]</tt></td>
+ * <td>Datatype identifier of the elements stored in elem</td></tr>
+ * <tr><td>\c ndim</td>
+ * <td><tt>[in]</tt></td>
+ * <td>Number of dimensions for the point array</td></tr>
+ * <tr><td>\c point</td>
+ * <td><tt>[in]</tt></td>
+ * <td>Array containing the location of the element within
+ * the original dataspace</td></tr>
+ * <tr><td>\c operator_data</td>
+ * <td><tt>[in,out]</tt></td>
+ * <td>Pointer to any user-defined data associated with the
+ * operation</td></tr>
+ * </table>
+ *
+ * The possible return values from the callback function, and
+ * the effect ofeach,are as follows:
+ *
+ * \li Zero causes the iterator to continue, returning zero
+ * when all data elements have been processed.
+ * \li A positive value causes the iterator to immediately
+ * return that positive value, indicating short-circuit success.
+ * \li A negative value causes the iterator to immediately return
+ * that value, indicating failure.
+ *
+ * The \p operator_data parameter is a user-defined pointer to
+ * the data required to process dataset elements in the course
+ * of the iteration. If operator needs to pass data back to the
+ * application, such data can be returned in this same buffer. This
+ * pointer is passed back to each step of the iteration in the
+ * operator callback function’s operator_data parameter.
+ *
+ * Unlike other HDF5 iterators, this iteration operation cannot
+ * be restarted at the point of exit; a second H5Diterate()
+ * call will always restart at the beginning.
+ *
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Determines the number of bytes required to store variable-length
+ * (VL) data
+ *
+ * \dset_id
+ * \type_id
+ * \space_id
+ * \param[out] size Size in bytes of the memory buffer required to store
+ * the VL data
+ *
+ * \return \herr_t
+ *
+ * \details H5Dvlen_get_buf_size() determines the number of bytes
+ * required to store the VL data from the dataset, using \p
+ * space_id for the selection in the dataset on disk and the \p
+ * type_id for the memory representation of the VL data in memory.
+ * \p size is returned with the number of bytes required to store
+ * the VL data in memory.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dset_id, hid_t type_id, hid_t space_id, hsize_t *size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Fills dataspace elements with a fill value in a memory buffer
+ *
+ * \param[in] fill Pointer to the fill value to be used
+ * \param[in] fill_type_id Fill value datatype identifier
+ * \param[in,out] buf Pointer to the memory buffer containing the
+ * selection to be filled
+ * \param[in] buf_type_id Datatype of dataspace elements to be filled
+ * \space_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Dfill() fills the dataspace selection in memory, \p space_id,
+ * with the fill value specified in \p fill. If \p fill is NULL,
+ * a fill value of 0 (zero) is used.
+ *
+ * \p fill_type_id specifies the datatype of the fill value.
+ * \p buf specifies the buffer in which the dataspace elements
+ * will be written.
+ * \p buf_type_id specifies the datatype of those data elements.
+ *
+ * \note Note that if the fill value datatype differs from the memory
+ * buffer datatype, the fill value will be converted to the memory
+ * buffer datatype before filling the selection.
+ *
+ * \note Applications sometimes write data only to portions of an
+ * allocated dataset. It is often useful in such cases to fill
+ * the unused space with a known fill value. See the following
+ * function for more information:
+ * - H5Pset_fill_value()
+ * - H5Pget_fill_value()
+ * - H5Pfill_value_defined()
+ * - H5Pset_fill_time()
+ * - H5Pget_fill_time()
+ * - H5Pcreate()
+ * - H5Pcreate_anon()
+ *
+ */
+H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Changes the sizes of a dataset’s dimensions
+ *
+ * \dset_id
+ * \param[in] size[] Array containing the new magnitude of each dimension
+ * of the dataset
+ *
+ * \return \herr_t
+ *
+ * \details H5Dset_extent() sets the current dimensions of the
+ * chunked dataset \p dset_id to the sizes specified in size.
+ *
+ * \p size is a 1-dimensional array with n elements, where \p n is
+ * the rank of the dataset’s current dataspace.
+ *
+ * This function can be applied to the following datasets:
+ * - A chunked dataset with unlimited dimensions
+ * - A chunked dataset with fixed dimensions if the new dimension
+ * sizes are less than the maximum sizes set with maxdims (see
+ * H5Screate_simple())
+ * - An external dataset with unlimited dimensions
+ * - An external dataset with fixed dimensions if the new dimension
+ * sizes are less than the maximum sizes set with \p maxdims
+ *
+ * Note that external datasets are always contiguous and can be
+ * extended only along the first dimension.
+ *
+ * Space on disk is immediately allocated for the new dataset extent if
+ * the dataset’s space allocation time is set to #H5D_ALLOC_TIME_EARLY.
+ *
+ * Fill values will be written to the dataset in either of the
+ * following situations, but not otherwise:
+ *
+ * - If the dataset’s fill time is set to #H5D_FILL_TIME_IFSET and a
+ * fill value is defined (see H5Pset_fill_time() and
+ * H5Pset_fill_value())
+ * - If the dataset’s fill time is set to #H5D_FILL_TIME_ALLOC
+ * (see H5Pset_alloc_time())
+ *
+ * \note
+ * \li If the sizes specified in \p size array are smaller than
+ * the dataset’s current dimension sizes, H5Dset_extent() will reduce
+ * the dataset’s dimension sizes to the specified values. It is the
+ * user application’s responsibility to ensure that valuable data is
+ * not lost as H5Dset_extent() does not check.
+ *
+ * \li Except for external datasets, H5Dset_extent() is for use with
+ * chunked datasets only, not contiguous datasets.
+ *
+ * \li A call to H5Dset_extent() affects the dataspace of a dataset.
+ * If a dataspace handle was opened for a dataset prior to a call to
+ * H5Dset_extent() then that dataspace handle will no longer reflect
+ * the correct dataspace extent of the dataset. H5Dget_space() must
+ * be called (after closing the previous handle) to obtain the current
+ * dataspace extent.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Flushes all buffers associated with a dataset to disk
+ *
+ * \dset_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Dflush() causes all buffers associated with a
+ * dataset to be immediately flushed to disk without removing
+ * the data from the cache.
+ *
+ * \note HDF5 does not possess full control over buffering.
+ * H5Dflush() flushes the internal HDF5 buffers and then asks the
+ * operating system (the OS) to flush the system buffers for the
+ * open files. After that, the OS is responsible for ensuring
+ * that the data is actually flushed to disk.
+ *
+ */
+H5_DLL herr_t H5Dflush(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Refreshes all buffers associated with a dataset
+ *
+ * \dset_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Drefresh() causes all buffers associated with a
+ * dataset to be cleared and immediately re-loaded with updated
+ * contents from disk.
+ *
+ * This function essentially closes the dataset, evicts all
+ * metadata associated with it from the cache, and then re-opens
+ * the dataset. The reopened dataset is automatically re-registered
+ * with the same identifier.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Drefresh(hid_t dset_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Scatters data into a selection within a memory buffer
+ *
+ * \param[in] op Callback function which provides data to be scattered
+ * \param[in] op_data User-defined pointer to data required by op
+ * \param[in] type_id Identifier for the datatype describing the data in
+ * both the source and destination buffers
+ * \param[in] dst_space_id Identifier for the dataspace for destination
+ * \param[out] dst_buf Destination buffer which the data will be scattered to
+ *
+ * \return \herr_t
+ *
+ * \details H5Dscatter() retrieves data from the supplied callback
+ * \p op and scatters it to the supplied buffer \p dst_buf in a
+ * manner similar to data being written to a dataset.
+ *
+ * \p dst_space_id is a dataspace which defines the extent of \p
+ * dst_buf and the selection within it to scatter the data to.
+ *
+ * \p type_id is the datatype of the data to be scattered in both
+ * the source and destination buffers.
+ *
+ * \p dst_buf must be at least as large as the number of elements
+ * in the extent of \p dst_space_id times the size in bytes of
+ * \p type_id.
+ *
+ * To retrieve the data to be scattered, H5Dscatter() repeatedly
+ * calls \p op, which should return a valid source buffer, until
+ * enough data to fill the selection has been retrieved. The
+ * prototype of the callback function \p op is as follows (as
+ * defined in the source code file H5Dpublic.h):
+ * \snippet this H5D_scatter_func_t_snip
+ * The parameters of this callback function are described below:
+ *
+ * <table>
+ * <tr><td>\c src_buf</td>
+ * <td><tt>[out]</tt></td>
+ * <td>Pointer to the buffer holding the next set of elements to
+ * scatter. On entry, the value of where \c src_buf points to
+ * is undefined. The callback function should set \c src_buf
+ * to point to the next set of elements.</td></tr>
+ * <tr><td>\c src_buf_bytes_used</td>
+ * <td><tt>[out]</tt></td>
+ * <td>Pointer to the number of valid bytes in \c src_buf. On
+ * entry, the value where \c src_buf_bytes_used points to is
+ * undefined. The callback function should set
+ * \c src_buf_bytes_used to the of valid bytes in \c src_buf.
+ * This number must be a multiple of the datatype size.
+ * </td></tr>
+ * <tr><td>\c op_data</td>
+ * <td><tt>[in,out]</tt></td>
+ * <td>User-defined pointer to data required by the callback
+ * function. A pass-through of the \c op_data pointer provided
+ * with the H5Dscatter() function call.</td></tr>
+ * </table>
+ *
+ * The callback function should always return at least one
+ * element in \p src_buf, and must not return more elements
+ * than are remaining to be scattered. This function will be
+ * repeatedly called until all elements to be scattered have
+ * been returned. The callback function should return zero (0)
+ * to indicate success, and a negative value to indicate failure.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id,
+ void *dst_buf);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Gathers data from a selection within a memory buffer
+ * raw data chunk in a dataset
+ *
+ * \param[in] src_space_id Dataspace identifier for the source buffer
+ * \param[in] src_buf Source buffer which the data will be gathered from
+ * \param[in] type_id Datatype identifier for the source
+ * \param[in] dst_buf_size Size in bytes of \p dst_buf
+ * \param[out] dst_buf Destination buffer for the gathered data
+ * \param[in] op Callback function which handles the gathered data
+ * \param[in] op_data User-defined pointer to data required by \p op
+ *
+ * \return \herr_t
+ *
+ * \details H5Dgather() retrieves data from a selection within the supplied
+ * buffer src_buf and passes it to the supplied callback function
+ * \p op in a contiguous form.
+ *
+ * The dataspace \p src_space_id describes both the dimensions of
+ * the source buffer and the selection within the source buffer
+ * to gather data from.
+ *
+ * \p src_buf must be at least the size of the gathered data, that
+ * is, the number of elements in the extent of \p src_space_id
+ * times the size in bytes of \p type_id.
+ *
+ * The datatype \p type_id describes the data in both the source
+ * and destination buffers. This information is used to calculate
+ * the element size.
+ *
+ * The data is gathered into \p dst_buf, which needs to be large
+ * enough to hold all the data if the callback function \p op is
+ * not provided.
+ *
+ * \p op is a callback function which handles the gathered data.
+ * It is optional if \p dst_buf is large enough to hold all of the
+ * gathered data; required otherwise.
+ *
+ * If no callback function is provided, H5Dgather() simply gathers
+ * the data into \p dst_buf and returns. If a callback function is
+ * provided, H5Dgather() repeatedly gathers up to \p dst_buf_size
+ * bytes to process the serialized data. The prototype of the
+ * callback function \p op is as follows (as defined in the source
+ * code file H5Dpublic.h):
+ * \snippet this H5D_gather_func_t_snip
+ * The parameters of this callback function are described in the
+ * table below.
+ * <table>
+ * <tr><td>\c dst_buf</td>
+ * <td>Pointer to the destination buffer which has been filled
+ * with the next set of elements gathered. This will always be
+ * identical to the \p dst_buf passed to H5Dgather().</td></tr>
+ * <tr><td>\c dst_buf_bytes_used</td>
+ * <td>Pointer to the number of valid bytes in \p dst_buf.
+ * This number must be a multiple of the datatype
+ * size.</td></tr>
+ * <tr><td>\c op_data</td>
+ * <td>User-defined pointer to data required by the callback
+ * function; a pass-through of the \p op_data pointer
+ * provided with the H5Dgather() function call.</td></tr>
+ * </table>
+ * The callback function should process, store, or otherwise,
+ * make use of the data returned in \p dst_buf before it returns,
+ * because the buffer will be overwritten unless it is the last
+ * call to the callback. This function will be repeatedly called
+ * until all gathered elements have been passed to the callback
+ * in \p dst_buf. The callback function should return zero (0)
+ * to indicate success, and a negative value to indicate failure.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size,
+ void *dst_buf, H5D_gather_func_t op, void *op_data);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Closes the specified dataset
+ *
+ * \dset_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Dclose() ends access to a dataset specified by \p dset_id
+ * and releases resources used by it.
+ *
+ * \attention Further use of a released dataset identifier is illegal; a
+ * function using such an identifier will generate an error.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Dcreate2(), H5Dopen2()
+ *
+ */
+H5_DLL herr_t H5Dclose(hid_t dset_id);
/* Internal API routines */
+H5_DLL herr_t H5Ddebug(hid_t dset_id);
H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
@@ -194,14 +1462,186 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
/* Typedefs */
/* Function prototypes */
-H5_DLL hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
-H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Creates a dataset at the specified location
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the dataset to create
+ * \type_id
+ * \space_id
+ * \dcpl_id
+ *
+ * \return \hid_t{dataset}
+ *
+ * \deprecated This function is deprecated in favor of the function H5Dcreate2()
+ * or the macro H5Dcreate().
+ *
+ * \details H5Dcreate1() creates a data set with a name, \p name, in the
+ * location specified by the identifier \p loc_id. \p loc_id may be a
+ * file, group, dataset, named datatype or attribute. If an attribute,
+ * dataset, or named datatype is specified for \p loc_id then the
+ * dataset will be created at the location where the attribute,
+ * dataset, or named datatype is attached.
+ *
+ * \p name can be a relative path based at \p loc_id or an absolute
+ * path from the root of the file. Use of this function requires that
+ * any intermediate groups specified in the path already exist.
+ *
+ * The dataset’s datatype and dataspace are specified by \p type_id and
+ * \p space_id, respectively. These are the datatype and dataspace of
+ * the dataset as it will exist in the file, which may differ from the
+ * datatype and dataspace in application memory.
+ *
+ * Names within a group are unique: H5Dcreate1() will return an error
+ * if a link with the name specified in name already exists at the
+ * location specified in \p loc_id.
+ *
+ * As is the case for any object in a group, the length of a dataset
+ * name is not limited.
+ *
+ * \p dcpl_id is an #H5P_DATASET_CREATE property list created with \p
+ * H5reate1() and initialized with various property list functions
+ * described in Property List Interface.
+ *
+ * H5Dcreate() and H5Dcreate_anon() return an error if the dataset’s
+ * datatype includes a variable-length (VL) datatype and the fill value
+ * is undefined, i.e., set to \c NULL in the dataset creation property
+ * list. Such a VL datatype may be directly included, indirectly
+ * included as part of a compound or array datatype, or indirectly
+ * included as part of a nested compound or array datatype.
+ *
+ * H5Dcreate() and H5Dcreate_anon() return a dataset identifier for
+ * success or a negative value for failure. The dataset identifier
+ * should eventually be closed by calling H5Dclose() to release
+ * resources it uses.
+ *
+ * See H5Dcreate_anon() for discussion of the differences between
+ * H5Dcreate() and H5Dcreate_anon().
+ *
+ * The HDF5 library provides flexible means of specifying a fill value,
+ * of specifying when space will be allocated for a dataset, and of
+ * specifying when fill values will be written to a dataset.
+ *
+ * \version 1.8.0 Function H5Dcreate() renamed to H5Dcreate1() and deprecated in this release.
+ * \since 1.0.0
+ *
+ * \see H5Dopen2(), H5Dclose(), H5Tset_size()
+ *
+ */
+H5_DLL hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Opens an existing dataset
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the dataset to access
+ *
+ * \return \hid_t{dataset}
+ *
+ * \deprecated This function is deprecated in favor of the function H5Dopen2()
+ * or the macro H5Dopen().
+ *
+ * \details H5Dopen1() opens an existing dataset for access at the location
+ * specified by \p loc_id. \p loc_id may be a file, group, dataset,
+ * named datatype or attribute. If an attribute, dataset, or named
+ * datatype is specified for loc_id then the dataset will be opened at
+ * the location where the attribute, dataset, or named datatype is
+ * attached. name is a dataset name and is used to identify the dataset
+ * in the file.
+ *
+ * A dataset opened with this function should be closed with H5Dclose()
+ * when the dataset is no longer needed so that resource leaks will not
+ * develop.
+ *
+ * \version 1.8.0 Function H5Dopen() renamed to H5Dopen1() and deprecated in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Extends a dataset
+ *
+ * \dset_id
+ * \param[in] size Array containing the new size of each dimension
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Dset_extent().
+ *
+ * \details H5Dextend() verifies that the dataset is at least of size \p size,
+ * extending it if necessary. The dimensionality of size is the same as
+ * that of the dataspace of the dataset being changed.
+ *
+ * This function can be applied to the following datasets:
+ * \li Any dataset with unlimited dimensions
+ * \li A dataset with fixed dimensions if the current dimension sizes
+ * are less than the maximum sizes set with \c maxdims
+ * (see H5Screate_simple())
+ *
+ * Space on disk is immediately allocated for the new dataset extent if
+ * the dataset’s space allocation time is set to
+ * #H5D_ALLOC_TIME_EARLY. Fill values will be written to the dataset if
+ * the dataset’s fill time is set to #H5D_FILL_TIME_IFSET or
+ * #H5D_FILL_TIME_ALLOC. (See H5Pset_fill_time() and
+ * H5Pset_alloc_time().)
+ *
+ * This function ensures that the dataset dimensions are of at least
+ * the sizes specified in size. The function H5Dset_extent() must be
+ * used if the dataset dimension sizes are are to be reduced.
+ *
+ * \version 1.8.0 Function Function deprecated in this release. Parameter size
+ * syntax changed to \Code{const hsize_t size[]} in this release.
+ *
+ */
H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
-H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
+ * \brief Reclaims variable-length (VL) datatype memory buffers
+ *
+ * \type_id
+ * \space_id
+ * \dxpl_id
+ * \param[in] buf Pointer to the buffer to be reclaimed
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function has been deprecated in HDF5-1.12 in favor of the
+ * function H5Treclaim().
+ *
+ * \details H5Dvlen_reclaim() reclaims memory buffers created to store VL
+ * datatypes.
+ *
+ * The \p type_id must be the datatype stored in the buffer. The \p
+ * space_id describes the selection for the memory buffer to free the
+ * VL datatypes within. The \p dxpl_id is the dataset transfer property
+ * list which was used for the I/O transfer to create the buffer. And
+ * \p buf is the pointer to the buffer to be reclaimed.
+ *
+ * The VL structures (\ref hvl_t) in the user's buffer are modified to
+ * zero out the VL information after the memory has been reclaimed.
+ *
+ * If nested VL datatypes were used to create the buffer, this routine
+ * frees them from the bottom up, releasing all the memory without
+ * creating memory leaks.
+ *
+ * \version 1.12.0 Routine was deprecated
+ *
+ */
+H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
#endif
-#endif /* _H5Dpublic_H */
+#endif /* H5Dpublic_H */
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 1a272d8..1888adb 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 327e90a..7d2ead1 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.ued>
+/* Programmer: Quincey Koziol
* Thursday, September 30, 2004
*
* Purpose: Dataspace I/O functions.
@@ -105,51 +105,38 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, co
HDassert(io_info->store);
HDassert(io_info->u.rbuf);
- /* Get info from API context */
- if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
-
- /* Allocate the vector I/O arrays */
- if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
- vec_size = dxpl_vec_size;
- else
- vec_size = H5D_IO_VECTOR_SIZE;
- if (NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if (NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
- if (NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if (NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
-
/* Check for only one element in selection */
if (nelmts == 1) {
+ hsize_t single_mem_off; /* Offset in memory */
+ hsize_t single_file_off; /* Offset in the file */
+ size_t single_mem_len; /* Length in memory */
+ size_t single_file_len; /* Length in the file */
+
/* Get offset of first element in selections */
- if (H5S_SELECT_OFFSET(file_space, file_off) < 0)
+ if (H5S_SELECT_OFFSET(file_space, &single_file_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve file selection offset")
- if (H5S_SELECT_OFFSET(mem_space, mem_off) < 0)
+ if (H5S_SELECT_OFFSET(mem_space, &single_mem_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve memory selection offset")
/* Set up necessary information for I/O operation */
file_nseq = mem_nseq = 1;
curr_mem_seq = curr_file_seq = 0;
- *file_off *= elmt_size;
- *mem_off *= elmt_size;
- *file_len = *mem_len = elmt_size;
+ single_file_off *= elmt_size;
+ single_mem_off *= elmt_size;
+ single_file_len = single_mem_len = elmt_size;
/* Perform I/O on memory and file sequences */
if (io_info->op_type == H5D_IO_OP_READ) {
- if ((tmp_file_len =
- (*io_info->layout_ops.readvv)(io_info, file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ if ((tmp_file_len = (*io_info->layout_ops.readvv)(
+ io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq,
+ &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
} /* end if */
else {
HDassert(io_info->op_type == H5D_IO_OP_WRITE);
- if ((tmp_file_len =
- (*io_info->layout_ops.writevv)(io_info, file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ if ((tmp_file_len = (*io_info->layout_ops.writevv)(
+ io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq,
+ &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
} /* end else */
@@ -160,6 +147,24 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, co
size_t mem_nelem; /* Number of elements used in memory sequences */
size_t file_nelem; /* Number of elements used in file sequences */
+ /* Get info from API context */
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
+
+ /* Allocate the vector I/O arrays */
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if (NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if (NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+ if (NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if (NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+
/* Allocate the iterators */
if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index d711fe4..50cf6a1 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
+/* Programmer: Vailin Choi
* May 2011; updated 10/2015
*
* Purpose: Single Chunk I/O functions.
@@ -521,7 +521,7 @@ H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
HDassert(storage);
HDassert(stream);
- HDfprintf(stream, " Address: %a\n", storage->idx_addr);
+ HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_dump() */
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index 43e7a82..f37682d 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Thursday, May 27, 2004
*
* Purpose: Dataset testing functions.
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 9dae180..beee8c6 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -5,13 +5,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Wednesday, January 28, 2015
*
* Purpose:
@@ -302,22 +302,23 @@ done:
herr_t
H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx)
{
- H5S_sel_type sel_type;
- int rank;
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
- int i;
- herr_t ret_value = SUCCEED;
+ 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];
+ hsize_t bounds_end[H5S_MAX_RANK];
+ int i;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
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 */
@@ -325,20 +326,18 @@ 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)
@@ -396,8 +395,8 @@ done:
* Purpose: Store virtual dataset layout information, for new dataset
*
* Note: We assume here that the contents of the heap block cannot
- * change! If this ever stops being the case we must change
- * this code to allow overwrites of the heap block. -NAF
+ * change! If this ever stops being the case we must change
+ * this code to allow overwrites of the heap block. -NAF
*
* Return: Success: SUCCEED
* Failure: FAIL
@@ -410,31 +409,31 @@ done:
herr_t
H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
{
- 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 */
- size_t block_size; /* Total size of block needed */
- hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */
- uint32_t chksum; /* Checksum for heap data */
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ 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 */
+ size_t block_size; /* Total size of block needed */
+ hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */
+ uint32_t chksum; /* Checksum for heap data */
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* 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")
/*
@@ -445,31 +444,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++) {
- hssize_t select_serial_size; /* Size of serialized selection */
+ 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 */
@@ -490,28 +488,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 */
@@ -520,7 +516,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)) <
+ 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 */
@@ -551,6 +547,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;
@@ -564,133 +561,125 @@ 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 =
- H5MM_strdup(orig_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 =
- H5MM_strdup(orig_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 =
- H5S_copy(orig_list[i].source_select, FALSE, TRUE)))
+ 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,
+ 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,
+ 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 =
- H5MM_strdup(orig_list[i].source_dset.file_name)))
+ else 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 =
- H5MM_strdup(orig_list[i].source_dset.dset_name)))
+ else 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 */
@@ -720,8 +709,9 @@ done:
herr_t
H5D__virtual_reset_layout(H5O_layout_t *layout)
{
- size_t i, j;
- herr_t ret_value = SUCCEED;
+ size_t i, j;
+ H5O_storage_virtual_t *virt = &layout->storage.u.virt;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -731,56 +721,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 */
@@ -907,7 +895,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir
HDassert(source_dset->dset_name);
/* Check if we need to open the source file */
- if (HDstrcmp(source_dset->file_name, ".")) {
+ if (HDstrcmp(source_dset->file_name, ".") != 0) {
unsigned intent; /* File access permissions */
/* Get the virtual dataset's file open flags ("intent") */
@@ -1114,7 +1102,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, s
/* Copy string to *p. Note that since src in not NULL terminated, we must
* use memcpy */
- (void)H5MM_memcpy(*p, src, src_len);
+ H5MM_memcpy(*p, src, src_len);
/* Advance *p */
*p += src_len;
@@ -2249,10 +2237,38 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
storage->printf_gap = (hsize_t)0;
/* Retrieve VDS file FAPL to layout */
- if (storage->source_fapl <= 0)
+ if (storage->source_fapl <= 0) {
+ H5P_genplist_t * source_fapl = NULL; /* Source file FAPL */
+ H5F_close_degree_t close_degree = H5F_CLOSE_WEAK; /* Close degree for source files */
+
if ((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl")
+ /* Get property list pointer */
+ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Source files must always be opened with H5F_CLOSE_WEAK close degree */
+ if (H5P_set(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree")
+ } /* end if */
+#ifndef NDEBUG
+ else {
+ H5P_genplist_t * source_fapl = NULL; /* Source file FAPL */
+ H5F_close_degree_t close_degree; /* Close degree for source files */
+
+ /* Get property list pointer */
+ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+
+ /* Verify H5F_CLOSE_WEAK close degree is set */
+ if (H5P_get(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree")
+
+ HDassert(close_degree == H5F_CLOSE_WEAK);
+ } /* end else */
+#endif /* NDEBUG */
+
/* Copy DAPL to layout */
if (storage->source_dapl <= 0)
if ((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0)
@@ -2283,7 +2299,7 @@ done:
hbool_t
H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
{
- hbool_t ret_value; /* Return value */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -2316,7 +2332,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);
@@ -2367,7 +2383,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, cons
hssize_t select_nelmts; /* Number of elements in selection */
hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */
- int rank;
+ int rank = 0;
hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */
size_t i, j, k; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2883,8 +2899,9 @@ 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")
diff --git a/src/H5E.c b/src/H5E.c
index 41cc53a..bcadd63 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -49,7 +49,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 */
@@ -245,6 +244,20 @@ H5E_term_package(void)
nstk = H5I_nmembers(H5I_ERROR_STACK);
if ((ncls + nmsg + nstk) > 0) {
+ /* Clear the default error stack. Note that
+ * the following H5I_clear_type calls do not
+ * force the clears and will not be able to
+ * clear any error message IDs that are still
+ * in use by the default error stack unless we
+ * clear that stack manually.
+ *
+ * Error message IDs will typically still be
+ * in use by the default error stack when the
+ * application does H5E_BEGIN/END_TRY cleanup
+ * at the very end.
+ */
+ H5E_clear_stack(NULL);
+
/* Clear any outstanding error stacks */
if (nstk > 0)
(void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE);
@@ -378,7 +391,7 @@ H5E__get_stack(void)
#endif /* H5_HAVE_THREADSAFE */
/*-------------------------------------------------------------------------
- * Function: H5E_free_class
+ * Function: H5E__free_class
*
* Purpose: Private function to free an error class.
*
@@ -390,9 +403,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);
@@ -404,7 +417,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() */
/*-------------------------------------------------------------------------
* Function: H5Eregister_class
@@ -487,7 +500,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)
@@ -498,9 +511,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
*
*-------------------------------------------------------------------------
@@ -555,7 +568,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:
@@ -1014,9 +1027,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
*
*-------------------------------------------------------------------------
@@ -1119,9 +1132,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
*
*-------------------------------------------------------------------------
@@ -1254,9 +1267,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
*
*-------------------------------------------------------------------------
@@ -1309,9 +1322,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
@@ -1319,16 +1332,13 @@ done:
*
*-------------------------------------------------------------------------
*/
+H5_ATTR_FORMAT(printf, 8, 9)
herr_t
H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id,
hid_t min_id, const char *fmt, ...)
{
- va_list ap; /* Varargs info */
- H5E_t * estack; /* Pointer to error stack to modify */
-#ifndef H5_HAVE_VASPRINTF
- int tmp_len; /* Current size of description buffer */
- int desc_len; /* Actual length of description when formatted */
-#endif /* H5_HAVE_VASPRINTF */
+ va_list ap; /* Varargs info */
+ H5E_t * estack; /* Pointer to error stack to modify */
char * tmp = NULL; /* Buffer to place formatted description in */
hbool_t va_started = FALSE; /* Whether the variable argument list is open */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1357,31 +1367,9 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid
HDva_start(ap, fmt);
va_started = TRUE;
-#ifdef H5_HAVE_VASPRINTF
/* Use the vasprintf() routine, since it does what we're trying to do below */
if (HDvasprintf(&tmp, fmt, ap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#else /* H5_HAVE_VASPRINTF */
- /* Allocate space for the formatted description buffer */
- tmp_len = 128;
- if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* If the description doesn't fit into the initial buffer size, allocate more space and try again */
- while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
- /* shutdown & restart the va_list */
- HDva_end(ap);
- HDva_start(ap, fmt);
-
- /* Release the previous description, it's too small */
- H5MM_xfree(tmp);
-
- /* Allocate a description of the appropriate length */
- tmp_len = desc_len + 1;
- if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- } /* end while */
-#endif /* H5_HAVE_VASPRINTF */
/* Push the error on the stack */
if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
@@ -1390,16 +1378,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid
done:
if (va_started)
HDva_end(ap);
-#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
*/
if (tmp)
HDfree(tmp);
-#else /* H5_HAVE_VASPRINTF */
- if (tmp)
- H5MM_xfree(tmp);
-#endif /* H5_HAVE_VASPRINTF */
FUNC_LEAVE_API(ret_value)
} /* end H5Epush2() */
@@ -1409,9 +1392,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
*
*-------------------------------------------------------------------------
@@ -1453,9 +1436,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
*
*-------------------------------------------------------------------------
@@ -1498,9 +1481,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
*
*-------------------------------------------------------------------------
@@ -1548,7 +1531,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
@@ -1562,7 +1545,8 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
H5E_auto_op_t op; /* Error stack function */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(FAIL)
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE3("e", "i*x**x", estack_id, func, client_data);
if (estack_id == H5E_DEFAULT) {
@@ -1570,8 +1554,13 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
/* Get the automatic error reporting information */
if (H5E__get_auto(estack, &op, client_data) < 0)
@@ -1605,7 +1594,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
@@ -1628,8 +1617,13 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Get the automatic error reporting information */
@@ -1663,7 +1657,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
@@ -1676,7 +1670,8 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(FAIL)
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE2("e", "i*Iu", estack_id, is_stack);
if (estack_id == H5E_DEFAULT) {
@@ -1684,8 +1679,13 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
/* Check if the error stack reporting function is the "newer" stack type */
if (is_stack)
diff --git a/src/H5EA.c b/src/H5EA.c
index e5e703c..4d6b7c1 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EA.c
* Jun 17 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implements an "extensible array" for storing elements
* in an array whose high bounds can extend and shrink.
@@ -112,7 +112,6 @@ H5FL_BLK_DEFINE(ea_native_elmt);
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Oct 10 2016
*
*-------------------------------------------------------------------------
@@ -176,7 +175,6 @@ END_FUNC(STATIC) /* end H5EA__new() */
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 17 2008
*
*-------------------------------------------------------------------------
@@ -225,7 +223,6 @@ END_FUNC(PRIV) /* end H5EA_create() */
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 28 2008
*
*-------------------------------------------------------------------------
@@ -264,7 +261,6 @@ END_FUNC(PRIV) /* end H5EA_open() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 21 2008
*
*-------------------------------------------------------------------------
@@ -292,7 +288,6 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 21 2008
*
*-------------------------------------------------------------------------
@@ -322,7 +317,6 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 9 2008
*
*-------------------------------------------------------------------------
@@ -514,10 +508,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
*/
if (will_extend && !sblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between super block and header, "
- "address = %llu",
- (unsigned long long)sblock->addr)
+ H5E_THROW(
+ H5E_CANTDEPEND,
+ "unable to create flush dependency between super block and header, address "
+ "= %llu",
+ (unsigned long long)sblock->addr)
sblock->has_hdr_depend = TRUE;
} /* end if */
} /* end if */
@@ -655,7 +650,6 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 9 2008
*
*-------------------------------------------------------------------------
@@ -719,7 +713,6 @@ END_FUNC(PRIV) /* end H5EA_set() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 11 2008
*
*-------------------------------------------------------------------------
@@ -729,7 +722,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
/* Local variables */
H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
- H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
+ H5EA__unprotect_func_t thing_unprot_func =
+ NULL; /* Function pointer for unprotecting the array metadata */
/*
* Check arguments.
@@ -783,7 +777,6 @@ END_FUNC(PRIV) /* end H5EA_get() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 27 2009
*
*-------------------------------------------------------------------------
@@ -830,7 +823,6 @@ END_FUNC(PRIV) /* end H5EA_depend() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 21 2008
*
*-------------------------------------------------------------------------
@@ -930,7 +922,6 @@ END_FUNC(PRIV) /* end H5EA_close() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 28 2008
*
*-------------------------------------------------------------------------
@@ -982,11 +973,6 @@ END_FUNC(PRIV) /* end H5EA_delete() */
*
* Programmer: Vailin Choi; Feb 2015
*
- * Modification:
- * Prototype changed (HDFFV-10661)
- * - herr_t to int
- * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
- * June 6, 2019 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
@@ -997,9 +983,7 @@ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
hsize_t u;
int cb_ret = H5_ITER_CONT; /* Return value from callback */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(op);
HDassert(udata);
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index b367798..2a3153c 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAcache.c
* Aug 26 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement extensible array metadata cache methods.
*
@@ -217,7 +217,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
*
*-------------------------------------------------------------------------
@@ -279,7 +278,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 16, 2013
*
*-------------------------------------------------------------------------
@@ -309,7 +307,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
hdr->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature")
image += H5_SIZEOF_MAGIC;
@@ -404,7 +402,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
*
*-------------------------------------------------------------------------
@@ -432,7 +429,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
*
*-------------------------------------------------------------------------
@@ -464,7 +460,7 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* General array creation/configuration information */
*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
*image++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to
- store max. # of elements */
+ store max. # of elements */
*image++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */
*image++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */
*image++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
@@ -580,7 +576,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
*
*-------------------------------------------------------------------------
@@ -606,7 +601,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
*
*-------------------------------------------------------------------------
@@ -675,7 +669,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -704,7 +697,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
iblock->addr = hdr->idx_blk_addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature")
image += H5_SIZEOF_MAGIC;
@@ -781,7 +774,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
*
*-------------------------------------------------------------------------
@@ -809,7 +801,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
*
*-------------------------------------------------------------------------
@@ -895,7 +886,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
*
*-------------------------------------------------------------------------
@@ -967,7 +957,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
*
*-------------------------------------------------------------------------
@@ -993,7 +982,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
*
*-------------------------------------------------------------------------
@@ -1081,7 +1069,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -1113,7 +1100,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
sblock->addr = udata->sblk_addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature")
image += H5_SIZEOF_MAGIC;
@@ -1184,7 +1171,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
*
*-------------------------------------------------------------------------
@@ -1212,7 +1198,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
*
*-------------------------------------------------------------------------
@@ -1285,7 +1270,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
*
*-------------------------------------------------------------------------
@@ -1380,7 +1364,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
*
*-------------------------------------------------------------------------
@@ -1406,7 +1389,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
*
*-------------------------------------------------------------------------
@@ -1495,7 +1477,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -1529,7 +1510,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
dblock->addr = udata->dblk_addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature")
image += H5_SIZEOF_MAGIC;
@@ -1596,7 +1577,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
*
*-------------------------------------------------------------------------
@@ -1627,7 +1607,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
*
*-------------------------------------------------------------------------
@@ -1697,7 +1676,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
*
*-------------------------------------------------------------------------
@@ -1790,7 +1768,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
*
*-------------------------------------------------------------------------
@@ -1861,7 +1838,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
*
*-------------------------------------------------------------------------
@@ -1923,7 +1899,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -1996,7 +1971,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
*
*-------------------------------------------------------------------------
@@ -2024,7 +1998,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
*
*-------------------------------------------------------------------------
@@ -2075,7 +2048,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
*
*-------------------------------------------------------------------------
@@ -2134,8 +2106,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for extensible array */
if (dblk_page->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page "
- "and extensible array 'top' proxy")
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block page and "
+ "extensible array 'top' proxy")
dblk_page->top_proxy = NULL;
} /* end if */
break;
@@ -2170,7 +2143,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 1920863..72d2f38 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5EAdbg.c
- * Sep 11 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5EAdbg.c
+ * Sep 11 2008
+ * Quincey Koziol
*
- * Purpose: Dump debugging information about an extensible array.
+ * Purpose: Dump debugging information about an extensible array.
*
*-------------------------------------------------------------------------
*/
@@ -35,9 +35,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 */
/****************/
/* Local Macros */
@@ -68,15 +68,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
*
*-------------------------------------------------------------------------
*/
@@ -112,10 +111,10 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Header size:", hdr->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"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);
@@ -127,15 +126,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
(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);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Highest element index stored (+1):", hdr->stats.stored.max_idx_set);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of super blocks created:", hdr->stats.stored.nsuper_blks);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of data blocks created:", hdr->stats.stored.ndata_blks);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of elements 'realized':", hdr->stats.stored.nelmts);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Index Block Address:", hdr->idx_blk_addr);
CATCH
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
@@ -146,15 +146,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
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
*
*-------------------------------------------------------------------------
*/
@@ -200,10 +199,10 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Index Block size:", iblock->size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"# of data block addresses in index block:", iblock->ndblk_addrs);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"# of super block addresses in index block:", iblock->nsblk_addrs);
/* Check if there are any elements in index block */
@@ -231,7 +230,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
for (u = 0; u < iblock->ndblk_addrs; u++) {
/* Print address */
HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
iblock->dblk_addrs[u]);
} /* end for */
} /* end if */
@@ -246,7 +245,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
for (u = 0; u < iblock->nsblk_addrs; u++) {
/* Print address */
HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
iblock->sblk_addrs[u]);
} /* end for */
} /* end if */
@@ -262,15 +261,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
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
*
*-------------------------------------------------------------------------
*/
@@ -315,10 +313,10 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Super Block size:", sblock->size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"# of data block addresses in super block:", sblock->ndblks);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"# of elements in data blocks from this super block:", sblock->dblk_nelmts);
/* Check if there are any data block addresses in super block */
@@ -331,7 +329,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
for (u = 0; u < sblock->ndblks; u++) {
/* Print address */
HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
sblock->dblk_addrs[u]);
} /* end for */
} /* end if */
@@ -347,15 +345,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
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
*
*-------------------------------------------------------------------------
*/
@@ -394,15 +391,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Protect data block */
/* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */
if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)addr)
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR,
+ addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, "");
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size);
/* Print the elements in the index block */
HDfprintf(stream, "%*sElements:\n", indent, "");
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index a1a6449..b42599c 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAdblkpage.c
* Nov 20 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Data block page routines for extensible arrays.
*
@@ -80,7 +80,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
*
*-------------------------------------------------------------------------
@@ -128,7 +127,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
*
*-------------------------------------------------------------------------
@@ -191,7 +189,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
*
*-------------------------------------------------------------------------
@@ -255,7 +252,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
*
*-------------------------------------------------------------------------
@@ -285,7 +281,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 b3c8bff..45696c7 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAdblock.c
* Sep 11 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Data block routines for extensible arrays.
*
@@ -81,7 +81,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
*
*-------------------------------------------------------------------------
@@ -140,7 +139,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
*
*-------------------------------------------------------------------------
@@ -234,7 +232,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
*
*-------------------------------------------------------------------------
@@ -268,7 +265,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
*
*-------------------------------------------------------------------------
@@ -333,7 +329,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
*
*-------------------------------------------------------------------------
@@ -363,7 +358,6 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 22 2008
*
*-------------------------------------------------------------------------
@@ -424,7 +418,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 83cc085..7f142af 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAhdr.c
* Aug 26 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Array header routines for extensible arrays.
*
@@ -98,7 +98,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
*
*-------------------------------------------------------------------------
@@ -165,7 +164,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
*
*-------------------------------------------------------------------------
@@ -227,7 +225,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
*
*-------------------------------------------------------------------------
@@ -294,7 +291,6 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 18 2008
*
*-------------------------------------------------------------------------
@@ -328,7 +324,6 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 17 2008
*
*-------------------------------------------------------------------------
@@ -446,7 +441,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
*
*-------------------------------------------------------------------------
@@ -476,7 +470,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
*
*-------------------------------------------------------------------------
@@ -509,7 +502,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
*
*-------------------------------------------------------------------------
@@ -532,7 +524,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
*
*-------------------------------------------------------------------------
@@ -559,7 +550,6 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 9 2008
*
*-------------------------------------------------------------------------
@@ -586,7 +576,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
*
*-------------------------------------------------------------------------
@@ -642,7 +631,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
*
*-------------------------------------------------------------------------
@@ -671,7 +659,6 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 26 2008
*
*-------------------------------------------------------------------------
@@ -725,7 +712,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 fea020b..1ef7980 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAiblock.c
* Sep 9 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Index block routines for extensible arrays.
*
@@ -87,7 +87,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
*
*-------------------------------------------------------------------------
@@ -116,11 +115,6 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t
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)
@@ -157,7 +151,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
*
*-------------------------------------------------------------------------
@@ -170,10 +163,6 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
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);
@@ -184,9 +173,6 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* 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)))
@@ -271,7 +257,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
*
*-------------------------------------------------------------------------
@@ -281,10 +266,6 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_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);
@@ -328,7 +309,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
*
*-------------------------------------------------------------------------
@@ -336,11 +316,7 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */
BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags))
-/* Local variables */
-
-#ifdef QAK
- HDfprintf(stderr, "%s: Called\n", FUNC);
-#endif /* QAK */
+ /* Local variables */
/* Sanity check */
HDassert(iblock);
@@ -362,7 +338,6 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 9 2008
*
*-------------------------------------------------------------------------
@@ -372,10 +347,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, 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));
@@ -447,7 +418,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 6be3478..472cfb4 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAint.c
* Jun 17 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Internal routines for extnsible arrays.
*
@@ -75,7 +75,6 @@
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 26 2009
*
*-------------------------------------------------------------------------
@@ -103,7 +102,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 cf5b3a1..1833e40 100644
--- a/src/H5EAmodule.h
+++ b/src/H5EAmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5EA package. Including this header means that the source file
* is part of the H5EA package.
*/
-#ifndef _H5EAmodule_H
-#define _H5EAmodule_H
+#ifndef H5EAmodule_H
+#define H5EAmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_EARRAY
#define H5_MY_PKG_INIT NO
-#endif /* _H5EAmodule_H */
+#endif /* H5EAmodule_H */
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index 50ccf55..bfa8588 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, June 17, 2008
*
* Purpose: This file contains declarations which are visible only
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5EA package!"
#endif
-#ifndef _H5EApkg_H
-#define _H5EApkg_H
+#ifndef H5EApkg_H
+#define H5EApkg_H
/* Get package's private header */
#include "H5EAprivate.h"
@@ -461,4 +461,4 @@ H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam);
H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2);
#endif /* H5EA_TESTING */
-#endif /* _H5EApkg_H */
+#endif /* H5EApkg_H */
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index 14b178b..19dabd9 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAprivate.h
* Jun 17 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Private header for library accessible extensible
* array routines.
@@ -23,8 +23,8 @@
*-------------------------------------------------------------------------
*/
-#ifndef _H5EAprivate_H
-#define _H5EAprivate_H
+#ifndef H5EAprivate_H
+#define H5EAprivate_H
/* Include package's public header */
#ifdef NOT_YET
@@ -155,4 +155,4 @@ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats);
#ifdef H5EA_DEBUGGING
#endif /* H5EA_DEBUGGING */
-#endif /* _H5EAprivate_H */
+#endif /* H5EAprivate_H */
diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c
index 86c8605..8639217 100644
--- a/src/H5EAsblock.c
+++ b/src/H5EAsblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAsblock.c
* Sep 30 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Super block routines for extensible arrays.
*
@@ -87,7 +87,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
*
*-------------------------------------------------------------------------
@@ -166,7 +165,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
*
*-------------------------------------------------------------------------
@@ -253,7 +251,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
*
*-------------------------------------------------------------------------
@@ -316,7 +313,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
*
*-------------------------------------------------------------------------
@@ -346,7 +342,6 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 30 2008
*
*-------------------------------------------------------------------------
@@ -394,7 +389,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 fd70b99..47b9a86 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5EAstat.c
* Sep 11 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Extensible array metadata statistics functions.
*
@@ -76,18 +76,13 @@
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 21 2008
*
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats))
-/* Local variables */
-
-#ifdef QAK
- HDfprintf(stderr, "%s: Called\n", FUNC);
-#endif /* QAK */
+ /* Local variables */
/*
* Check arguments.
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 9e60374..dd669fc 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Thursday, August 28, 2008
*
* Purpose: Extensible array testing functions.
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index 63f2379..28b41fa 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -5,13 +5,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef _H5ESpublic_H
-#define _H5ESpublic_H
+/*
+ * This file contains public declarations for the H5ES (event set) module.
+ */
+
+#ifndef H5ESpublic_H
+#define H5ESpublic_H
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
@@ -48,4 +52,4 @@ extern "C" {
}
#endif
-#endif /* _H5ESpublic_H */
+#endif /* H5ESpublic_H */
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index d34435e..f9c9196 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new errors to H5err.txt file */
-#ifndef _H5Edefin_H
-#define _H5Edefin_H
+#ifndef H5Edefin_H
+#define H5Edefin_H
/* Major error IDs */
hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */
@@ -39,6 +39,7 @@ hid_t H5E_ATTR_g = FAIL; /* Attribute */
hid_t H5E_IO_g = FAIL; /* Low-level I/O */
hid_t H5E_EFL_g = FAIL; /* External file list */
hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */
+hid_t H5E_LIB_g = FAIL; /* General library infrastructure */
hid_t H5E_PAGEBUF_g = FAIL; /* Page Buffering */
hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */
hid_t H5E_DATASET_g = FAIL; /* Dataset */
@@ -148,6 +149,8 @@ hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */
hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */
hid_t H5E_MOUNT_g = FAIL; /* File mount error */
hid_t H5E_CANTDELETEFILE_g = FAIL; /* Unable to delete file */
+hid_t H5E_CANTLOCKFILE_g = FAIL; /* Unable to lock file */
+hid_t H5E_CANTUNLOCKFILE_g = FAIL; /* Unable to unlock file */
/* Object atom related errors */
hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 96d6aa1..9431089 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Edeprec.c
* April 11 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Deprecated functions from the H5E interface. These
* functions are here for compatibility purposes and may be
@@ -35,7 +35,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 */
@@ -187,7 +186,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
@@ -217,7 +216,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
@@ -250,7 +249,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
@@ -286,7 +285,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
@@ -327,7 +326,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
@@ -380,7 +379,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/H5Einit.h b/src/H5Einit.h
index 4563265..d27e550 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new errors to H5err.txt file */
-#ifndef _H5Einit_H
-#define _H5Einit_H
+#ifndef H5Einit_H
+#define H5Einit_H
/*********************/
/* Major error codes */
@@ -122,6 +122,11 @@ if((msg = H5E__create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+HDassert(H5E_LIB_g==(-1));
+if((msg = H5E__create_msg(cls, H5E_MAJOR, "General library infrastructure"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_LIB_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
HDassert(H5E_PAGEBUF_g==(-1));
if((msg = H5E__create_msg(cls, H5E_MAJOR, "Page Buffering"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
@@ -558,6 +563,16 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to delete file"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTDELETEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+HDassert(H5E_CANTLOCKFILE_g==(-1));
+if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock file"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+HDassert(H5E_CANTUNLOCKFILE_g==(-1));
+if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock file"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTUNLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* Object atom related errors */
HDassert(H5E_BADATOM_g==(-1));
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 40ca741..3fd4099 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Eint.c
* April 11 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: General use, "internal" routines for error handling.
*
@@ -32,10 +32,10 @@
/* 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 */
+#include "H5TSprivate.h" /* Thread stuff */
/****************/
/* Local Macros */
@@ -218,7 +218,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
cls_ptr = maj_ptr->cls;
/* Print error class header if new class */
- if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
+ if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
/* update to the new class information */
if (cls_ptr->cls_name)
eprint->cls.cls_name = cls_ptr->cls_name;
@@ -247,10 +247,8 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
else
HDfprintf(stream, "thread 0");
} /* end block */
-#elif defined(H5_HAVE_THREADSAFE)
- HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- HDfprintf(stream, "thread 0");
+ HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id());
#endif
HDfprintf(stream, ":\n");
} /* end if */
@@ -348,7 +346,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
HGOTO_DONE(FAIL)
/* Print error class header if new class */
- if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
+ if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
/* update to the new class information */
if (cls_ptr->cls_name)
eprint->cls.cls_name = cls_ptr->cls_name;
@@ -377,10 +375,8 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
else
HDfprintf(stream, "thread 0");
} /* end block */
-#elif defined(H5_HAVE_THREADSAFE)
- HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong());
#else
- HDfprintf(stream, "thread 0");
+ HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id());
#endif
HDfprintf(stream, ":\n");
} /* end if */
@@ -654,11 +650,7 @@ 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, ...)
{
- va_list ap; /* Varargs info */
-#ifndef H5_HAVE_VASPRINTF
- int tmp_len; /* Current size of description buffer */
- int desc_len; /* Actual length of description when formatted */
-#endif /* H5_HAVE_VASPRINTF */
+ va_list ap; /* Varargs info */
char * tmp = NULL; /* Buffer to place formatted description in */
hbool_t va_started = FALSE; /* Whether the variable argument list is open */
herr_t ret_value = SUCCEED; /* Return value */
@@ -687,31 +679,9 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
HDva_start(ap, fmt);
va_started = TRUE;
-#ifdef H5_HAVE_VASPRINTF
/* Use the vasprintf() routine, since it does what we're trying to do below */
if (HDvasprintf(&tmp, fmt, ap) < 0)
HGOTO_DONE(FAIL)
-#else /* H5_HAVE_VASPRINTF */
- /* Allocate space for the formatted description buffer */
- tmp_len = 128;
- if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
- HGOTO_DONE(FAIL)
-
- /* If the description doesn't fit into the initial buffer size, allocate more space and try again */
- while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
- /* shutdown & restart the va_list */
- HDva_end(ap);
- HDva_start(ap, fmt);
-
- /* Release the previous description, it's too small */
- H5MM_xfree(tmp);
-
- /* Allocate a description of the appropriate length */
- tmp_len = desc_len + 1;
- if (NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
- HGOTO_DONE(FAIL)
- } /* end while */
-#endif /* H5_HAVE_VASPRINTF */
/* Push the error on the stack */
if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
@@ -720,16 +690,11 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
done:
if (va_started)
HDva_end(ap);
-#ifdef H5_HAVE_VASPRINTF
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
*/
if (tmp)
HDfree(tmp);
-#else /* H5_HAVE_VASPRINTF */
- if (tmp)
- H5MM_xfree(tmp);
-#endif /* H5_HAVE_VASPRINTF */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_printf_stack() */
@@ -862,14 +827,12 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
/* Release strings */
if (error->func_name)
- error->func_name =
- (const char *)H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */
+ error->func_name = (const char *)H5MM_xfree_const(error->func_name);
if (error->file_name)
- error->file_name =
- (const char *)H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */
+ error->file_name = (const char *)H5MM_xfree_const(error->file_name);
if (error->desc)
- error->desc = (const char *)H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */
- } /* end for */
+ error->desc = (const char *)H5MM_xfree_const(error->desc);
+ }
/* Decrement number of errors on stack */
estack->nused -= u;
diff --git a/src/H5Emodule.h b/src/H5Emodule.h
index 8137673..43d5d36 100644
--- a/src/H5Emodule.h
+++ b/src/H5Emodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5E package. Including this header means that the source file
* is part of the H5E package.
*/
-#ifndef _H5Emodule_H
-#define _H5Emodule_H
+#ifndef H5Emodule_H
+#define H5Emodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,33 @@
#define H5_MY_PKG_ERR H5E_ERROR
#define H5_MY_PKG_INIT YES
-#endif /* _H5Emodule_H */
+/**
+ * \defgroup H5E H5E
+ * \brief Error Handling Interface
+ *
+ * \details The Error interface provides error handling in the form of a stack.
+ * The \Code{FUNC_ENTER} macro clears the error stack whenever an
+ * interface function is entered. When an error is detected, an entry
+ * is pushed onto the stack. As the functions unwind, additional
+ * entries are pushed onto the stack. The API function will return some
+ * indication that an error occurred and the application can print the
+ * error stack.
+ *
+ * Certain API functions in the \c H5E package, such as H5Eprint1(), do
+ * not clear the error stack. Otherwise, any function which does not
+ * have an underscore immediately after the package name will clear the
+ * error stack. For instance, H5Fopen() clears the error stack while
+ * \Code{H5F_open} does not.
+ *
+ * An error stack has a fixed maximum size. If this size is exceeded
+ * then the stack will be truncated and only the inner-most functions
+ * will have entries on the stack. This is expected to be a rare
+ * condition.
+ *
+ * Each thread has its own error stack, but since multi-threading has
+ * not been added to the library yet, this package maintains a single
+ * error stack. The error stack is statically allocated to reduce the
+ * complexity of handling errors within the \c H5E package.
+ */
+
+#endif /* H5Emodule_H */
diff --git a/src/H5Epkg.h b/src/H5Epkg.h
index 260b8da..30ff084 100644
--- a/src/H5Epkg.h
+++ b/src/H5Epkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Wednesday, April 11, 2007
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5E package!"
#endif
-#ifndef _H5Epkg_H
-#define _H5Epkg_H
+#ifndef H5Epkg_H
+#define H5Epkg_H
/* Get package's private header */
#include "H5Eprivate.h"
@@ -140,4 +140,4 @@ H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **clie
H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data);
H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count);
-#endif /* _H5Epkg_H */
+#endif /* H5Epkg_H */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 8f89201..4cd8b70 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* Header file for error values, etc.
*/
-#ifndef _H5Eprivate_H
-#define _H5Eprivate_H
+#ifndef H5Eprivate_H
+#define H5Eprivate_H
#include "H5Epublic.h"
@@ -111,18 +111,54 @@ typedef struct H5E_t H5E_t;
/* Retrieve the error code description string and push it onto the error
* stack.
*/
+#ifndef H5_HAVE_WIN32_API
#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
{ \
int myerrno = errno; \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
HDstrerror(myerrno)); \
}
#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
{ \
int myerrno = errno; \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
HDstrerror(myerrno)); \
}
+#else /* H5_HAVE_WIN32_API */
+/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a
+ * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will
+ * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero,
+ * though I wouldn't count on that.
+ */
+#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HDONE_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HGOTO_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#endif /* H5_HAVE_WIN32_API */
#ifdef H5_HAVE_PARALLEL
/*
@@ -132,20 +168,15 @@ typedef struct H5E_t H5E_t;
extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
extern int H5E_mpi_error_str_len;
-#define HMPI_ERROR(mpierr) \
- { \
- MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
- HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \
- }
#define HMPI_DONE_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#define HMPI_GOTO_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#endif /* H5_HAVE_PARALLEL */
@@ -203,4 +234,4 @@ H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func
H5_DLL herr_t H5E_clear_stack(H5E_t *estack);
H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api);
-#endif /* _H5Eprivate_H */
+#endif /* H5Eprivate_H */
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index cb156af..375e92d 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new errors to H5err.txt file */
-#ifndef _H5Epubgen_H
-#define _H5Epubgen_H
+#ifndef H5Epubgen_H
+#define H5Epubgen_H
#ifdef __cplusplus
extern "C" {
@@ -46,6 +46,7 @@ extern "C" {
#define H5E_IO (H5OPEN H5E_IO_g)
#define H5E_EFL (H5OPEN H5E_EFL_g)
#define H5E_TST (H5OPEN H5E_TST_g)
+#define H5E_LIB (H5OPEN H5E_LIB_g)
#define H5E_PAGEBUF (H5OPEN H5E_PAGEBUF_g)
#define H5E_FSPACE (H5OPEN H5E_FSPACE_g)
#define H5E_DATASET (H5OPEN H5E_DATASET_g)
@@ -83,6 +84,7 @@ H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */
H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */
H5_DLLVAR hid_t H5E_EFL_g; /* External file list */
H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */
+H5_DLLVAR hid_t H5E_LIB_g; /* General library infrastructure */
H5_DLLVAR hid_t H5E_PAGEBUF_g; /* Page Buffering */
H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */
H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */
@@ -248,6 +250,8 @@ H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */
#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g)
#define H5E_MOUNT (H5OPEN H5E_MOUNT_g)
#define H5E_CANTDELETEFILE (H5OPEN H5E_CANTDELETEFILE_g)
+#define H5E_CANTLOCKFILE (H5OPEN H5E_CANTLOCKFILE_g)
+#define H5E_CANTUNLOCKFILE (H5OPEN H5E_CANTUNLOCKFILE_g)
H5_DLLVAR hid_t H5E_FILEEXISTS_g; /* File already exists */
H5_DLLVAR hid_t H5E_FILEOPEN_g; /* File already open */
H5_DLLVAR hid_t H5E_CANTCREATE_g; /* Unable to create file */
@@ -258,6 +262,8 @@ H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */
H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */
H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */
H5_DLLVAR hid_t H5E_CANTDELETEFILE_g; /* Unable to delete file */
+H5_DLLVAR hid_t H5E_CANTLOCKFILE_g; /* Unable to lock file */
+H5_DLLVAR hid_t H5E_CANTUNLOCKFILE_g; /* Unable to unlock file */
/* Object atom related errors */
#define H5E_BADATOM (H5OPEN H5E_BADATOM_g)
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 8f9b473..2f529b3 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5E module.
*/
-#ifndef _H5Epublic_H
-#define _H5Epublic_H
+#ifndef H5Epublic_H
+#define H5Epublic_H
#include <stdio.h> /*FILE arg of H5Eprint() */
@@ -26,27 +26,38 @@
/* Value for the default error stack */
#define H5E_DEFAULT (hid_t)0
-/* Different kinds of error information */
+/**
+ * Different kinds of error information
+ */
typedef enum H5E_type_t { H5E_MAJOR, H5E_MINOR } H5E_type_t;
-/* Information about an error; element of error stack */
+/**
+ * Information about an error; element of error stack
+ */
typedef struct H5E_error2_t {
- hid_t cls_id; /*class ID */
- hid_t maj_num; /*major error ID */
- hid_t min_num; /*minor error number */
- unsigned line; /*line in file where error occurs */
- const char *func_name; /*function in which error occurred */
- const char *file_name; /*file in which error occurred */
- const char *desc; /*optional supplied description */
+ hid_t cls_id;
+ /**< Class ID */
+ hid_t maj_num;
+ /**< Major error ID */
+ hid_t min_num;
+ /**< Minor error number */
+ unsigned line;
+ /**< Line in file where error occurs */
+ const char *func_name;
+ /**< Function in which error occurred */
+ const char *file_name;
+ /**< File in which error occurred */
+ const char *desc;
+ /**< Optional supplied description */
} H5E_error2_t;
/* When this header is included from a private header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5private_H
+#ifndef H5private_H
#define H5OPEN H5open(),
-#else /* _H5private_H */
+#else /* H5private_H */
#define H5OPEN
-#endif /* _H5private_H */
+#endif /* H5private_H */
/* HDF5 error class */
#define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)
@@ -61,12 +72,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
* trying something that's likely or expected to fail. The code to try can
* be nested between calls to H5Eget_auto() and H5Eset_auto(), but it's
* easier just to use this macro like:
- * H5E_BEGIN_TRY {
- * ...stuff here that's likely to fail...
+ * H5E_BEGIN_TRY {
+ * ...stuff here that's likely to fail...
* } H5E_END_TRY;
*
* Warning: don't break, return, or longjmp() from the body of the loop or
- * the error reporting won't be properly restored!
+ * the error reporting won't be properly restored!
*
* These two macros still use the old API functions for backward compatibility
* purpose.
@@ -124,10 +135,10 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */
/* And return after pushing error onto stack */
#define H5Epush_ret(func, cls, maj, min, str, ret) \
- { \
+ do { \
H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str); \
return (ret); \
- }
+ } while (0)
/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in
* And goto a label after pushing error onto stack.
@@ -138,10 +149,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
goto label; \
}
-/* Error stack traversal direction */
+/**
+ * Error stack traversal direction
+ */
typedef enum H5E_direction_t {
- H5E_WALK_UPWARD = 0, /*begin deep, end at API function */
- H5E_WALK_DOWNWARD = 1 /*begin at API function, end deep */
+ H5E_WALK_UPWARD = 0, /**< begin w/ most specific error, end at API function */
+ H5E_WALK_DOWNWARD = 1 /**< begin at API function, end w/ most specific error */
} H5E_direction_t;
#ifdef __cplusplus
@@ -149,29 +162,478 @@ extern "C" {
#endif
/* Error stack traversal callback function pointers */
+//! <!-- [H5E_walk2_t_snip] -->
+/**
+ * \brief Callback function for H5Ewalk2()
+ *
+ * \param[in] n Indexed error position in the stack
+ * \param[in] err_desc Pointer to a data structure describing the error
+ * \param[in] client_data Pointer to client data in the format expected by the
+ * user-defined function
+ * \return \herr_t
+ */
typedef herr_t (*H5E_walk2_t)(unsigned n, const H5E_error2_t *err_desc, void *client_data);
+//! <!-- [H5E_walk2_t_snip] -->
+
+//! <!-- [H5E_auto2_t_snip] -->
+/**
+ * \brief Callback function for H5Eset_auto2()
+ *
+ * \estack_id{estack}
+ * \param[in] client_data Pointer to client data in the format expected by the
+ * user-defined function
+ * \return \herr_t
+ */
typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data);
+//! <!-- [H5E_auto2_t_snip] -->
/* Public API functions */
-H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version);
-H5_DLL herr_t H5Eunregister_class(hid_t class_id);
-H5_DLL herr_t H5Eclose_msg(hid_t err_id);
-H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg);
-H5_DLL hid_t H5Ecreate_stack(void);
-H5_DLL hid_t H5Eget_current_stack(void);
-H5_DLL herr_t H5Eclose_stack(hid_t stack_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Registers a client library or application program to the HDF5 error API
+ *
+ * \param[in] cls_name Name of the error class
+ * \param[in] lib_name Name of the client library or application to which the error class belongs
+ * \param[in] version Version of the client library or application to which the
+ error class belongs. Can be \c NULL.
+ * \return Returns a class identifier on success; otherwise returns H5I_INVALID_ID.
+ *
+ * \details H5Eregister_class() registers a client library or application
+ * program to the HDF5 error API so that the client library or
+ * application program can report errors together with the HDF5
+ * library. It receives an identifier for this error class for further
+ * error operations. The library name and version number will be
+ * printed out in the error message as a preamble.
+ *
+ * \since 1.8.0
+ */
+H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Removes an error class
+ *
+ * \param[in] class_id Error class identifier.
+ * \return \herr_t
+ *
+ * \details H5Eunregister_class() removes the error class specified by \p
+ * class_id. All the major and minor errors in this class will also be
+ * closed.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eunregister_class(hid_t class_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Closes an error message
+ *
+ * \param[in] err_id An error message identifier
+ * \return \herr_t
+ *
+ * \details H5Eclose_msg() closes an error message identifier, which can be
+ * either a major or minor message.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eclose_msg(hid_t err_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Adds a major error message to an error class
+ *
+ * \param[in] cls An error class identifier
+ * \param[in] msg_type The type of the error message
+ * \param[in] msg Major error message
+ * \return \herr_t
+ *
+ * \details H5Ecreate_msg() adds an error message to an error class defined by
+ * client library or application program. The error message can be
+ * either major or minor as indicated by the parameter \p msg_type.
+ *
+ * Use H5Eclose_msg() to close the message identifier returned by this
+ * function.
+ *
+ * \since 1.8.0
+ */
+H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Creates a new, empty error stack
+ *
+ * \return \hid_ti{error stack}
+ *
+ * \details H5Ecreate_stack() creates a new empty error stack and returns the
+ * new stack’s identifier. Use H5Eclose_stack() to close the error stack
+ * identifier returned by this function.
+ *
+ * \since 1.8.0
+ */
+H5_DLL hid_t H5Ecreate_stack(void);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Returns a copy of the current error stack
+ *
+ * \return \hid_ti{error stack}
+ *
+ * \details H5Eget_current_stack() copies the current error stack and returns an
+ * error stack identifier for the new copy.
+ *
+ * \since 1.8.0
+ */
+H5_DLL hid_t H5Eget_current_stack(void);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Closes an error stack handle
+ *
+ * \estack_id{stack_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Eclose_stack() closes the error stack handle \p stack_id
+ * and releases its resources. #H5E_DEFAULT cannot be closed.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eclose_stack(hid_t stack_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Retrieves error class name
+ *
+ * \param[in] class_id Error class identifier
+ * \param[out] name Buffer for the error class name
+ * \param[in] size The maximum number of characters the class name to be returned
+ * by this function in\p name.
+ * \return Returns non-negative value as on success; otherwise returns negative value.
+ *
+ * \details H5Eget_class_name() retrieves the name of the error class specified
+ * by the class identifier. If non-NULL pointer is passed in for \p
+ * name and \p size is greater than zero, the class name of \p size
+ * long is returned. The length of the error class name is also
+ * returned. If NULL is passed in as \p name, only the length of class
+ * name is returned. If zero is returned, it means no name. The user is
+ * responsible for allocating sufficient buffer space for the name.
+ *
+ * \since 1.8.0
+ */
H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size);
-H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id);
-H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id,
- hid_t maj_id, hid_t min_id, const char *msg, ...);
-H5_DLL herr_t H5Epop(hid_t err_stack, size_t count);
-H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream);
-H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data);
-H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data);
-H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data);
-H5_DLL herr_t H5Eclear2(hid_t err_stack);
-H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Replaces the current error stack
+ *
+ * \estack_id{err_stack_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Eset_current_stack() replaces the content of the current error
+ * stack with a copy of the content of the error stack specified by
+ * \p err_stack_id, and it closes the error stack specified by
+ * \p err_stack_id.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Pushes a new error record onto an error stack
+ *
+ * \estack_id{err_stack}. If the identifier is #H5E_DEFAULT, the error record
+ * will be pushed to the current stack.
+ * \param[in] file Name of the file in which the error was detected
+ * \param[in] func Name of the function in which the error was detected
+ * \param[in] line Line number in the file where the error was detected
+ * \param[in] cls_id Error class identifier
+ * \param[in] maj_id Major error identifier
+ * \param[in] min_id Minor error identifier
+ * \param[in] msg Error description string
+ * \return \herr_t
+ *
+ * \details H5Epush2() pushes a new error record onto the error stack specified
+ * by \p err_stack.\n
+ * The error record contains the error class identifier \p cls_id, the
+ * major and minor message identifiers \p maj_id and \p min_id, the
+ * function name \p func where the error was detected, the file name \p
+ * file and line number \p line in the file where the error was
+ * detected, and an error description \p msg.\n
+ * The major and minor errors must be in the same error class.\n
+ * The function name, filename, and error description strings must be
+ * statically allocated.\n
+ * \p msg can be a format control string with additional
+ * arguments. This design of appending additional arguments is similar
+ * to the system and C functions printf() and fprintf().
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id,
+ hid_t maj_id, hid_t min_id, const char *msg, ...);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Deletes specified number of error messages from the error stack
+ *
+ * \estack_id{err_stack}
+ * \param[in] count The number of error messages to be deleted from the top
+ * of error stack
+ * \return \herr_t
+ *
+ * \details H5Epop() deletes the number of error records specified in \p count
+ * from the top of the error stack specified by \p err_stack (including
+ * major, minor messages and description). The number of error messages
+ * to be deleted is specified by \p count.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Epop(hid_t err_stack, size_t count);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Prints the specified error stack in a default manner
+ *
+ * \estack_id{err_stack}
+ * \param[in] stream File pointer, or \c NULL for \c stderr
+ * \return \herr_t
+ *
+ * \details H5Eprint2() prints the error stack specified by \p err_stack on the
+ * specified stream, \p stream. Even if the error stack is empty, a
+ * one-line message of the following form will be printed:
+ * \code{.unparsed}
+ * HDF5-DIAG: Error detected in HDF5 library version: 1.5.62 thread 0.
+ * \endcode
+ *
+ * A similar line will appear before the error messages of each error
+ * class stating the library name, library version number, and thread
+ * identifier.
+ *
+ * If \p err_stack is #H5E_DEFAULT, the current error stack will be
+ * printed.
+ *
+ * H5Eprint2() is a convenience function for H5Ewalk2() with a function
+ * that prints error messages. Users are encouraged to write their own
+ * more specific error handlers.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Walks the specified error stack, calling the specified function
+ *
+ * \estack_id{err_stack}
+ * \param[in] direction Direction in which the error stack is to be walked
+ * \param[in] func Function to be called for each error encountered
+ * \param[in] client_data Data to be passed to \p func
+ * \return \herr_t
+ *
+ * \details H5Ewalk2() walks the error stack specified by err_stack for the
+ * current thread and calls the function specified in \p func for each
+ * error along the way.
+ *
+ * If the value of \p err_stack is #H5E_DEFAULT, then H5Ewalk2() walks
+ * the current error stack.
+ *
+ * \p direction specifies whether the stack is walked from the inside
+ * out or the outside in. A value of #H5E_WALK_UPWARD means to begin
+ * with the most specific error and end at the API; a value of
+ * #H5E_WALK_DOWNWARD means to start at the API and end at the
+ * innermost function where the error was first detected.
+ *
+ * \p func, a function conforming to the #H5E_walk2_t prototype, will
+ * be called for each error in the error stack. Its arguments will
+ * include an index number \c n (beginning at zero regardless of stack
+ * traversal direction), an error stack entry \c err_desc, and the \c
+ * client_data pointer passed to H5Eprint(). The #H5E_walk2_t prototype
+ * is as follows:
+ * \snippet this H5E_walk2_t_snip
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Returns the settings for the automatic error stack traversal
+ * function and its data
+ *
+ * \estack_id
+ * \param[out] func The function currently set to be called upon an error condition
+ * \param[out] client_data Data currently set to be passed to the error function
+ * \return \herr_t
+ *
+ * \details H5Eget_auto2() returns the settings for the automatic error stack
+ * traversal function, \p func, and its data, \p client_data, that are
+ * associated with the error stack specified by \p estack_id.
+ *
+ * Either or both of the \p func and \p client_data arguments may be
+ * \c NULL, in which case the value is not returned.
+ *
+ * The library initializes its default error stack traversal functions
+ * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns
+ * H5Eprint2() or the user-defined function passed in through
+ * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the
+ * user-defined function passed in through H5Eset_auto1(). However, if
+ * the application passes in a user-defined function through
+ * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal
+ * function. If the application passes in a user-defined function
+ * through H5Eset_auto2(), it should call H5Eget_auto2() to query the
+ * traversal function.
+ *
+ * Mixing the new style and the old style functions will cause a
+ * failure. For example, if the application sets a user-defined
+ * old-style traversal function through H5Eset_auto1(), a call to
+ * H5Eget_auto2() will fail and will indicate that the application has
+ * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing
+ * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if
+ * the traversal functions are the library’s default H5Eprint1() or
+ * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing
+ * H5Eset_auto2() and H5Eget_auto1() does not fail.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Turns automatic error printing on or off
+ *
+ * \estack_id
+ * \param[in] func Function to be called upon an error condition
+ * \param[in] client_data Data passed to the error function
+ * \return \herr_t
+ *
+ * \details H5Eset_auto2() turns on or off automatic printing of errors for the
+ * error stack specified with \p estack_id. An \p estack_id value of
+ * #H5E_DEFAULT indicates the current stack.
+ *
+ * When automatic printing is turned on, by the use of a non-null \p func
+ * pointer, any API function which returns an error indication will
+ * first call \p func, passing it \p client_data as an argument.
+ *
+ * \p func, a function compliant with the #H5E_auto2_t prototype, is
+ * defined in the H5Epublic.h source code file as:
+ * \snippet this H5E_auto2_t_snip
+ *
+ * When the library is first initialized, the auto printing function is
+ * set to H5Eprint2() (cast appropriately) and \p client_data is the
+ * standard error stream pointer, \c stderr.
+ *
+ * Automatic stack traversal is always in the #H5E_WALK_DOWNWARD
+ * direction.
+ *
+ * Automatic error printing is turned off with a H5Eset_auto2() call
+ * with a \c NULL \p func pointer.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Clears the specified error stack or the error stack for the current thread
+ *
+ * \estack_id{err_stack}
+ * \return \herr_t
+ *
+ * \details H5Eclear2() clears the error stack specified by \p err_stack, or, if
+ * \p err_stack is set to #H5E_DEFAULT, the error stack for the current
+ * thread.
+ *
+ * \p err_stack is an error stack identifier, such as that returned by
+ * H5Eget_current_stack().
+ *
+ * The current error stack is also cleared whenever an API function is
+ * called, with certain exceptions (for instance, H5Eprint1() or
+ * H5Eprint2()).
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eclear2(hid_t err_stack);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Determines the type of error stack
+ *
+ * \estack_id{err_stack}
+ * \param[out] is_stack A flag indicating which error stack \c typedef the
+ * specified error stack conforms to
+ *
+ * \return \herr_t
+ *
+ * \details H5Eauto_is_v2() determines whether the error auto reporting function
+ * for an error stack conforms to the #H5E_auto2_t \c typedef or the
+ * #H5E_auto1_t \c typedef.
+ *
+ * The \p is_stack parameter is set to 1 if the error stack conforms to
+ * #H5E_auto2_t and 0 if it conforms to #H5E_auto1_t.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Retrieves an error message
+ *
+ * \param[in] msg_id Error message identifier
+ * \param[out] type The type of the error message Valid values are #H5E_MAJOR
+ * and #H5E_MINOR.
+ * \param[out] msg Error message buffer
+ * \param[in] size The length of error message to be returned by this function
+ * \return Returns the size of the error message in bytes on success; otherwise
+ * returns a negative value.
+ *
+ * \details H5Eget_msg() retrieves the error message including its length and
+ * type. The error message is specified by \p msg_id. The user is
+ * responsible for passing in sufficient buffer space for the
+ * message. If \p msg is not NULL and \p size is greater than zero, the
+ * error message of \p size long is returned. The length of the message
+ * is also returned. If NULL is passed in as \p msg, only the length
+ * and type of the message is returned. If the return value is zero, it
+ * means there is no message.
+ *
+ * \since 1.8.0
+ */
H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, size_t size);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Retrieves the number of error messages in an error stack
+ *
+ * \estack_id{error_stack_id}
+ * \return Returns a non-negative value on success; otherwise returns a negative value.
+ *
+ * \details H5Eget_num() retrieves the number of error records in the error
+ * stack specified by \p error_stack_id (including major, minor
+ * messages and description).
+ *
+ * \since 1.8.0
+ */
H5_DLL ssize_t H5Eget_num(hid_t error_stack_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
@@ -188,34 +650,263 @@ H5_DLL ssize_t H5Eget_num(hid_t error_stack_id);
typedef hid_t H5E_major_t;
typedef hid_t H5E_minor_t;
-/* Information about an error element of error stack. */
+/**
+ * Information about an error element of error stack.
+ */
typedef struct H5E_error1_t {
- H5E_major_t maj_num; /*major error number */
- H5E_minor_t min_num; /*minor error number */
- const char *func_name; /*function in which error occurred */
- const char *file_name; /*file in which error occurred */
- unsigned line; /*line in file where error occurs */
- const char *desc; /*optional supplied description */
+ H5E_major_t maj_num; /**< major error number */
+ H5E_minor_t min_num; /**< minor error number */
+ const char *func_name; /**< function in which error occurred */
+ const char *file_name; /**< file in which error occurred */
+ unsigned line; /**< line in file where error occurs */
+ const char *desc; /**< optional supplied description */
} H5E_error1_t;
/* Error stack traversal callback function pointers */
+//! <!-- [H5E_walk1_t_snip] -->
+/**
+ * \brief Callback function for H5Ewalk1()
+ *
+ * \param[in] n Indexed error position in the stack
+ * \param[in] err_desc Pointer to a data structure describing the error
+ * \param[in] client_data Pointer to client data in the format expected by the
+ * user-defined function
+ * \return \herr_t
+ */
typedef herr_t (*H5E_walk1_t)(int n, H5E_error1_t *err_desc, void *client_data);
+//! <!-- [H5E_walk1_t_snip] -->
+
+//! <!-- [H5E_auto1_t_snip] -->
+/**
+ * \brief Callback function for H5Eset_auto1()
+ *
+ * \param[in] client_data Pointer to client data in the format expected by the
+ * user-defined function
+ * \return \herr_t
+ */
typedef herr_t (*H5E_auto1_t)(void *client_data);
+//! <!-- [H5E_auto1_t_snip] -->
/* Function prototypes */
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Clears the error stack for the current thread
+ *
+ * \return \herr_t
+ *
+ * \details H5Eclear1() clears the error stack for the current thread.\n
+ * The stack is also cleared whenever an API function is called, with
+ * certain exceptions (for instance, H5Eprint1()).
+ *
+ * \deprecated 1.8.0 Function H5Eclear() renamed to H5Eclear1() and deprecated
+ * in this release.
+ */
H5_DLL herr_t H5Eclear1(void);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Returns the current settings for the automatic error stack traversal
+ * function and its data
+ *
+ * \param[out] func Current setting for the function to be called upon an error
+ * condition
+ * \param[out] client_data Current setting for the data passed to the error
+ * function
+ * \return \herr_t
+ *
+ * \details H5Eget_auto1() returns the current settings for the automatic error
+ * stack traversal function, \p func, and its data,
+ * \p client_data. Either or both arguments may be \c NULL, in which case the
+ * value is not returned.
+ *
+ * The library initializes its default error stack traversal functions
+ * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns
+ * H5Eprint2() or the user-defined function passed in through
+ * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the
+ * user-defined function passed in through H5Eset_auto1(). However, if
+ * the application passes in a user-defined function through
+ * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal
+ * function. If the application passes in a user-defined function
+ * through H5Eset_auto2(), it should call H5Eget_auto2() to query the
+ * traversal function.
+ *
+ * Mixing the new style and the old style functions will cause a
+ * failure. For example, if the application sets a user-defined
+ * old-style traversal function through H5Eset_auto1(), a call to
+ * H5Eget_auto2() will fail and will indicate that the application has
+ * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing
+ * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if
+ * the traversal functions are the library’s default H5Eprint1() or
+ * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing
+ * H5Eset_auto2() and H5Eget_auto1() does not fail.
+ *
+ * \deprecated 1.8.0 Function H5Eget_auto() renamed to H5Eget_auto1() and
+ * deprecated in this release.
+ */
H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Pushes a new error record onto the error stack
+ *
+ * \param[in] file Name of the file in which the error was detected
+ * \param[in] func Name of the function in which the error was detected
+ * \param[in] line Line number in the file where the error was detected
+ * \param[in] maj Major error identifier
+ * \param[in] min Minor error identifier
+ * \param[in] str Error description string
+ * \return \herr_t
+ *
+ * \details H5Epush1() pushes a new error record onto the error stack for the
+ * current thread.\n
+ * The error has major and minor numbers \p maj_num
+ * and \p min_num, the function \p func where the error was detected, the
+ * name of the file \p file where the error was detected, the line \p line
+ * within that file, and an error description string \p str.\n
+ * The function name, filename, and error description strings must be statically
+ * allocated.
+ *
+ * \since 1.4.0
+ * \deprecated 1.8.0 Function H5Epush() renamed to H5Epush1() and
+ * deprecated in this release.
+ */
H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min,
const char *str);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Prints the current error stack in a default manner
+ *
+ * \param[in] stream File pointer, or \c NULL for \c stderr
+ * \return \herr_t
+ *
+ * \details H5Eprint1() prints prints the error stack for the current thread
+ * on the specified stream, \p stream. Even if the error stack is empty, a
+ * one-line message of the following form will be printed:
+ * \code{.unparsed}
+ * HDF5-DIAG: Error detected in thread 0.
+ * \endcode
+ * H5Eprint1() is a convenience function for H5Ewalk1() with a function
+ * that prints error messages. Users are encouraged to write their own
+ * more specific error handlers.
+ *
+ * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and
+ * deprecated in this release.
+ */
H5_DLL herr_t H5Eprint1(FILE *stream);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Turns automatic error printing on or off
+ *
+ * \param[in] func Function to be called upon an error condition
+ * \param[in] client_data Data passed to the error function
+ * \return \herr_t
+ *
+ * \details H5Eset_auto1() turns on or off automatic printing of errors. When
+ * turned on (non-null \p func pointer), any API function which returns
+ * an error indication will first call \p func, passing it \p
+ * client_data as an argument.
+ *
+ * \p func, a function conforming to the #H5E_auto1_t prototype, is
+ * defined in the H5Epublic.h source code file as:
+ * \snippet this H5E_auto1_t_snip
+ *
+ * When the library is first initialized, the auto printing function is
+ * set to H5Eprint1() (cast appropriately) and \p client_data is the
+ * standard error stream pointer, \c stderr.
+ *
+ * Automatic stack traversal is always in the #H5E_WALK_DOWNWARD
+ * direction.
+ *
+ * \deprecated 1.8.0 Function H5Eset_auto() renamed to H5Eset_auto1() and
+ * deprecated in this release.
+ */
H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Walks the current error stack, calling the specified function
+ *
+ * \param[in] direction Direction in which the error stack is to be walked
+ * \param[in] func Function to be called for each error encountered
+ * \param[in] client_data Data to be passed to \p func
+ * \return \herr_t
+ *
+ * \details H5Ewalk1() walks the error stack for the current thread and calls
+ * the function specified in \p func for each error along the way.
+ *
+ * \p direction specifies whether the stack is walked from the inside
+ * out or the outside in. A value of #H5E_WALK_UPWARD means to begin
+ * with the most specific error and end at the API; a value of
+ * #H5E_WALK_DOWNWARD means to start at the API and end at the
+ * innermost function where the error was first detected.
+ *
+ * \p func, a function conforming to the #H5E_walk1_t prototype, will
+ * be called for each error in the error stack. Its arguments will
+ * include an index number \c n (beginning at zero regardless of stack
+ * traversal direction), an error stack entry \c err_desc, and the \c
+ * client_data pointer passed to H5Eprint(). The #H5E_walk1_t prototype
+ * is as follows:
+ * \snippet this H5E_walk1_t_snip
+ *
+ * \deprecated 1.8.0 Function H5Ewalk() renamed to H5Ewalk1() and
+ * deprecated in this release.
+ */
H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data);
-H5_DLL char * H5Eget_major(H5E_major_t maj);
-H5_DLL char * H5Eget_minor(H5E_minor_t min);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Returns a character string describing an error specified by a major
+ * error number
+ *
+ * \param[in] maj Major error number
+ * \return \herr_t
+ *
+ * \details Given a major error number, H5Eget_major() returns a constant
+ * character string that describes the error.
+ *
+ * \attention This function returns a dynamically allocated string (\c char
+ * array). An application calling this function must free the memory
+ * associated with the return value to prevent a memory leak.
+ *
+ * \deprecated 1.8.0 Function deprecated in this release.
+ */
+H5_DLL char *H5Eget_major(H5E_major_t maj);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5E
+ *
+ * \brief Returns a character string describing an error specified by a minor
+ * error number
+ *
+ * \param[in] min Minor error number
+ * \return \herr_t
+ *
+ * \details Given a minor error number, H5Eget_minor() returns a constant
+ * character string that describes the error.
+ *
+ * \attention In the Release 1.8.x series, H5Eget_minor() returns a string of
+ * dynamic allocated \c char array. An application calling this
+ * function from an HDF5 library of Release 1.8.0 or later must free
+ * the memory associated with the return value to prevent a memory
+ * leak. This is a change from the 1.6.x release series.
+ *
+ * \deprecated 1.8.0 Function deprecated and return type changed in this release.
+ */
+H5_DLL char *H5Eget_minor(H5E_minor_t min);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
#endif
-#endif /* end _H5Epublic_H */
+#endif /* end H5Epublic_H */
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 2d9208c..4eff528 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new errors to H5err.txt file */
-#ifndef _H5Eterm_H
-#define _H5Eterm_H
+#ifndef H5Eterm_H
+#define H5Eterm_H
/* Reset major error IDs */
@@ -40,6 +40,7 @@ H5E_ATTR_g=
H5E_IO_g=
H5E_EFL_g=
H5E_TST_g=
+H5E_LIB_g=
H5E_PAGEBUF_g=
H5E_FSPACE_g=
H5E_DATASET_g=
@@ -149,7 +150,9 @@ H5E_NOTHDF5_g=
H5E_BADFILE_g=
H5E_TRUNCATED_g=
H5E_MOUNT_g=
-H5E_CANTDELETEFILE_g=
+H5E_CANTDELETEFILE_g=
+H5E_CANTLOCKFILE_g=
+H5E_CANTUNLOCKFILE_g=
/* Object atom related errors */
H5E_BADATOM_g=
diff --git a/src/H5F.c b/src/H5F.c
index d22feb5..3d044c5 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,20 +21,13 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
#include "H5FLprivate.h" /* Free lists */
-#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
@@ -68,8 +61,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);
@@ -80,9 +71,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 */
/*****************************/
@@ -97,146 +85,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() */
-
/*-------------------------------------------------------------------------
* Function: H5Fget_create_plist
*
@@ -266,7 +114,7 @@ H5Fget_create_plist(hid_t file_id)
/* Retrieve the file creation property list */
if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
done:
FUNC_LEAVE_API(ret_value)
@@ -305,7 +153,7 @@ H5Fget_access_plist(hid_t file_id)
/* Retrieve the file's access property list */
if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
done:
FUNC_LEAVE_API(ret_value)
@@ -531,8 +379,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
@@ -566,8 +414,8 @@ done:
*
* Purpose: Check if the file can be opened with the given fapl.
*
- * Return: Succeed: TRUE/FALSE
- * Failure: FAIL (includes file does not exist)
+ * Return: Success: TRUE/FALSE
+ * Failure: -1 (includes file does not exist)
*
*-------------------------------------------------------------------------
*/
@@ -618,15 +466,13 @@ done:
* the list of file creation and file access properties.
*
* Return: Success: A file ID
- *
* Failure: H5I_INVALID_HID
- *
*-------------------------------------------------------------------------
*/
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- H5F_t * new_file = NULL; /* File struct for new file */
+ void * new_file = NULL; /* File struct for new file */
H5P_genplist_t * plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
H5VL_object_t * vol_obj = NULL; /* VOL object for file */
@@ -681,8 +527,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/* Create a new file or truncate an existing file through the VOL */
- if (NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (new_file = H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file")
/* Get an atom for the file */
@@ -720,15 +566,13 @@ done:
* See Also: H5Fpublic.h for a list of possible values for FLAGS.
*
* Return: Success: A file ID
- *
* Failure: H5I_INVALID_HID
- *
*-------------------------------------------------------------------------
*/
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- H5F_t * new_file = NULL; /* File struct for new file */
+ void * new_file = NULL; /* File struct for new file */
H5P_genplist_t * plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
H5VL_object_t * vol_obj = NULL; /* VOL object for file */
@@ -771,8 +615,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
/* Open the file through the VOL layer */
- if (NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (new_file = H5VL_file_open(&connector_prop, filename, flags, fapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
/* Get an ID for the file */
@@ -781,7 +625,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
/* Get the file object */
if (NULL == (vol_obj = H5VL_vol_object(ret_value)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier")
/* Make the 'post open' callback */
supported = FALSE;
@@ -803,8 +647,8 @@ done:
* not remove them from the cache. The OBJECT_ID can be a file,
* dataset, group, attribute, or named data type.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -823,7 +667,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
H5I_DATASET != obj_type && H5I_ATTR != obj_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- /* get the file object */
+ /* Get the file object */
if (NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
@@ -846,14 +690,14 @@ done:
* closed until those objects are closed; however, all data for
* the file and the open objects is flushed.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5Fclose(hid_t file_id)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -862,11 +706,9 @@ H5Fclose(hid_t file_id)
if (H5I_FILE != H5I_get_type(file_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
- /* Decrement reference count on atom. When it reaches zero the file will
- * be closed.
- */
+ /* Close the file */
if (H5I_dec_app_ref(file_id) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -984,7 +826,6 @@ H5Freopen(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback")
done:
- /* XXX (VOL MERGE): If registration fails, file will not be closed */
FUNC_LEAVE_API(ret_value)
} /* end H5Freopen() */
@@ -994,8 +835,8 @@ done:
* Purpose: Public API to retrieve the file's 'intent' flags passed
* during H5Fopen()
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1066,9 +907,7 @@ done:
* Purpose: Retrieves the amount of free space in the file.
*
* Return: Success: Amount of free space for type
- *
* Failure: -1
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -1100,8 +939,8 @@ done:
* is called after an existing file is opened in order
* to learn the true size of the underlying file.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1162,19 +1001,17 @@ done:
* this now.
*
* Return: Success: Bytes copied / number of bytes needed
- *
* Failure: -1
- *
*-------------------------------------------------------------------------
*/
ssize_t
-H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
+H5Fget_file_image(hid_t file_id, void *buf, size_t buf_len)
{
H5VL_object_t *vol_obj; /* File object for file ID */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
+ H5TRACE3("Zs", "i*xz", file_id, buf, buf_len);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1182,7 +1019,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
/* Get the file image */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, buf_ptr, &ret_value, buf_len) < 0)
+ H5_REQUEST_NULL, buf, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
@@ -1199,22 +1036,22 @@ 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
-H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
+H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config)
{
H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", file_id, config_ptr);
+ H5TRACE2("e", "i*x", file_id, config);
/* Check args */
- if ((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
+ if ((NULL == config) || (config->version != H5AC__CURR_CACHE_CONFIG_VERSION))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad configptr")
/* Get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
@@ -1222,7 +1059,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
/* Get the metadata cache configuration */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- config_ptr) < 0)
+ config) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1236,8 +1073,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
@@ -1270,28 +1107,28 @@ done:
* the hit rate statistics were reset either manually or
* automatically.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
+H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate)
{
H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*d", file_id, hit_rate_ptr);
+ H5TRACE2("e", "i*d", file_id, hit_rate);
/* Check args */
- if (NULL == hit_rate_ptr)
+ if (NULL == hit_rate)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the current hit rate */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- hit_rate_ptr) < 0)
+ hit_rate) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1307,19 +1144,19 @@ done:
* the ptr parameters are NULL, the associated datum is
* not returned.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
- int *cur_num_entries_ptr)
+H5Fget_mdc_size(hid_t file_id, size_t *max_size, size_t *min_clean_size, size_t *cur_size,
+ int *cur_num_entries)
{
H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr);
+ H5TRACE5("e", "i*z*z*z*Is", file_id, max_size, min_clean_size, cur_size, cur_num_entries);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1327,7 +1164,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
/* Get the size data */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
+ max_size, min_clean_size, cur_size, cur_num_entries) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
@@ -1346,8 +1183,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
@@ -1388,9 +1225,7 @@ done:
* not the actual name after resolving symlinks, etc.
*
* Return: Success: The length of the file name
- *
* Failure: -1
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1431,8 +1266,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
@@ -1474,8 +1309,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
@@ -1513,9 +1348,7 @@ done:
* sections.
*
* Return: Success: The total # of free space sections
- *
* Failure: -1
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1549,8 +1382,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
@@ -1605,8 +1438,8 @@ done:
* set up flush dependency/proxy even for file opened without
* SWMR to resolve issues with opened objects.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1641,8 +1474,8 @@ done:
* Purpose: Start metadata cache logging operations for a file.
* - Logging must have been set up via the fapl.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1674,8 +1507,8 @@ done:
* - Does not close the log file.
* - Logging must have been set up via the fapl.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1707,8 +1540,8 @@ done:
* set up via the fapl. is_currently_logging determines if
* log messages are being recorded at this time.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1741,8 +1574,8 @@ done:
* H5Fset_latest_format() starting release 1.10.2.
* See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1778,8 +1611,8 @@ done:
* downgrade persistent file space to non-persistent
* for 1.8 library.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1813,8 +1646,8 @@ done:
*
* Purpose: Resets statistics for the page buffer layer.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1844,8 +1677,8 @@ done:
*
* Purpose: Retrieves statistics for the page buffer layer.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1882,8 +1715,8 @@ done:
* image_len: --size of the on disk metadata cache image
* --zero if no cache image
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1911,11 +1744,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: SUCCEED/FAIL
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1948,7 +1782,8 @@ done:
*
* Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -1974,24 +1809,13 @@ done:
} /* H5Fincrement_filesize() */
/*-------------------------------------------------------------------------
- * Function: H5Fget_dset_no_attrs_hint
- *
- * Purpose:
- *
- * Get the file-level setting to create minimized dataset object headers.
- * Result is stored at pointer `minimize`.
+ * Function: H5Fget_dset_no_attrs_hint
*
- * Return:
+ * Purpose: Get the file-level setting to create minimized dataset object headers.
+ * Result is stored at pointer `minimize`.
*
- * Success: SUCCEED (0) (non-negative value)
- * Failure: FAIL (-1) (negative value)
- *
- * Programmer:
- *
- * Jacob Smith
- * 15 August 2018
- *
- * Changes: None.
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -2019,23 +1843,13 @@ done:
} /* H5Fget_dset_no_attrs_hint */
/*-------------------------------------------------------------------------
- * Function: H5Fset_dset_no_attrs_hint
- *
- * Purpose:
- *
- * Set the file-level setting to create minimized dataset object headers.
- *
- * Return:
- *
- * Success: SUCCEED (0) (non-negative value)
- * Failure: FAIL (-1) (negative value)
- *
- * Programmer:
+ * Function: H5Fset_dset_no_attrs_hint
*
- * Jacob Smith
- * 15 August 2018
+ * Purpose: Set the file-level setting to create minimized dataset object
+ * headers.
*
- * Changes: None.
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5FA.c b/src/H5FA.c
index b5d45cb..05b0bd8 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FA.c
* April 2009
- * Vailin Choi <vchoi@hdfgroup.org>
+ * Vailin Choi
*
* Purpose: Implements a Fixed Array for storing elements
* of datasets with fixed dimensions.
@@ -101,7 +101,6 @@ H5FL_BLK_DEFINE(fa_native_elmt);
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Oct 17 2016
*
*-------------------------------------------------------------------------
@@ -670,11 +669,6 @@ END_FUNC(PRIV) /* end H5FA_delete() */
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
- * Modification:
- * Prototype changed (HDFFV-10661)
- * - herr_t to int
- * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
- * June 6, 2019 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 44a05b6..1b127c7 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FAcache.c
* Jul 2 2009
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement fixed array metadata cache methods.
*
@@ -163,7 +163,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
*
*-------------------------------------------------------------------------
@@ -225,7 +224,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 12, 2013
*
*-------------------------------------------------------------------------
@@ -254,7 +252,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
hdr->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature")
image += H5_SIZEOF_MAGIC;
@@ -336,7 +334,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
*
*-------------------------------------------------------------------------
@@ -364,7 +361,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
*
*-------------------------------------------------------------------------
@@ -503,7 +499,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 12, 2013
*
*-------------------------------------------------------------------------
@@ -529,7 +524,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
*
*-------------------------------------------------------------------------
@@ -613,7 +607,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -644,7 +637,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
dblock->addr = udata->dblk_addr;
/* Magic number */
- if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature")
image += H5_SIZEOF_MAGIC;
@@ -712,7 +705,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
*
*-------------------------------------------------------------------------
@@ -743,7 +735,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
*
*-------------------------------------------------------------------------
@@ -890,7 +881,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -962,7 +952,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
*
*-------------------------------------------------------------------------
@@ -1025,7 +1014,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -1097,7 +1085,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
*
*-------------------------------------------------------------------------
@@ -1125,7 +1112,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -1176,7 +1162,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
*
*-------------------------------------------------------------------------
@@ -1238,7 +1223,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/H5FAdbg.c b/src/H5FAdbg.c
index b50cd67..8c2c9a8 100644
--- a/src/H5FAdbg.c
+++ b/src/H5FAdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -111,19 +111,20 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Header size:", hdr->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of elements in data block page:",
(unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits));
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of elements in Fixed Array:", hdr->stats.nelmts);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Fixed Array Data Block Address:", hdr->dblk_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Fixed Array Data Block Address:", hdr->dblk_addr);
CATCH
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
@@ -185,12 +186,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of elements in Data Block:", hdr->cparam.nelmts);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Number of elements per Data Block page:", dblock->dblk_page_nelmts);
if (dblock->npages) { /* paging */
@@ -207,7 +208,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Read and print each page's elements in the data block */
for (page_idx = 0; page_idx < dblock->npages; page_idx++) {
if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) {
- HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty");
+ HDfprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, "Page %zu:", page_idx, "empty");
} /* end if */
else { /* get the page */
@@ -225,7 +226,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
"unable to protect fixed array data block page, address = %llu",
(unsigned long long)dblk_page_addr)
- HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx);
+ HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx);
for (u = 0; u < dblk_page_nelmts; u++) {
/* Call the class's 'debug' callback */
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c
index 61aaf0e..0f5ee29 100644
--- a/src/H5FAdblkpage.c
+++ b/src/H5FAdblkpage.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c
index 1c0a2d7..21e2e03 100644
--- a/src/H5FAdblock.c
+++ b/src/H5FAdblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 921d0a0..867160f 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -37,7 +37,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -382,7 +382,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
*
*-------------------------------------------------------------------------
@@ -438,7 +437,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
*
*-------------------------------------------------------------------------
@@ -457,7 +455,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_unprotect(H5FA_hdr_t *hdr,
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
+END_FUNC(PKG) /* end H5FA__hdr_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_delete
diff --git a/src/H5FAint.c b/src/H5FAint.c
index 63dd128..864c7ee 100644
--- a/src/H5FAint.c
+++ b/src/H5FAint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FAint.c
* Fall 2012
- * Dana Robinson <derobins@hdfgroup.org>
+ * Dana Robinson
*
* Purpose: Internal routines for fixed arrays.
*
diff --git a/src/H5FAmodule.h b/src/H5FAmodule.h
index c96c8df..ef814ae 100644
--- a/src/H5FAmodule.h
+++ b/src/H5FAmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5FA package. Including this header means that the source file
* is part of the H5FA package.
*/
-#ifndef _H5FAmodule_H
-#define _H5FAmodule_H
+#ifndef H5FAmodule_H
+#define H5FAmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_FARRAY
#define H5_MY_PKG_INIT NO
-#endif /* _H5FAmodule_H */
+#endif /* H5FAmodule_H */
diff --git a/src/H5FApkg.h b/src/H5FApkg.h
index 4e13014..c4bf934 100644
--- a/src/H5FApkg.h
+++ b/src/H5FApkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -22,8 +22,8 @@
#error "Do not include this file outside the H5FA package!"
#endif
-#ifndef _H5FApkg_H
-#define _H5FApkg_H
+#ifndef H5FApkg_H
+#define H5FApkg_H
/* Get package's private header */
#include "H5FAprivate.h"
@@ -299,4 +299,4 @@ H5_DLL herr_t H5FA__get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam);
H5_DLL int H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2);
#endif /* H5FA_TESTING */
-#endif /* _H5FApkg_H */
+#endif /* H5FApkg_H */
diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h
index 02d859b..26057bf 100644
--- a/src/H5FAprivate.h
+++ b/src/H5FAprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,8 +21,8 @@
*-------------------------------------------------------------------------
*/
-#ifndef _H5FAprivate_H
-#define _H5FAprivate_H
+#ifndef H5FAprivate_H
+#define H5FAprivate_H
/* Include package's public header */
#ifdef NOT_YET
@@ -137,4 +137,4 @@ H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats);
#ifdef H5FA_DEBUGGING
#endif /* H5FA_DEBUGGING */
-#endif /* _H5FAprivate_H */
+#endif /* H5FAprivate_H */
diff --git a/src/H5FAstat.c b/src/H5FAstat.c
index 530cc64..1fdf47f 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -33,9 +33,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 4da7d6f..6dd6e00 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FD.c b/src/H5FD.c
index 7e83c0c..11cbdc4 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -193,7 +193,7 @@ H5FD__free_cls(H5FD_class_t *cls)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_free_cls() */
+} /* end H5FD__free_cls() */
/*-------------------------------------------------------------------------
* Function: H5FDregister
@@ -496,9 +496,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf)
/* Check if driver matches driver information saved. Unfortunately, we can't push this
* function to each specific driver because we're checking if the driver is correct.
*/
- if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family"))
+ if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used")
- if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi"))
+ if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used")
/* Decode driver information */
@@ -551,22 +551,22 @@ done:
} /* end H5FD_fapl_get() */
/*-------------------------------------------------------------------------
- * Function: H5FD_fapl_close
+ * Function: H5FD_free_driver_info
*
- * Purpose: Closes a driver for a dataset transfer property list
+ * Purpose: Frees a driver's info
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_fapl_close(hid_t driver_id, const void *driver_info)
+H5FD_free_driver_info(hid_t driver_id, const void *driver_info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (driver_id > 0) {
+ if (driver_id > 0 && driver_info) {
H5FD_class_t *driver;
/* Retrieve the driver for the ID */
@@ -574,19 +574,19 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
/* Allow driver to free info or do it ourselves */
- if (driver_info) {
- if (driver->fapl_free) {
- if ((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
- } /* end if */
- else
- driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */
- } /* end if */
- } /* end if */
+ if (driver->fapl_free) {
+ /* Free the const pointer */
+ /* Cast through uintptr_t to de-const memory */
+ if ((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
+ }
+ else
+ driver_info = H5MM_xfree_const(driver_info);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_fapl_close() */
+} /* end H5FD_free_driver_info() */
/*-------------------------------------------------------------------------
* Function: H5FDopen
@@ -770,7 +770,7 @@ done:
* will be all zero during the driver close callback like during
* the 'open' callback.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1061,7 +1061,7 @@ done:
* doesn't map to a free list then either the application 'free'
* callback is invoked (if defined) or the memory is leaked.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1346,11 +1346,11 @@ done:
* be the constant H5P_DEFAULT). The result is written into the
* buffer BUF.
*
- * Return: Success: SUCCEED
+ * Return: Success: Non-negative
* The read result is written into the BUF buffer
* which should be allocated by the caller.
*
- * Failure: FAIL
+ * Failure: Negative
* The contents of BUF are undefined.
*
*-------------------------------------------------------------------------
@@ -1397,7 +1397,7 @@ done:
* constant H5P_DEFAULT). The bytes to be written come from the
* buffer BUF.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1441,7 +1441,7 @@ done:
* Purpose: Notify driver to flush all cached data. If the driver has no
* flush method then nothing happens.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failureL
*
*-------------------------------------------------------------------------
*/
@@ -1508,7 +1508,7 @@ done:
*
* Purpose: Notify driver to truncate the file back to the allocated size.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1542,7 +1542,7 @@ done:
} /* end H5FDtruncate() */
/*-------------------------------------------------------------------------
- * Function: H5FD_truncate
+ * Function: H5FD_truncate
*
* Purpose: Private version of H5FDtruncate()
*
@@ -1574,7 +1574,7 @@ done:
*
* Purpose: Set a file lock
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1594,7 +1594,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)
@@ -1622,7 +1622,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)
@@ -1633,7 +1633,7 @@ done:
*
* Purpose: Remove a file lock
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1653,7 +1653,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)
@@ -1681,7 +1681,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)
@@ -1719,7 +1719,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
* Purpose: Returns a pointer to the file handle of low-level virtual
* file driver.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*--------------------------------------------------------------------------
*/
@@ -1860,7 +1860,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
* can't use the file to get the driver, the driver ID is passed
* in as a parameter.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 9d22c4a..3bb95f7 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * 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,7 +59,8 @@ 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 */
- int fd; /* backing store file descriptor */
+ 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
/* On most systems the combination of device and i-node number uniquely
@@ -142,8 +146,8 @@ static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, h
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 */
@@ -175,8 +179,8 @@ static const H5FD_class_t H5FD_core_g = {
H5FD__core_write, /* write */
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 */
};
@@ -277,13 +281,13 @@ H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end)
else {
/* Store the new item endpoint if it's bigger */
item->end = (item->end < end) ? end : item->end;
- } /* end else */
- } /* end if */
+ }
+ }
else {
/* Update the size of the before region */
if (b_item->end < end)
b_item->end = end;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -338,9 +342,10 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
unsigned char *ptr = file->mem + addr; /* mutable pointer into the
* buffer (can't change mem)
*/
- herr_t ret_value = SUCCEED; /* Return value */
+ 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);
@@ -354,7 +359,6 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -367,7 +371,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset);
- offset += bytes_wrote;
+ if (bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, ptr, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -412,9 +417,19 @@ done:
static herr_t
H5FD__init_package(void)
{
- herr_t ret_value = SUCCEED;
+ char * lock_env_var = NULL; /* Environment variable pointer */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
- FUNC_ENTER_NOAPI_NOINIT
+ /* 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")
@@ -793,6 +808,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
@@ -855,12 +880,12 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
* partial results, and the end of the file.
*/
- uint8_t *mem = file->mem; /* memory pointer for writes */
+ uint8_t *mem = file->mem; /* memory pointer for writes */
+ HDoff_t offset = (HDoff_t)0; /* offset for reading */
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 */
- HDoff_t offset = (HDoff_t)0;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -873,7 +898,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, mem, bytes_in, offset);
- offset += bytes_read;
+ if (bytes_read > 0)
+ offset += bytes_read;
#else
bytes_read = HDread(file->fd, mem, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -1104,24 +1130,24 @@ H5FD__core_query(const H5FD_t *_file, unsigned long *flags /* out */)
FUNC_ENTER_STATIC_NOERR
+ /* clang-format off */
/* Set the VFL feature flags that this driver supports */
- if (flags) {
+ if(flags) {
*flags = 0;
- *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
- *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
- *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */
- *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
+ *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ *flags |= H5FD_FEAT_ALLOW_FILE_IMAGE; /* OK to use file image feature with this VFD */
+ *flags |= H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS; /* OK to use file image callbacks with this VFD */
/* These feature flags are only applicable if the backing store is enabled */
- if (file && file->fd >= 0 && file->backing_store) {
- *flags |=
- H5FD_FEAT_POSIX_COMPAT_HANDLE; /* get_handle callback returns a POSIX file descriptor */
- *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the
- default VFD */
+ if(file && file->fd >= 0 && file->backing_store) {
+ *flags |= H5FD_FEAT_POSIX_COMPAT_HANDLE; /* get_handle callback returns a POSIX file descriptor */
+ *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */
}
} /* end if */
+ /* clang-format on */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__core_query() */
@@ -1499,7 +1525,7 @@ done:
* If we are not closing, we realloc the buffer to size equal
* to the smallest multiple of the allocation increment that
* equals or exceeds the eoa and set the eof accordingly.
- * Note that we no longer truncate the backing store to the
+ * Note that we no longer truncate the backing store to the
* new eof if applicable.
* -- JRM
*
@@ -1598,12 +1624,12 @@ done:
} /* end H5FD__core_truncate() */
/*-------------------------------------------------------------------------
- * 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":
- * TRUE--opens for write: an exclusive lock
- * FALSE--opens for read: a shared lock
+ * The lock type to apply depends on the parameter "rw":
+ * TRUE--opens for write: an exclusive lock
+ * FALSE--opens for read: a shared lock
*
* Return: SUCCEED/FAIL
*
@@ -1612,13 +1638,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);
@@ -1626,28 +1652,28 @@ 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 */
+ } /* 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
*
@@ -1658,28 +1684,27 @@ 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 d8fc366..d456c3e 100644
--- a/src/H5FDcore.h
+++ b/src/H5FDcore.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, August 2, 1999
*
* Purpose: The public header file for the core driver.
@@ -25,8 +25,70 @@
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_core_init(void);
+H5_DLL hid_t H5FD_core_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Modifies the file access property list to use the #H5FD_CORE driver
+ *
+ * \fapl_id
+ * \param[in] increment Size, in bytes, of memory increments
+ * \param[in] backing_store Boolean flag indicating whether to write the file
+ * contents to disk when the file is closed
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_core() modifies the file access property list to use the
+ * #H5FD_CORE driver.
+ *
+ * The #H5FD_CORE driver enables an application to work with a file in
+ * memory, speeding reads and writes as no disk access is made. File
+ * contents are stored only in memory until the file is closed. The \p
+ * backing_store parameter determines whether file contents are ever
+ * written to disk.
+ *
+ * \p increment specifies the increment by which allocated memory is to
+ * be increased each time more memory is required.
+ *
+ * While using H5Fcreate() to create a core file, if the \p
+ * backing_store is set to 1 (TRUE), the file contents are flushed to a
+ * file with the same name as this core file when the file is closed or
+ * access to the file is terminated in memory.
+ *
+ * The application is allowed to open an existing file with #H5FD_CORE
+ * driver. While using H5Fopen() to open an existing file, if the \p
+ * backing_store is set to 1 (TRUE) and the \c flags for H5Fopen() is set to
+ * #H5F_ACC_RDWR, any change to the file contents are saved to the file
+ * when the file is closed. If \p backing_store is set to 0 (FALSE) and the \c
+ * flags for H5Fopen() is set to #H5F_ACC_RDWR, any change to the file
+ * contents will be lost when the file is closed. If the flags for
+ * H5Fopen() is set to #H5F_ACC_RDONLY, no change to the file is
+ * allowed either in memory or on file.
+ *
+ * \note Currently this driver cannot create or open family or multi files.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Queries core file driver properties
+ *
+ * \fapl_id
+ * \param[out] increment Size, in bytes, of memory increments
+ * \param[out] backing_store Boolean flag indicating whether to write the file
+ * contents to disk when the file is closed
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_core() queries the #H5FD_CORE driver properties as set
+ * by H5Pset_fapl_core().
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/);
#ifdef __cplusplus
}
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 6eb9f8c..35da1f1 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@hdfgroup.uiuc.edu>
+ * Programmer: Raymond Lu
* Wednesday, 20 September 2006
*
* Purpose: The Direct I/O file driver forces the data to be written to
@@ -22,21 +22,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
@@ -70,6 +73,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
@@ -115,58 +119,58 @@ typedef struct H5FD_direct_t {
(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, 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, 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, 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_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, 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, size_t size,
+ const void *buf);
+static herr_t H5FD__direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__direct_lock(H5FD_t *_file, hbool_t rw);
+static herr_t H5FD__direct_unlock(H5FD_t *_file);
static const H5FD_class_t H5FD_direct_g = {
- "direct", /*name */
- 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, /*flush */
- H5FD_direct_truncate, /*truncate */
- H5FD_direct_lock, /*lock */
- H5FD_direct_unlock, /*unlock */
- H5FD_FLMAP_DICHOTOMY /*fl_map */
+ "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, /* 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 */
@@ -187,10 +191,20 @@ DESCRIPTION
static herr_t
H5FD__init_package(void)
{
- herr_t ret_value = SUCCEED;
+ 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")
@@ -230,7 +244,7 @@ done:
} /* end H5FD_direct_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_direct_term
+ * Function: H5FD__direct_term
*
* Purpose: Shut down the VFD
*
@@ -242,15 +256,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_direct
@@ -350,7 +364,7 @@ done:
} /* end H5Pget_fapl_direct() */
/*-------------------------------------------------------------------------
- * 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
@@ -364,27 +378,24 @@ 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 */
+ H5FD_direct_t *file = (H5FD_direct_t *)_file;
+ void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
/* 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.
*
@@ -395,17 +406,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);
@@ -413,10 +422,10 @@ 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.
*
@@ -429,17 +438,15 @@ 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);
- H5FD_direct_t * file = NULL;
- H5FD_direct_fapl_t *fa;
+ int o_flags;
+ int fd = (-1);
+ H5FD_direct_t * file = NULL;
+ const H5FD_direct_fapl_t *fa;
#ifdef H5_HAVE_WIN32_API
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
@@ -449,7 +456,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));
@@ -488,7 +495,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
/* Get the driver specific information */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL == (fa = (H5FD_direct_fapl_t *)H5P_peek_driver_info(plist)))
+ if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
file->fd = fd;
@@ -508,6 +515,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.
@@ -528,7 +545,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
}
else {
file->fa.must_align = FALSE;
- HDftruncate(file->fd, (HDoff_t)0);
+ if (-1 == HDftruncate(file->fd, (HDoff_t)0))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to truncate file")
}
}
else {
@@ -570,7 +588,7 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_direct_close
+ * Function: H5FD__direct_close
*
* Purpose: Closes the file.
*
@@ -581,17 +599,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")
@@ -603,7 +619,7 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_direct_cmp
+ * Function: H5FD__direct_cmp
*
* Purpose: Compares two files belonging to this driver using an
* arbitrary (but consistent) ordering.
@@ -616,18 +632,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)
@@ -669,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)
@@ -681,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) {
@@ -705,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
@@ -718,25 +730,20 @@ 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
@@ -749,19 +756,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;
@@ -769,7 +771,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
@@ -784,16 +786,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_NOERR
FUNC_LEAVE_NOAPI(file->eof)
}
@@ -808,17 +808,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")
@@ -829,7 +827,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
@@ -843,13 +841,11 @@ 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,
- size_t size, void *buf /*out*/)
+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;
ssize_t nbytes;
@@ -864,7 +860,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);
@@ -1012,7 +1008,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
@@ -1025,13 +1021,11 @@ 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,
- size_t size, const void *buf)
+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;
ssize_t nbytes;
@@ -1049,7 +1043,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);
@@ -1243,7 +1237,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.
@@ -1258,12 +1252,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);
@@ -1304,10 +1298,10 @@ 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":
@@ -1321,29 +1315,37 @@ 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 */
- int lock; /* The type of lock */
- 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);
- /* Determine the type of lock */
- int lock = rw ? LOCK_EX : LOCK_SH;
+ /* Set exclusive or shared lock based on rw status */
+ lock_flags = rw ? LOCK_EX : LOCK_SH;
- /* Place the lock with non-blocking */
- if (HDflock(file->fd, lock | LOCK_NB) < 0)
- HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file")
+ /* 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
*
@@ -1354,20 +1356,28 @@ 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 0b51a1b..f06de7f 100644
--- a/src/H5FDdirect.h
+++ b/src/H5FDdirect.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@hdfgroup.uiuc.edu>
+ * Programmer: Raymond Lu
* Wednesday, 20 September 2006
*
* Purpose: The public header file for the direct driver.
@@ -23,7 +23,7 @@
#ifdef H5_HAVE_DIRECT
#define H5FD_DIRECT (H5FD_direct_init())
#else
-#define H5FD_DIRECT (-1)
+#define H5FD_DIRECT (H5I_INVALID_HID)
#endif /* H5_HAVE_DIRECT */
#ifdef H5_HAVE_DIRECT
@@ -37,8 +37,69 @@ extern "C" {
#define FBSIZE_DEF 4096
#define CBSIZE_DEF 16 * 1024 * 1024
-H5_DLL hid_t H5FD_direct_init(void);
+H5_DLL hid_t H5FD_direct_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets up use of the direct I/O driver
+ *
+ * \fapl_id
+ * \param[in] alignment Required memory alignment boundary
+ * \param[in] block_size File system block size
+ * \param[in] cbuf_size Copy buffer size
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_direct() sets the file access property list, \p fapl_id,
+ * to use the direct I/O driver, #H5FD_DIRECT. With this driver, data
+ * is written to or read from the file synchronously without being
+ * cached by the system.
+ *
+ * File systems usually require the data address in memory, the file
+ * address, and the size of the data to be aligned. The HDF5 library’s
+ * direct I/O driver is able to handle unaligned data, though that will
+ * consume some additional memory resources and may slow
+ * performance. To get better performance, use the system function \p
+ * posix_memalign to align the data buffer in memory and the HDF5
+ * function H5Pset_alignment() to align the data in the file. Be aware,
+ * however, that aligned data I/O may cause the HDF5 file to be bigger
+ * than the actual data size would otherwise require because the
+ * alignment may leave some holes in the file.
+ *
+ * \p alignment specifies the required alignment boundary in memory.
+ *
+ * \p block_size specifies the file system block size. A value of 0
+ * (zero) means to use HDF5 library’s default value of 4KB.
+ *
+ * \p cbuf_size specifies the copy buffer size.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves direct I/O driver settings
+ *
+ * \fapl_id
+ * \param[out] boundary Required memory alignment boundary
+ * \param[out] block_size File system block size
+ * \param[out] cbuf_size Copy buffer size
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_direct() retrieves the required memory alignment (\p
+ * alignment), file system block size (\p block_size), and copy buffer
+ * size (\p cbuf_size) settings for the direct I/O driver, #H5FD_DIRECT,
+ * from the file access property list \p fapl_id.
+ *
+ * See H5Pset_fapl_direct() for discussion of these values,
+ * requirements, and important considerations.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size /*out*/,
size_t *cbuf_size /*out*/);
diff --git a/src/H5FDdrvr_module.h b/src/H5FDdrvr_module.h
index e3df47f..1d20fce 100644
--- a/src/H5FDdrvr_module.h
+++ b/src/H5FDdrvr_module.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5FD driver package. Including this header means that the source file
* is part of the H5FD driver package.
*/
-#ifndef _H5FDdrvr_module_H
-#define _H5FDdrvr_module_H
+#ifndef H5FDdrvr_module_H
+#define H5FDdrvr_module_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_INIT YES
#define H5_PKG_SINGLE_SOURCE
-#endif /* _H5FDdrvr_module_H */
+#endif /* H5FDdrvr_module_H */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 2b3b286..adfa1a3 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -6,43 +6,43 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, November 10, 1997
- *
- * Purpose: Implements a family of files that acts as a single hdf5
- * file. The purpose is to be able to split a huge file on a
- * 64-bit platform, transfer all the <2GB members to a 32-bit
- * platform, and then access the entire huge file on the 32-bit
- * platform.
- *
- * All family members are logically the same size although their
- * physical sizes may vary. The logical member size is
- * determined by looking at the physical size of the first member
- * when the file is opened. When creating a file family, the
- * first member is created with a predefined physical size
- * (actually, this happens when the file family is flushed, and
- * can be quite time consuming on file systems that don't
- * implement holes, like nfs).
+ * Programmer: Robb Matzke
+ * Monday, November 10, 1997
+ *
+ * Purpose: Implements a family of files that acts as a single hdf5
+ * file. The purpose is to be able to split a huge file on a
+ * 64-bit platform, transfer all the <2GB members to a 32-bit
+ * platform, and then access the entire huge file on the 32-bit
+ * platform.
+ *
+ * All family members are logically the same size although their
+ * physical sizes may vary. The logical member size is
+ * determined by looking at the physical size of the first member
+ * when the file is opened. When creating a file family, the
+ * first member is created with a predefined physical size
+ * (actually, this happens when the file family is flushed, and
+ * can be quite time consuming on file systems that don't
+ * implement holes, like nfs).
*
*/
#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FDfamily.h" /* Family file driver */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDfamily.h" /* Family file driver */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/* The size of the member name buffers */
#define H5FD_FAM_MEMB_NAME_BUF_SIZE 4096
@@ -52,16 +52,16 @@ static hid_t H5FD_FAMILY_g = 0;
/* The description of a file belonging to this driver. */
typedef struct H5FD_family_t {
- H5FD_t pub; /*public stuff, must be first */
- hid_t memb_fapl_id; /*file access property list for members */
- hsize_t memb_size; /*actual size of each member file */
- hsize_t pmem_size; /*member size passed in from property */
- unsigned nmembs; /*number of family members */
- unsigned amembs; /*number of member slots allocated */
- H5FD_t **memb; /*dynamic array of member pointers */
- haddr_t eoa; /*end of allocated addresses */
- char * name; /*name generator printf format */
- unsigned flags; /*flags for opening additional members */
+ H5FD_t pub; /*public stuff, must be first */
+ hid_t memb_fapl_id; /*file access property list for members */
+ hsize_t memb_size; /*actual size of each member file */
+ hsize_t pmem_size; /*member size passed in from property */
+ unsigned nmembs; /*number of family members */
+ unsigned amembs; /*number of member slots allocated */
+ H5FD_t **memb; /*dynamic array of member pointers */
+ haddr_t eoa; /*end of allocated addresses */
+ char * name; /*name generator printf format */
+ unsigned flags; /*flags for opening additional members */
/* Information from properties set by 'h5repart' tool */
hsize_t mem_newsize; /*new member size passed in as private
@@ -73,69 +73,69 @@ typedef struct H5FD_family_t {
/* Driver-specific file access properties */
typedef struct H5FD_family_fapl_t {
- hsize_t memb_size; /*size of each member */
+ hsize_t memb_size; /*size of each member */
hid_t memb_fapl_id; /*file access property list of each memb*/
} 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*/, unsigned char *buf /*out*/);
-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, 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, 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, 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_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, const unsigned char *buf);
+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, 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, 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);
/* 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 */
- 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 */
+ H5FD__family_truncate, /* truncate */
+ H5FD__family_lock, /* lock */
+ H5FD__family_unlock, /* unlock */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/*--------------------------------------------------------------------------
@@ -196,9 +196,9 @@ done:
} /* H5FD_family_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_family_term
+ * Function: H5FD__family_term
*
- * Purpose: Shut down the VFD
+ * Purpose: Shut down the VFD
*
* Returns: Non-negative on success or negative on failure
*
@@ -208,39 +208,32 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_family
+ * Function: H5Pset_fapl_family
*
- * Purpose: Sets the file access property list FAPL_ID to use the family
- * driver. The MEMB_SIZE is the size in bytes of each file
- * member (used only when creating a new file) and the
- * MEMB_FAPL_ID is a file access property list to be used for
- * each family member.
+ * Purpose: Sets the file access property list FAPL_ID to use the family
+ * driver. The MEMB_SIZE is the size in bytes of each file
+ * member (used only when creating a new file) and the
+ * MEMB_FAPL_ID is a file access property list to be used for
+ * each family member.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * 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
@@ -274,25 +267,18 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5Pget_fapl_family
+ * Function: H5Pget_fapl_family
*
- * Purpose: Returns information about the family file access property
- * list though the function arguments.
+ * Purpose: Returns information about the family file access property
+ * list though the function arguments.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * 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
@@ -324,31 +310,29 @@ 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.
+ * Purpose: Gets a file access property list which could be used to
+ * create an identical file.
*
- * Return: Success: Ptr to new file access property list.
+ * Return: Success: Ptr to new file access property list.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * 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")
@@ -362,38 +346,36 @@ 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.
+ * Purpose: Copies the family-specific file access properties.
*
- * Return: Success: Ptr to a new property list
+ * Return: Success: Ptr to a new property list
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * 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")
@@ -416,36 +398,34 @@ 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.
+ * Purpose: Frees the family-specific file access properties.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * 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")
@@ -456,26 +436,24 @@ 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.
+ * Purpose: Returns the size of the private information to be stored in
+ * the superblock.
*
- * Return: Success: The super block driver data size.
+ * Return: Success: The super block driver data size.
*
- * Failure: never fails
+ * Failure: never fails
*
- * Programmer: Raymond Lu
+ * 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. */
@@ -483,31 +461,29 @@ 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
- * an eight-character name/version number and null termination.
+ * Purpose: Encode driver information for the superblock. The NAME
+ * argument is a nine-byte buffer which will be initialized with
+ * an eight-character name/version number and null termination.
*
- * The encoding is the member file size and name template.
+ * The encoding is the member file size and name template.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * 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);
@@ -517,41 +493,41 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*ou
* 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
+ * Purpose: This function has 2 separate purpose. One is to decodes the
* superblock information for this driver. The NAME argument is
* the eight-character (plus null termination) name stored in i
* the file. The FILE argument is updated according to the
* information in the superblock.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Tuesday, May 10, 2005
*
*-------------------------------------------------------------------------
*/
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);
@@ -580,20 +556,20 @@ 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.
+ * Purpose: Creates and/or opens a family of files as an HDF5 file.
*
- * Return: Success: A pointer to a new file dat structure. The
- * public fields will be initialized by the
- * caller, which is always H5FD_open().
+ * Return: Success: A pointer to a new file dat structure. The
+ * public fields will be initialized by the
+ * caller, which is always H5FD_open().
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -604,9 +580,9 @@ done:
* memb_name & temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(format - nonliteral)
+H5_GCC_DIAG_OFF("format-nonliteral")
static H5FD_t *
-H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
+H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
H5FD_family_t *file = NULL;
char * memb_name = NULL, *temp = NULL;
@@ -614,7 +590,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
unsigned t_flags = flags & ~H5F_ACC_CREAT;
H5FD_t * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
if (!name || !*name)
@@ -756,34 +732,34 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_family_open() */
-H5_GCC_DIAG_ON(format - nonliteral)
+} /* end H5FD__family_open() */
+H5_GCC_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
- * Function: H5FD_family_close
+ * Function: H5FD__family_close
*
- * Purpose: Closes a family of files.
+ * Purpose: Closes a family of files.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative with as many members closed as
- * possible. The only subsequent operation
- * permitted on the file is a close operation.
+ * Failure: Negative with as many members closed as
+ * possible. The only subsequent operation
+ * permitted on the file is a close operation.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
*/
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. */
@@ -808,34 +784,32 @@ 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.
+ * Purpose: Compares two file families to see if they are the same. It
+ * does this by comparing the first member of the two families.
*
- * Return: Success: like strcmp()
+ * Return: Success: like strcmp()
*
- * Failure: never fails (arguments were checked by the
- * caller).
+ * Failure: never fails (arguments were checked by the
+ * caller).
*
- * Programmer: Robb Matzke
+ * 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]);
@@ -843,28 +817,28 @@ 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.
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, August 25, 2000
*
*-------------------------------------------------------------------------
*/
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) {
@@ -881,56 +855,46 @@ 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
- * the format address space.
+ * Purpose: Returns the end-of-address marker for the file. The EOA
+ * marker is the first address past the last byte allocated in
+ * the format address space.
*
- * Return: Success: The end-of-address-marker
+ * Return: Success: The end-of-address-marker
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * 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.
+ * Purpose: Set the end-of-address marker for the file.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * 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 */
@@ -939,9 +903,9 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* memb_name in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(format - nonliteral)
+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;
@@ -949,7 +913,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)))
@@ -1008,36 +972,34 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
-H5_GCC_DIAG_ON(format - nonliteral)
+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.
+ * Purpose: Returns the end-of-file marker, which is the greater of
+ * either the total family size or the current EOA marker.
*
- * Return: Success: End of file address, the first address past
- * the end of the family of files or the current
- * EOA, whichever is larger.
+ * Return: Success: End of file address, the first address past
+ * the end of the family of files or the current
+ * EOA, whichever is larger.
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * 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
@@ -1068,7 +1030,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.
*
@@ -1077,12 +1039,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;
@@ -1090,7 +1050,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)))
@@ -1109,26 +1069,25 @@ 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
- * DXPL_ID.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID.
*
- * Return: Success: Zero. Result is stored in caller-supplied
- * buffer BUF.
+ * Return: Success: Zero. Result is stored in caller-supplied
+ * buffer BUF.
*
- * Failure: -1, contents of buffer BUF are undefined.
+ * Failure: -1, contents of buffer BUF are undefined.
*
- * Programmer: Robb Matzke
+ * 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, void *_buf /*out*/)
+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;
unsigned char * buf = (unsigned char *)_buf;
@@ -1139,7 +1098,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
@@ -1177,25 +1136,23 @@ 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
- * DXPL_ID.
+ * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
+ * from buffer BUF according to data transfer properties in
+ * DXPL_ID.
*
- * Return: Success: Zero
+ * Return: Success: Zero
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * 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, const void *_buf)
+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;
const unsigned char *buf = (const unsigned char *)_buf;
@@ -1206,7 +1163,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
@@ -1244,26 +1201,26 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_family_flush
+ * Function: H5FD__family_flush
*
- * Purpose: Flushes all family members.
+ * Purpose: Flushes all family members.
*
- * Return: Success: 0
- * Failure: -1, as many files flushed as possible.
+ * Return: Success: 0
+ * Failure: -1, as many files flushed as possible.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
*/
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)
@@ -1274,30 +1231,30 @@ 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.
+ * Purpose: Truncates all family members.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1, as many files truncated as possible.
+ * Failure: -1, as many files truncated as possible.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, February 23, 2008
*
*-------------------------------------------------------------------------
*/
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)
@@ -1308,10 +1265,10 @@ 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":
@@ -1325,13 +1282,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++)
@@ -1348,17 +1305,17 @@ 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
*
@@ -1369,20 +1326,20 @@ 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 acf6180..20ef532 100644
--- a/src/H5FDfamily.h
+++ b/src/H5FDfamily.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, August 4, 1999
*
* Purpose: The public header file for the family driver.
@@ -26,8 +26,58 @@
extern "C" {
#endif
-H5_DLL hid_t H5FD_family_init(void);
+H5_DLL hid_t H5FD_family_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the file access property list to use the family driver
+ *
+ * \fapl_id
+ * \param[in] memb_size Size in bytes of each file member
+ * \param[in] memb_fapl_id Identifier of file access property list for
+ * each family member
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_family() sets the file access property list identifier,
+ * \p fapl_id, to use the family driver.
+ *
+ * \p memb_size is the size in bytes of each file member. This size
+ * will be saved in file when the property list \p fapl_id is used to
+ * create a new file. If \p fapl_id is used to open an existing file,
+ * \p memb_size has to be equal to the original size saved in file. A
+ * failure with an error message indicating the correct member size
+ * will be returned if \p memb_size does not match the size saved. If
+ * any user does not know the original size, #H5F_FAMILY_DEFAULT can be
+ * passed in. The library will retrieve the saved size.
+ *
+ * \p memb_fapl_id is the identifier of the file access property list
+ * to be used for each family member.
+ *
+ * \version 1.8.0 Behavior of the \p memb_size parameter was changed.
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns file access property list information
+ *
+ * \fapl_id
+ * \param[out] memb_size Size in bytes of each file member
+ * \param[out] memb_fapl_id Identifier of file access property list for
+ * each family member
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_family() returns file access property list for use with
+ * the family driver. This information is returned through the output
+ * parameters.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size /*out*/, hid_t *memb_fapl_id /*out*/);
#ifdef __cplusplus
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index af412db..9f0614e 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -20,8 +20,14 @@
* File System (HDFS).
*/
-/* This source code file is part of the H5FD driver module */
+#ifdef H5_HAVE_LIBHDFS
+/* This source code file is part of the H5FD driver module
+ * NOTE: If we're just building the binary compatibility stubs,
+ * we're never going to really initialize the package, so we
+ * don't include this.
+ */
#include "H5FDdrvr_module.h"
+#endif /* H5_HAVE_LIBHDFS */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
@@ -32,8 +38,20 @@
#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_LIBHDFS
-#include "hdfs.h"
-#endif
+
+/* HDFS routines
+ * Have to turn off -Wstrict-prototypes as this header contains functions
+ * defined as foo() instead of foo(void), which triggers warnings that HDF5
+ * then interprets as errors.
+ * -Wundef isn't interpreted as an error by HDF5, but the header does do
+ * some bad symbol interpretation that raises a warning that is out of our
+ * control.
+ */
+H5_GCC_DIAG_OFF("strict-prototypes")
+H5_GCC_DIAG_OFF("undef")
+#include <hdfs.h>
+H5_GCC_DIAG_ON("strict-prototypes")
+H5_GCC_DIAG_ON("undef")
/* toggle function call prints: 1 turns on */
#define HDFS_DEBUG 0
@@ -115,8 +133,6 @@ static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT];
*
* Programmer: Jacob Smith
*
- * Changes: None
- *
***************************************************************************/
typedef struct {
unsigned long long count;
@@ -127,8 +143,6 @@ typedef struct {
#endif /* HDFS_STATS */
-#ifdef H5_HAVE_LIBHDFS
-
/* "unique" identifier for `hdfs_t` structures.
* Randomly generated by unweighted dice rolls.
*/
@@ -142,9 +156,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)
*
@@ -171,8 +183,6 @@ typedef struct {
* Programmer: Jacob Smith
* May 2018
*
- * Changes: None
- *
***************************************************************************
*/
typedef struct {
@@ -182,168 +192,6 @@ typedef struct {
hdfsFile file;
} 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 */
-
/***************************************************************************
*
* Structure: H5FD_hdfs_t
@@ -400,17 +248,12 @@ 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
+ hdfs_t * hdfs_handle;
#if HDFS_STATS
hdfs_statsbin meta[HDFS_STATS_BIN_COUNT + 1];
hdfs_statsbin raw[HDFS_STATS_BIN_COUNT + 1];
@@ -427,72 +270,69 @@ 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, 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, void **file_handle);
-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, haddr_t addr, size_t size,
- const void *buf);
-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_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, void **file_handle);
+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, haddr_t addr, size_t size,
+ const void *buf);
+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 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, /* 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 */
/*-------------------------------------------------------------------------
* Function: H5FD__init_package
@@ -501,9 +341,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
@@ -513,13 +350,11 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- if (H5FD_hdfs_init() < 0) {
+ 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() */
/*-------------------------------------------------------------------------
@@ -538,15 +373,15 @@ done:
hid_t
H5FD_hdfs_init(void)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID;
#if HDFS_STATS
unsigned int bin_i;
#endif
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
#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))
@@ -560,7 +395,7 @@ H5FD_hdfs_init(void)
HDFS_STATS_POW(bin_i, &value)
hdfs_stats_boundaries[bin_i] = value;
- } /* end for */
+ }
#endif
ret_value = H5FD_HDFS_g;
@@ -570,7 +405,7 @@ done:
} /* end H5FD_hdfs_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_hdfs_term
+ * Function: H5FD__hdfs_term
*
* Purpose: Shut down the VFD
*
@@ -579,77 +414,159 @@ 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,
@@ -666,34 +583,68 @@ 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) {
+ 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) {
+ if (fa->namenode_port > 65535)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number");
- }
- if (fa->namenode_port < 0) {
+ 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 specific
+ * properties are passed in as a pointer to a suitably
+ * initialized instance of H5FD_hdfs_fapl_t
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Jacob Smith 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+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;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", fapl_id, fa);
-} /* H5FD_hdfs_validate_config() */
+ 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() */
/*-------------------------------------------------------------------------
* Function: H5Pget_fapl_hdfs
@@ -708,50 +659,44 @@ 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_dst)
{
- const H5FD_hdfs_fapl_t *fa = NULL;
+ const H5FD_hdfs_fapl_t *fa_src = NULL;
H5P_genplist_t * plist = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", fapl_id, fa_out);
+ H5TRACE2("e", "i*x", fapl_id, fa_dst);
#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_dst == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst ptr 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_HDFS != H5P_peek_driver(plist)) {
+
+ 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) {
+ fa_src = (const H5FD_hdfs_fapl_t *)H5P_peek_driver_info(plist);
+ if (fa_src == 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));
+ H5MM_memcpy(fs_dst, fa_src, 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.
@@ -763,40 +708,35 @@ 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));
+ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t));
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.
*
@@ -807,38 +747,33 @@ 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));
+ H5MM_memcpy(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.
*
@@ -847,30 +782,26 @@ 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:
*
@@ -887,25 +818,22 @@ 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");
+ HDfprintf(stdout, "called %s.\n", FUNC);
#endif
- if (file == NULL) {
+ if (file == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null")
- }
for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) {
file->raw[i].bytes = 0;
@@ -922,12 +850,12 @@ 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:
*
@@ -946,114 +874,77 @@ 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) {
+ if (!path || !*path)
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) {
+ 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) {
+ 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)) {
+ 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) {
+ 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));
+ H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t));
#if HDFS_STATS
- if (FAIL == hdfs_reset_stats(file)) {
+ 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)) {
+ 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 (file != NULL)
file = H5FL_FREE(H5FD_hdfs_t, file);
- }
} /* end if null return value (error) */
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* 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 */
+} /* H5FD__hdfs_open() */
#if HDFS_STATS
/*----------------------------------------------------------------------------
*
- * Function: hdfs_fprint_stats()
+ * Function: hdfs__fprint_stats()
*
* Purpose:
*
@@ -1103,12 +994,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;
@@ -1127,20 +1016,16 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
unsigned suffix_i = 0;
const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'};
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- if (stream == NULL) {
+ if (stream == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null")
- }
- if (file == NULL) {
+ if (file == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null")
- }
- if (file->hdfs_handle == 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) {
+ if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic")
- }
/*******************
* AGGREGATE STATS *
@@ -1150,30 +1035,24 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
const hdfs_statsbin *r = &file->raw[i];
const hdfs_statsbin *m = &file->meta[i];
- if (m->min < min_meta) {
+ if (m->min < min_meta)
min_meta = m->min;
- }
- if (r->min < min_raw) {
+ if (r->min < min_raw)
min_raw = r->min;
- }
- if (m->max > max_meta) {
+ if (m->max > max_meta)
max_meta = m->max;
- }
- if (r->max > max_raw) {
+ 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 *
@@ -1184,9 +1063,8 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
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 *
@@ -1194,57 +1072,49 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
HDfprintf(stream, "SIZES meta raw\n");
HDfprintf(stream, " min ");
- if (count_meta == 0) {
+ if (count_meta == 0)
HDfprintf(stream, " 0.000 ");
- }
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 {
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]);
@@ -1270,9 +1140,8 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
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];
@@ -1280,46 +1149,38 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
range_end = hdfs_stats_boundaries[i - 1];
HDfprintf(stream, ">");
}
- else {
+ 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(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub,
@@ -1330,17 +1191,17 @@ hdfs_fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
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:
*
@@ -1353,73 +1214,46 @@ 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;
+ herr_t ret_value = SUCCEED;
- 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)) {
+ /* 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)) {
+ 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:
*
@@ -1427,23 +1261,16 @@ done:
* field-by-field.
*
* Return:
- * + Equivalent: 0
- * + Not Equivalent: -1
+ * Equivalent: 0
+ * Not Equivalent: -1
*
* 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;
@@ -1451,10 +1278,10 @@ H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
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);
@@ -1485,10 +1312,10 @@ H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if (finfo1->mBlockSize != finfo2->mBlockSize) {
HGOTO_DONE(-1);
}
- if (strcmp(finfo1->mOwner, finfo2->mOwner)) {
+ if (HDstrcmp(finfo1->mOwner, finfo2->mOwner)) {
HGOTO_DONE(-1);
}
- if (strcmp(finfo1->mGroup, finfo2->mGroup)) {
+ if (HDstrcmp(finfo1->mGroup, finfo2->mGroup)) {
HGOTO_DONE(-1);
}
if (finfo1->mPermissions != finfo2->mPermissions) {
@@ -1500,24 +1327,10 @@ H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
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)
@@ -1536,12 +1349,12 @@ H5FD_hdfs_cmp(const H5FD_t H5_ATTR_UNUSED *_f1, const H5FD_t H5_ATTR_UNUSED *_f2
*-------------------------------------------------------------------------
*/
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) {
@@ -1550,11 +1363,11 @@ H5FD_hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) /* out
}
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5FD_hdfs_query() */
+} /* H5FD__hdfs_query() */
/*-------------------------------------------------------------------------
*
- * Function: H5FD_hdfs_get_eoa()
+ * Function: H5FD__hdfs_get_eoa()
*
* Purpose:
*
@@ -1569,45 +1382,25 @@ H5FD_hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) /* out
* 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:
*
@@ -1620,47 +1413,27 @@ H5FD_hdfs_get_eoa(const H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED
* 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:
*
@@ -1676,44 +1449,26 @@ H5FD_hdfs_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type,
*
*-------------------------------------------------------------------------
*/
-#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:
*
@@ -1726,59 +1481,32 @@ H5FD_hdfs_get_eof(const H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED
* 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;
+ herr_t ret_value = SUCCEED;
- 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) {
+ 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:
*
@@ -1796,31 +1524,25 @@ 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;
size_t filesize = 0;
+ herr_t ret_value = SUCCEED;
#if HDFS_STATS
/* working variables for storing stats */
hdfs_statsbin *bin = NULL;
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);
@@ -1830,39 +1552,31 @@ H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
filesize = (size_t)file->hdfs_handle->fileinfo->mSize;
- if ((addr > filesize) || ((addr + size) > filesize)) {
+ 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)) {
+ 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
- */
+ /* 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;
@@ -1871,33 +1585,11 @@ H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
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:
*
@@ -1911,31 +1603,29 @@ 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:
*
@@ -1951,30 +1641,29 @@ 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:
*
@@ -1982,7 +1671,7 @@ done:
* No effect on Read-Only S3 file.
*
* Suggestion: remove lock/unlock from class
- * > would result in error at H5FD_[un]lock() (H5FD.c)
+ * would result in error at H5FD_[un]lock() (H5FD.c)
*
* Return:
*
@@ -1991,20 +1680,19 @@ done:
* Programmer: Jacob Smith
* 2017-11-03
*
- * Changes: None.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_hdfs_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw)
+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:
*
@@ -2018,13 +1706,57 @@ H5FD_hdfs_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw)
* 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() */
+
+#else /* H5_HAVE_LIBHDFS */
+
+/* No-op stubs to avoid binary compatibility problems with previous
+ * HDF5 1.10 versions. Non-functional versions of these API calls were
+ * erroneously included in the library even when the HDFS VFD was not
+ * configured.
+ */
+hid_t
+H5FD_hdfs_init(void)
+{
+ /* This should never be called since the header doesn't invoke it */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_LEAVE_NOAPI(H5I_INVALID_HID)
+}
+
+herr_t
+H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out)
+{
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*x", fapl_id, fa_out);
+
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+}
+
+herr_t
+H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa)
+{
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE2("e", "i*x", fapl_id, fa);
+
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+}
+
+#endif /* H5_HAVE_LIBHDFS */
diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h
index 2f1085a..219d0ac 100644
--- a/src/H5FDhdfs.h
+++ b/src/H5FDhdfs.h
@@ -16,17 +16,17 @@
* Programmer: Jacob Smith
* 2018-04-23
*
- * Purpose: The public header file for the hdfs driver.
+ * Purpose: The public header file for the hdfs driver.
*/
#ifndef H5FDhdfs_H
#define H5FDhdfs_H
+#ifdef H5_HAVE_LIBHDFS
#define H5FD_HDFS (H5FD_hdfs_init())
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#else /* H5_HAVE_LIBHDFS */
+#define H5FD_HDFS (H5I_INVALID_HID)
+#endif /* H5_HAVE_LIBHDFS */
/****************************************************************************
*
@@ -90,8 +90,6 @@ extern "C" {
* Programmer: Jacob Smith
* 2018-04-23
*
- * Changes: None
- *
****************************************************************************/
#define H5FD__CURR_HDFS_FAPL_T_VERSION 1
@@ -109,8 +107,24 @@ typedef struct H5FD_hdfs_fapl_t {
int32_t stream_buffer_size;
} H5FD_hdfs_fapl_t;
-H5_DLL hid_t H5FD_hdfs_init(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL hid_t H5FD_hdfs_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa);
#ifdef __cplusplus
diff --git a/src/H5FDint.c b/src/H5FDint.c
index b651c23..25d77d1 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index f5cd805..7214b75 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Monday, April 17, 2000
*
* 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_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 */
@@ -68,12 +71,13 @@ static const char *flavors[] = {
* occurs), and `op' will be set to H5F_OP_UNKNOWN.
*/
typedef struct H5FD_log_t {
- H5FD_t pub; /* public stuff, must be first */
- int fd; /* the unix file */
- haddr_t eoa; /* end of allocated region */
- haddr_t eof; /* end of file; current file size */
- haddr_t pos; /* current file I/O position */
- H5FD_file_op_t op; /* last operation */
+ H5FD_t pub; /* public stuff, must be first */
+ int fd; /* the unix file */
+ haddr_t eoa; /* end of allocated region */
+ 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
@@ -152,61 +156,61 @@ typedef struct H5FD_log_t {
(ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || 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, 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_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_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, 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, 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 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, size_t size,
+ const void *buf);
+static herr_t H5FD__log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__log_lock(H5FD_t *_file, hbool_t rw);
+static herr_t H5FD__log_unlock(H5FD_t *_file);
static const H5FD_class_t H5FD_log_g = {
- "log", /*name */
- 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, /*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, /* 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 */
@@ -224,10 +228,20 @@ H5FL_DEFINE_STATIC(H5FD_log_t);
static herr_t
H5FD__init_package(void)
{
- herr_t ret_value = SUCCEED;
+ 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")
@@ -267,7 +281,7 @@ done:
} /* end H5FD_log_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_log_term
+ * Function: H5FD__log_term
*
* Purpose: Shut down the VFD
*
@@ -279,15 +293,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_log
@@ -312,12 +326,15 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size);
+ /* Do this first, so that we don't try to free a wild pointer if
+ * H5P_object_verify() fails.
+ */
+ HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
+
/* Check arguments */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
-
/* Duplicate the log file string
* A little wasteful, since this string will just be copied later, but
* passing it in as a pointer sets off a chain of impossible-to-resolve
@@ -338,7 +355,7 @@ done:
} /* end H5Pset_fapl_log() */
/*-------------------------------------------------------------------------
- * 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
@@ -354,21 +371,21 @@ 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.
*
@@ -381,13 +398,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);
@@ -412,13 +429,13 @@ done:
if (new_fa->logfile)
new_fa->logfile = (char *)H5MM_xfree(new_fa->logfile);
H5MM_free(new_fa);
- } /* 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.
*
@@ -430,11 +447,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)
@@ -442,10 +459,10 @@ 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.
*
@@ -460,7 +477,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 */
@@ -470,15 +487,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_stat_t sb;
- H5FD_t * ret_value = NULL; /* Return value */
+ 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));
@@ -491,6 +505,10 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
+ /* Initialize timers */
+ H5_timer_init(&open_timer);
+ H5_timer_init(&stat_timer);
+
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
if (H5F_ACC_TRUNC & flags)
@@ -506,10 +524,10 @@ 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
+ /* Start timer for open() call */
if (fa->flags & H5FD_LOG_TIME_OPEN)
- HDgettimeofday(&timeval_start, NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ H5_timer_start(&open_timer);
+
/* Open the file */
if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) {
int myerrno = errno;
@@ -518,45 +536,23 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
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);
-
- /* 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 */
- } /* end if */
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ }
-#ifdef H5_HAVE_GETTIMEOFDAY
+ /* Stop timer for open() call */
+ if (fa->flags & H5FD_LOG_TIME_OPEN)
+ H5_timer_stop(&open_timer);
+
+ /* Start timer for stat() call */
if (fa->flags & H5FD_LOG_TIME_STAT)
- HDgettimeofday(&timeval_start, NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ H5_timer_start(&stat_timer);
+
/* 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)))
@@ -601,15 +597,15 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (file->fa.flags & H5FD_LOG_FILE_READ) {
file->nread = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nread);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FILE_WRITE) {
file->nwrite = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nwrite);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FLAVOR) {
file->flavor = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->flavor);
- } /* end if */
+ }
/* Set the log file pointer */
if (fa->logfile)
@@ -617,18 +613,30 @@ 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 */
- } /* end if */
+ H5_timer_get_times(open_timer, &open_times);
+ HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed);
+ }
+ 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);
+ }
+ }
+
+ /* 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) {
@@ -640,7 +648,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0)
if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single")
- } /* end if */
+ }
/* Set return value */
ret_value = (H5FD_t *)file;
@@ -651,13 +659,13 @@ done:
HDclose(fd);
if (file)
file = H5FL_FREE(H5FD_log_t, file);
- } /* 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.
*
@@ -670,30 +678,31 @@ 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
+ /* Initialize timer */
+ H5_timer_init(&close_timer);
+
+ /* Start timer for close() call */
if (file->fa.flags & H5FD_LOG_TIME_CLOSE)
- HDgettimeofday(&timeval_start, NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ H5_timer_start(&close_timer);
+
/* 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) {
@@ -701,21 +710,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));
- } /* end if */
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ 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);
+ }
/* Dump the total number of seek/read/write operations */
if (file->fa.flags & H5FD_LOG_NUM_READ)
@@ -745,16 +745,18 @@ H5FD_log_close(H5FD_t *_file)
addr = 1;
while (addr < file->eoa) {
if (file->nwrite[addr] != last_val) {
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr,
- (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ HDfprintf(file->logfp,
+ "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
last_val = file->nwrite[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr,
- (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
+ HDfprintf(file->logfp,
+ "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ }
/* Dump the read I/O information */
if (file->fa.flags & H5FD_LOG_FILE_READ) {
@@ -764,16 +766,18 @@ H5FD_log_close(H5FD_t *_file)
addr = 1;
while (addr < file->eoa) {
if (file->nread[addr] != last_val) {
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr,
- (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ HDfprintf(file->logfp,
+ "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
last_val = file->nread[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr,
- (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
+ HDfprintf(file->logfp,
+ "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ }
/* Dump the I/O flavor information */
if (file->fa.flags & H5FD_LOG_FLAVOR) {
@@ -783,16 +787,17 @@ H5FD_log_close(H5FD_t *_file)
addr = 1;
while (addr < file->eoa) {
if (file->flavor[addr] != last_val) {
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr,
- (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
+ HDfprintf(file->logfp,
+ "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
last_val = file->flavor[addr];
last_addr = addr;
- } /* end if */
+ }
addr++;
- } /* end while */
- HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1),
- (unsigned long)(addr - last_addr), flavors[last_val]);
- } /* end if */
+ }
+ HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n",
+ last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
+ }
/* Free the logging information */
if (file->fa.flags & H5FD_LOG_FILE_WRITE)
@@ -813,10 +818,10 @@ 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.
@@ -831,13 +836,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)
@@ -880,10 +885,10 @@ 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)
@@ -896,11 +901,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) {
@@ -919,13 +924,13 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */)
if (file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which
eliminates it) */
- } /* 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.
*
@@ -938,13 +943,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;
@@ -958,18 +963,19 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], (int)type, (size_t)size);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_ALLOC)
- HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", addr, (addr + size) - 1, size,
- flavors[type]);
- } /* end if */
+ HDfprintf(file->logfp,
+ "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr,
+ (haddr_t)((addr + size) - 1), size, flavors[type]);
+ }
/* Set return value */
ret_value = addr;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_log_alloc() */
+} /* end H5FD__log_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FD__log_free
@@ -996,19 +1002,19 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the file memory freed */
if (file->fa.flags & H5FD_LOG_FREE)
- HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", addr, (addr + size) - 1, size,
- flavors[type]);
- } /* end if */
+ HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
+ addr, (haddr_t)((addr + size) - 1), size, flavors[type]);
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__log_free() */
/*-------------------------------------------------------------------------
- * 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
@@ -1023,17 +1029,17 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
*-------------------------------------------------------------------------
*/
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
@@ -1047,11 +1053,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 */
@@ -1063,13 +1069,14 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size);
- } /* end if */
+ }
/* Log the extension like an allocation */
if (file->fa.flags & H5FD_LOG_ALLOC)
- HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size,
- flavors[type]);
- } /* end if */
+ HDfprintf(file->logfp,
+ "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n",
+ file->eoa, addr, size, flavors[type]);
+ }
/* Check for decreasing file size */
if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) {
@@ -1080,22 +1087,23 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert((addr + size) < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the shrink like a free */
if (file->fa.flags & H5FD_LOG_FREE)
- HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", file->eoa, addr, size,
- flavors[type]);
- } /* end if */
- } /* end if */
+ HDfprintf(file->logfp,
+ "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
+ file->eoa, addr, size, flavors[type]);
+ }
+ }
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
@@ -1112,17 +1120,17 @@ 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.
*
@@ -1134,12 +1142,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")
@@ -1148,10 +1156,10 @@ 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
@@ -1167,22 +1175,25 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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_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 */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t read_timer; /* Timer for read operation */
+ H5_timevals_t read_times; /* Elapsed time for read operation */
+ 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);
+ /* Initialize timer */
+ H5_timer_init(&read_timer);
+
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
@@ -1199,70 +1210,67 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nread[tmp_addr++]++;
- } /* end if */
- } /* end if */
+ }
+ }
#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
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
+ /* Start timer for seek() call */
if (file->fa.flags & H5FD_LOG_TIME_SEEK)
- HDgettimeofday(&timeval_start, NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ H5_timer_start(&seek_timer);
+
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;
+ }
+
+ /* 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 */
+ HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr);
+
+ /* 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");
-#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp, "\n");
-#endif /* H5_HAVE_GETTIMEOFDAY */
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
+
+ /* Start timer for read operation */
+ if (file->fa.flags & H5FD_LOG_TIME_READ)
+ H5_timer_start(&read_timer);
/*
* 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 */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1275,9 +1283,10 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, buf, bytes_in, offset);
- offset += bytes_read;
+ if (bytes_read > 0)
+ offset += bytes_read;
#else
- bytes_read = HDread(file->fd, buf, bytes_in);
+ bytes_read = HDread(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
} while (-1 == bytes_read && EINTR == errno);
@@ -1288,8 +1297,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if (file->fa.flags & H5FD_LOG_LOC_READ)
- HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr,
- (orig_addr + orig_size) - 1, orig_size);
+ HDfprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n",
+ orig_addr, (orig_addr + orig_size) - 1, orig_size);
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
@@ -1298,13 +1307,13 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
(unsigned long long)size, (unsigned long long)bytes_in,
(unsigned long long)bytes_read, (unsigned long long)offset);
- } /* end if */
+ }
if (0 == bytes_read) {
- /* end of file but not end of format address space */
+ /* End of file but not end of format address space */
HDmemset(buf, 0, size);
break;
- } /* end if */
+ }
HDassert(bytes_read >= 0);
HDassert((size_t)bytes_read <= size);
@@ -1312,19 +1321,26 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
size -= (size_t)bytes_read;
addr += (haddr_t)bytes_read;
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;
+ }
+
+ /* 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]);
+ HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Read", orig_addr,
+ (orig_addr + orig_size) - 1, orig_size, flavors[type]);
/* Verify that we are reading in the type of data we allocated in this location */
if (file->flavor) {
@@ -1333,33 +1349,17 @@ 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 */
file->pos = addr;
@@ -1370,13 +1370,13 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* 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
@@ -1390,30 +1390,33 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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_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 */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t write_timer; /* Timer for write operation */
+ H5_timevals_t write_times; /* Elapsed time for write operation */
+ 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(size > 0);
HDassert(buf);
+ /* Initialize timer */
+ H5_timer_init(&write_timer);
+
/* Verify that we are writing out the type of data we allocated in this location */
if (file->flavor) {
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] ||
(H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT);
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] ||
(H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT);
- } /* end if */
+ }
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
@@ -1431,69 +1434,66 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nwrite[tmp_addr++]++;
- } /* end if */
+ }
#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
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
+ /* Start timer for seek() call */
if (file->fa.flags & H5FD_LOG_TIME_SEEK)
- HDgettimeofday(&timeval_start, NULL);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ H5_timer_start(&seek_timer);
+
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;
+ }
+
+ /* 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 */
+ HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr);
+
+ /* 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");
-#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp, "\n");
-#endif /* H5_HAVE_GETTIMEOFDAY */
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
+
+ /* Start timer for write operation */
+ if (file->fa.flags & H5FD_LOG_TIME_WRITE)
+ H5_timer_start(&write_timer);
/*
* 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 */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1506,7 +1506,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
- offset += bytes_wrote;
+ if (bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -1519,8 +1520,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if (file->fa.flags & H5FD_LOG_LOC_WRITE)
- HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr,
- (orig_addr + orig_size) - 1, orig_size);
+ HDfprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n",
+ orig_addr, (orig_addr + orig_size) - 1, orig_size);
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
@@ -1538,17 +1539,25 @@ 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;
+ }
+
+ /* 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]);
+ HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Written", orig_addr,
+ (orig_addr + orig_size) - 1, orig_size, flavors[type]);
/* Check if this is the first write into a "default" section, grabbed by the metadata agregation
* algorithm */
@@ -1556,34 +1565,18 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if ((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) {
HDmemset(&file->flavor[orig_addr], (int)type, orig_size);
HDfprintf(file->logfp, " (fresh)");
- } /* 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 */
+ }
+ }
+
+ /* 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");
-#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp, "\n");
-#endif /* H5_HAVE_GETTIMEOFDAY */
- } /* end if */
+ }
/* Update current position and eof */
file->pos = addr;
@@ -1596,13 +1589,13 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* 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.
@@ -1615,92 +1608,87 @@ 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 */
-#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
+ H5_timer_t trunc_timer; /* Timer for truncate operation */
+ H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+
+ /* Initialize timer */
+ H5_timer_init(&trunc_timer);
+
+ /* Start timer for truncate operation */
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;
+ H5_timer_start(&trunc_timer);
- /* Extend the file to make sure it's large enough.
- *
- * Since INVALID_SET_FILE_POINTER can technically be a valid return value
- * from SetFilePointer(), we also need to check GetLastError().
- */
- dwPtrLow = SetFilePointer(file->hFile, li.LowPart, &li.HighPart, FILE_BEGIN);
- if (INVALID_SET_FILE_POINTER == dwPtrLow) {
- dwError = GetLastError();
- if (dwError != NO_ERROR)
- HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
+#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.
+ */
+
+ /* Windows uses this odd QuadPart union for 32/64-bit portability */
+ li.QuadPart = (__int64)file->eoa;
+
+ /* Extend the file to make sure it's large enough.
+ *
+ * Since INVALID_SET_FILE_POINTER can technically be a valid return value
+ * from SetFilePointer(), we also need to check GetLastError().
+ */
+ 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")
+ }
+
+ if (0 == SetEndOfFile(file->hFile))
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
}
-
- bError = SetEndOfFile(file->hFile);
- if (0 == bError)
- 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;
+ }
+
+ /* 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 */
+ HDfprintf(file->logfp, "Truncate: To %10" PRIuHADDR, file->eoa);
+
+ /* 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");
-#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp, "\n");
-#endif /* H5_HAVE_GETTIMEOFDAY */
- } /* end if */
+ }
/* Update the eof value */
file->eof = file->eoa;
@@ -1712,10 +1700,10 @@ 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
*
@@ -1727,13 +1715,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);
@@ -1743,20 +1731,22 @@ 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
*
@@ -1767,24 +1757,26 @@ 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 42de705..969c091 100644
--- a/src/H5FDlog.h
+++ b/src/H5FDlog.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Monday, April 17, 2000
*
* Purpose: The public header file for the log driver.
@@ -65,7 +65,410 @@
extern "C" {
#endif
-H5_DLL hid_t H5FD_log_init(void);
+H5_DLL hid_t H5FD_log_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets up the logging virtual file driver (#H5FD_LOG) for use
+ *
+ * \fapl_id
+ * \param[in] logfile Name of the log file
+ * \param[in] flags Flags specifying the types of logging activity
+ * \param[in] buf_size The size of the logging buffers, in bytes (see description)
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_log() modifies the file access property list to use the
+ * logging driver, #H5FD_LOG. The logging virtual file driver (VFD) is
+ * a clone of the standard SEC2 (#H5FD_SEC2) driver with additional
+ * facilities for logging VFD metrics and activity to a file.
+ *
+ * \p logfile is the name of the file in which the logging entries are
+ * to be recorded.
+ *
+ * The actions to be logged are specified in the parameter \p flags
+ * using the pre-defined constants described in the following
+ * table. Multiple flags can be set through the use of a logical \c OR
+ * contained in parentheses. For example, logging read and write
+ * locations would be specified as
+ * \Code{(H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE)}.
+ *
+ * <table>
+ * <caption>Table1: Logging Flags</caption>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_LOC_READ
+ * </td>
+ * <td rowspan="3">
+ * Track the location and length of every read, write, or seek operation.
+ * </td>
+ * </tr>
+ * <tr><td>#H5FD_LOG_LOC_WRITE</td></tr>
+ * <tr><td>#H5FD_LOG_LOC_SEEK</td></tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_LOC_IO
+ * </td>
+ * <td>
+ * Track all I/O locations and lengths. The logical equivalent of the following:
+ * \Code{(#H5FD_LOG_LOC_READ | #H5FD_LOG_LOC_WRITE | #H5FD_LOG_LOC_SEEK)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_FILE_READ
+ * </td>
+ * <td rowspan="2">
+ * Track the number of times each byte is read or written.
+ * </td>
+ * </tr>
+ * <tr><td>#H5FD_LOG_FILE_WRITE</td></tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_FILE_IO
+ * </td>
+ * <td>
+ * Track the number of times each byte is read and written. The logical
+ * equivalent of the following:
+ * \Code{(#H5FD_LOG_FILE_READ | #H5FD_LOG_FILE_WRITE)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_FLAVOR
+ * </td>
+ * <td>
+ * Track the type, or flavor, of information stored at each byte.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_NUM_READ
+ * </td>
+ * <td rowspan="4">
+ * Track the total number of read, write, seek, or truncate operations that occur.
+ * </td>
+ * </tr>
+ * <tr><td>#H5FD_LOG_NUM_WRITE</td></tr>
+ * <tr><td>#H5FD_LOG_NUM_SEEK</td></tr>
+ * <tr><td>#H5FD_LOG_NUM_TRUNCATE</td></tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_NUM_IO
+ * </td>
+ * <td>
+ * Track the total number of all types of I/O operations. The logical equivalent
+ * of the following:
+ * \Code{(#H5FD_LOG_NUM_READ | #H5FD_LOG_NUM_WRITE | #H5FD_LOG_NUM_SEEK | #H5FD_LOG_NUM_TRUNCATE)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_TIME_OPEN
+ * </td>
+ * <td rowspan="6">
+ * Track the time spent in open, stat, read, write, seek, or close operations.
+ * </td>
+ * </tr>
+ * <tr><td>#H5FD_LOG_TIME_STAT</td></tr>
+ * <tr><td>#H5FD_LOG_TIME_READ</td></tr>
+ * <tr><td>#H5FD_LOG_TIME_WRITE</td></tr>
+ * <tr><td>#H5FD_LOG_TIME_SEEK</td></tr>
+ * <tr><td>#H5FD_LOG_TIME_CLOSE</td></tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_TIME_IO
+ * </td>
+ * <td>
+ * Track the time spent in each of the above operations. The logical equivalent
+ * of the following:
+ * \Code{(#H5FD_LOG_TIME_OPEN | #H5FD_LOG_TIME_STAT | #H5FD_LOG_TIME_READ | #H5FD_LOG_TIME_WRITE |
+ * #H5FD_LOG_TIME_SEEK | #H5FD_LOG_TIME_CLOSE)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_ALLOC
+ * </td>
+ * <td>
+ * Track the allocation of space in the file.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * #H5FD_LOG_ALL
+ * </td>
+ * <td>
+ * Track everything. The logical equivalent of the following:
+ * \Code{(#H5FD_LOG_ALLOC | #H5FD_LOG_TIME_IO | #H5FD_LOG_NUM_IO | #H5FD_LOG_FLAVOR | #H5FD_LOG_FILE_IO |
+ * #H5FD_LOG_LOC_IO)}
+ * </td>
+ * </tr>
+ * </table>
+ * The logging driver can track the number of times each byte in the file is
+ * read from or written to (using #H5FD_LOG_FILE_READ and #H5FD_LOG_FILE_WRITE)
+ * and what kind of data is at that location (e.g., metadata, raw data; using
+ * #H5FD_LOG_FLAVOR). This information is tracked in internal buffers of size
+ * buf_size, which must be at least the maximum size in bytes of the file to be
+ * logged while the log driver is in use.\n
+ * One buffer of size buf_size will be created for each of #H5FD_LOG_FILE_READ,
+ * #H5FD_LOG_FILE_WRITE and #H5FD_LOG_FLAVOR when those flags are set; these
+ * buffers will not grow as the file increases in size.
+ *
+ * \par Output:
+ * This section describes the logging driver (LOG VFD) output.\n
+ * The table, immediately below, describes output of the various logging driver
+ * flags and function calls. A list of valid flavor values, describing the type
+ * of data stored, follows the table.
+ * <table>
+ * <caption>Table2: Logging Output</caption>
+ * <tr>
+ * <th>Flag</th><th>VFD Call</th><th>Output and Comments</th>
+ * </th>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_LOC_READ</td>
+ * <td>Read</td>
+ * <td>
+ * \Code{%10a-%10a (%10Zu bytes) (%s) Read}\n\n
+ * Start position\n
+ * End position\n
+ * Number of bytes\n
+ * Flavor of read\n\n
+ * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_LOC_READ</td>
+ * <td>Read Error</td>
+ * <td>
+ * \Code{Error! Reading: %10a-%10a (%10Zu bytes)}\n\n
+ * Same parameters as non-error entry.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_LOC_WRITE</td>
+ * <td>Write</td>
+ * <td>
+ * \Code{%10a-%10a (%10Zu bytes) (%s) Written}\n\n
+ * Start position\n
+ * End position\n
+ * Number of bytes\n
+ * Flavor of write\n\n
+ * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_LOC_WRITE</td>
+ * <td>Write Error</td>
+ * <td>
+ * \Code{Error! Writing: %10a-%10a (%10Zu bytes)}\n\n
+ * Same parameters as non-error entry.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_LOC_SEEK</td>
+ * <td>Read, Write</td>
+ * <td>
+ * \Code{Seek: From %10a-%10a}\n\n
+ * Start position\n
+ * End position\n\n
+ * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_FILE_READ</td>
+ * <td>Close</td>
+ * <td>
+ * Begins with:\n
+ * Dumping read I/O information\n\n
+ * Then, for each range of identical values, there is this line:\n
+ * \Code{Addr %10-%10 (%10lu bytes) read from %3d times}\n\n
+ * Start address\n
+ * End address\n
+ * Number of bytes\n
+ * Number of times read\n\n
+ * Note: The data buffer is scanned and each range of identical values
+ * gets one entry in the log file to save space and make it easier to read.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_FILE_WRITE</td>
+ * <td>Close</td>
+ * <td>
+ * Begins with:\n
+ * Dumping read I/O information\n\n
+ * Then, for each range of identical values, there is this line:\n
+ * \Code{Addr %10-%10 (%10lu bytes) written to %3d times}\n\n
+ * Start address\n
+ * End address\n
+ * Number of bytes\n
+ * Number of times written\n\n
+ * Note: The data buffer is scanned and each range of identical values
+ * gets one entry in the log file to save space and make it easier to read.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_FLAVOR</td>
+ * <td>Close</td>
+ * <td>
+ * Begins with:\n
+ * Dumping I/O flavor information\n\n
+ * Then, for each range of identical values, there is this line:\n
+ * \Code{Addr %10-%10 (%10lu bytes) flavor is %s}\n\n
+ * Start address\n
+ * End address\n
+ * Number of bytes\n
+ * Flavor\n\n
+ * Note: The data buffer is scanned and each range of identical values
+ * gets one entry in the log file to save space and make it easier to read.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_NUM_READ</td>
+ * <td>Close</td>
+ * <td>
+ * Total number of read operations: \Code{%11u}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_NUM_WRITE</td>
+ * <td>Close</td>
+ * <td>
+ * Total number of write operations: \Code{%11u}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_NUM_SEEK</td>
+ * <td>Close</td>
+ * <td>
+ * Total number of seek operations: \Code{%11u}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_NUM_TRUNCATE</td>
+ * <td>Close</td>
+ * <td>
+ * Total number of truncate operations: \Code{%11u}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_OPEN</td>
+ * <td>Open</td>
+ * <td>
+ * Open took: \Code{(\%f s)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_READ</td>
+ * <td>Close, Read</td>
+ * <td>
+ * Total time in read operations: \Code{\%f s}\n\n
+ * See also: #H5FD_LOG_LOC_READ
+ * </td>
+ * </tr>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_WRITE</td>
+ * <td>Close, Write</td>
+ * <td>
+ * Total time in write operations: \Code{\%f s}\n\n
+ * See also: #H5FD_LOG_LOC_WRITE
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_SEEK</td>
+ * <td>Close, Read, Write</td>
+ * <td>
+ * Total time in write operations: \Code{\%f s}\n\n
+ * See also: #H5FD_LOG_LOC_SEEK or #H5FD_LOG_LOC_WRITE
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_CLOSE</td>
+ * <td>Close</td>
+ * <td>
+ * Close took: \Code{(\%f s)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_TIME_STAT</td>
+ * <td>Open</td>
+ * <td>
+ * Stat took: \Code{(\%f s)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_LOG_ALLOC</td>
+ * <td>Alloc</td>
+ * <td>
+ * \Code{%10-%10 (%10Hu bytes) (\%s) Allocated}\n\n
+ * Start of address space\n
+ * End of address space\n
+ * Total size allocation\n
+ * Flavor of allocation
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \par Flavors:
+ * The \Emph{flavor} describes the type of stored information. The following
+ * table lists the flavors that appear in log output and briefly describes each.
+ * These terms are provided here to aid in the construction of log message
+ * parsers; a full description is beyond the scope of this document.
+ * <table>
+ * <caption>Table3: Flavors of logged data</caption>
+ * <tr>
+ * <th>Flavor</th><th>Description</th>
+ * </th>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_NOLIST</td>
+ * <td>Error value</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_DEFAULT</td>
+ * <td>Value not yet set.\n
+ * May also be a datatype set in a larger allocation that will be
+ * suballocated by the library.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_SUPER</td>
+ * <td>Superblock data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_BTREE</td>
+ * <td>B-tree data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_DRAW</td>
+ * <td>Raw data (for example, contents of a dataset)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_GHEAP</td>
+ * <td>Global heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_LHEAP</td>
+ * <td>Local heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_OHDR</td>
+ * <td>Object header data</td>
+ * </tr>
+ * </table>
+ *
+ * \version 1.8.7 The flags parameter has been changed from \Code{unsigned int}
+ * to \Code{unsigned long long}.
+ * The implementation of the #H5FD_LOG_TIME_OPEN, #H5FD_LOG_TIME_READ,
+ * #H5FD_LOG_TIME_WRITE, and #H5FD_LOG_TIME_SEEK flags has been finished.
+ * New flags were added: #H5FD_LOG_NUM_TRUNCATE and #H5FD_LOG_TIME_STAT.
+ * \version 1.6.0 The \c verbosity parameter has been removed.
+ * Two new parameters have been added: \p flags of type \Code{unsigned} and
+ * \p buf_size of type \Code{size_t}.
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size);
#ifdef __cplusplus
diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c
new file mode 100644
index 0000000..f604eaf
--- /dev/null
+++ b/src/H5FDmirror.c
@@ -0,0 +1,1926 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Transmit write-only operations to a receiver/writer process on
+ * a remote host.
+ */
+
+#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
+
+#include "H5private.h" /* Generic Functions */
+
+#ifdef H5_HAVE_MIRROR_VFD
+
+#include "H5Eprivate.h" /* Error handling */
+#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 */
+#include "H5Pprivate.h" /* Property lists */
+
+/* The driver identification number, initialized at runtime */
+static hid_t H5FD_MIRROR_g = 0;
+
+/* Virtual file structure for a Mirror Driver */
+typedef struct H5FD_mirror_t {
+ H5FD_t pub; /* Public stuff, must be first */
+ H5FD_mirror_fapl_t fa; /* Configuration structure */
+ haddr_t eoa; /* End of allocated region */
+ haddr_t eof; /* End of file; current file size */
+ int sock_fd; /* Handle of socket to remote operator */
+ H5FD_mirror_xmit_t xmit; /* Primary communication header */
+ uint32_t xmit_i; /* Counter of transmission sent and rec'd */
+} H5FD_mirror_t;
+
+/*
+ * These macros check for overflow of various quantities. These macros
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
+ *
+ * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
+ * is too large to be represented by the second argument
+ * of the file seek function.
+ *
+ * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
+ * large to be represented by the `size_t' type.
+ *
+ * REGION_OVERFLOW: Checks whether an address and size pair describe data
+ * 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))
+
+#ifndef BSWAP_64
+#define BSWAP_64(X) \
+ (uint64_t)((((X)&0x00000000000000FF) << 56) | (((X)&0x000000000000FF00) << 40) | \
+ (((X)&0x0000000000FF0000) << 24) | (((X)&0x00000000FF000000) << 8) | \
+ (((X)&0x000000FF00000000) >> 8) | (((X)&0x0000FF0000000000) >> 24) | \
+ (((X)&0x00FF000000000000) >> 40) | (((X)&0xFF00000000000000) >> 56))
+#endif /* BSWAP_64 */
+
+/* Debugging flabs for verbose tracing -- nonzero to enable */
+#define MIRROR_DEBUG_OP_CALLS 0
+#define MIRROR_DEBUG_XMIT_BYTES 0
+
+#if MIRROR_DEBUG_XMIT_BYTES
+#define LOG_XMIT_BYTES(label, buf, len) \
+ do { \
+ ssize_t bytes_written = 0; \
+ const unsigned char *b = NULL; \
+ \
+ HDfprintf(stdout, "%s bytes:\n```\n", (label)); \
+ \
+ /* print whole lines */ \
+ while ((len - bytes_written) >= 32) { \
+ b = (const unsigned char *)(buf) + bytes_written; \
+ HDfprintf(stdout, \
+ "%04zX %02X%02X%02X%02X %02X%02X%02X%02X" \
+ " %02X%02X%02X%02X %02X%02X%02X%02X" \
+ " %02X%02X%02X%02X %02X%02X%02X%02X" \
+ " %02X%02X%02X%02X %02X%02X%02X%02X\n", \
+ bytes_written, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], \
+ b[11], b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20], b[21], b[22], \
+ b[23], b[24], b[25], b[26], b[27], b[28], b[29], b[30], b[31]); \
+ bytes_written += 32; \
+ } \
+ \
+ /* start partial line */ \
+ if (len > bytes_written) { \
+ HDfprintf(stdout, "%04zX ", bytes_written); \
+ } \
+ \
+ /* partial line blocks */ \
+ while ((len - bytes_written) >= 4) { \
+ HDfprintf(stdout, " %02X%02X%02X%02X", (buf)[bytes_written], (buf)[bytes_written + 1], \
+ (buf)[bytes_written + 2], (buf)[bytes_written + 3]); \
+ bytes_written += 4; \
+ } \
+ \
+ /* block separator before partial block */ \
+ if (len > bytes_written) { \
+ HDfprintf(stdout, " "); \
+ } \
+ \
+ /* partial block individual bytes */ \
+ while (len > bytes_written) { \
+ HDfprintf(stdout, "%02X", (buf)[bytes_written++]); \
+ } \
+ \
+ /* end partial line */ \
+ HDfprintf(stdout, "\n"); \
+ HDfprintf(stdout, "```\n"); \
+ HDfflush(stdout); \
+ } while (0)
+#else
+#define LOG_XMIT_BYTES(label, buf, len) /* no-op */
+#endif /* MIRROR_DEBUG_XMIT_BYTE */
+
+#if MIRROR_DEBUG_OP_CALLS
+#define LOG_OP_CALL(name) \
+ do { \
+ HDprintf("called %s()\n", (name)); \
+ 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, 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, 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, haddr_t addr, size_t size,
+ void *buf);
+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_verify_reply(H5FD_mirror_t *file);
+
+static const H5FD_class_t H5FD_mirror_g = {
+ "mirror", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ 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 */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD__mirror_open, /* open */
+ H5FD__mirror_close, /* close */
+ NULL, /* cmp */
+ 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 */
+ NULL, /* get_handle */
+ H5FD__mirror_read, /* read */
+ H5FD__mirror_write, /* write */
+ NULL, /* flush */
+ 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
+ *
+ * Purpose: Initializes any interface-specific data or routines.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__init_package(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ if (H5FD_mirror_init() < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FD__init_package() */
+
+/* -------------------------------------------------------------------------
+ * Function: H5FD_mirror_init
+ *
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
+ *
+ * Return: Success: The driver ID for the mirror driver.
+ * Failure: Negative
+ * -------------------------------------------------------------------------
+ */
+hid_t
+H5FD_mirror_init(void)
+{
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ 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);
+
+ ret_value = H5FD_MIRROR_g;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_mirror_init() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_term
+ *
+ * Purpose: Shut down the VFD
+ *
+ * Returns: SUCCEED (Can't fail)
+ * ---------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_term(void)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Reset VFL ID */
+ H5FD_MIRROR_g = 0;
+
+ LOG_OP_CALL(FUNC);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FD__mirror_term() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_decode_uint16
+ *
+ * Purpose: Extract a 16-bit integer in "network" (Big-Endian) word order
+ * from the byte-buffer and return it with the local word order at
+ * the destination pointer.
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * Return: The number of bytes read from the buffer (2).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf)
+{
+ uint16_t n = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_buf && out);
+
+ H5MM_memcpy(&n, _buf, sizeof(n));
+ *out = (uint16_t)HDntohs(n);
+
+ return 2; /* number of bytes eaten */
+} /* end H5FD__mirror_xmit_decode_uint16() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_decode_uint32
+ *
+ * Purpose: Extract a 32-bit integer in "network" (Big-Endian) word order
+ * from the byte-buffer and return it with the local word order at
+ * the destination pointer.
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * Return: The number of bytes read from the buffer (4).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf)
+{
+ uint32_t n = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_buf && out);
+
+ H5MM_memcpy(&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
+ *
+ * Purpose: Determine whether the host machine is is little-endian.
+ *
+ * Store an intger with a known value, re-map the memory to a
+ * character array, and inspect the array's contents.
+ *
+ * Return: The number of bytes written to the buffer (8).
+ *
+ * Programmer: Jacob Smith
+ * 2020-03-05
+ * ---------------------------------------------------------------------------
+ */
+static hbool_t
+is_host_little_endian(void)
+{
+ union {
+ uint32_t u32;
+ uint8_t u8[4];
+ } echeck;
+ echeck.u32 = 0xA1B2C3D4;
+
+ if (echeck.u8[0] == 0xD4)
+ return TRUE;
+ else
+ return FALSE;
+} /* end is_host_little_endian() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_decode_uint64
+ *
+ * Purpose: Extract a 64-bit integer in "network" (Big-Endian) word order
+ * from the byte-buffer and return it with the local word order.
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * WARNING: Does not accommodate other forms of endianness,
+ * e.g. "middle-endian".
+ *
+ * Return: The number of bytes written to the buffer (8).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf)
+{
+ uint64_t n = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_buf && out);
+
+ H5MM_memcpy(&n, _buf, sizeof(n));
+ if (TRUE == is_host_little_endian())
+ *out = BSWAP_64(n);
+ else
+ *out = n;
+
+ return 8;
+} /* end H5FD__mirror_xmit_decode_uint64() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_decode_uint8
+ *
+ * Purpose: Extract a 8-bit integer in "network" (Big-Endian) word order
+ * from the byte-buffer and return it with the local word order at
+ * the destination pointer.
+ * (yes, it's one byte).
+ *
+ * Return: The number of bytes read from the buffer (1).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(_buf && out);
+
+ H5MM_memcpy(out, _buf, sizeof(uint8_t));
+
+ return 1; /* number of bytes eaten */
+} /* end H5FD__mirror_xmit_decode_uint8() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_encode_uint16
+ *
+ * Purpose: Encode a 16-bit integer in "network" (Big-Endian) word order
+ * in place in the destination bytes-buffer.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer (2).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v)
+{
+ uint16_t n = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_dest);
+
+ n = (uint16_t)HDhtons(v);
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
+ return 2;
+} /* end H5FD__mirror_xmit_encode_uint16() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_encode_uint32
+ *
+ * Purpose: Encode a 32-bit integer in "network" (Big-Endian) word order
+ * in place in the destination bytes-buffer.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer (4).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v)
+{
+ uint32_t n = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_dest);
+
+ n = (uint32_t)HDhtonl(v);
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
+ return 4;
+} /* end H5FD__mirror_xmit_encode_uint32() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_encode_uint64
+ *
+ * Purpose: Encode a 64-bit integer in "network" (Big-Endian) word order
+ * in place in the destination bytes-buffer.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer (8).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v)
+{
+ uint64_t n = v;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(_dest);
+
+ if (TRUE == is_host_little_endian())
+ n = BSWAP_64(v);
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
+ return 8;
+} /* H5FD__mirror_xmit_encode_uint64() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD__mirror_xmit_encode_uint8
+ *
+ * Purpose: Encode a 8-bit integer in "network" (Big-Endian) word order
+ * in place in the destination bytes-buffer.
+ * (yes, it's one byte).
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes read from the buffer (1).
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(dest);
+
+ H5MM_memcpy(dest, &v, sizeof(v));
+
+ return 1;
+} /* end H5FD__mirror_xmit_encode_uint8() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_header
+ *
+ * Purpose: Extract a mirror_xmit_t "header" from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_xmit() before use.
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * Return: The number of bytes consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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), &buf[n_eaten]);
+ n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->xmit_count), &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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_lock
+ *
+ * Purpose: Extract a mirror_xmit_lock_t from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_lock() before use.
+ *
+ * Return: The number of bytes consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_open
+ *
+ * Purpose: Extract a mirror_xmit_open_t from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_open() before use.
+ *
+ * Return: The maximum number of bytes that this decoding operation might
+ * have consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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]);
+ n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size_t_blob), &buf[n_eaten]);
+ 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 */
+
+ return H5FD_MIRROR_XMIT_OPEN_SIZE;
+} /* end H5FD_mirror_xmit_decode_open() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_reply
+ *
+ * Purpose: Extract a mirror_xmit_reply_t from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_reply() before use.
+ *
+ * Return: The maximum number of bytes that this decoding operation might
+ * have consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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 */
+
+ return H5FD_MIRROR_XMIT_REPLY_SIZE;
+} /* end H5FD_mirror_xmit_decode_reply() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_set_eoa
+ *
+ * Purpose: Extract a mirror_xmit_eoa_t from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_set_eoa() before use.
+ *
+ * Return: The number of bytes consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_decode_write
+ *
+ * Purpose: Extract a mirror_xmit_write_t from the bytes-buffer.
+ *
+ * Fields will be lifted from the buffer and stored in the
+ * target structure, using in the correct location (different
+ * systems may insert different padding between components) and
+ * word order (Big- vs Little-Endian).
+ *
+ * The programmer must ensure that the received buffer holds
+ * at least the expected size of data.
+ *
+ * The resulting structure should be sanity-checked with
+ * H5FD_mirror_xmit_is_write() before use.
+ *
+ * Return: The number of bytes consumed from the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf)
+{
+ size_t n_eaten = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_header
+ *
+ * Purpose: Encode a mirror_xmit_t "header" to the bytes-buffer.
+ *
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x)
+{
+ size_t n_writ = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_lock
+ *
+ * Purpose: Encode a mirror_xmit_lock_t to the bytes-buffer.
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x)
+{
+ size_t n_writ = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_open
+ *
+ * Purpose: Encode a mirror_xmit_open_t to the bytes-buffer.
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The maximum number of bytes that this decoding operation might
+ * have written into the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x)
+{
+ size_t n_writ = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(dest && x);
+
+ /* clear entire structure, but especially its filepath string area */
+ 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);
+ n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->maxaddr);
+ 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);
+
+ return H5FD_MIRROR_XMIT_OPEN_SIZE;
+} /* end H5FD_mirror_xmit_encode_open() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_reply
+ *
+ * Purpose: Encode a mirror_xmit_reply_t to the bytes-buffer.
+ *
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The maximum number of bytes that this decoding operation might
+ * have written into the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x)
+{
+ size_t n_writ = 0;
+
+ LOG_OP_CALL(__func__);
+
+ HDassert(dest && x);
+
+ /* clear entire structure, but especially its message string area */
+ 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);
+
+ return H5FD_MIRROR_XMIT_REPLY_SIZE;
+} /* end H5FD_mirror_xmit_encode_reply() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_set_eoa
+ *
+ * Purpose: Encode a mirror_xmit_eoa_t to the bytes-buffer.
+ *
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x)
+{
+ size_t n_writ = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_encode_write
+ *
+ * Purpose: Encode a mirror_xmit_write_t to the bytes-buffer.
+ *
+ * Fields will be packed into the buffer in a predictable manner,
+ * any numbers stored in "network" (Big-Endian) word order.
+ *
+ * The programmer must ensure that the destination buffer is
+ * large enough to hold the expected data.
+ *
+ * Return: The number of bytes written to the buffer.
+ * ---------------------------------------------------------------------------
+ */
+size_t
+H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x)
+{
+ size_t n_writ = 0;
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_close
+ *
+ * Purpose: Verify that a mirror_xmit_t is a valid CLOSE xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op))
+ return TRUE;
+
+ return FALSE;
+} /* end H5FD_mirror_xmit_is_close() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_lock
+ *
+ * Purpose: Verify that a mirror_xmit_lock_t is a valid LOCK xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_open
+ *
+ * Purpose: Verify that a mirror_xmit_open_t is a valid OPEN xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_eoa
+ *
+ * Purpose: Verify that a mirror_xmit_eoa_t is a valid SET-EOA xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_reply
+ *
+ * Purpose: Verify that a mirror_xmit_reply_t is a valid REPLY xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_write
+ *
+ * Purpose: Verify that a mirror_xmit_write_t is a valid WRITE xmit.
+ *
+ * Checks header validity and op code.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ 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() */
+
+/* ---------------------------------------------------------------------------
+ * Function: H5FD_mirror_xmit_is_xmit
+ *
+ * Purpose: Verify that a mirror_xmit_t is well-formed.
+ *
+ * Checks magic number and structure version.
+ *
+ * Return: TRUE if valid; else FALSE.
+ * ---------------------------------------------------------------------------
+ */
+H5_ATTR_PURE hbool_t
+H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit)
+{
+ LOG_OP_CALL(__func__);
+
+ HDassert(xmit);
+
+ if ((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version))
+ return FALSE;
+
+ return TRUE;
+} /* end H5FD_mirror_xmit_is_xmit() */
+
+/* ----------------------------------------------------------------------------
+ * Function: H5FD__mirror_verify_reply
+ *
+ * Purpose: Wait for and read reply data from remote processes.
+ * Sanity-check that a reply is well-formed and valid.
+ * If all checks pass, inspect the reply contents and handle
+ * reported error, if not an OK reply.
+ *
+ * Return: SUCCEED if ok, else FAIL.
+ * ----------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_verify_reply(H5FD_mirror_t *file)
+{
+ unsigned char * xmit_buf = NULL;
+ struct H5FD_mirror_xmit_reply_t reply;
+ ssize_t read_ret = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to read reply");
+ 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, 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)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "xmit op code was not REPLY");
+
+ 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)++)
+ 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));
+
+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
+ *
+ * Purpose: Get the file access propety list which could be used to create
+ * an identical file.
+ *
+ * Return: Success: pointer to the new file access property list value.
+ * Failure: NULL
+ * -------------------------------------------------------------------------
+ */
+static void *
+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_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t));
+ if (NULL == fa)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "calloc failed");
+
+ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t));
+
+ ret_value = fa;
+
+done:
+ if (ret_value == NULL)
+ if (fa != NULL)
+ H5MM_xfree(fa);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__mirror_fapl_get() */
+
+/* -------------------------------------------------------------------------
+ * Function: H5FD__mirror_fapl_copy
+ *
+ * Purpose: Copies the mirror vfd-specific file access properties.
+ *
+ * Return: Success: Pointer to a new property list
+ * Failure: NULL
+ * -------------------------------------------------------------------------
+ */
+static void *
+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_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t));
+ if (new_fa == NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed");
+
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t));
+ ret_value = new_fa;
+
+done:
+ if (ret_value == NULL)
+ if (new_fa != NULL)
+ H5MM_xfree(new_fa);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__mirror_fapl_copy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_fapl_free
+ *
+ * Purpose: Frees the mirror VFD-specific file access properties.
+ *
+ * Return: SUCCEED (cannot fail)
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_fapl_free(void *_fa)
+{
+ H5FD_mirror_fapl_t *fa = (H5FD_mirror_fapl_t *)_fa;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ LOG_OP_CALL(FUNC);
+
+ /* sanity check */
+ HDassert(fa != NULL);
+ HDassert(fa->magic == H5FD_MIRROR_FAPL_MAGIC);
+
+ fa->magic += 1; /* invalidate */
+ H5MM_xfree(fa);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FD__mirror_fapl_free() */
+
+/* -------------------------------------------------------------------------
+ * Function: H5Pget_fapl_mirror
+ *
+ * Purpose: Get the configuration information for this fapl.
+ * Data is memcopied into the fa_dst pointer.
+ *
+ * Return: SUCCEED/FAIL
+ * -------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst)
+{
+ const H5FD_mirror_fapl_t *fa_src = NULL;
+ H5P_genplist_t * plist = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", fapl_id, fa_dst);
+
+ LOG_OP_CALL(FUNC);
+
+ if (NULL == fa_dst)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst 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)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
+
+ fa_src = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist);
+ if (NULL == fa_src)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
+
+ HDassert(fa_src->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */
+
+ H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_mirror_fapl_t));
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* end H5Pget_fapl_mirror() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fapl_mirror
+ *
+ * Purpose: Modify the file access property list to use the mirror
+ * driver (H5FD_MIRROR) defined in this source file.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa)
+{
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", fapl_id, fa);
+
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null fapl_t pointer");
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown fapl_t version");
+
+ ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_fapl_mirror() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_open
+ *
+ * Purpose: Create and/or opens a file as an HDF5 file.
+ *
+ * Initiate connection with remote Server/Writer.
+ * If successful, the remote file is open.
+ *
+ * Return: Success: A pointer to a new file data structure. The
+ * public fields will be initialized by the
+ * caller, which is always H5FD_open().
+ * Failure: NULL
+ *-------------------------------------------------------------------------
+ */
+static H5FD_t *
+H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
+{
+ int live_socket = -1;
+ struct sockaddr_in target_addr;
+ socklen_t addr_size;
+ unsigned char * xmit_buf = NULL;
+ H5FD_mirror_fapl_t fa;
+ H5FD_mirror_t * file = NULL;
+ H5FD_mirror_xmit_open_t *open_xmit = NULL;
+ H5FD_t * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ /* --------------- */
+ /* Check arguments */
+ /* --------------- */
+
+ if (!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
+ if (ADDR_OVERFLOW(maxaddr))
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr");
+
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl magic");
+ 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)
+ 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);
+ target_addr.sin_addr.s_addr = HDinet_addr(fa.remote_ip);
+ 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");
+
+ /* ------------- */
+ /* Open the file */
+ /* ------------- */
+
+ file = (H5FD_mirror_t *)H5FL_CALLOC(H5FD_mirror_t);
+ if (NULL == file)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct");
+
+ file->sock_fd = live_socket;
+ file->xmit_i = 0;
+
+ file->xmit.magic = H5FD_MIRROR_XMIT_MAGIC;
+ file->xmit.version = H5FD_MIRROR_XMIT_CURR_VERSION;
+ file->xmit.xmit_count = file->xmit_i++;
+ 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);
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to transmit open");
+
+ 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)
+ 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 (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)
+} /* end H5FD__mirror_open() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_close
+ *
+ * Purpose: Closes the HDF5 file.
+ *
+ * Tries to send a CLOSE op to the remote Writer and expects
+ * a valid reply, then closes the socket.
+ * In error, attempts to send a deliberately invalid xmit to the
+ * Writer to get it to close/abort, then attempts to close the
+ * socket.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL, file possibly not closed but resources freed.
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_close(H5FD_t *_file)
+{
+ H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
+ unsigned char *xmit_buf = NULL;
+ int xmit_encoded = 0; /* monitor point of failure */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ /* Sanity check */
+ HDassert(file);
+ HDassert(file->sock_fd >= 0);
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_CLOSE;
+
+ 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)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close");
+
+ if (H5FD__mirror_verify_reply(file) == FAIL)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
+
+ 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) {
+ /* 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");
+ 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 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 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_query
+ *
+ * Purpose: Get the driver feature flags implemented by the driver.
+ *
+ * Return: SUCCEED (non-negative) (can't fail)
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
+{
+ FUNC_ENTER_STATIC_NOERR;
+
+ 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
+ * the Sec2 feature flags as its own.
+ *
+ * File pointer is always NULL/unused -- the H5FD_FEAT_IGNORE_DRVRINFO flag
+ * is never included.
+ * -- JOS 2020-01-13
+ */
+ 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() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * format address space.
+ *
+ * Required to register the driver.
+ *
+ * Return: The end-of-address marker.
+ *-------------------------------------------------------------------------
+ */
+static haddr_t
+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_STATIC_NOERR
+
+ LOG_OP_CALL(FUNC);
+
+ HDassert(file);
+
+ FUNC_LEAVE_NOAPI(file->eoa)
+} /* end H5FD__mirror_get_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
+ * to tell the driver where the end of the HDF5 data is located.
+ *
+ * Return: SUCCEED / FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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 = NULL;
+ H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ HDassert(file);
+
+ file->eoa = addr; /* local copy */
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_SET_EOA;
+
+ xmit_eoa.pub = file->xmit;
+ xmit_eoa.type = (uint8_t)type;
+ xmit_eoa.eoa_addr = (uint64_t)addr;
+
+ 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 (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() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * markers.
+ *
+ * Required to register the driver.
+ *
+ * Return: End of file address, the first address past the end of the
+ * "file", either the filesystem file or the HDF5 file.
+ *-------------------------------------------------------------------------
+ */
+static haddr_t
+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_STATIC_NOERR
+
+ LOG_OP_CALL(FUNC);
+
+ HDassert(file);
+
+ FUNC_LEAVE_NOAPI(file->eof)
+} /* end H5FD__mirror_get_eof() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_read
+ *
+ * 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)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ LOG_OP_CALL(FUNC);
+
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5FD__mirror_read() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * DXPL_ID.
+ *
+ * Send metadata regarding the write (location, size) to the
+ * remote Writer, then separately transmits the data.
+ * Both transmission expect an OK reply from the Writer.
+ * This two-exchange approach incurs significant overhead,
+ * but is a simple and modular approach.
+ * Start optimizations here.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+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_xmit_write_t xmit_write;
+ unsigned char * xmit_buf = NULL;
+ H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ HDassert(file);
+ HDassert(buf);
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_WRITE;
+
+ xmit_write.pub = file->xmit;
+ xmit_write.size = (uint64_t)size;
+ 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, &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)
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
+
+ /* Send the data to be written */
+ 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)
+ 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_truncate
+ *
+ * Purpose: Makes sure that the true file size is the same (or larger)
+ * than the end-of-address.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
+{
+ unsigned char *xmit_buf = NULL;
+ H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_TRUNCATE;
+
+ 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 (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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_lock
+ *
+ * Purpose: To place an advisory lock on a file.
+ * The lock type to apply depends on the parameter "rw":
+ * TRUE--opens for write: an exclusive lock
+ * FALSE--opens for read: a shared lock
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_lock(H5FD_t *_file, hbool_t rw)
+{
+ H5FD_mirror_xmit_lock_t xmit_lock;
+ unsigned char * xmit_buf = NULL;
+ H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_LOCK;
+
+ xmit_lock.pub = file->xmit;
+ xmit_lock.rw = (uint64_t)rw;
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit lock");
+
+ 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 */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__mirror_unlock
+ *
+ * Purpose: Remove the existing lock on the file.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mirror_unlock(H5FD_t *_file)
+{
+ unsigned char *xmit_buf = NULL;
+ H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ LOG_OP_CALL(FUNC);
+
+ file->xmit.xmit_count = (file->xmit_i)++;
+ file->xmit.op = H5FD_MIRROR_OP_UNLOCK;
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit unlock");
+
+ 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 */
+
+#endif /* H5_HAVE_MIRROR_VFD */
diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h
new file mode 100644
index 0000000..49e24c1
--- /dev/null
+++ b/src/H5FDmirror.h
@@ -0,0 +1,90 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * 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_H
+#define H5FDmirror_H
+
+#ifdef H5_HAVE_MIRROR_VFD
+
+#define H5FD_MIRROR (H5FD_mirror_init())
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================
+ * Mirror VFD use and operation.
+ * ============================================================================
+ */
+
+/* ---------------------------------------------------------------------------
+ * Structure: H5FD_mirror_fapl_t
+ *
+ * Used to pass configuraiton information to the Mirror VFD.
+ * Populate components as appropriate and pass structure pointer to
+ * `H5Pset_fapl_mirror()`.
+ *
+ * `magic` (uint32_t)
+ * Semi-unique number to sanity-check pointers to this structure type.
+ * MUST equal H5FD_MIRROR_FAPL_MAGIC to be considered valid.
+ *
+ * `version` (uint32_t)
+ * Indicates expected components of the structure.
+ *
+ * `handshake_port (int)
+ * Port number to expect to reach the "Mirror Server" on the remote host.
+ *
+ * `remote_ip` (char[])
+ * IP address string of "Mirror Server" remote host.
+ * ---------------------------------------------------------------------------
+ */
+#define H5FD_MIRROR_FAPL_MAGIC 0xF8DD514C
+#define H5FD_MIRROR_CURR_FAPL_T_VERSION 1
+#define H5FD_MIRROR_MAX_IP_LEN 32
+typedef struct H5FD_mirror_fapl_t {
+ uint32_t magic;
+ uint32_t version;
+ int handshake_port;
+ char remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1];
+} H5FD_mirror_fapl_t;
+
+H5_DLL hid_t H5FD_mirror_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
+H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
+H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa);
+
+#ifdef __cplusplus
+}
+#endif
+
+#else /* H5_HAVE_MIRROR_VFD */
+
+#define H5FD_MIRROR (H5I_INAVLID_HID)
+
+#endif /* H5_HAVE_MIRROR_VFD */
+
+#endif /* H5FDmirror_H */
diff --git a/src/H5FDmirror_priv.h b/src/H5FDmirror_priv.h
new file mode 100644
index 0000000..21de97b
--- /dev/null
+++ b/src/H5FDmirror_priv.h
@@ -0,0 +1,317 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * 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 794b175..0b92b27 100644
--- a/src/H5FDmodule.h
+++ b/src/H5FDmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5FD package. Including this header means that the source file
* is part of the H5FD package.
*/
-#ifndef _H5FDmodule_H
-#define _H5FDmodule_H
+#ifndef H5FDmodule_H
+#define H5FDmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_VFL
#define H5_MY_PKG_INIT YES
-#endif /* _H5FDmodule_H */
+#endif /* H5FDmodule_H */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 0c528df..048b8f3 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, January 30, 2004
*
* Purpose: Common routines for all MPI-based VFL drivers.
@@ -41,8 +41,6 @@
* Programmer: Quincey Koziol
* Friday, January 30, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -79,8 +77,6 @@ done:
* Programmer: Quincey Koziol
* Friday, January 30, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -116,8 +112,6 @@ done:
* Programmer: Quincey Koziol
* Friday, January 30, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
MPI_Comm
@@ -142,43 +136,6 @@ done:
} /* end H5FD_mpi_get_comm() */
/*-------------------------------------------------------------------------
- * Function: H5FD_get_mpi_info
- *
- * Purpose: Retrieves the file's mpi info
- *
- * Return: Success: SUCCEED
- *
- * Failure: FAIL
- *
- * Programmer: John Mainzer
- * 4/4/17
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_get_mpi_info(H5FD_t *file, void **mpi_info)
-{
- const H5FD_class_mpi_t *cls;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(file);
- cls = (const H5FD_class_mpi_t *)(file->cls);
- HDassert(cls);
- HDassert(cls->get_mpi_info); /* All MPI drivers must implement this */
-
- /* Dispatch to driver */
- if ((ret_value = (cls->get_mpi_info)(file, mpi_info)) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_mpi_info request failed")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_get_mpi_info() */
-
-/*-------------------------------------------------------------------------
* Function: H5FD_mpi_MPIOff_to_haddr
*
* Purpose: Convert an MPI_Offset value to haddr_t.
@@ -191,13 +148,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
@@ -228,16 +178,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
@@ -283,9 +223,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
@@ -337,9 +274,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 d33105e..cf49301 100644
--- a/src/H5FDmpi.h
+++ b/src/H5FDmpi.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, January 30, 2004
*
* Purpose: The public header file for common items for all MPI VFL drivers
@@ -34,10 +34,12 @@
*/
#define H5D_MULTI_CHUNK_IO_COL_THRESHOLD 60
-/* Type of I/O for data transfer properties */
+/**
+ * Type of I/O for data transfer properties
+ */
typedef enum H5FD_mpio_xfer_t {
- H5FD_MPIO_INDEPENDENT = 0, /*zero is the default*/
- H5FD_MPIO_COLLECTIVE
+ H5FD_MPIO_INDEPENDENT = 0, /**< Use independent I/O access */
+ H5FD_MPIO_COLLECTIVE /**< Use collective I/O access */
} H5FD_mpio_xfer_t;
/* Type of chunked dataset I/O */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index bb65300..c0b14ce 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -6,16 +6,16 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Purpose: This is the MPI-2 I/O driver.
+ * Purpose: This is the MPI-2 I/O driver.
*
*/
@@ -42,7 +42,7 @@
static hid_t H5FD_MPIO_g = 0;
/* Whether to allow collective I/O operations */
-/* (Value can be set from environment variable also) */
+/* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */
hbool_t H5FD_mpi_opt_types_g = TRUE;
/*
@@ -89,7 +89,6 @@ static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closin
static int H5FD__mpio_mpi_rank(const H5FD_t *_file);
static int H5FD__mpio_mpi_size(const H5FD_t *_file);
static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file);
-static herr_t H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info);
/* The MPIO file driver information */
static const H5FD_class_mpi_t H5FD_mpio_g = {
@@ -130,28 +129,30 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
}, /* End of superclass information */
H5FD__mpio_mpi_rank, /*get_rank */
H5FD__mpio_mpi_size, /*get_size */
- H5FD__mpio_communicator, /*get_comm */
- H5FD__mpio_get_info /*get_info */
+ H5FD__mpio_communicator /*get_comm */
};
#ifdef H5FDmpio_DEBUG
-/* Flags to control debug actions in H5Fmpio.
- * Meant to be indexed by characters.
- *
- * 'c' show result of MPI_Get_count after read
- * 'r' show read offset and size
- * 't' trace function entry and exit
- * 'w' show write offset and size
+/* Flags to control debug actions in the MPI-IO VFD.
+ * (Meant to be indexed by characters)
+ *
+ * These flags can be set with either (or both) the environment variable
+ * "H5FD_mpio_Debug" set to a string containing one or more characters
+ * (flags) or by setting them as a string value for the
+ * "H5F_mpio_debug_key" MPI Info key.
+ *
+ * Supported characters in 'H5FD_mpio_Debug' string:
+ * 't' trace function entry and exit
+ * 'r' show read offset and size
+ * 'w' show write offset and size
+ * '0'-'9' only show output from a single MPI rank (ranks 0-9 supported)
*/
-static int H5FD_mpio_Debug[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static int H5FD_mpio_debug_flags_s[256];
+static int H5FD_mpio_debug_rank_s = -1;
+
+/* Indicate if this rank should output tracing info */
+#define H5FD_MPIO_TRACE_THIS_RANK(file) \
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == (file)->mpi_rank)
#endif
/*--------------------------------------------------------------------------
@@ -183,6 +184,41 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD__init_package() */
+#ifdef H5FDmpio_DEBUG
+
+/*---------------------------------------------------------------------------
+ * Function: H5FD__mpio_parse_debug_str
+ *
+ * Purpose: Parse a string for debugging flags
+ *
+ * Returns: N/A
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, Aug 12, 2020
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+H5FD__mpio_parse_debug_str(const char *s)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(s);
+
+ /* Set debug mask */
+ while (*s) {
+ if ((int)(*s) >= (int)'0' && (int)(*s) <= (int)'9')
+ H5FD_mpio_debug_rank_s = ((int)*s) - (int)'0';
+ else
+ H5FD_mpio_debug_flags_s[(int)*s]++;
+ s++;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5FD__mpio_parse_debug_str() */
+#endif /* H5FDmpio_DEBUG */
+
/*-------------------------------------------------------------------------
* Function: H5FD_mpio_init
*
@@ -200,11 +236,8 @@ done:
hid_t
H5FD_mpio_init(void)
{
-#ifdef H5FDmpio_DEBUG
static int H5FD_mpio_Debug_inited = 0;
-#endif /* H5FDmpio_DEBUG */
- const char *s; /* String for environment variables */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -212,28 +245,27 @@ H5FD_mpio_init(void)
if (H5I_VFL != H5I_get_type(H5FD_MPIO_g))
H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_mpi_t), FALSE);
- /* Allow MPI buf-and-file-type optimizations? */
- s = HDgetenv("HDF5_MPI_OPT_TYPES");
- if (s && HDisdigit(*s)) {
- long env_val = HDstrtol(s, NULL, 0);
- H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE;
- }
+ if (!H5FD_mpio_Debug_inited) {
+ const char *s; /* String for environment variables */
+
+ /* Allow MPI buf-and-file-type optimizations? */
+ s = HDgetenv("HDF5_MPI_OPT_TYPES");
+ if (s && HDisdigit(*s))
+ H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE;
#ifdef H5FDmpio_DEBUG
- if (!H5FD_mpio_Debug_inited) {
+ /* Clear the flag buffer */
+ HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s));
+
/* Retrieve MPI-IO debugging environment variable */
s = HDgetenv("H5FD_mpio_Debug");
- if (s) {
- /* Set debug mask */
- while (*s) {
- H5FD_mpio_Debug[(int)*s]++;
- s++;
- } /* end while */
- } /* end if */
- H5FD_mpio_Debug_inited++;
- } /* end if */
+ if (s)
+ H5FD__mpio_parse_debug_str(s);
#endif /* H5FDmpio_DEBUG */
+ H5FD_mpio_Debug_inited++;
+ } /* end if */
+
/* Set return value */
ret_value = H5FD_MPIO_g;
@@ -657,30 +689,27 @@ herr_t
H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
- if (FALSE == flag)
- temp_flag = 0;
- else
- temp_flag = 1;
-
/* set atomicity value */
- if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag)))
+ if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, (int)(flag != FALSE))))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -702,15 +731,18 @@ herr_t
H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Get atomicity value */
@@ -724,8 +756,8 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -752,26 +784,23 @@ done:
static H5FD_t *
H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr)
{
- H5FD_mpio_t * file = NULL;
- MPI_File fh;
- hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */
- int mpi_amode;
- int mpi_rank; /* MPI rank of this process */
- int mpi_size; /* Total number of MPI processes */
- int mpi_code; /* MPI return code */
- MPI_Offset size;
- H5P_genplist_t *plist; /* Property list pointer */
- MPI_Comm comm = MPI_COMM_NULL;
- MPI_Info info = MPI_INFO_NULL;
- H5FD_t * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
+ H5FD_mpio_t * file = NULL; /* VFD File struct for new file */
+ H5P_genplist_t *plist; /* Property list pointer */
+ MPI_Comm comm = MPI_COMM_NULL; /* MPI Communicator, from plist */
+ MPI_Info info = MPI_INFO_NULL; /* MPI Info, from plist */
+ MPI_File fh; /* MPI file handle */
+ hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */
+ int mpi_amode; /* MPI file access flags */
+ int mpi_rank = INT_MAX; /* MPI rank of this process */
+ int mpi_size; /* Total number of MPI processes */
+ MPI_Offset file_size; /* File size (of existing files) */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC,
- name, flags, (int)fapl_id, (unsigned long)maxaddr);
+ hbool_t H5FD_mpio_debug_t_flag = FALSE;
#endif
+ int mpi_code; /* MPI return code */
+ H5FD_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Get a pointer to the fapl */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
@@ -783,6 +812,20 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object")
+ /* Get the MPI rank of this process and the total number of processes */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
+
+#ifdef H5FDmpio_DEBUG
+ H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] &&
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank));
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n",
+ FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr);
+#endif
+
/* Convert HDF5 flags to MPI-IO flags */
/* Some combinations are illegal; let MPI-IO figure it out */
mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY;
@@ -798,26 +841,15 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
int flag;
MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag);
- if (flag) {
- int i;
-
- HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str);
- for (i = 0; debug_str[i] /*end of string*/ && i < 128 /*just in case*/; ++i)
- H5FD_mpio_Debug[(int)debug_str[i]] = 1;
- } /* end if */
- } /* end if */
+ if (flag)
+ H5FD__mpio_parse_debug_str(debug_str);
+ } /* end if */
#endif
if (MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh)))
HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code)
file_opened = TRUE;
- /* Get the MPI rank of this process and the total number of processes */
- if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
- if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
-
/* Build the return value and initialize it */
if (NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -828,17 +860,17 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
file->mpi_size = mpi_size;
/* Only processor p0 will get the filesize and broadcast it. */
- if (mpi_rank == 0) {
- if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &size)))
+ if (mpi_rank == 0)
+ if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &file_size)))
HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code)
- } /* end if */
/* Broadcast file size */
- if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&file_size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm)))
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
/* Determine if the file should be truncated */
- if (size && (flags & H5F_ACC_TRUNC)) {
+ if (file_size && (flags & H5F_ACC_TRUNC)) {
+ /* Truncate the file */
if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0)))
HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code)
@@ -847,11 +879,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code)
/* File is zero size now */
- size = 0;
+ file_size = 0;
} /* end if */
/* Set the size of the file (from library's perspective) */
- file->eof = H5FD_mpi_MPIOff_to_haddr(size);
+ file->eof = H5FD_mpi_MPIOff_to_haddr(file_size);
file->local_eof = file->eof;
/* Set return value */
@@ -870,8 +902,8 @@ done:
} /* end if */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -893,14 +925,18 @@ static herr_t
H5FD__mpio_close(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED; /* Return value */
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ int mpi_rank = file->mpi_rank;
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -908,7 +944,7 @@ H5FD__mpio_close(H5FD_t *_file)
HDassert(H5FD_MPIO == file->pub.driver_id);
/* MPI_File_close sets argument to MPI_FILE_NULL */
- if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f) /*in,out*/)))
+ if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f))))
HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code)
/* Clean up other stuff */
@@ -918,8 +954,8 @@ H5FD__mpio_close(H5FD_t *_file)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -951,7 +987,7 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
*flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
*flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default
- VFD */
+ VFD */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1113,7 +1149,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
- int mpi_code; /* mpi return code */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
int size_i; /* Integer copy of 'size' to read */
#if MPI_VERSION >= 3
@@ -1129,13 +1164,18 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
#endif
hbool_t use_view_this_time = FALSE;
hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1154,8 +1194,9 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
+ size_i);
#endif
/* Only look for MPI views for raw data transfers */
@@ -1201,8 +1242,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1210,14 +1251,14 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank);
#endif
/* Check whether we should read from rank 0 and broadcast to other ranks */
if (H5CX_get_mpio_rank0_bcast()) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank);
#endif
/* Indicate path we've taken */
rank0_bcast = TRUE;
@@ -1230,16 +1271,19 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS !=
- (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ else
+ /* Perform collective read operation */
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
} /* end if */
else {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
#endif
+ /* Perform independent read operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
@@ -1252,8 +1296,16 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
+#endif
+
+ /* Perform independent read operation */
+ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ } /* end else */
/* Only retrieve bytes read if this rank _actually_ participated in I/O */
if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) {
@@ -1299,8 +1351,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1335,7 +1387,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int mpi_code; /* MPI return code */
#if MPI_VERSION >= 3
MPI_Count bytes_written;
MPI_Count type_size; /* MPI datatype used for I/O's size */
@@ -1349,13 +1400,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
hbool_t use_view_this_time = FALSE;
hbool_t derived_type = FALSE;
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1375,8 +1431,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
size_i = (int)size;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
+ size_i);
#endif
/* Get the transfer mode from the API context */
@@ -1431,8 +1488,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
@@ -1441,9 +1498,10 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank);
#endif
+ /* Perform collective write operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
@@ -1452,10 +1510,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (type != H5FD_MEM_DRAW)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL,
"Metadata Coll opt property should be collective at this point")
+
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
#endif
+ /* Perform independent write operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
@@ -1466,11 +1526,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS !=
- (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
+#endif
- /* How many bytes were actually written? */
+ /* Perform independent write operation */
+ if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ } /* end else */
+
+ /* How many bytes were actually written? */
#if MPI_VERSION >= 3
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written)))
#else
@@ -1505,12 +1572,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
file->local_eof = addr + (haddr_t)bytes_written;
done:
- if (derived_type) {
+ if (derived_type)
MPI_Type_free(&buf_type);
- }
+
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1532,14 +1599,17 @@ static herr_t
H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* mpi return code */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1553,8 +1623,8 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1567,13 +1637,14 @@ done:
*
* This is a little sticky in the mpio case, as it is not
* easy for us to track the current EOF by extracting it from
- * write calls.
+ * write calls, since other ranks could have written to the
+ * file beyond the local EOF.
*
- * Instead, we first check to see if the eoa has changed since
+ * Instead, we first check to see if the EOA has changed since
* the last call to this function. If it has, we call
* MPI_File_get_size() to determine the current EOF, and
* only call MPI_File_set_size() if this value disagrees
- * with the current eoa.
+ * with the current EOA.
*
* Return: SUCCEED/FAIL
*
@@ -1585,14 +1656,17 @@ done:
static herr_t
H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1635,7 +1709,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
if (H5FD_mpi_haddr_to_MPIOff(file->eoa, &needed_eof) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset")
- /* eoa != eof. Set eof to eoa */
+ /* EOA != EOF. Set EOF to EOA */
if (size != needed_eof) {
/* Extend the file's size */
if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(file->f, needed_eof)))
@@ -1660,8 +1734,8 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1747,34 +1821,4 @@ H5FD__mpio_communicator(const H5FD_t *_file)
FUNC_LEAVE_NOAPI(file->comm)
} /* end H5FD__mpio_communicator() */
-
-/*-------------------------------------------------------------------------
- * Function: H5FD__mpio_get_info
- *
- * Purpose: Returns the file info of MPIO file driver.
- *
- * Returns: Non-negative if succeed or negative if fails.
- *
- * Programmer: John Mainzer
- * April 4, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info)
-{
- H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
- if (!mpi_info)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid")
-
- *mpi_info = &(file->info);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD__mpio_get_info() */
-
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 289cfde..8caf11c 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, August 2, 1999
*
* Purpose: The public header file for the mpio driver.
@@ -25,7 +25,7 @@
#ifdef H5_HAVE_PARALLEL
#define H5FD_MPIO (H5FD_mpio_init())
#else
-#define H5FD_MPIO (-1)
+#define H5FD_MPIO (H5I_INVALID_HID)
#endif /* H5_HAVE_PARALLEL */
#ifdef H5_HAVE_PARALLEL
@@ -44,14 +44,237 @@ H5_DLLVAR hbool_t H5FD_mpi_opt_types_g;
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_mpio_init(void);
+H5_DLL hid_t H5FD_mpio_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Stores MPI IO communicator information to the file access property list
+ *
+ * \fapl_id
+ * \param[in] comm MPI-2 communicator
+ * \param[in] info MPI-2 info object
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_mpio() stores the user-supplied MPI IO parameters \p
+ * comm, for communicator, and \p info, for information, in the file
+ * access property list \p fapl_id. That property list can then be used
+ * to create and/or open a file.
+ *
+ * H5Pset_fapl_mpio() is available only in the parallel HDF5 library
+ * and is not a collective function.
+ *
+ * \p comm is the MPI communicator to be used for file open, as defined
+ * in \c MPI_File_open of MPI-2. This function makes a duplicate of the
+ * communicator, so modifications to \p comm after this function call
+ * returns have no effect on the file access property list.
+ *
+ * \p info is the MPI Info object to be used for file open, as defined
+ * in MPI_File_open() of MPI-2. This function makes a duplicate copy of
+ * the Info object, so modifications to the Info object after this
+ * function call returns will have no effect on the file access
+ * property list.
+ *
+ * If the file access property list already contains previously-set
+ * communicator and Info values, those values will be replaced and the
+ * old communicator and Info object will be freed.
+ *
+ * \note Raw dataset chunk caching is not currently supported when using this
+ * file driver in read/write mode. All calls to H5Dread() and H5Dwrite()
+ * will access the disk directly, and H5Pset_cache() and
+ * H5Pset_chunk_cache() will have no effect on performance.\n
+ * Raw dataset chunk caching is supported when this driver is used in
+ * read-only mode.
+ *
+ * \version 1.4.5 Handling of the MPI Communicator and Info object changed at
+ * this release. A duplicate of each of these is now stored in the property
+ * list instead of pointers to each.
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns MPI IO communicator information
+ *
+ * \fapl_id
+ * \param[out] comm MPI-2 communicator
+ * \param[out] info MPI-2 info object
+ * \returns \herr_t
+ *
+ * \details If the file access property list is set to the #H5FD_MPIO driver,
+ * H5Pget_fapl_mpio() returns duplicates of the stored MPI communicator
+ * and Info object through the \p comm and \p info pointers, if those
+ * values are non-null.
+ *
+ * Since the MPI communicator and Info object are duplicates of the
+ * stored information, future modifications to the access property list
+ * will not affect them. It is the responsibility of the application to
+ * free these objects.
+ *
+ * \version 1.4.5 Handling of the MPI Communicator and Info object changed at
+ * this release. A duplicate of each of these is now stored in the
+ * property list instead of pointers to each.
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets data transfer mode
+ *
+ * \dxpl_id
+ * \param[in] xfer_mode Transfer mode
+ * \returns \herr_t
+ *
+ * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id
+ * to use transfer mode \p xfer_mode. The property list can then be
+ * used to control the I/O transfer mode during data I/O operations.
+ *
+ * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and
+ * #H5FD_MPIO_COLLECTIVE.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Returns the data transfer mode
+ *
+ * \dxpl_id
+ * \param[out] xfer_mode Transfer mode
+ * \returns \herr_t
+ *
+ * \details H5Pget_dxpl_mpio() queries the data transfer mode currently set in
+ * the data transfer property list \p dxpl_id.
+ *
+ * Upon return, \p xfer_mode contains the data transfer mode, if it is
+ * non-null.
+ *
+ * H5Pget_dxpl_mpio() is not a collective function.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets data transfer mode
+ *
+ * \dxpl_id
+ * \param[in] opt_mode Transfer mode
+ * \returns \herr_t
+ *
+ * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id
+ * to use transfer mode xfer_mode. The property list can then be used
+ * to control the I/O transfer mode during data I/O operations.
+ *
+ * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and
+ * #H5FD_MPIO_COLLECTIVE.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets a flag specifying linked-chunk I/O or multi-chunk I/O
+ *
+ * \dxpl_id
+ * \param[in] opt_mode Transfer mode
+ * \returns \herr_t
+ *
+ * \details H5Pset_dxpl_mpio_chunk_opt() specifies whether I/O is to be
+ * performed as linked-chunk I/O or as multi-chunk I/O. This function
+ * overrides the HDF5 library's internal algorithm for determining
+ * which mechanism to use.
+ *
+ * When an application uses collective I/O with chunked storage, the
+ * HDF5 library normally uses an internal algorithm to determine
+ * whether that I/O activity should be conducted as one linked-chunk
+ * I/O or as multi-chunk I/O. H5Pset_dxpl_mpio_chunk_opt() is provided
+ * so that an application can override the library's algorithm in
+ * circumstances where the library might lack the information needed to
+ * make an optimal decision.
+ *
+ * H5Pset_dxpl_mpio_chunk_opt() works by setting one of the following
+ * flags in the parameter \p opt_mode:
+ * - #H5FD_MPIO_CHUNK_ONE_IO - Do one-link chunked I/O
+ * - #H5FD_MPIO_CHUNK_MULTI_IO - Do multi-chunked I/O
+ *
+ * This function works by setting a corresponding property in the
+ * dataset transfer property list \p dxpl_id.
+ *
+ * The library performs I/O in the specified manner unless it
+ * determines that the low-level MPI IO package does not support the
+ * requested behavior; in such cases, the HDF5 library will internally
+ * use independent I/O.
+ *
+ * Use of this function is optional.
+ *
+ * \todo Add missing version information
+ *
+ */
H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets a numeric threshold for linked-chunk I/O
+ *
+ * \dxpl_id
+ * \param[in] num_chunk_per_proc
+ * \returns \herr_t
+ *
+ * \details H5Pset_dxpl_mpio_chunk_opt_num() sets a numeric threshold for the
+ * use of linked-chunk I/O.
+ *
+ * The library will calculate the average number of chunks selected by
+ * each process when doing collective access with chunked storage. If
+ * the number is greater than the threshold set in \p
+ * num_chunk_per_proc, the library will use linked-chunk I/O;
+ * otherwise, a separate I/O process will be invoked for each chunk
+ * (multi-chunk I/O).
+ *
+ * \todo Add missing version information
+ *
+ */
H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets a ratio threshold for collective I/O
+ *
+ * \dxpl_id
+ * \param[in] percent_num_proc_per_chunk
+ * \returns \herr_t
+ *
+ * \details H5Pset_dxpl_mpio_chunk_opt_ratio() sets a threshold for the use of
+ * collective I/O based on the ratio of processes with collective
+ * access to a dataset with chunked storage. The decision whether to
+ * use collective I/O is made on a per-chunk basis.
+ *
+ * The library will calculate the percentage of the total number of
+ * processes, the ratio, that hold selections in each chunk. If that
+ * percentage is greater than the threshold set in \p
+ * percent_proc_per_chunk, the library will do collective I/O for this
+ * chunk; otherwise, independent I/O will be done for the chunk.
+ *
+ * \todo Add missing version information
+ *
+ */
H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk);
#ifdef __cplusplus
}
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 161ec0d..9226624 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -6,21 +6,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Monday, November 10, 1997
- *
- * Purpose: Implements a file driver which dispatches I/O requests to
- * other file drivers depending on the purpose of the address
- * region being accessed. For instance, all meta-data could be
- * place in one file while all raw data goes to some other file.
- * This also serves as an example of coding a complex file driver,
- * therefore, it should not use any non-public definitions.
+ * Programmer: Robb Matzke
+ * Monday, November 10, 1997
+ *
+ * Purpose: Implements a file driver which dispatches I/O requests to
+ * other file drivers depending on the purpose of the address
+ * region being accessed. For instance, all meta-data could be
+ * place in one file while all raw data goes to some other file.
+ * This also serves as an example of coding a complex file driver,
+ * therefore, it should not use any non-public definitions.
*/
#include <assert.h>
#include <stdlib.h>
@@ -35,6 +35,15 @@
#define TRUE 1
#endif
+/* Windows doesn't like some POSIX names and redefines them with an
+ * underscore
+ */
+#ifdef _WIN32
+#define my_strdup _strdup
+#else
+#define my_strdup strdup
+#endif
+
/* Loop through all mapped files */
#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \
{ \
@@ -74,7 +83,7 @@ typedef struct H5FD_multi_fapl_t {
hid_t memb_fapl[H5FD_MEM_NTYPES]; /*member access properties */
char * memb_name[H5FD_MEM_NTYPES]; /*name generators */
haddr_t memb_addr[H5FD_MEM_NTYPES]; /*starting addr per member */
- hbool_t relax; /*less stringent error checking */
+ hbool_t relax; /*less stringent error checking */
} H5FD_multi_fapl_t;
/*
@@ -103,9 +112,8 @@ typedef struct H5FD_multi_dxpl_t {
} H5FD_multi_dxpl_t;
/* Private functions */
-static char *my_strdup(const char *s);
-static int compute_next(H5FD_multi_t *file);
-static int open_members(H5FD_multi_t *file);
+static int compute_next(H5FD_multi_t *file);
+static int open_members(H5FD_multi_t *file);
/* Callback prototypes */
static herr_t H5FD_multi_term(void);
@@ -137,71 +145,41 @@ static herr_t H5FD_multi_unlock(H5FD_t *_file);
/* The class struct */
static const H5FD_class_t H5FD_multi_g = {
- "multi", /*name */
- HADDR_MAX, /*maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
+ "multi", /*name */
+ HADDR_MAX, /*maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
H5FD_multi_term, /*terminate */
- H5FD_multi_sb_size, /*sb_size */
- H5FD_multi_sb_encode, /*sb_encode */
- H5FD_multi_sb_decode, /*sb_decode */
- sizeof(H5FD_multi_fapl_t), /*fapl_size */
- H5FD_multi_fapl_get, /*fapl_get */
- H5FD_multi_fapl_copy, /*fapl_copy */
- H5FD_multi_fapl_free, /*fapl_free */
- 0, /*dxpl_size */
- NULL, /*dxpl_copy */
- NULL, /*dxpl_free */
- H5FD_multi_open, /*open */
- H5FD_multi_close, /*close */
- H5FD_multi_cmp, /*cmp */
- H5FD_multi_query, /*query */
- H5FD_multi_get_type_map, /*get_type_map */
- H5FD_multi_alloc, /*alloc */
- H5FD_multi_free, /*free */
- H5FD_multi_get_eoa, /*get_eoa */
- H5FD_multi_set_eoa, /*set_eoa */
- H5FD_multi_get_eof, /*get_eof */
+ H5FD_multi_sb_size, /*sb_size */
+ H5FD_multi_sb_encode, /*sb_encode */
+ H5FD_multi_sb_decode, /*sb_decode */
+ sizeof(H5FD_multi_fapl_t), /*fapl_size */
+ H5FD_multi_fapl_get, /*fapl_get */
+ H5FD_multi_fapl_copy, /*fapl_copy */
+ H5FD_multi_fapl_free, /*fapl_free */
+ 0, /*dxpl_size */
+ NULL, /*dxpl_copy */
+ NULL, /*dxpl_free */
+ H5FD_multi_open, /*open */
+ H5FD_multi_close, /*close */
+ H5FD_multi_cmp, /*cmp */
+ H5FD_multi_query, /*query */
+ H5FD_multi_get_type_map, /*get_type_map */
+ H5FD_multi_alloc, /*alloc */
+ H5FD_multi_free, /*free */
+ H5FD_multi_get_eoa, /*get_eoa */
+ H5FD_multi_set_eoa, /*set_eoa */
+ H5FD_multi_get_eof, /*get_eof */
H5FD_multi_get_handle, /*get_handle */
- H5FD_multi_read, /*read */
- H5FD_multi_write, /*write */
- H5FD_multi_flush, /*flush */
- H5FD_multi_truncate, /*truncate */
+ H5FD_multi_read, /*read */
+ H5FD_multi_write, /*write */
+ H5FD_multi_flush, /*flush */
+ H5FD_multi_truncate, /*truncate */
H5FD_multi_lock, /*lock */
H5FD_multi_unlock, /*unlock */
- H5FD_FLMAP_DEFAULT /*fl_map */
+ H5FD_FLMAP_DEFAULT /*fl_map */
};
/*-------------------------------------------------------------------------
- * Function: my_strdup
- *
- * Purpose: Private version of strdup()
- *
- * Return: Success: Ptr to new copy of string
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Friday, August 13, 1999
- *
- *-------------------------------------------------------------------------
- */
-static char *
-my_strdup(const char *s)
-{
- char * x;
- size_t str_len;
-
- if (!s)
- return NULL;
- str_len = strlen(s) + 1;
- if (NULL == (x = (char *)malloc(str_len)))
- return NULL;
- memcpy(x, s, str_len);
-
- return x;
-}
-
-/*-------------------------------------------------------------------------
* Function: H5FD_multi_init
*
* Purpose: Initialize this driver by registering the driver with the
@@ -228,9 +206,9 @@ H5FD_multi_init(void)
} /* end H5FD_multi_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_multi_term
+ * Function: H5FD_multi_term
*
- * Purpose: Shut down the VFD
+ * Purpose: Shut down the VFD
*
* Returns: Non-negative on success or negative on failure
*
@@ -249,17 +227,17 @@ H5FD_multi_term(void)
} /* end H5FD_multi_term() */
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_split
+ * Function: H5Pset_fapl_split
*
- * Purpose: Compatibility function. Makes the multi driver act like the
- * old split driver which stored meta data in one file and raw
- * data in another file.
+ * Purpose: Compatibility function. Makes the multi driver act like the
+ * old split driver which stored meta data in one file and raw
+ * data in another file.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 11, 1999
*
*-------------------------------------------------------------------------
@@ -339,77 +317,77 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c
}
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_multi
+ * Function: H5Pset_fapl_multi
*
- * Purpose: Sets the file access property list FAPL_ID to use the multi
- * driver. The MEMB_MAP array maps memory usage types to other
- * memory usage types and is the mechanism which allows the
- * caller to specify how many files are created. The array
- * contains H5FD_MEM_NTYPES entries which are either the value
- * H5FD_MEM_DEFAULT or a memory usage type and the number of
- * unique values determines the number of files which are
- * opened. For each memory usage type which will be associated
- * with a file the MEMB_FAPL array should have a property list
- * and the MEMB_NAME array should be a name generator (a
- * printf-style format with a %s which will be replaced with the
- * name passed to H5FDopen(), usually from H5Fcreate() or
- * H5Fopen()).
+ * Purpose: Sets the file access property list FAPL_ID to use the multi
+ * driver. The MEMB_MAP array maps memory usage types to other
+ * memory usage types and is the mechanism which allows the
+ * caller to specify how many files are created. The array
+ * contains H5FD_MEM_NTYPES entries which are either the value
+ * H5FD_MEM_DEFAULT or a memory usage type and the number of
+ * unique values determines the number of files which are
+ * opened. For each memory usage type which will be associated
+ * with a file the MEMB_FAPL array should have a property list
+ * and the MEMB_NAME array should be a name generator (a
+ * printf-style format with a %s which will be replaced with the
+ * name passed to H5FDopen(), usually from H5Fcreate() or
+ * H5Fopen()).
*
- * If RELAX is set then opening an existing file for read-only
- * access will not fail if some file members are missing. This
- * allows a file to be accessed in a limited sense if just the
- * meta data is available.
+ * If RELAX is set then opening an existing file for read-only
+ * access will not fail if some file members are missing. This
+ * allows a file to be accessed in a limited sense if just the
+ * meta data is available.
*
- * Defaults: Default values for each of the optional arguments are:
+ * Defaults: Default values for each of the optional arguments are:
*
- * memb_map: The default member map has the value
- * H5FD_MEM_DEFAULT for each element.
+ * memb_map: The default member map has the value
+ * H5FD_MEM_DEFAULT for each element.
*
- * memb_fapl: The value H5P_DEFAULT for each element.
+ * memb_fapl: The value H5P_DEFAULT for each element.
*
- * memb_name: The string `%s-X.h5' where `X' is one of the
- * letters `s' (H5FD_MEM_SUPER),
- * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW),
- * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP),
- * `o' (H5FD_MEM_OHDR).
+ * memb_name: The string `%s-X.h5' where `X' is one of the
+ * letters `s' (H5FD_MEM_SUPER),
+ * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW),
+ * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP),
+ * `o' (H5FD_MEM_OHDR).
*
- * memb_addr: The value HADDR_UNDEF for each element.
+ * memb_addr: The value HADDR_UNDEF for each element.
*
*
- * Example: To set up a multi file access property list which partitions
- * data into meta and raw files each being 1/2 of the address
- * space one would say:
+ * Example: To set up a multi file access property list which partitions
+ * data into meta and raw files each being 1/2 of the address
+ * space one would say:
*
- * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- * hid_t memb_fapl[H5FD_MEM_NTYPES];
- * const char *memb[H5FD_MEM_NTYPES];
- * haddr_t memb_addr[H5FD_MEM_NTYPES];
+ * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ * hid_t memb_fapl[H5FD_MEM_NTYPES];
+ * const char *memb[H5FD_MEM_NTYPES];
+ * haddr_t memb_addr[H5FD_MEM_NTYPES];
*
- * // The mapping...
- * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
- * memb_map[mt] = H5FD_MEM_SUPER;
- * }
- * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ * // The mapping...
+ * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
+ * memb_map[mt] = H5FD_MEM_SUPER;
+ * }
+ * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
*
- * // Member information
- * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
- * memb_name[H5FD_MEM_SUPER] = "%s.meta";
- * memb_addr[H5FD_MEM_SUPER] = 0;
+ * // Member information
+ * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
+ * memb_name[H5FD_MEM_SUPER] = "%s.meta";
+ * memb_addr[H5FD_MEM_SUPER] = 0;
*
- * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
- * memb_name[H5FD_MEM_DRAW] = "%s.raw";
- * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
+ * memb_name[H5FD_MEM_DRAW] = "%s.raw";
+ * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
*
- * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
- * H5Pset_fapl_multi(fapl, memb_map, memb_fapl,
- * memb_name, memb_addr, TRUE);
+ * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
+ * H5Pset_fapl_multi(fapl, memb_map, memb_fapl,
+ * memb_name, memb_addr, TRUE);
*
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -435,12 +413,12 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f
/* Check arguments and supply default values */
if (H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1) if (!memb_map)
- {
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1))
- _memb_map[mt] = H5FD_MEM_DEFAULT;
- memb_map = _memb_map;
- }
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "not an access list", -1);
+ if (!memb_map) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1))
+ _memb_map[mt] = H5FD_MEM_DEFAULT;
+ memb_map = _memb_map;
+ }
if (!memb_fapl) {
for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1))
_memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS);
@@ -464,19 +442,20 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f
/* Map usage type */
mmt = memb_map[mt];
if (mmt < 0 || mmt >= H5FD_MEM_NTYPES)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range",
- -1) if (H5FD_MEM_DEFAULT == mmt) mmt = mt;
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADRANGE, "file resource type out of range", -1);
+ if (H5FD_MEM_DEFAULT == mmt)
+ mmt = mt;
/*
* All members of MEMB_FAPL must be either defaults or actual file
* access property lists.
*/
if (H5P_DEFAULT != memb_fapl[mmt] && TRUE != H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1);
- /* All names must be defined */
- if (!memb_name[mmt] || !memb_name[mmt][0]) H5Epush_ret(
- func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1)
+ /* All names must be defined */
+ if (!memb_name[mmt] || !memb_name[mmt][0])
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1);
}
/*
@@ -499,17 +478,17 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f
}
/*-------------------------------------------------------------------------
- * Function: H5Pget_fapl_multi
+ * Function: H5Pget_fapl_multi
*
- * Purpose: Returns information about the multi file access property
- * list though the function arguments which are the same as for
- * H5Pset_fapl_multi() above.
+ * Purpose: Returns information about the multi file access property
+ * list though the function arguments which are the same as for
+ * H5Pset_fapl_multi() above.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -528,13 +507,14 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
H5Eclear2(H5E_DEFAULT);
if (H5I_GENPROP_LST != H5Iget_type(fapl_id) || TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list",
- -1) if (H5FD_MULTI != H5Pget_driver(fapl_id))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver",
- -1) if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id)))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1)
-
- if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1);
+ if (H5FD_MULTI != H5Pget_driver(fapl_id))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);
+ if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id)))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1);
+
+ if (memb_map)
+ memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
if (memb_fapl) {
for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
if (fa->memb_fapl[mt] >= 0)
@@ -560,16 +540,16 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_sb_size
+ * Function: H5FD_multi_sb_size
*
- * Purpose: Returns the size of the private information to be stored in
- * the superblock.
+ * Purpose: Returns the size of the private information to be stored in
+ * the superblock.
*
- * Return: Success: The super block driver data size.
+ * Return: Success: The super block driver data size.
*
- * Failure: never fails
+ * Failure: never fails
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 16, 1999
*
*-------------------------------------------------------------------------
@@ -604,24 +584,24 @@ H5FD_multi_sb_size(H5FD_t *_file)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_sb_encode
+ * Function: H5FD_multi_sb_encode
*
- * Purpose: Encode driver information for the superblock. The NAME
- * argument is a nine-byte buffer which will be initialized with
- * an eight-character name/version number and null termination.
+ * Purpose: Encode driver information for the superblock. The NAME
+ * argument is a nine-byte buffer which will be initialized with
+ * an eight-character name/version number and null termination.
*
- * The encoding is a six-byte member mapping followed two bytes
- * which are unused. For each unique file in usage-type order
- * encode all the starting addresses as unsigned 64-bit integers,
- * then all the EOA values as unsigned 64-bit integers, then all
- * the template names as null terminated strings which are
- * multiples of 8 characters.
+ * The encoding is a six-byte member mapping followed two bytes
+ * which are unused. For each unique file in usage-type order
+ * encode all the starting addresses as unsigned 64-bit integers,
+ * then all the EOA values as unsigned 64-bit integers, then all
+ * the template names as null terminated strings which are
+ * multiples of 8 characters.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 16, 1999
*
*-------------------------------------------------------------------------
@@ -671,10 +651,10 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
}
END_MEMBERS;
if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen * 2, buf + 8, NULL, H5P_DEFAULT) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
- /* Encode all name templates */
- p = buf + 8 + nseen * 2 * 8;
+ /* Encode all name templates */
+ p = buf + 8 + nseen * 2 * 8;
UNIQUE_MEMBERS (file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
strncpy((char *)p, file->fa.memb_name[mt], n);
@@ -688,21 +668,21 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
} /* end H5FD_multi_sb_encode() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_sb_decode
+ * Function: H5FD_multi_sb_decode
*
- * Purpose: Decodes the superblock information for this driver. The NAME
- * argument is the eight-character (plus null termination) name
- * stored in the file.
+ * Purpose: Decodes the superblock information for this driver. The NAME
+ * argument is the eight-character (plus null termination) name
+ * stored in the file.
*
- * The FILE argument is updated according to the information in
- * the superblock. This may mean that some member files are
- * closed and others are opened.
+ * The FILE argument is updated according to the information in
+ * the superblock. This may mean that some member files are
+ * closed and others are opened.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 16, 1999
*
*-------------------------------------------------------------------------
@@ -727,16 +707,15 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5Eclear2(H5E_DEFAULT);
/* Make sure the name/version number is correct */
- if (strcmp(name, "NCSAmult"))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1)
+ if (strcmp(name, "NCSAmult") != 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1);
- /* Set default values */
- ALL_MEMBERS (mt)
- {
- memb_addr[mt] = HADDR_UNDEF;
- memb_eoa[mt] = HADDR_UNDEF;
- memb_name[mt] = NULL;
- }
+ /* Set default values */
+ ALL_MEMBERS (mt) {
+ memb_addr[mt] = HADDR_UNDEF;
+ memb_eoa[mt] = HADDR_UNDEF;
+ memb_name[mt] = NULL;
+ }
END_MEMBERS;
/*
@@ -761,9 +740,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
memcpy(x, buf, (nseen * 2 * 8));
buf += nseen * 2 * 8;
if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen * 2, x, NULL, H5P_DEFAULT) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
- ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning -
- 2019/07/05, QAK */
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
+ ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning -
+ 2019/07/05, QAK */
UNIQUE_MEMBERS (map, mt) {
memb_addr[_unmapped] = *ap++;
memb_eoa[_unmapped] = *ap++;
@@ -818,41 +797,40 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
}
END_MEMBERS;
if (compute_next(file) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1);
- /* Open all necessary files */
- if (open_members(file) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1)
+ /* Open all necessary files */
+ if (open_members(file) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1);
- /* Set the EOA marker for all open files */
- UNIQUE_MEMBERS (file->fa.memb_map, mt)
- {
- if (file->memb[mt])
- if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1)
+ /* Set the EOA marker for all open files */
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
+ if (file->memb[mt])
+ if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1);
- /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa)
- */
- file->memb_eoa[mt] = memb_eoa[mt];
- }
+ /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa)
+ */
+ file->memb_eoa[mt] = memb_eoa[mt];
+ }
END_MEMBERS;
return 0;
} /* end H5FD_multi_sb_decode() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_fapl_get
+ * Function: H5FD_multi_fapl_get
*
- * Purpose: Returns a file access property list which indicates how the
- * specified file is being accessed. The return list could be
- * used to access another file the same way.
+ * Purpose: Returns a file access property list which indicates how the
+ * specified file is being accessed. The return list could be
+ * used to access another file the same way.
*
- * Return: Success: Ptr to new file access property list with all
- * members copied from the file struct.
+ * Return: Success: Ptr to new file access property list with all
+ * members copied from the file struct.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, August 13, 1999
*
*-------------------------------------------------------------------------
@@ -869,15 +847,15 @@ H5FD_multi_fapl_get(H5FD_t *_file)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_fapl_copy
+ * Function: H5FD_multi_fapl_copy
*
- * Purpose: Copies the multi-specific file access properties.
+ * Purpose: Copies the multi-specific file access properties.
*
- * Return: Success: Ptr to a new property list
+ * Return: Success: Ptr to a new property list
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -923,21 +901,21 @@ H5FD_multi_fapl_copy(const void *_old_fa)
}
END_MEMBERS;
free(new_fa);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't release object on error", NULL)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't release object on error", NULL);
}
return new_fa;
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_fapl_free
+ * Function: H5FD_multi_fapl_free
*
- * Purpose: Frees the multi-specific file access properties.
+ * Purpose: Frees the multi-specific file access properties.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -954,8 +932,9 @@ H5FD_multi_fapl_free(void *_fa)
ALL_MEMBERS (mt) {
if (fa->memb_fapl[mt] >= 0)
if (H5Idec_ref(fa->memb_fapl[mt]) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list",
- -1) if (fa->memb_name[mt]) free(fa->memb_name[mt]);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1);
+ if (fa->memb_name[mt])
+ free(fa->memb_name[mt]);
}
END_MEMBERS;
free(fa);
@@ -964,17 +943,17 @@ H5FD_multi_fapl_free(void *_fa)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_open
+ * Function: H5FD_multi_open
*
- * Purpose: Creates and/or opens a multi HDF5 file.
+ * Purpose: Creates and/or opens a multi HDF5 file.
*
- * Return: Success: A pointer to a new file data structure. The
- * public fields will be initialized by the
- * caller, which is always H5FD_open().
+ * Return: Success: A pointer to a new file data structure. The
+ * public fields will be initialized by the
+ * caller, which is always H5FD_open().
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -993,24 +972,23 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
/* Check arguments */
if (!name || !*name)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name",
- NULL) if (0 == maxaddr || HADDR_UNDEF == maxaddr)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL);
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL);
- /*
- * Initialize the file from the file access properties, using default
- * values if necessary. Make sure to use CALLOC here because the code
- * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa
- * in H5FD_multi_t.
- */
- if (NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t)))) H5Epush_ret(
- func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed",
- NULL) if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id))
- {
- close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0)
- H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error)
- }
+ /*
+ * Initialize the file from the file access properties, using default
+ * values if necessary. Make sure to use CALLOC here because the code
+ * in H5FD_multi_set_eoa depends on the proper initialization of memb_eoa
+ * in H5FD_multi_t.
+ */
+ if (NULL == (file = (H5FD_multi_t *)calloc((size_t)1, sizeof(H5FD_multi_t))))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
+ if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MULTI != H5Pget_driver(fapl_id)) {
+ close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0)
+ H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error)
+ }
fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
assert(fa);
ALL_MEMBERS (mt) {
@@ -1066,17 +1044,17 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_close
+ * Function: H5FD_multi_close
*
- * Purpose: Closes a multi file.
+ * Purpose: Closes a multi file.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative with as many members closed as
- * possible. The only subsequent operation
- * permitted on the file is a close operation.
+ * Failure: Negative with as many members closed as
+ * possible. The only subsequent operation
+ * permitted on the file is a close operation.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1104,16 +1082,15 @@ H5FD_multi_close(H5FD_t *_file)
}
END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1);
- /* Clean up other stuff */
- ALL_MEMBERS (mt)
- {
- if (file->fa.memb_fapl[mt] >= 0)
- (void)H5Idec_ref(file->fa.memb_fapl[mt]);
- if (file->fa.memb_name[mt])
- free(file->fa.memb_name[mt]);
- }
+ /* Clean up other stuff */
+ ALL_MEMBERS (mt) {
+ if (file->fa.memb_fapl[mt] >= 0)
+ (void)H5Idec_ref(file->fa.memb_fapl[mt]);
+ if (file->fa.memb_name[mt])
+ free(file->fa.memb_name[mt]);
+ }
END_MEMBERS;
free(file->name);
@@ -1122,20 +1099,19 @@ H5FD_multi_close(H5FD_t *_file)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_cmp
+ * Function: H5FD_multi_cmp
*
- * Purpose: Compares two file families to see if they are the same. It
- * does this by comparing the first common member of the two
- * families. If the families have no members in common then the
- * file with the earliest member is smaller than the other file.
- * We abort if neither file has any members.
+ * Purpose: Compares two file families to see if they are the same. It
+ * does this by comparing the first common member of the two
+ * families. If the families have no members in common then the
+ * file with the earliest member is smaller than the other file.
+ * We abort if neither file has any members.
*
- * Return: Success: like strcmp()
+ * Return: Success: like strcmp()
*
- * Failure: never fails (arguments were checked by the
- * caller).
+ * Failure: never fails (arguments were checked by th caller).
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1171,16 +1147,16 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_query
+ * Function: H5FD_multi_query
*
- * Purpose: Set the flags that this VFL driver is capable of supporting.
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, September 26, 2000
*
*-------------------------------------------------------------------------
@@ -1189,7 +1165,7 @@ static herr_t
H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */)
{
/* Shut compiler up */
- _f = _f;
+ (void)_f;
/* Set the VFL feature flags that this driver supports */
if (flags) {
@@ -1204,14 +1180,14 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */)
} /* end H5FD_multi_query() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_get_type_map
+ * Function: H5FD_multi_get_type_map
*
- * Purpose: Retrieve the memory type mapping for this file
+ * Purpose: Retrieve the memory type mapping for this file
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, October 9, 2008
*
*-------------------------------------------------------------------------
@@ -1228,27 +1204,19 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
} /* end H5FD_multi_get_type_map() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_get_eoa
+ * Function: H5FD_multi_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
- * the format address space.
+ * Purpose: Returns the end-of-address marker for the file. The EOA
+ * marker is the first address past the last byte allocated in
+ * the format address space.
*
- * Return: Success: The end-of-address-marker
+ * Return: Success: The end-of-address-marker
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * 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
@@ -1281,7 +1249,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
if (HADDR_UNDEF == memb_eoa)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa",
- HADDR_UNDEF) if (memb_eoa > 0) memb_eoa += file->fa.memb_addr[mt];
+ HADDR_UNDEF);
+ if (memb_eoa > 0)
+ memb_eoa += file->fa.memb_addr[mt];
}
else if (file->fa.relax) {
/*
@@ -1292,7 +1262,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
assert(HADDR_UNDEF != memb_eoa);
}
else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF);
}
if (memb_eoa > eoa)
@@ -1315,7 +1285,9 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
if (HADDR_UNDEF == eoa)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa",
- HADDR_UNDEF) if (eoa > 0) eoa += file->fa.memb_addr[mmt];
+ HADDR_UNDEF);
+ if (eoa > 0)
+ eoa += file->fa.memb_addr[mmt];
}
else if (file->fa.relax) {
/*
@@ -1326,7 +1298,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
assert(HADDR_UNDEF != eoa);
}
else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF);
}
}
@@ -1334,31 +1306,20 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
} /* end H5FD_multi_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_set_eoa
+ * Function: H5FD_multi_set_eoa
*
- * Purpose: Set the end-of-address marker for the file by savig the new
- * EOA value in the file struct. Also set the EOA marker for the
- * subfile in which the new EOA value falls. We don't set the
- * EOA values of any other subfiles.
+ * Purpose: Set the end-of-address marker for the file by savig the new
+ * EOA value in the file struct. Also set the EOA marker for the
+ * subfile in which the new EOA value falls. We don't set the
+ * EOA values of any other subfiles.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * 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
@@ -1403,24 +1364,24 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
}
H5E_END_TRY;
if (status < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1);
- return 0;
+ return 0;
} /* end H5FD_multi_set_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_get_eof
+ * Function: H5FD_multi_get_eof
*
- * Purpose: Returns the end-of-file marker, which is the greater of
- * either the total multi size or the current EOA marker.
+ * Purpose: Returns the end-of-file marker, which is the greater of
+ * either the total multi size or the current EOA marker.
*
- * Return: Success: End of file address, the first address past
- * the end of the multi of files or the current
- * EOA, whichever is larger.
+ * Return: Success: End of file address, the first address past
+ * the end of the multi of files or the current
+ * EOA, whichever is larger.
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1449,7 +1410,9 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
if (HADDR_UNDEF == tmp_eof)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof",
- HADDR_UNDEF) if (tmp_eof > 0) tmp_eof += file->fa.memb_addr[mt];
+ HADDR_UNDEF);
+ if (tmp_eof > 0)
+ tmp_eof += file->fa.memb_addr[mt];
}
else if (file->fa.relax) {
/*
@@ -1460,7 +1423,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
assert(HADDR_UNDEF != tmp_eof);
}
else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF);
}
if (tmp_eof > eof)
eof = tmp_eof;
@@ -1483,7 +1446,9 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
if (HADDR_UNDEF == eof)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof",
- HADDR_UNDEF) if (eof > 0) eof += file->fa.memb_addr[mmt];
+ HADDR_UNDEF);
+ if (eof > 0)
+ eof += file->fa.memb_addr[mmt];
}
else if (file->fa.relax) {
/*
@@ -1494,7 +1459,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
assert(HADDR_UNDEF != eof);
}
else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF);
}
}
return eof;
@@ -1522,9 +1487,10 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
/* Get data type for multi driver */
if (H5Pget_multi_type(fapl, &type) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver",
- -1) if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1) mmt =
- file->fa.memb_map[type];
+ -1);
+ if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1);
+ mmt = file->fa.memb_map[type];
if (H5FD_MEM_DEFAULT == mmt)
mmt = type;
@@ -1532,15 +1498,15 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_alloc
+ * Function: H5FD_multi_alloc
*
- * Purpose: Allocate file memory.
+ * Purpose: Allocate file memory.
*
- * Return: Success: Address of new memory
+ * Return: Success: Address of new memory
*
- * Failure: HADDR_UNDEF
+ * Failure: HADDR_UNDEF
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, August 12, 1999
*
*-------------------------------------------------------------------------
@@ -1567,36 +1533,36 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
}
if (HADDR_UNDEF == (addr = H5FDalloc(file->memb[mmt], mmt, dxpl_id, size)))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF)
- addr += file->fa.memb_addr[mmt];
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF);
+ addr += file->fa.memb_addr[mmt];
/*#ifdef TMP
if ( addr + size > file->eoa ) {
- if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) {
+ if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) {
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, \
- "can't set eoa", HADDR_UNDEF)
- }
+ "can't set eoa", HADDR_UNDEF);
+ }
}
#else
if ( addr + size > file->eoa )
- file->eoa = addr + size;
+ file->eoa = addr + size;
#endif */
return addr;
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_free
+ * Function: H5FD_multi_free
*
- * Purpose: Frees memory
+ * Purpose: Frees memory
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, August 12, 1999
*
*-------------------------------------------------------------------------
@@ -1620,18 +1586,18 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_read
+ * Function: H5FD_multi_read
*
- * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
- * into buffer BUF according to data transfer properties in
- * DXPL_ID.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID.
*
- * Return: Success: Zero. Result is stored in caller-supplied
- * buffer BUF.
+ * Return: Success: Zero. Result is stored in caller-supplied
+ * buffer BUF.
*
- * Failure: -1, contents of buffer BUF are undefined.
+ * Failure: -1, contents of buffer BUF are undefined.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1667,17 +1633,17 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
} /* end H5FD_multi_read() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_write
+ * Function: H5FD_multi_write
*
- * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
- * from buffer BUF according to data transfer properties in
- * DXPL_ID.
+ * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
+ * from buffer BUF according to data transfer properties in
+ * DXPL_ID.
*
- * Return: Success: Zero
+ * Return: Success: Zero
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1713,15 +1679,15 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
} /* end H5FD_multi_write() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_flush
+ * Function: H5FD_multi_flush
*
- * Purpose: Flushes all multi members.
+ * Purpose: Flushes all multi members.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1, as many files flushed as possible.
+ * Failure: -1, as many files flushed as possible.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
*-------------------------------------------------------------------------
@@ -1735,7 +1701,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
static const char *func = "H5FD_multi_flush"; /* Function Name for error reporting */
#if 0
- H5FD_mem_t mmt;
+ H5FD_mem_t mmt;
/* Debugging stuff... */
fprintf(stderr, "multifile access information:\n");
@@ -1743,9 +1709,9 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
/* print the map */
fprintf(stderr, " map=");
for (mt=1; mt<H5FD_MEM_NTYPES; mt++) {
- mmt = file->memb_map[mt];
- if (H5FD_MEM_DEFAULT==mmt) mmt = mt;
- fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt);
+ mmt = file->memb_map[mt];
+ if (H5FD_MEM_DEFAULT==mmt) mmt = mt;
+ fprintf(stderr, "%s%d", 1==mt?"":",", (int)mmt);
}
fprintf(stderr, "\n");
@@ -1755,14 +1721,14 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
fprintf(stderr, " ------ -------------------- -------------------- -------------------- ------------------------------\n");
for (mt=1; mt<H5FD_MEM_NTYPES; mt++) {
- if (HADDR_UNDEF!=file->memb_addr[mt]) {
- haddr_t eoa = H5FDget_eoa(file->memb[mt], mt);
- fprintf(stderr, " %6d %20llu %20llu %20llu %s\n",
- (int)mt, (unsigned long long)(file->memb_addr[mt]),
- (unsigned long long)eoa,
- (unsigned long long)(file->memb_next[mt]),
- file->memb_name[mt]);
- }
+ if (HADDR_UNDEF!=file->memb_addr[mt]) {
+ haddr_t eoa = H5FDget_eoa(file->memb[mt], mt);
+ fprintf(stderr, " %6d %20llu %20llu %20llu %s\n",
+ (int)mt, (unsigned long long)(file->memb_addr[mt]),
+ (unsigned long long)eoa,
+ (unsigned long long)(file->memb_next[mt]),
+ file->memb_name[mt]);
+ }
}
#endif
@@ -1781,20 +1747,20 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
}
}
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error flushing member files", -1);
- return 0;
+ return 0;
}
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_truncate
+ * Function: H5FD_multi_truncate
*
- * Purpose: Truncates all multi members.
+ * Purpose: Truncates all multi members.
*
- * Return: Success: 0
- * Failure: -1, as many files truncated as possible.
+ * Return: Success: 0
+ * Failure: -1, as many files truncated as possible.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, January 31, 2008
*
*-------------------------------------------------------------------------
@@ -1822,23 +1788,23 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
}
}
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error truncating member files", -1);
- return 0;
+ return 0;
} /* end H5FD_multi_truncate() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_lock
+ * Function: H5FD_multi_lock
*
- * Purpose: Place a lock on all multi members.
- * When there is error in locking a member file, it will not
- * proceed further and will try to remove the locks of those
- * member files that are locked before error is encountered.
+ * Purpose: Place a lock on all multi members.
+ * When there is error in locking a member file, it will not
+ * proceed further and will try to remove the locks of those
+ * member files that are locked before error is encountered.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Vailin Choi; March 2015
+ * Programmer: Vailin Choi; March 2015
*
*-------------------------------------------------------------------------
*/
@@ -1847,8 +1813,8 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
{
H5FD_multi_t * file = (H5FD_multi_t *)_file;
int nerrors = 0;
- H5FD_mem_t out_mt;
- static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */
+ H5FD_mem_t out_mt = H5FD_MEM_DEFAULT;
+ static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1884,21 +1850,22 @@ 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) return 0;
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1);
+ return 0;
} /* H5FD_multi_lock() */
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_unlock
+ * Function: H5FD_multi_unlock
*
- * Purpose: Remove the lock on all multi members.
- * It will try to unlock all member files but will record error
- * encountered.
+ * Purpose: Remove the lock on all multi members.
+ * It will try to unlock all member files but will record error
+ * encountered.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Vailin Choi; March 2015
+ * Programmer: Vailin Choi; March 2015
*
*-------------------------------------------------------------------------
*/
@@ -1920,22 +1887,22 @@ 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;
+ return 0;
} /* H5FD_multi_unlock() */
/*-------------------------------------------------------------------------
- * Function: compute_next
+ * Function: compute_next
*
- * Purpose: Compute the memb_next[] values of the file based on the
- * file's member map and the member starting addresses.
+ * Purpose: Compute the memb_next[] values of the file based on the
+ * file's member map and the member starting addresses.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 23, 1999
*
*-------------------------------------------------------------------------
@@ -1970,15 +1937,15 @@ compute_next(H5FD_multi_t *file)
}
/*-------------------------------------------------------------------------
- * Function: open_members
+ * Function: open_members
*
- * Purpose: Opens all members which are not opened yet.
+ * Purpose: Opens all members which are not opened yet.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, August 23, 1999
*
*-------------------------------------------------------------------------
@@ -1989,7 +1956,7 @@ compute_next(H5FD_multi_t *file)
* tmp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(format - nonliteral)
+H5_GCC_DIAG_OFF("format-nonliteral")
static int
open_members(H5FD_multi_t *file)
{
@@ -2022,13 +1989,13 @@ open_members(H5FD_multi_t *file)
}
END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1);
- return 0;
+ return 0;
}
-H5_GCC_DIAG_ON(format - nonliteral)
+H5_GCC_DIAG_ON("format-nonliteral")
-#ifdef _H5private_H
+#ifdef H5private_H
/*
* This is not related to the functionality of the driver code.
* It is added here to trigger warning if HDF5 private definitions are included
diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h
index 7385a69..62cc9c8 100644
--- a/src/H5FDmulti.h
+++ b/src/H5FDmulti.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, August 2, 1999
*
* Purpose: The public header file for the "multi" driver.
@@ -25,11 +25,228 @@
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_multi_init(void);
+H5_DLL hid_t H5FD_multi_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets up use of the multi-file driver
+ *
+ * \fapl_id
+ * \param[in] memb_map Maps memory usage types to other memory usage types
+ * \param[in] memb_fapl Property list for each memory usage type
+ * \param[in] memb_name Name generator for names of member files
+ * \param[in] memb_addr The offsets within the virtual address space, from 0
+ * (zero) to #HADDR_MAX, at which each type of data storage begins
+ * \param[in] relax Allows read-only access to incomplete file sets when \c TRUE
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to
+ * use the multi-file driver.
+ *
+ * The multi-file driver enables different types of HDF5 data and
+ * metadata to be written to separate files. These files are viewed by
+ * the HDF5 library and the application as a single virtual HDF5 file
+ * with a single HDF5 file address space. The types of data that can be
+ * broken out into separate files include raw data, the superblock,
+ * B-tree data, global heap data, local heap data, and object
+ * headers. At the programmer's discretion, two or more types of data
+ * can be written to the same file while other types of data are
+ * written to separate files.
+ *
+ * The array \p memb_map maps memory usage types to other memory usage
+ * types and is the mechanism that allows the caller to specify how
+ * many files are created. The array contains #H5FD_MEM_NTYPES entries,
+ * which are either the value #H5FD_MEM_DEFAULT or a memory usage
+ * type. The number of unique values determines the number of files
+ * that are opened.
+ *
+ * The array \p memb_fapl contains a property list for each memory
+ * usage type that will be associated with a file.
+ *
+ * The array \p memb_name should be a name generator (a
+ * \Code{printf}-style format with a \Code{%s} which will be replaced
+ * with the name passed to H5FDopen(), usually from H5Fcreate() or
+ * H5Fopen()).
+ *
+ * The array \p memb_addr specifies the offsets within the virtual
+ * address space, from 0 (zero) to #HADDR_MAX, at which each type of
+ * data storage begins.
+ *
+ * If \p relax is set to 1 (TRUE), then opening an existing file for
+ * read-only access will not fail if some file members are
+ * missing. This allows a file to be accessed in a limited sense if
+ * just the meta data is available.
+ *
+ * Default values for each of the optional arguments are as follows:
+ * <table>
+ * <tr>
+ * <td>\p memb_map</td>
+ * <td>The default member map contains the value #H5FD_MEM_DEFAULT for each element.</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * \p memb_fapl
+ * </td>
+ * <td>
+ * The default value is #H5P_DEFAULT for each element.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * \p memb_name
+ * </td>
+ * <td>
+ * The default string is \Code{%s-X.h5} where \c X is one of the following letters:
+ * - \c s for #H5FD_MEM_SUPER
+ * - \c b for #H5FD_MEM_BTREE
+ * - \c r for #H5FD_MEM_DRAW
+ * - \c g for #H5FD_MEM_GHEAP
+ * - \c l for #H5FD_MEM_LHEAP
+ * - \c o for #H5FD_MEM_OHDR
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
+ * \p memb_addr
+ * </td>
+ * <td>
+ * The default setting is that the address space is equally divided
+ * among all of the elements:
+ * - #H5FD_MEM_SUPER \Code{-> 0 * (HADDR_MAX/6)}
+ * - #H5FD_MEM_BTREE \Code{-> 1 * (HADDR_MAX/6)}
+ * - #H5FD_MEM_DRAW \Code{-> 2 * (HADDR_MAX/6)}
+ * - #H5FD_MEM_GHEAP \Code{-> 3 * (HADDR_MAX/6)}
+ * - #H5FD_MEM_LHEAP \Code{-> 4 * (HADDR_MAX/6)}
+ * - #H5FD_MEM_OHDR \Code{-> 5 * (HADDR_MAX/6)}
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \par Example:
+ * The following code sample sets up a multi-file access property list that
+ * partitions data into meta and raw files, each being one-half of the address:\n
+ * \code
+ * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ * hid_t memb_fapl[H5FD_MEM_NTYPES];
+ * const char *memb[H5FD_MEM_NTYPES];
+ * haddr_t memb_addr[H5FD_MEM_NTYPES];
+ *
+ * // The mapping...
+ * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
+ * memb_map[mt] = H5FD_MEM_SUPER;
+ * }
+ * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
+ *
+ * // Member information
+ * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
+ * memb_name[H5FD_MEM_SUPER] = "%s.meta";
+ * memb_addr[H5FD_MEM_SUPER] = 0;
+ *
+ * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
+ * memb_name[H5FD_MEM_DRAW] = "%s.raw";
+ * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
+ *
+ * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
+ * H5Pset_fapl_multi(fapl, memb_map, memb_fapl,
+ * memb_name, memb_addr, TRUE);
+ * \endcode
+ *
+ * \version 1.6.3 \p memb_name parameter type changed to \Code{const char* const*}.
+ * \since 1.4.0
+ */
H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl,
const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns information about the multi-file access property list
+ *
+ * \fapl_id
+ * \param[out] memb_map Maps memory usage types to other memory usage types
+ * \param[out] memb_fapl Property list for each memory usage type
+ * \param[out] memb_name Name generator for names of member files
+ * \param[out] memb_addr The offsets within the virtual address space, from 0
+ * (zero) to #HADDR_MAX, at which each type of data storage begins
+ * \param[out] relax Allows read-only access to incomplete file sets when \c TRUE
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_multi() returns information about the multi-file access
+ * property list.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/,
char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax /*out*/);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Emulates the old split file driver
+ *
+ * \fapl_id{fapl}
+ * \param[in] meta_ext Metadata filename extension
+ * \param[in] meta_plist_id File access property list identifier for the metadata file
+ * \param[in] raw_ext Raw data filename extension
+ * \param[in] raw_plist_id
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_split() is a compatibility function that enables the
+ * multi-file driver to emulate the split driver from HDF5 Releases 1.0
+ * and 1.2. The split file driver stored metadata and raw data in
+ * separate files but provided no mechanism for separating types of
+ * metadata.
+ *
+ * \p fapl is a file access property list identifier.
+ *
+ * \p meta_ext is the filename extension for the metadata file. The
+ * extension is appended to the name passed to H5FDopen(), usually from
+ * H5Fcreate() or H5Fopen(), to form the name of the metadata file. If
+ * the string \Code{%s} is used in the extension, it works like the
+ * name generator as in H5Pset_fapl_multi().
+ *
+ * \p meta_plist_id is the file access property list identifier for the
+ * metadata file.
+ *
+ * \p raw_ext is the filename extension for the raw data file. The
+ * extension is appended to the name passed to H5FDopen(), usually from
+ * H5Fcreate() or H5Fopen(), to form the name of the raw data file. If
+ * the string \Code{%s} is used in the extension, it works like the
+ * name generator as in H5Pset_fapl_multi().
+ *
+ * \p raw_plist_id is the file access property list identifier for the
+ * raw data file.
+ *
+ * If a user wishes to check to see whether this driver is in use, the
+ * user must call H5Pget_driver() and compare the returned value to the
+ * string #H5FD_MULTI. A positive match will confirm that the multi
+ * driver is in use; HDF5 provides no mechanism to determine whether it
+ * was called as the special case invoked by H5Pset_fapl_split().
+ *
+ * \par Example:
+ * \code
+ * // Example 1: Both metadata and rawdata files are in the same
+ * // directory. Use Station1-m.h5 and Station1-r.h5 as
+ * // the metadata and rawdata files.
+ * hid_t fapl, fid;
+ * fapl = H5Pcreate(H5P_FILE_ACCESS);
+ * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
+ * fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
+ *
+ * // Example 2: metadata and rawdata files are in different
+ * // directories. Use PointA-m.h5 and /pfs/PointA-r.h5 as
+ * // the metadata and rawdata files.
+ * hid_t fapl, fid;
+ * fapl = H5Pcreate(H5P_FILE_ACCESS);
+ * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/pfs/%s-r.h5", H5P_DEFAULT);
+ * fid=H5Fcreate("PointA",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
+ * \endcode
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext,
hid_t raw_plist_id);
#ifdef __cplusplus
diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h
index d3a0dcd..acbaf88 100644
--- a/src/H5FDpkg.h
+++ b/src/H5FDpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Thursday, January 3, 2008
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5FD package!"
#endif
-#ifndef _H5FDpkg_H
-#define _H5FDpkg_H
+#ifndef H5FDpkg_H
+#define H5FDpkg_H
/* Get package's private header */
#include "H5FDprivate.h" /* File drivers */
@@ -55,4 +55,4 @@ H5_DLL herr_t H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsiz
H5_DLL hbool_t H5FD__supports_swmr_test(const char *vfd_name);
#endif /* H5FD_TESTING */
-#endif /* _H5FDpkg_H */
+#endif /* H5FDpkg_H */
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 56ee402..10d8069 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -6,29 +6,29 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, July 26, 1999
*/
-#ifndef _H5FDprivate_H
-#define _H5FDprivate_H
+#ifndef H5FDprivate_H
+#define H5FDprivate_H
/* Include package's public header */
#include "H5FDpublic.h"
/* Private headers needed by this file */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5Pprivate.h" /* Property lists */
/*
* The MPI drivers are needed because there are
* places where we check for things that aren't handled by these drivers.
*/
-#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5FDmpi.h" /* MPI-based file drivers */
/**************************/
/* Library Private Macros */
@@ -46,11 +46,10 @@
/* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */
typedef struct H5FD_class_mpi_t {
- H5FD_class_t super; /* Superclass information & methods */
- int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */
- int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */
- MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */
- herr_t (*get_mpi_info)(H5FD_t *file, void **mpi_info); /* get MPI_Info for a file */
+ H5FD_class_t super; /* Superclass information & methods */
+ int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */
+ int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */
+ MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */
} H5FD_class_mpi_t;
#endif
@@ -75,10 +74,16 @@ typedef struct {
/* Define default file image info */
#define H5FD_DEFAULT_FILE_IMAGE_INFO \
{ \
- /* file image buffer */ NULL, /* buffer size */ 0, \
- { /* Callbacks */ \
- /* image_malloc */ NULL, /* image_memcpy */ NULL, /* image_realloc */ NULL, \
- /* image_free */ NULL, /* udata_copy */ NULL, /* udata_free */ NULL, /* udata */ NULL, \
+ NULL, /* file image buffer */ \
+ 0, /* buffer size */ \
+ { /* Callbacks */ \
+ NULL, /* image_malloc */ \
+ NULL, /* image_memcpy */ \
+ NULL, /* image_realloc */ \
+ NULL, /* image_free */ \
+ NULL, /* udata_copy */ \
+ NULL, /* udata_free */ \
+ NULL, /* udata */ \
} \
}
@@ -106,7 +111,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name /*out*/, uint8_t *buf);
H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf);
H5_DLL void * H5FD_fapl_get(H5FD_t *file);
-H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl);
+H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
@@ -152,7 +157,6 @@ H5_DLL herr_t H5FD_get_mpio_atomicity(H5FD_t *file, hbool_t *flag);
H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file);
H5_DLL int H5FD_mpi_get_size(const H5FD_t *file);
H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file);
-H5_DLL herr_t H5FD_get_mpi_info(H5FD_t *file, void **file_info);
#endif /* H5_HAVE_PARALLEL */
-#endif /* !_H5FDprivate_H */
+#endif /* H5FDprivate_H */
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 96b9ba2..36f37f0 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -6,17 +6,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, July 26, 1999
*/
-#ifndef _H5FDpublic_H
-#define _H5FDpublic_H
+#ifndef H5FDpublic_H
+#define H5FDpublic_H
#include "H5public.h"
#include "H5Fpublic.h" /*for H5F_close_degree_t */
@@ -258,6 +258,8 @@ typedef enum H5F_mem_t H5FD_mem_t;
* that creates a file which is compatible with the default VFD.
* Generally, this means that the VFD creates a single file that follows
* the canonical HDF5 file format.
+ * Regarding the Splitter VFD specifically, only drivers with this flag
+ * enabled may be used as the Write-Only (W/O) channel driver.
*/
#define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000
@@ -326,29 +328,113 @@ struct H5FD_t {
hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
};
-/* Define enum for the source of file image callbacks */
+/**
+ * Define enum for the source of file image callbacks
+ */
+//! <!-- [H5FD_file_image_op_t_snip] -->
typedef enum {
H5FD_FILE_IMAGE_OP_NO_OP,
H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET,
+ /**< Passed to the \p image_malloc and \p image_memcpy callbacks when a
+ * file image buffer is to be copied while being set in a file access
+ * property list (FAPL)*/
H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY,
+ /**< Passed to the \p image_malloc and \p image_memcpy callbacks
+ * when a file image buffer is to be copied when a FAPL is copied*/
H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET,
+ /**<Passed to the \p image_malloc and \p image_memcpy callbacks when
+ * a file image buffer is to be copied while being retrieved from a FAPL*/
H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
+ /**<Passed to the \p image_free callback when a file image
+ * buffer is to be released during a FAPL close operation*/
H5FD_FILE_IMAGE_OP_FILE_OPEN,
+ /**<Passed to the \p image_malloc and
+ * \p image_memcpy callbackswhen a
+ * file image buffer is to be copied during a file open operation \n
+ * While the file image being opened will typically be copied from a
+ * FAPL, this need not always be the case. For example, the core file
+ * driver, also known as the memory file driver, takes its initial
+ * image from a file.*/
H5FD_FILE_IMAGE_OP_FILE_RESIZE,
+ /**<Passed to the \p image_realloc callback when a file driver needs
+ * to resize an image buffer*/
H5FD_FILE_IMAGE_OP_FILE_CLOSE
+ /**<Passed to the \p image_free callback when an image buffer is to
+ * be released during a file close operation*/
} H5FD_file_image_op_t;
+//! <!-- [H5FD_file_image_op_t_snip] -->
-/* Define structure to hold file image callbacks */
+/**
+ * Define structure to hold file image callbacks
+ */
+//! <!-- [H5FD_file_image_callbacks_t_snip] -->
typedef struct {
+ /**
+ * \param[in] size Size in bytes of the file image buffer to allocate
+ * \param[in] file_image_op A value from H5FD_file_image_op_t indicating
+ * the operation being performed on the file image
+ * when this callback is invoked
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [image_malloc_snip] -->
void *(*image_malloc)(size_t size, H5FD_file_image_op_t file_image_op, void *udata);
+ //! <!-- [image_malloc_snip] -->
+ /**
+ * \param[in] dest Address of the destination buffer
+ * \param[in] src Address of the source buffer
+ * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating
+ * the operation being performed on the file image
+ * when this callback is invoked
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [image_memcpy_snip] -->
void *(*image_memcpy)(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op,
void *udata);
+ //! <!-- [image_memcpy_snip] -->
+ /**
+ * \param[in] ptr Pointer to the buffer being reallocated
+ * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating
+ * the operation being performed on the file image
+ * when this callback is invoked
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [image_realloc_snip] -->
void *(*image_realloc)(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata);
+ //! <!-- [image_realloc_snip] -->
+ /**
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [image_free_snip] -->
herr_t (*image_free)(void *ptr, H5FD_file_image_op_t file_image_op, void *udata);
+ //! <!-- [image_free_snip] -->
+ /**
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [udata_copy_snip] -->
void *(*udata_copy)(void *udata);
+ //! <!-- [udata_copy_snip] -->
+ /**
+ * \param[in] udata Value passed in in the H5Pset_file_image_callbacks
+ * parameter \p udata
+ */
+ //! <!-- [udata_free_snip] -->
herr_t (*udata_free)(void *udata);
+ //! <!-- [udata_free_snip] -->
+ /**
+ * \brief The final field in the #H5FD_file_image_callbacks_t struct,
+ * provides a pointer to user-defined data. This pointer will be
+ * passed to the image_malloc, image_memcpy, image_realloc, and
+ * image_free callbacks. Define udata as NULL if no user-defined
+ * data is provided.
+ */
void *udata;
} H5FD_file_image_callbacks_t;
+//! <!-- [H5FD_file_image_callbacks_t_snip] -->
#ifdef __cplusplus
extern "C" {
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 829f8a0..2470c8b 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -13,7 +13,7 @@
/*
* Read-Only S3 Virtual File Driver (VFD)
*
- * Programmer: Jacob Smith <jake.smith@hdfgroup.org>
+ * Programmer: Jacob Smith
* 2017-10-13
*
* Purpose:
@@ -214,59 +214,60 @@ typedef struct H5FD_ros3_t {
#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, 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, void **file_handle);
-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, haddr_t addr, size_t size,
- const void *buf);
-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_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, void **file_handle);
+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, haddr_t addr, size_t size,
+ const void *buf);
+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 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, /* 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 */
};
@@ -291,13 +292,11 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- if (H5FD_ros3_init() < 0) {
+ 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() */
/*-------------------------------------------------------------------------
@@ -316,10 +315,12 @@ done:
hid_t
H5FD_ros3_init(void)
{
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
+#if ROS3_STATS
unsigned int bin_i;
+#endif
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
#if ROS3_DEBUG
HDfprintf(stdout, "H5FD_ros3_init() called.\n");
@@ -333,21 +334,20 @@ 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;
}
#endif
- /* Set return value */
ret_value = H5FD_ROS3_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5FD_ros3_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_ros3_term
+ * Function: H5FD__ros3_term
*
* Purpose: Shut down the VFD
*
@@ -358,20 +358,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_ros3
@@ -404,23 +403,20 @@ H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa)
#endif
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 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,
@@ -440,30 +436,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) {
+ 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')) {
+ /* 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() */
/*-------------------------------------------------------------------------
* Function: H5Pget_fapl_ros3
@@ -478,52 +469,45 @@ 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_dst)
{
- const H5FD_ros3_fapl_t *fa = NULL;
+ const H5FD_ros3_fapl_t *fa_src = NULL;
H5P_genplist_t * plist = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", fapl_id, fa_out);
+ H5TRACE2("e", "i*x", fapl_id, fa_dst);
#if ROS3_DEBUG
HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n");
#endif
- if (fa_out == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL")
- }
+ if (fa_dst == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst 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) {
+ fa_src = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist);
+ if (fa_src == 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));
+ H5MM_memcpy(fa_dst, fa_src, 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.
@@ -535,42 +519,37 @@ 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) {
+ 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));
+ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t));
/* Set return value */
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.
*
@@ -581,39 +560,34 @@ 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) {
+ if (new_fa == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- }
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t));
+ H5MM_memcpy(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.
*
@@ -622,27 +596,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()
@@ -670,15 +640,14 @@ 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) {
+ if (file == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null");
- }
for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) {
file->raw[i].bytes = 0;
@@ -694,14 +663,12 @@ 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:
*
@@ -731,7 +698,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;
@@ -741,10 +708,10 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
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 */
@@ -760,13 +727,11 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
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)) {
+ 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.
@@ -778,66 +743,54 @@ H5FD_ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
*/
now = gmnow();
HDassert(now != NULL);
- if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) {
+ 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)) {
+ (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 {
+ 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) {
+ 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));
+ H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t));
#if ROS3_STATS
- if (FAIL == ros3_reset_stats(file)) {
+ 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)) {
+ 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 (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()
@@ -912,20 +865,16 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
unsigned suffix_i = 0;
const char suffixes[] = {' ', 'K', 'M', 'G', 'T', 'P'};
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- if (stream == NULL) {
+ if (stream == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null");
- }
- if (file == NULL) {
+ if (file == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null");
- }
- if (file->s3r_handle == 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) {
+ if (file->s3r_handle->purl == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null");
- }
purl = file->s3r_handle->purl;
/******************
@@ -992,9 +941,8 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
HDfprintf(stream, "SIZES meta raw\n");
HDfprintf(stream, " min ");
- if (count_meta == 0) {
+ if (count_meta == 0)
HDfprintf(stream, " 0.000 ");
- }
else {
re_dub = (double)min_meta;
for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
@@ -1003,9 +951,8 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]);
}
- if (count_raw == 0) {
+ if (count_raw == 0)
HDfprintf(stream, " 0.000 \n");
- }
else {
re_dub = (double)min_raw;
for (suffix_i = 0; re_dub >= 1024.0; suffix_i++)
@@ -1071,9 +1018,8 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
range_end = ros3_stats_boundaries[i - 1];
HDfprintf(stream, ">");
}
- else {
+ else
HDfprintf(stream, " ");
- }
bm_val = (double)m->bytes;
for (suffix_i = 0; bm_val >= 1024.0; suffix_i++)
@@ -1115,7 +1061,7 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
am_val, am_suffix, /* metadata average */
ar_val, ar_suffix); /* rawdata average */
- fflush(stream);
+ HDfflush(stream);
}
done:
@@ -1126,7 +1072,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_close()
+ * Function: H5FD__ros3_close()
*
* Purpose:
*
@@ -1142,49 +1088,44 @@ 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)) {
+ 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) {
+ 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:
*
@@ -1213,7 +1154,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;
@@ -1221,10 +1162,10 @@ H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
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);
@@ -1240,100 +1181,79 @@ H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
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 (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 (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 (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' && f1->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' && f1->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' && f1->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)
@@ -1352,12 +1272,12 @@ 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 */
@@ -1368,12 +1288,11 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-
-} /* H5FD_ros3_query() */
+} /* H5FD__ros3_query() */
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_get_eoa()
+ * Function: H5FD__ros3_get_eoa()
*
* Purpose:
*
@@ -1391,23 +1310,22 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
*-------------------------------------------------------------------------
*/
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:
*
@@ -1423,25 +1341,24 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*-------------------------------------------------------------------------
*/
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:
*
@@ -1458,23 +1375,22 @@ H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
*-------------------------------------------------------------------------
*/
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:
*
@@ -1490,31 +1406,29 @@ H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*-------------------------------------------------------------------------
*/
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
*
@@ -1535,10 +1449,8 @@ 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;
@@ -1549,10 +1461,10 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
unsigned bin_i = 0;
#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);
@@ -1561,38 +1473,30 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
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
- */
+ /* 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;
@@ -1601,12 +1505,11 @@ H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
done:
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* end H5FD_ros3_read() */
+} /* end H5FD__ros3_read() */
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_write()
+ * Function: H5FD__ros3_write()
*
* Purpose:
*
@@ -1623,27 +1526,26 @@ 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.")
done:
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5FD_ros3_write() */
+} /* H5FD__ros3_write() */
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_truncate()
+ * Function: H5FD__ros3_truncate()
*
* Purpose:
*
@@ -1662,26 +1564,26 @@ 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.")
done:
FUNC_LEAVE_NOAPI(ret_value)
-
-} /* end H5FD_ros3_truncate() */
+} /* end H5FD__ros3_truncate() */
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_lock()
+ * Function: H5FD__ros3_lock()
*
* Purpose:
*
@@ -1701,16 +1603,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw)
+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:
*
@@ -1727,11 +1629,11 @@ H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw)
*-------------------------------------------------------------------------
*/
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/H5FDros3.h b/src/H5FDros3.h
index 4290a63..8e42ca2 100644
--- a/src/H5FDros3.h
+++ b/src/H5FDros3.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -89,8 +89,20 @@ typedef struct H5FD_ros3_fapl_t {
extern "C" {
#endif
-H5_DLL hid_t H5FD_ros3_init(void);
+H5_DLL hid_t H5FD_ros3_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa);
#ifdef __cplusplus
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index 19900e1..ee5b5ec 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -140,18 +140,16 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata)
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);
+ H5MM_memcpy(&(sds->data[sds->size]), ptr, product);
sds->size += product;
written = product;
}
return written;
-
} /* end curlwritecallback() */
/*----------------------------------------------------------------------------
@@ -224,21 +222,19 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
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);
/***********************
@@ -248,12 +244,10 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
/* 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".
@@ -267,33 +261,28 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
size_t catwrite = catlen + 3; /* 3 not 1 to quiet compiler warning */
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");
- }
- HDmemcpy(namecpy, name, (namelen + 1));
+ if (namecpy == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy.");
+ H5MM_memcpy(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");
- }
- HDmemcpy(valuecpy, value, (valuelen + 1));
+ if (valuecpy == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy.");
+ H5MM_memcpy(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) {
+ 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;
@@ -308,13 +297,12 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
***************/
if (*L == NULL) {
- if (value == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list");
- }
+ 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);
+ HDfflush(stdout);
#endif
/*******************
* CREATE NEW LIST *
@@ -338,14 +326,14 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
/* 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);
+ HDfflush(stdout);
#endif
/***************
* REMOVE HEAD *
@@ -355,39 +343,39 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
#if S3COMMS_DEBUG
HDprintf("FREEING CAT (node)\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
H5MM_xfree(node_ptr->cat);
#if S3COMMS_DEBUG
HDprintf("FREEING LOWERNAME (node)\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
H5MM_xfree(node_ptr->lowername);
#if S3COMMS_DEBUG
HDprintf("FREEING NAME (node)\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
H5MM_xfree(node_ptr->name);
#if S3COMMS_DEBUG
HDprintf("FREEING VALUE (node)\n");
- fflush(stdout);
+ 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);
+ HDfflush(stdout);
#endif
H5MM_xfree(node_ptr);
#if S3COMMS_DEBUG
HDprintf("FREEING WORKING LOWERNAME\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
H5MM_xfree(lowername);
lowername = NULL;
@@ -395,7 +383,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
HDprintf("MODIFY HEAD\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
/***************
* MODIFY HEAD *
@@ -416,17 +404,16 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
new_node = NULL;
}
}
- else if (strcmp(lowername, node_ptr->lowername) < 0) {
+ else 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);
+ HDfflush(stdout);
#endif
/*******************
* INSERT NEW HEAD *
@@ -450,19 +437,18 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
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);
+ 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;
@@ -470,23 +456,22 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
node_ptr->next = new_node;
}
}
- else if (strcmp(lowername, node_ptr->next->lowername) < 0) {
+ else 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);
+ 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;
@@ -495,7 +480,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
node_ptr->next = new_node;
}
}
- else if (strcmp(lowername, node_ptr->next->lowername) == 0) {
+ else if (HDstrcmp(lowername, node_ptr->next->lowername) == 0) {
is_looking = FALSE;
@@ -509,7 +494,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
#if S3COMMS_DEBUG
HDprintf("REMOVE A NODE\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
H5MM_xfree(tmp->cat);
H5MM_xfree(tmp->lowername);
@@ -526,7 +511,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
HDprintf("MODIFY A NODE\n");
- fflush(stdout);
+ HDfflush(stdout);
#endif
/*****************
* MODIFY A NODE *
@@ -560,20 +545,15 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
done:
if (ret_value == FAIL) {
- /* clean up
- */
- if (nvcat != NULL) {
+ /* clean up */
+ if (nvcat != NULL)
H5MM_xfree(nvcat);
- }
- if (namecpy != NULL) {
+ if (namecpy != NULL)
H5MM_xfree(namecpy);
- }
- if (lowername != NULL) {
+ if (lowername != NULL)
H5MM_xfree(lowername);
- }
- if (valuecpy != NULL) {
+ if (valuecpy != NULL)
H5MM_xfree(valuecpy);
- }
if (new_node != NULL) {
HDassert(new_node->magic == S3COMMS_HRB_NODE_MAGIC);
new_node->magic += 1ul;
@@ -634,9 +614,8 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf)
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);
@@ -697,68 +676,55 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
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) {
+ 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) {
+ if (res == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string");
- }
- HDmemcpy(res, _resource, (reslen + 1));
+ H5MM_memcpy(res, _resource, (reslen + 1));
}
else {
res = (char *)H5MM_malloc(sizeof(char) * (reslen + 2));
- if (res == NULL) {
+ if (res == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string");
- }
*res = '/';
- HDmemcpy((&res[1]), _resource, (reslen + 1));
+ H5MM_memcpy((&res[1]), _resource, (reslen + 1));
HDassert((reslen + 1) == HDstrlen(res));
} /* end if (else resource string not starting with '/') */
verblen = HDstrlen(_verb) + 1;
verb = (char *)H5MM_malloc(sizeof(char) * verblen);
- if (verb == NULL) {
+ 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) {
+ 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;
@@ -766,8 +732,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
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);
@@ -818,12 +783,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);
@@ -834,9 +797,8 @@ H5FD_s3comms_s3r_close(s3r_t *handle)
HDassert(handle->httpverb != NULL);
H5MM_xfree(handle->httpverb);
- if (FAIL == H5FD_s3comms_free_purl(handle->purl)) {
+ if (FAIL == H5FD_s3comms_free_purl(handle->purl))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to release parsed url structure")
- }
H5MM_xfree(handle);
@@ -871,9 +833,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 */
@@ -927,45 +888,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) {
+ 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);
+ H5MM_memcpy(handle->httpverb, "HEAD", 5);
headerresponse = (char *)H5MM_malloc(sizeof(char) * CURL_MAX_HTTP_HEADER);
- if (headerresponse == NULL) {
+ if (headerresponse == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for curl header response");
- }
sds.data = headerresponse;
/*******************
@@ -976,55 +925,44 @@ 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) {
+ 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);
+ 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 (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) {
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n");
- }
-
- if (content_length == 0 || errno == ERANGE) /* errno set by strtoumax*/
- {
+ 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;
@@ -1032,24 +970,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 */
/*----------------------------------------------------------------------------
@@ -1106,21 +1037,19 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
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.\n");
- }
+ if (url == NULL || url[0] == '\0')
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null.");
- 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");
- }
+
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;
@@ -1135,40 +1064,33 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
*************************************/
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");
- }
- /* 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");
- }
- HDmemcpy(handle->region, region, tmplen);
+ if (handle->region == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy.");
+ H5MM_memcpy(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");
- }
- HDmemcpy(handle->secret_id, id, tmplen);
+ if (handle->secret_id == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy.");
+ H5MM_memcpy(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");
- }
- HDmemcpy(handle->signing_key, signing_key, tmplen);
+ if (handle->signing_key == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy.");
+ H5MM_memcpy(handle->signing_key, signing_key, tmplen);
} /* if authentication information provided */
/************************
@@ -1176,40 +1098,23 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
************************/
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). "
- "(placeholder flags)");
- }
+ 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_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
@@ -1225,40 +1130,35 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
* 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 *
*********************/
HDassert(handle->httpverb != NULL);
- HDmemcpy(handle->httpverb, "GET", 4);
+ H5MM_memcpy(handle->httpverb, "GET", 4);
ret_value = handle;
done:
if (ret_value == NULL) {
- if (curlh != NULL) {
+ if (curlh != NULL)
curl_easy_cleanup(curlh);
- }
- if (FAIL == H5FD_s3comms_free_purl(purl)) {
+ 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 */
/*----------------------------------------------------------------------------
@@ -1328,22 +1228,17 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
* 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) {
+ if (offset > handle->filesize || (len + offset) > handle->filesize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF")
- }
curlh = handle->curlhandle;
@@ -1353,18 +1248,15 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
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 (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)) {
+ 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)");
- }
+ "error while setting CURL option (CURLOPT_WRITEDATA).");
}
/*********************
@@ -1373,21 +1265,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
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),
- "bytes=" H5_PRINTF_HADDR_FMT "-" H5_PRINTF_HADDR_FMT, offset, offset + len - 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=%" PRIuHADDR "-%" PRIuHADDR,
+ 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 (rangebytesstr == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.");
+ ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset);
if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value");
}
@@ -1397,22 +1286,19 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
*******************/
if (handle->signing_key == NULL) {
- /* Do not authenticate.
- */
+ /* Do not authenticate. */
if (rangebytesstr != NULL) {
- /* Pass in range directly
- */
+ /* 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)) {
+ 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 {
@@ -1446,98 +1332,71 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
/**** 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) ****/
request = H5FD_s3comms_hrb_init_request((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)) {
+ 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 (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)) {
+ 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 (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)) {
+ 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. "
- "(placeholder flags)\n");
- }
+ 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)) {
+ 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. "
- "(placeholder flags)\n");
- }
+ 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");
@@ -1546,23 +1405,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
ret = HDsnprintf(authorization, 512, "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s",
buffer2, signed_headers, buffer1);
- if (ret <= 0 || ret >= 512) {
+ 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) {
+ /* 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");
- }
+ 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 ****/
@@ -1571,29 +1423,20 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
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");
- }
+ 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");
- }
+ 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) {
+ /* 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)");
- }
-
+ "error while setting CURL option (CURLOPT_HTTPHEADER).");
} /* end if should authenticate (info provided) */
/*******************
@@ -1609,50 +1452,43 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
char curlerrbuf[CURL_ERROR_SIZE];
curlerrbuf[0] = '\0';
- if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf)) {
+ 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)) {
+ 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");
+ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request.");
}
- if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL)) {
+ 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) {
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:
@@ -1672,26 +1508,22 @@ done:
}
if (request != NULL) {
while (headers != NULL)
- if (FAIL == H5FD_s3comms_hrb_node_set(&headers, headers->name, 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)) {
+ 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) {
/* clear any Range */
- if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL)) {
+ 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)) {
+ 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);
@@ -1727,9 +1559,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);
@@ -1806,77 +1637,65 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
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) {
+ 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), "%s\n%s\n%s\n", http_request->verb,
+ /* 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) {
+ 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) {
HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC);
ret = HDsnprintf(tmpstr, 256, "%s:%s\n", node->lowername, node->value);
- if (ret < 0 || ret >= 256) {
+ 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) {
+ if (cr_len + 1 > cr_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request");
- }
- strcat(canonical_request_dest, tmpstr);
+ HDstrcat(canonical_request_dest, tmpstr);
ret = HDsnprintf(tmpstr, 256, "%s;", node->lowername);
- if (ret < 0 || ret >= 256) {
+ 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) {
+ if (sh_len + 1 > sh_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers");
- }
- strcat(signed_headers_dest, tmpstr);
+ 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);
@@ -1925,24 +1744,20 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len,
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) {
+ 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() */
/*----------------------------------------------------------------------------
@@ -1975,21 +1790,16 @@ H5FD_s3comms_free_purl(parsed_url_t *purl)
if (purl != NULL) {
HDassert(purl->magic == S3COMMS_PARSED_URL_MAGIC);
- if (purl->scheme != NULL) {
+ if (purl->scheme != NULL)
H5MM_xfree(purl->scheme);
- }
- if (purl->host != NULL) {
+ if (purl->host != NULL)
H5MM_xfree(purl->host);
- }
- if (purl->port != NULL) {
+ if (purl->port != NULL)
H5MM_xfree(purl->port);
- }
- if (purl->path != NULL) {
+ if (purl->path != NULL)
H5MM_xfree(purl->path);
- }
- if (purl->query != NULL) {
+ if (purl->query != NULL)
H5MM_xfree(purl->query);
- }
purl->magic += 1ul;
H5MM_xfree(purl);
}
@@ -2041,15 +1851,13 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m
HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n");
#endif
- if (dest == 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) {
+ 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);
@@ -2127,42 +1935,37 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
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)) {
+ 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 */
+ line_buffer = HDfgets(line_buffer, 128, 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) {
+ line_buffer = HDfgets(line_buffer, 128, file);
+ 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++) {
@@ -2172,40 +1975,33 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
setting_name = setting_names[setting_i];
setting_name_len = HDstrlen(setting_name);
- if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) {
+ 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)) {
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) {
+ 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 */
@@ -2266,59 +2062,50 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
#endif
#ifdef H5_HAVE_WIN32_API
- ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE"));
+ ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE"));
#else
- ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME"));
+ ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME"));
#endif
- if (ret < 0 || (size_t)ret >= 117) {
+ 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) {
+ if (ret < 0 || (size_t)ret >= 128)
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path")
- }
- credfile = fopen(filepath, "r");
+ 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) {
+ aws_region_out) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials")
- }
- if (fclose(credfile) == EOF) {
+ 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) {
+ if (ret < 0 || (size_t)ret >= 128)
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path")
- }
- credfile = fopen(filepath, "r");
+ 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) {
+ (*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) {
+ 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) {
+ 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() */
@@ -2359,15 +2146,14 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len)
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) {
- HDmemcpy(dest, s, len);
+ H5MM_memcpy(dest, s, len);
do {
len--;
- dest[len] = (char)tolower((int)dest[len]);
+ dest[len] = (char)HDtolower((int)dest[len]);
} while (len > 0);
}
@@ -2423,16 +2209,14 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
HDprintf("called H5FD_s3comms_parse_url.\n");
#endif
- if (str == NULL || *str == '\0') {
+ 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) {
+ 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;
@@ -2445,31 +2229,26 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
***************/
tmpstr = HDstrchr(curstr, ':');
- if (tmpstr == NULL) {
+ 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
- */
+ /* 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]) {
+ 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) {
+ 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);
+ 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;
@@ -2482,36 +2261,31 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
if (*curstr == '[') {
/* IPv6 */
while (']' != *tmpstr) {
- if (tmpstr == 0) { /* end of string reached! */
+ /* 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) {
+ 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) {
+ 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) {
+ 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);
+ HDstrncpy(purl->host, curstr, (size_t)len);
purl->host[len] = 0;
/*************
@@ -2521,29 +2295,22 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
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) {
+ 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])) {
+ 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
- */
+ /* copy port */
purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
- if (purl->port == NULL) { /* cannot malloc */
+ if (purl->port == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT");
- }
- (void)HDstrncpy(purl->port, curstr, (size_t)len);
+ HDstrncpy(purl->port, curstr, (size_t)len);
purl->port[len] = 0;
} /* end if PORT element */
@@ -2556,21 +2323,17 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
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) {
+ 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) {
+ 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);
+ HDstrncpy(purl->path, curstr, (size_t)len);
purl->path[len] = 0;
}
} /* end if PATH element */
@@ -2582,21 +2345,17 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
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) {
+ 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) {
+ 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);
+ HDstrncpy(purl->query, curstr, (size_t)len);
purl->query[len] = 0;
} /* end if QUERY exists */
@@ -2604,9 +2363,9 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
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() */
@@ -2666,9 +2425,8 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
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);
@@ -2685,9 +2443,8 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
#endif
*repr_len = 3;
chars_written = HDsnprintf(repr, 4, "%%%02X", c);
- if (chars_written < 0) {
+ 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
@@ -2737,9 +2494,8 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
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) {
+ if (chars_written < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c);
- }
*repr_len += 3;
/************************
@@ -2750,9 +2506,8 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
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) {
+ 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) */
@@ -2818,31 +2573,24 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi
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)) {
+ 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
@@ -2917,22 +2665,17 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
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++) {
checksum[i] = '\0';
hexsum[i] = '\0';
@@ -2940,31 +2683,28 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
HDstrncpy(day, now, 8);
day[8] = '\0';
ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region);
- if (ret <= 0 || ret >= 127) {
+ 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);
+ H5MM_memcpy((dest + d), "AWS4-HMAC-SHA256\n", 17);
d = 17;
- HDmemcpy((dest + d), now, HDstrlen(now));
+ H5MM_memcpy((dest + d), now, HDstrlen(now));
d += HDstrlen(now);
dest[d++] = '\n';
- HDmemcpy((dest + d), tmp, HDstrlen(tmp));
+ H5MM_memcpy((dest + d), tmp, HDstrlen(tmp));
d += HDstrlen(tmp);
dest[d++] = '\n';
SHA256((const unsigned char *)req, HDstrlen(req), checksum);
if (H5FD_s3comms_bytes_to_hex(hexsum, (const unsigned char *)checksum, SHA256_DIGEST_LENGTH, true) ==
- FAIL) {
+ 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';
@@ -3012,18 +2752,16 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
HDfprintf(stdout, "called H5FD_s3comms_trim.\n");
#endif
- if (dest == NULL) {
+ if (dest == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.")
- }
- if (s == NULL) {
+ if (s == NULL)
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--;
}
@@ -3035,12 +2773,11 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written)
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
- */
- HDmemcpy(dest, s, s_len);
+ /* write output into dest */
+ H5MM_memcpy(dest, s, s_len);
}
}
@@ -3105,12 +2842,10 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s
HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n");
#endif
- if (s == NULL) {
+ if (s == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL");
- }
- if (dest == 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.
@@ -3118,10 +2853,9 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s
*/
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) {
@@ -3133,9 +2867,8 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_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 */
diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h
index 5d939f8..da6a62d 100644
--- a/src/H5FDs3comms.h
+++ b/src/H5FDs3comms.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 6ceb487..6fe1282 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, July 29, 1999
*
* Purpose: The POSIX unbuffered file driver using only the HDF5 public
@@ -38,6 +38,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
@@ -50,12 +53,13 @@ static hid_t H5FD_SEC2_g = 0;
* occurs), and 'op' will be set to H5F_OP_UNKNOWN.
*/
typedef struct H5FD_sec2_t {
- H5FD_t pub; /* public stuff, must be first */
- int fd; /* the filesystem file descriptor */
- haddr_t eoa; /* end of allocated region */
- haddr_t eof; /* end of file; current file size */
- haddr_t pos; /* current file I/O position */
- H5FD_file_op_t op; /* last operation */
+ H5FD_t pub; /* public stuff, must be first */
+ int fd; /* the filesystem file descriptor */
+ haddr_t eoa; /* end of allocated region */
+ 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
@@ -94,7 +98,6 @@ typedef struct H5FD_sec2_t {
* a single file.
*/
hbool_t fam_to_single;
-
} H5FD_sec2_t;
/*
@@ -119,56 +122,56 @@ typedef struct H5FD_sec2_t {
(ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || 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, 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, 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, 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_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, 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, size_t size,
+ const void *buf);
+static herr_t H5FD__sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__sec2_lock(H5FD_t *_file, hbool_t rw);
+static herr_t H5FD__sec2_unlock(H5FD_t *_file);
static const H5FD_class_t H5FD_sec2_g = {
- "sec2", /* name */
- MAXADDR, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- H5FD_sec2_term, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 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 */
- 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 */
- NULL, /* flush */
- H5FD_sec2_truncate, /* truncate */
- H5FD_sec2_lock, /* lock */
- H5FD_sec2_unlock, /* unlock */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ "sec2", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ H5FD__sec2_term, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 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 */
+ 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 */
+ NULL, /* flush */
+ H5FD__sec2_truncate, /* truncate */
+ H5FD__sec2_lock, /* lock */
+ H5FD__sec2_unlock, /* unlock */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/* Declare a free list to manage the H5FD_sec2_t struct */
@@ -186,10 +189,20 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t);
static herr_t
H5FD__init_package(void)
{
- herr_t ret_value = SUCCEED;
+ 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")
@@ -229,7 +242,7 @@ done:
} /* end H5FD_sec2_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_sec2_term
+ * Function: H5FD__sec2_term
*
* Purpose: Shut down the VFD
*
@@ -241,15 +254,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_sec2
@@ -284,7 +297,7 @@ done:
} /* end H5Pset_fapl_sec2() */
/*-------------------------------------------------------------------------
- * Function: H5FD_sec2_open
+ * Function: H5FD__sec2_open
*
* Purpose: Create and/or opens a file as an HDF5 file.
*
@@ -299,7 +312,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 */
@@ -307,10 +320,11 @@ H5FD_sec2_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
- h5_stat_t sb;
- H5FD_t * ret_value = NULL; /* Return value */
+ 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));
@@ -368,17 +382,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
@@ -402,10 +425,10 @@ 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.
*
@@ -418,12 +441,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);
@@ -437,10 +460,10 @@ 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.
@@ -455,13 +478,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)
@@ -502,10 +525,10 @@ 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)
@@ -518,13 +541,19 @@ 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
+ * the underying driver -- as such, the Mirror VFD implementation copies
+ * these feature flags as its own. Any modifications made here must be
+ * reflected in H5FDmirror.c
+ * -- JOS 2020-01-13
+ */
if (flags) {
*flags = 0;
*flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
@@ -544,10 +573,10 @@ 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
@@ -561,17 +590,17 @@ 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
@@ -585,19 +614,19 @@ 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
@@ -612,17 +641,17 @@ 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.
*
@@ -634,12 +663,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")
@@ -648,10 +677,10 @@ 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
@@ -667,13 +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, haddr_t addr,
- size_t size, void *buf /*out*/)
+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);
@@ -686,20 +716,17 @@ 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")
- } /* end if */
#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 */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -712,7 +739,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
do {
#ifdef H5_HAVE_PREADWRITE
bytes_read = HDpread(file->fd, buf, bytes_in, offset);
- offset += bytes_read;
+ if (bytes_read > 0)
+ offset += bytes_read;
#else
bytes_read = HDread(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -759,10 +787,10 @@ 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
@@ -776,13 +804,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, haddr_t addr,
- size_t size, const void *buf)
+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);
@@ -796,20 +825,17 @@ 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")
- } /* end if */
#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 */
- HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -822,7 +848,8 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
do {
#ifdef H5_HAVE_PREADWRITE
bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
- offset += bytes_wrote;
+ if (bytes_wrote > 0)
+ offset += bytes_wrote;
#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
#endif /* H5_HAVE_PREADWRITE */
@@ -865,10 +892,10 @@ 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.
@@ -881,12 +908,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);
@@ -933,10 +960,10 @@ 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":
@@ -950,13 +977,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);
@@ -965,20 +992,22 @@ 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
*
@@ -989,24 +1018,26 @@ 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 656b0fd..541ac71 100644
--- a/src/H5FDsec2.h
+++ b/src/H5FDsec2.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * 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 cd67f15..339c413 100644
--- a/src/H5FDspace.c
+++ b/src/H5FDspace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FDspace.c
* Jan 3 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Space allocation routines for the file driver code.
*
@@ -74,7 +74,7 @@
H5FL_DEFINE(H5FD_free_t);
/*-------------------------------------------------------------------------
- * Function: H5FD_extend
+ * Function: H5FD__extend
*
* Purpose: Extend the EOA space of a file.
*
@@ -89,12 +89,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);
@@ -119,7 +119,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() */
/*-------------------------------------------------------------------------
* Function: H5FD__alloc_real
@@ -193,7 +193,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr
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 */
@@ -425,7 +425,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
new file mode 100644
index 0000000..93ba154
--- /dev/null
+++ b/src/H5FDsplitter.c
@@ -0,0 +1,1314 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: The Splitter VFD implements a file driver which relays all the
+ * VFD calls to an underlying VFD, and send all the write calls to
+ * another underlying VFD. Maintains two files simultaneously.
+ */
+
+/* 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 "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDsplitter.h" /* Splitter file driver */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+
+/* The driver identification number, initialized at runtime */
+static hid_t H5FD_SPLITTER_g = 0;
+
+/* Driver-specific file access properties */
+typedef struct H5FD_splitter_fapl_t {
+ hid_t rw_fapl_id; /* fapl for the R/W channel */
+ hid_t wo_fapl_id; /* fapl for the W/O channel */
+ char wo_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file name for the W/O channel */
+ char log_file_path[H5FD_SPLITTER_PATH_MAX + 1]; /* file to record errors reported by the W/O channel */
+ hbool_t ignore_wo_errs; /* TRUE to ignore errors on the W/O channel */
+} H5FD_splitter_fapl_t;
+
+/* The information of this splitter */
+typedef struct H5FD_splitter_t {
+ H5FD_t pub; /* public stuff, must be first */
+ unsigned version; /* version of the H5FD_splitter_vfd_config_t structure used */
+ H5FD_splitter_fapl_t fa; /* driver-specific file access properties */
+ H5FD_t * rw_file; /* pointer of R/W channel */
+ H5FD_t * wo_file; /* pointer of W/O channel */
+ FILE * logfp; /* Log file pointer */
+} H5FD_splitter_t;
+
+/*
+ * These macros check for overflow of various quantities. These macros
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
+ *
+ * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
+ * is too large to be represented by the second argument
+ * of the file seek function.
+ *
+ * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
+ * large to be represented by the `size_t' type.
+ *
+ * REGION_OVERFLOW: Checks whether an address and size pair describe data
+ * 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 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))
+
+/* This macro provides a wrapper for shared fail-log-ignore behavior
+ * for errors arising in the splitter's W/O channel.
+ * Logs an error entry in a log file, if the file exists.
+ * If not set to ignore errors, registers an error with the library.
+ */
+#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) \
+ HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \
+ }
+
+#define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */
+
+#if H5FD_SPLITTER_DEBUG_OP_CALLS
+#define H5FD_SPLITTER_LOG_CALL(name) \
+ do { \
+ HDprintf("called %s()\n", (name)); \
+ HDfflush(stdout); \
+ } while (0)
+#else
+#define H5FD_SPLITTER_LOG_CALL(name) /* no-op */
+#endif /* H5FD_SPLITTER_DEBUG_OP_CALLS */
+
+/* Private functions */
+
+/* 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 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 */
+ 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 */
+ 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_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
+ *
+ * Purpose: Initializes any interface-specific data or routines.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__init_package(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ if (H5FD_splitter_init() < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FD__init_package() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_splitter_init
+ *
+ * Purpose: Initialize the splitter driver by registering it with the
+ * library.
+ *
+ * Return: Success: The driver ID for the splitter driver.
+ * Failure: Negative
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5FD_splitter_init(void)
+{
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g))
+ H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g);
+
+ ret_value = H5FD_SPLITTER_g;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_splitter_init() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5FD__splitter_term
+ *
+ * Purpose: Shut down the splitter VFD.
+ *
+ * Returns: SUCCEED (Can't fail)
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_term(void)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Reset VFL ID */
+ H5FD_SPLITTER_g = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FD__splitter_term() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__copy_plist
+ *
+ * Purpose: Sanity-wrapped H5P_copy_plist() for each channel.
+ * Utility function for operation in multiple locations.
+ *
+ * Return: 0 on success, -1 on error.
+ *-------------------------------------------------------------------------
+ */
+static int
+H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr)
+{
+ int ret_value = 0;
+ H5P_genplist_t *plist_ptr = NULL;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ HDassert(id_out_ptr != NULL);
+
+ 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)
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FD__copy_plist() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fapl_splitter
+ *
+ * Purpose: Sets the file access property list to use the
+ * splitter driver.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
+{
+ H5FD_splitter_fapl_t *info = NULL;
+ H5P_genplist_t * plist_ptr = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Dr", fapl_id, vfd_config);
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ 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, "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
+ * in-memory, causing problems in that channel.
+ * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the
+ * determining attribute.
+ */
+ 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)
+ 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)
+ 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)
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD 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 */
+
+ /* 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))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
+ 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))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
+ info->wo_fapl_id = vfd_config->wo_fapl_id;
+ }
+
+ 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fapl_splitter
+ *
+ * Purpose: Returns information about the splitter file access property
+ * list through the structure config.
+ *
+ * Will fail if config is received without pre-set valid
+ * magic and version information.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config)
+{
+ const H5FD_splitter_fapl_t *fapl_ptr = NULL;
+ H5P_genplist_t * plist_ptr = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Dr", fapl_id, config);
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ 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 == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config pointer is null")
+ if (H5FD_SPLITTER_MAGIC != config->magic)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)")
+ if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config->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->rw_fapl_id = H5I_INVALID_HID;
+ config->wo_fapl_id = H5I_INVALID_HID;
+
+ /* Check and get the splitter fapl */
+ 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))
+ 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)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info")
+
+ HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ config->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->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->wo_fapl_id)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_fapl_splitter() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_flush
+ *
+ * Purpose: Flushes all data to disk for both channels.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Public API for dxpl "context" */
+ 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, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_flush() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * properties in DXPL_ID.
+ *
+ * Return: Success: SUCCEED
+ * The read result is written into the BUF buffer
+ * which should be allocated by the caller.
+ * Failure: FAIL
+ * The contents of BUF are undefined.
+ *-------------------------------------------------------------------------
+ */
+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)
+{
+ H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ HDassert(file && file->pub.cls);
+ HDassert(buf);
+
+ /* Check for overflow conditions */
+ 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))
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_read() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * properties in DXPL_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+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_t *file = (H5FD_splitter_t *)_file;
+ H5P_genplist_t * plist_ptr = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ 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)
+ 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, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_write() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * used to access another file the same way.
+ *
+ * Return: Success: Ptr to new file access property list with all
+ * members copied from the file struct.
+ * Failure: NULL
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5FD__splitter_fapl_get(H5FD_t *_file)
+{
+ H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ ret_value = H5FD__splitter_fapl_copy(&(file->fa));
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_fapl_get() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_fapl_copy
+ *
+ * Purpose: Copies the file access properties.
+ *
+ * Return: Success: Pointer to a new property list info structure.
+ * Failure: NULL
+ *-------------------------------------------------------------------------
+ */
+static void *
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ HDassert(old_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")
+
+ H5MM_memcpy(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)
+ 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)
+ 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)
+ new_fa_ptr = H5FL_FREE(H5FD_splitter_fapl_t, new_fa_ptr);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_fapl_copy() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5FD__splitter_fapl_free
+ *
+ * Purpose: Releases the file access lists
+ *
+ * Return: SUCCEED/FAIL
+ *--------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_fapl_free(void *_fapl)
+{
+ H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t *)_fapl;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ HDassert(fapl);
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID")
+
+ /* Free the property list */
+ fapl = H5FL_FREE(H5FD_splitter_fapl_t, fapl);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_fapl_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_open
+ *
+ * Purpose: Create and/or opens a file as an HDF5 file.
+ *
+ * Return: Success: A pointer to a new file data structure. The
+ * public fields will be initialized by the
+ * caller, which is always H5FD_open().
+ * Failure: NULL
+ *-------------------------------------------------------------------------
+ */
+static H5FD_t *
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ if (!name || !*name)
+ 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 ((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_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)
+ 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)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info")
+
+ /* Copy simpler info */
+ 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)
+ 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)
+ 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') {
+ file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w");
+ 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)
+ 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, 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)
+ H5I_dec_ref(file_ptr->fa.rw_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)
+ H5FD_close(file_ptr->rw_file);
+ if (file_ptr->wo_file)
+ H5FD_close(file_ptr->wo_file);
+ 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_close
+ *
+ * Purpose: Closes files on both read-write and write-only channels.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL, file not closed.
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_close(H5FD_t *_file)
+{
+ H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Sanity check */
+ HDassert(file);
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL")
+
+ 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, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file")
+
+ if (file->logfp) {
+ HDfclose(file->logfp);
+ file->logfp = NULL;
+ }
+
+ /* Release the file info */
+ file = H5FL_FREE(H5FD_splitter_t, file);
+ file = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_close() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * the format address space.
+ *
+ * Return: Success: The end-of-address-marker
+ *
+ * Failure: HADDR_UNDEF
+ *-------------------------------------------------------------------------
+ */
+static haddr_t
+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_STATIC
+
+ 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)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_get_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
+ * to tell the driver where the end of the HDF5 data is located.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ 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)
+ 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, 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() */
+
+/*-------------------------------------------------------------------------
+ * 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
+ * the format address space.
+ *
+ * Return: Success: The end-of-address-marker
+ *
+ * Failure: HADDR_UNDEF
+ *-------------------------------------------------------------------------
+ */
+static haddr_t
+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_STATIC
+
+ 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)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_get_eof */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_truncate
+ *
+ * Purpose: Notify driver to truncate the file back to the allocated size.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ HDassert(file);
+ HDassert(file->rw_file);
+ HDassert(file->wo_file);
+
+ 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, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_truncate */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_sb_size
+ *
+ * Purpose: Obtains the number of bytes required to store the driver file
+ * access data in the HDF5 superblock.
+ *
+ * Return: Success: Number of bytes required.
+ *
+ * Failure: 0 if an error occurs or if the driver has no
+ * data to store in the superblock.
+ *
+ * NOTE: no public API for H5FD_sb_size, it needs to be added
+ *-------------------------------------------------------------------------
+ */
+static hsize_t
+H5FD__splitter_sb_size(H5FD_t *_file)
+{
+ H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
+ hsize_t ret_value = 0;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Sanity check */
+ HDassert(file);
+ HDassert(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 */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_sb_encode
+ *
+ * Purpose: Encode driver-specific data into the output arguments.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ 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)
+ 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 */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_sb_decode
+ *
+ * Purpose: Decodes the driver information block.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * NOTE: no public API for H5FD_sb_size, need to add
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Sanity check */
+ HDassert(file);
+ HDassert(file->rw_file);
+
+ 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 */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_cmp
+ *
+ * Purpose: Compare the keys of two files.
+ *
+ * Return: Success: A value like strcmp()
+ * Failure: Must never fail
+ *-------------------------------------------------------------------------
+ */
+static int
+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_STATIC_NOERR
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ HDassert(f1);
+ HDassert(f2);
+
+ ret_value = H5FD_cmp(f1->rw_file, f2->rw_file);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_cmp */
+
+/*--------------------------------------------------------------------------
+ * Function: H5FD__splitter_get_handle
+ *
+ * Purpose: Returns a pointer to the file handle of low-level virtual
+ * file driver.
+ *
+ * Return: SUCCEED/FAIL
+ *--------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ HDassert(file);
+ HDassert(file->rw_file);
+ 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)
+ 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 */
+
+/*--------------------------------------------------------------------------
+ * Function: H5FD__splitter_lock
+ *
+ * Purpose: Sets a file lock.
+ *
+ * Return: SUCCEED/FAIL
+ *--------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ 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_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 */
+
+/*--------------------------------------------------------------------------
+ * Function: H5FD__splitter_unlock
+ *
+ * Purpose: Removes a file lock.
+ *
+ * Return: SUCCEED/FAIL
+ *--------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ 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_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 */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_query
+ *
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
+ * (listed in H5FDpublic.h)
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ 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");
+ }
+ else {
+ /* There is no file. Because this is a pure passthrough VFD,
+ * it has no features of its own.
+ */
+ if (flags)
+ *flags = 0;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_query() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_alloc
+ *
+ * Purpose: Allocate file memory.
+ *
+ * Return: Address of allocated space (HADDR_UNDEF if error).
+ *-------------------------------------------------------------------------
+ */
+static haddr_t
+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_STATIC
+
+ 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)
+ 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, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_alloc() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_get_type_map
+ *
+ * Purpose: Retrieve the memory type mapping for this file
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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_STATIC
+
+ 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)
+ 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_free
+ *
+ * Purpose: Free the resources for the splitter VFD.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+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_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ HDassert(file);
+ HDassert(file->rw_file);
+
+ 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, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_log_error
+ *
+ * Purpose: Log an error from the W/O channel appropriately.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ H5FD_SPLITTER_LOG_CALL(FUNC);
+
+ /* Check arguments */
+ HDassert(file);
+ HDassert(atfunc && *atfunc);
+ HDassert(msg && *msg);
+
+ if (file->logfp != NULL) {
+ size_t size;
+ char * s;
+
+ size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */
+ s = (char *)H5MM_malloc(sizeof(char) * (size + 1));
+ if (NULL == s)
+ ret_value = FAIL;
+ 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))
+ ret_value = FAIL;
+ H5MM_free(s);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_log_error() */
diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h
new file mode 100644
index 0000000..ee6e7c5
--- /dev/null
+++ b/src/H5FDsplitter.h
@@ -0,0 +1,110 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * 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 "splitter" driver.
+ */
+
+#ifndef H5FDsplitter_H
+#define H5FDsplitter_H
+
+#define H5FD_SPLITTER (H5FD_splitter_init())
+
+/* The version of the H5FD_splitter_vfd_config_t structure used */
+#define H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION 1
+
+/* Maximum length of a filename/path string in the Write-Only channel,
+ * including the NULL-terminator.
+ */
+#define H5FD_SPLITTER_PATH_MAX 4096
+
+/* Semi-unique constant used to help identify structure pointers */
+#define H5FD_SPLITTER_MAGIC 0x2B916880
+
+/* ----------------------------------------------------------------------------
+ * Structure: H5FD_spliiter_vfd_config_t
+ *
+ * One-stop shopping for configuring a Splitter VFD (rather than many
+ * paramaters passed into H5Pset/get functions).
+ *
+ * magic (int32_t)
+ * Semi-unique number, used to sanity-check that a given pointer is
+ * likely (or not) to be this structure type. MUST be first.
+ * If magic is not H5FD_SPLITTER_MAGIC, the structure (and/or pointer to)
+ * must be considered invalid.
+ *
+ * version (unsigned int)
+ * Version number of this structure -- informs component membership.
+ * If not H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION, the structure (and/or
+ * pointer to) must be considered invalid.
+ *
+ * rw_fapl_id (hid_t)
+ * Library-given identification number of the Read/Write channel driver
+ * File Access Property List.
+ * The driver must support read/write access.
+ * Must be set to H5P_DEFAULT or a valid FAPL ID.
+ *
+ * wo_fapl_id (hid_t)
+ * Library-given identification number of the Read/Write channel driver
+ * File Access Property List.
+ * The driver feature flags must include H5FD_FEAT_DEFAULT_VFD_COMPAITBLE.
+ * Must be set to H5P_DEFAULT or a valid FAPL ID.
+ *
+ * wo_file_path (char[H5FD_SPLITTER_PATH_MAX + 1])
+ * String buffer for the Write-Only channel target file.
+ * Must be null-terminated, cannot be empty.
+ *
+ * log_file_path (char[H5FD_SPLITTER_PATH_MAX + 1])
+ * String buffer for the Splitter VFD logging output.
+ * Must be null-terminated.
+ * If null, no logfile is created.
+ *
+ * ignore_wo_errors (hbool_t)
+ * Toggle flag for how judiciously to respond to errors on the Write-Only
+ * channel.
+ *
+ * ----------------------------------------------------------------------------
+ */
+typedef struct H5FD_splitter_vfd_config_t {
+ int32_t magic;
+ unsigned int version;
+ hid_t rw_fapl_id;
+ hid_t wo_fapl_id;
+ char wo_path[H5FD_SPLITTER_PATH_MAX + 1];
+ char log_file_path[H5FD_SPLITTER_PATH_MAX + 1];
+ hbool_t ignore_wo_errs;
+} H5FD_splitter_vfd_config_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+H5_DLL hid_t H5FD_splitter_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
+H5_DLL herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
+H5_DLL herr_t H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index a84a25b..3d0332f 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* 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,7 +85,8 @@ 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 */
- H5FD_stdio_file_op op; /* last operation */
+ 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
* identify a file. Note that Cygwin, MinGW and other Windows POSIX
@@ -230,11 +234,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);
+ /* 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() */
@@ -284,9 +300,9 @@ H5Pset_fapl_stdio(hid_t fapl_id)
H5Eclear2(H5E_DEFAULT);
if (0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
- return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
+ return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
} /* end H5Pset_fapl_stdio() */
/*-------------------------------------------------------------------------
@@ -314,7 +330,7 @@ H5Pset_fapl_stdio(hid_t fapl_id)
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, haddr_t maxaddr)
+H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
FILE * f = NULL;
unsigned write_access = 0; /* File opened with write access? */
@@ -330,21 +346,22 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, hadd
assert(sizeof(file_offset_t) >= sizeof(size_t));
/* Quiet compiler */
- fapl_id = fapl_id;
+ (void)fapl_id;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Check arguments */
if (!name || !*name)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name",
- NULL) if (0 == maxaddr || HADDR_UNDEF == maxaddr)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr",
- NULL) if (ADDR_OVERFLOW(maxaddr))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL)
-
- /* Tentatively open file in read-only mode, to check for existence */
- if (flags & H5F_ACC_RDWR) f = fopen(name, "rb+");
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL);
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL);
+ if (ADDR_OVERFLOW(maxaddr))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL);
+
+ /* Tentatively open file in read-only mode, to check for existence */
+ if (flags & H5F_ACC_RDWR)
+ f = fopen(name, "rb+");
else
f = fopen(name, "rb");
@@ -357,14 +374,14 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, hadd
}
else
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE,
- "file doesn't exist and CREAT wasn't specified", NULL)
+ "file doesn't exist and CREAT wasn't specified", NULL);
}
else if (flags & H5F_ACC_EXCL) {
/* File exists, but EXCL is passed. Fail. */
assert(flags & H5F_ACC_CREAT);
fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS,
- "file exists but CREAT and EXCL were specified", NULL)
+ "file exists but CREAT and EXCL were specified", NULL);
}
else if (flags & H5F_ACC_RDWR) {
if (flags & H5F_ACC_TRUNC)
@@ -375,14 +392,13 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, hadd
* as the tentative open will work */
if (!f)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL);
- /* Build the return value */
- if (NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t))))
- {
- fclose(f);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
- } /* end if */
+ /* Build the return value */
+ if (NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) {
+ fclose(f);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
+ } /* end if */
file->fp = f;
file->op = H5FD_STDIO_OP_SEEK;
file->pos = HADDR_UNDEF;
@@ -396,6 +412,22 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, hadd
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);
@@ -430,7 +462,7 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, hadd
if (fstat(file->fd, &sb) < 0) {
free(file);
fclose(f);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL);
} /* end if */
file->device = sb.st_dev;
file->inode = sb.st_ino;
@@ -464,9 +496,9 @@ H5FD_stdio_close(H5FD_t *_file)
H5Eclear2(H5E_DEFAULT);
if (fclose(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1);
- free(file);
+ free(file);
return 0;
} /* end H5FD_stdio_close() */
@@ -555,7 +587,7 @@ static herr_t
H5FD_stdio_query(const H5FD_t *_f, unsigned long /*OUT*/ *flags)
{
/* Quiet the compiler */
- _f = _f;
+ (void)_f;
/* Set the VFL feature flags that this driver supports.
*
@@ -600,8 +632,8 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
haddr_t addr;
/* Quiet compiler */
- type = type;
- dxpl_id = dxpl_id;
+ (void)type;
+ (void)dxpl_id;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -639,7 +671,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type)
H5Eclear2(H5E_DEFAULT);
/* Quiet compiler */
- type = type;
+ (void)type;
return file->eoa;
} /* end H5FD_stdio_get_eoa() */
@@ -669,7 +701,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr)
H5Eclear2(H5E_DEFAULT);
/* Quiet the compiler */
- type = type;
+ (void)type;
file->eoa = addr;
@@ -700,13 +732,13 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type)
const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file;
/* Quiet the compiler */
- type = type;
+ (void)type;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Quiet the compiler */
- type = type;
+ (void)type;
return (file->eof);
} /* end H5FD_stdio_get_eof() */
@@ -730,16 +762,16 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle)
static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */
/* Quiet the compiler */
- fapl = fapl;
+ (void)fapl;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
*file_handle = &(file->fp);
if (*file_handle == NULL)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1);
- return 0;
+ return 0;
} /* end H5FD_stdio_get_handle() */
/*-------------------------------------------------------------------------
@@ -768,20 +800,21 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl
static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */
/* Quiet the compiler */
- type = type;
- dxpl_id = dxpl_id;
+ (void)type;
+ (void)dxpl_id;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Check for overflow */
if (HADDR_UNDEF == addr)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed",
- -1) if (REGION_OVERFLOW(addr, size))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ if (REGION_OVERFLOW(addr, size))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
- /* Check easy cases */
- if (0 == size) return 0;
+ /* Check easy cases */
+ if (0 == size)
+ return 0;
if ((haddr_t)addr >= file->eof) {
memset(buf, 0, size);
return 0;
@@ -792,7 +825,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl
if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
}
file->pos = addr;
}
@@ -824,7 +857,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl
if (0 == bytes_read && ferror(file->fp)) { /* error */
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1);
} /* end if */
if (0 == bytes_read && feof(file->fp)) {
@@ -870,28 +903,27 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */
/* Quiet the compiler */
- dxpl_id = dxpl_id;
- type = type;
+ (void)dxpl_id;
+ (void)type;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Check for overflow conditions */
if (HADDR_UNDEF == addr)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed",
- -1) if (REGION_OVERFLOW(addr, size))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
-
- /* Seek to the correct file position. */
- if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) || file->pos != addr)
- {
- if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
- file->op = H5FD_STDIO_OP_UNKNOWN;
- file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
- }
- file->pos = addr;
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ if (REGION_OVERFLOW(addr, size))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+
+ /* Seek to the correct file position. */
+ if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) || file->pos != addr) {
+ if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
+ file->op = H5FD_STDIO_OP_UNKNOWN;
+ file->pos = HADDR_UNDEF;
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
}
+ file->pos = addr;
+ }
/* Write the buffer. On successful return, the file position will be
* advanced by the number of bytes read. On failure, the file position is
@@ -913,7 +945,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(file->fp))) { /* error */
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1);
} /* end if */
assert(bytes_wrote > 0);
@@ -958,7 +990,7 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing)
static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */
/* Quiet the compiler */
- dxpl_id = dxpl_id;
+ (void)dxpl_id;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -967,11 +999,11 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing)
if (file->write_access) {
if (!closing) {
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
- /* Reset last file I/O information */
- file->pos = HADDR_UNDEF;
- file->op = H5FD_STDIO_OP_UNKNOWN;
+ /* Reset last file I/O information */
+ file->pos = HADDR_UNDEF;
+ file->op = H5FD_STDIO_OP_UNKNOWN;
} /* end if */
} /* end if */
@@ -1002,8 +1034,8 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/
static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */
/* Quiet the compiler */
- dxpl_id = dxpl_id;
- closing = closing;
+ (void)dxpl_id;
+ (void)closing;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1036,13 +1068,13 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/
if (INVALID_SET_FILE_POINTER == dwPtrLow) {
dwError = GetLastError();
if (dwError != NO_ERROR)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_FILEOPEN, "unable to set file pointer", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_FILEOPEN, "unable to set file pointer", -1);
}
bError = SetEndOfFile(file->hFile);
if (0 == bError)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR,
- "unable to truncate/extend file properly", -1)
+ "unable to truncate/extend file properly", -1);
#else /* H5_HAVE_WIN32_API */
/* Reset seek offset to beginning of file, so that file isn't re-extended later */
rewind(file->fp);
@@ -1050,11 +1082,11 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/
/* Truncate file to proper length */
if (-1 == file_ftruncate(file->fd, (file_offset_t)file->eoa))
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR,
- "unable to truncate/extend file properly", -1)
+ "unable to truncate/extend file properly", -1);
#endif /* H5_HAVE_WIN32_API */
- /* Update the eof value */
- file->eof = file->eoa;
+ /* Update the eof value */
+ file->eof = file->eoa;
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
@@ -1064,7 +1096,7 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/
else {
/* Double-check for problems */
if (file->eoa > file->eof)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa > eof!", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa > eof!", -1);
} /* end else */
return 0;
@@ -1103,20 +1135,22 @@ 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) else H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file lock failed", -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_VFL, H5E_CANTLOCKFILE, "file lock failed", -1);
} /* end if */
/* Flush the stream */
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
#endif /* H5_HAVE_FLOCK */
- return 0;
+ return 0;
} /* end H5FD_stdio_lock() */
/*-------------------------------------------------------------------------
@@ -1148,25 +1182,25 @@ H5FD_stdio_unlock(H5FD_t *_file)
/* Flush the stream */
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
-
- /* 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) else H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file unlock failed",
- -1)
- } /* end if */
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+
+ /* Place a non-blocking lock on the file */
+ if (flock(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
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1);
+ } /* end if */
#endif /* H5_HAVE_FLOCK */
return 0;
} /* end H5FD_stdio_unlock() */
-#ifdef _H5private_H
+#ifdef H5private_H
/*
* This is not related to the functionality of the driver code.
* It is added here to trigger warning if HDF5 private definitions are included
diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h
index 2c3ef07..9db92ed 100644
--- a/src/H5FDstdio.h
+++ b/src/H5FDstdio.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, August 2, 1999
*
* Purpose: The public header file for the sec2 driver.
@@ -28,7 +28,21 @@
extern "C" {
#endif
-H5_DLL hid_t H5FD_stdio_init(void);
+H5_DLL hid_t H5FD_stdio_init(void);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the standard I/O driver
+ *
+ * \fapl_id
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_stdio() modifies the file access property list to use
+ * the standard I/O driver, H5FDstdio().
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_stdio(hid_t fapl_id);
#ifdef __cplusplus
diff --git a/src/H5FDtest.c b/src/H5FDtest.c
index 74ac570..4a907e5 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -102,5 +102,4 @@ 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.c b/src/H5FDwindows.c
index a5b98f0..6ce33a7 100644
--- a/src/H5FDwindows.c
+++ b/src/H5FDwindows.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h
index 77521b3..79e73b6 100644
--- a/src/H5FDwindows.h
+++ b/src/H5FDwindows.h
@@ -6,14 +6,14 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Scott Wegner <swegner@hdfgroup.org>
- * 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.
@@ -27,6 +27,36 @@
extern "C" {
#endif /* __cplusplus */
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the Windows I/O driver
+ *
+ * \fapl_id
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_windows() sets the default HDF5 Windows I/O driver on
+ * Windows systems.
+ *
+ * Since the HDF5 library uses this driver, #H5FD_WINDOWS, by default
+ * on Windows systems, it is not normally necessary for a user
+ * application to call H5Pset_fapl_windows(). While it is not
+ * recommended, there may be times when a user chooses to set a
+ * different HDF5 driver, such as the standard I/O driver (#H5FD_STDIO)
+ * or the sec2 driver (#H5FD_SEC2), in a Windows
+ * application. H5Pset_fapl_windows() is provided so that the
+ * application can return to the Windows I/O driver when the time
+ * comes.
+ *
+ * Only the Windows driver is tested on Windows systems; other drivers
+ * are used at the application’s and the user’s risk.
+ *
+ * Furthermore, the Windows driver is tested and available only on
+ * Windows systems; it is not available on non-Windows systems.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_windows(hid_t fapl_id);
#ifdef __cplusplus
diff --git a/src/H5FL.c b/src/H5FL.c
index d33cb07..95188d5 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
* Purpose: Manage priority queues of free-lists (of blocks of bytes).
@@ -130,18 +130,24 @@ static H5FL_track_t *H5FL_out_head_g = NULL;
#endif /* H5FL_TRACK */
/* Forward declarations of local static functions */
-static herr_t H5FL__reg_gc(void);
-static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head);
-static int H5FL__reg_term(void);
-static herr_t H5FL__arr_gc(void);
-static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head);
-static int H5FL__arr_term(void);
-static herr_t H5FL__blk_gc(void);
-static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head);
-static int H5FL__blk_term(void);
-static herr_t H5FL__fac_gc(void);
-static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head);
-static int H5FL__fac_term_all(void);
+static void * H5FL__malloc(size_t mem_size);
+static herr_t H5FL__reg_init(H5FL_reg_head_t *head);
+static herr_t H5FL__reg_gc(void);
+static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head);
+static int H5FL__reg_term(void);
+static H5FL_blk_node_t *H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size);
+static H5FL_blk_node_t *H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size);
+static herr_t H5FL__blk_init(H5FL_blk_head_t *head);
+static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head);
+static herr_t H5FL__blk_gc(void);
+static int H5FL__blk_term(void);
+static herr_t H5FL__arr_init(H5FL_arr_head_t *head);
+static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head);
+static herr_t H5FL__arr_gc(void);
+static int H5FL__arr_term(void);
+static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head);
+static herr_t H5FL__fac_gc(void);
+static int H5FL__fac_term_all(void);
/* Declare a free list to manage the H5FL_blk_node_t struct */
H5FL_DEFINE(H5FL_blk_node_t);
@@ -216,7 +222,7 @@ H5FL_term_package(void)
} /* end H5FL_term_package() */
/*-------------------------------------------------------------------------
- * Function: H5FL_malloc
+ * Function: H5FL__malloc
*
* Purpose: Attempt to allocate space using malloc. If malloc fails, garbage
* collect and try again. If malloc fails again, then return NULL.
@@ -227,16 +233,14 @@ H5FL_term_package(void)
* Programmer: Quincey Koziol
* Tuesday, August 1, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
-H5FL_malloc(size_t mem_size)
+H5FL__malloc(size_t mem_size)
{
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Attempt to allocate the memory requested */
if (NULL == (ret_value = H5MM_malloc(mem_size))) {
@@ -251,10 +255,10 @@ H5FL_malloc(size_t mem_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_malloc() */
+} /* end H5FL__malloc() */
/*-------------------------------------------------------------------------
- * Function: H5FL_reg_init
+ * Function: H5FL__reg_init
*
* Purpose: Initialize a free list for a certain type. Right now, this just
* adds the free list to the list of things to garbage collect.
@@ -265,17 +269,15 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_reg_init(H5FL_reg_head_t *head)
+H5FL__reg_init(H5FL_reg_head_t *head)
{
H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
herr_t ret_value = SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if (NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t))))
@@ -302,7 +304,7 @@ H5FL_reg_init(H5FL_reg_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_reg_init() */
+} /* end H5FL__reg_init() */
/*-------------------------------------------------------------------------
* Function: H5FL_reg_free
@@ -314,8 +316,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -399,8 +399,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -415,7 +413,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if (!head->init)
- if (H5FL_reg_init(head) < 0)
+ if (H5FL__reg_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
/* Check for nodes available on the free list first */
@@ -434,7 +432,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
} /* end if */
/* Otherwise allocate a node */
else {
- if (NULL == (ret_value = H5FL_malloc(head->size)))
+ if (NULL == (ret_value = H5FL__malloc(head->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
@@ -475,8 +473,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -518,35 +514,34 @@ static herr_t
H5FL__reg_gc_list(H5FL_reg_head_t *head)
{
H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
FUNC_ENTER_STATIC_NOERR
- /* Calculate the total memory used on this list */
- total_mem = head->onlist * head->size;
-
/* For each free list being garbage collected, walk through the nodes and free them */
free_list = head->list;
while (free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_reg_node_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
-
+ /* Free the block */
H5MM_free(free_list);
- free_list = (H5FL_reg_node_t *)tmp;
+ /* Advance to the next node */
+ free_list = tmp;
} /* end while */
+ /* Decrement the count of nodes allocated and free the node */
+ head->allocated -= head->onlist;
+
+ /* Decrement global count of free memory on "regular" lists */
+ H5FL_reg_gc_head.mem_freed -= (head->onlist * head->size);
+
/* Indicate no free nodes on the free list */
head->list = NULL;
head->onlist = 0;
- /* Decrement global count of free memory on "regular" lists */
- H5FL_reg_gc_head.mem_freed -= total_mem;
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FL__reg_gc_list() */
@@ -561,10 +556,6 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head)
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- * Broke into two parts, one for looping over all the free lists and
- * another for freeing each list - QAK 7/25/00
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -662,7 +653,7 @@ H5FL__reg_term(void)
} /* end H5FL__reg_term() */
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_find_list
+ * Function: H5FL__blk_find_list
*
* Purpose: Finds the free list for blocks of a given size. Also moves that
* free list node to the head of the priority queue (if it isn't there
@@ -676,16 +667,14 @@ H5FL__reg_term(void)
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
-H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
+H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size)
{
H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Find the correct free list */
temp = *head;
@@ -721,10 +710,10 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
} /* end if */
FUNC_LEAVE_NOAPI(temp)
-} /* end H5FL_blk_find_list() */
+} /* end H5FL__blk_find_list() */
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_create_list
+ * Function: H5FL__blk_create_list
*
* Purpose: Creates a new free list for blocks of the given size at the
* head of the priority queue.
@@ -736,46 +725,37 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
-H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size)
+H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size)
{
- H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */
H5FL_blk_node_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate room for the new free list node */
- if (NULL == (temp = H5FL_MALLOC(H5FL_blk_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk info")
+ if (NULL == (ret_value = H5FL_CALLOC(H5FL_blk_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info")
/* Set the correct values for the new free list */
- temp->size = size;
- temp->list = NULL;
+ ret_value->size = size;
/* Attach to head of priority queue */
- if (*head == NULL) {
- *head = temp;
- temp->next = temp->prev = NULL;
- } /* end if */
+ if (NULL == *head)
+ *head = ret_value;
else {
- temp->next = *head;
- (*head)->prev = temp;
- temp->prev = NULL;
- *head = temp;
+ ret_value->next = *head;
+ (*head)->prev = ret_value;
+ *head = ret_value;
} /* end else */
- ret_value = temp;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_blk_create_list() */
+} /* end H5FL__blk_create_list() */
/*-------------------------------------------------------------------------
- * Function: H5FL_blk_init
+ * Function: H5FL__blk_init
*
* Purpose: Initialize a priority queue of a certain type. Right now, this just
* adds the PQ to the list of things to garbage collect.
@@ -786,17 +766,15 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_blk_init(H5FL_blk_head_t *head)
+H5FL__blk_init(H5FL_blk_head_t *head)
{
H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
herr_t ret_value = SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if (NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t))))
@@ -814,7 +792,7 @@ H5FL_blk_init(H5FL_blk_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_blk_init() */
+} /* end H5FL__blk_init() */
/*-------------------------------------------------------------------------
* Function: H5FL_blk_free_block_avail
@@ -828,8 +806,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -845,10 +821,11 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size)
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
- if ((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL)
+ if ((free_list = H5FL__blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL)
ret_value = TRUE;
else
ret_value = FALSE;
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_blk_free_block_avail() */
@@ -866,8 +843,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size)
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -885,31 +860,41 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if (!head->init)
- if (H5FL_blk_init(head) < 0)
+ if (H5FL__blk_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
- if ((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) {
+ if (NULL != (free_list = H5FL__blk_find_list(&(head->head), size)) && NULL != free_list->list) {
/* Remove the first node from the free list */
temp = free_list->list;
free_list->list = free_list->list->next;
/* Decrement the number of blocks & memory used on free list */
+ free_list->onlist--;
head->onlist--;
head->list_mem -= size;
/* Decrement the amount of global "block" free list memory in use */
H5FL_blk_gc_head.mem_freed -= size;
-
} /* end if */
/* No free list available, or there are no nodes on the list, allocate a new node to give to the user */
else {
+ /* Check if there was no free list for native blocks of this size */
+ if (NULL == free_list)
+ /* Create a new list node and insert it to the queue */
+ free_list = H5FL__blk_create_list(&(head->head), size);
+ HDassert(free_list);
+
/* Allocate new node, with room for the page info header and the actual page data */
- if (NULL == (temp = (H5FL_blk_list_t *)H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size)))
+ if (NULL ==
+ (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk")
- /* Increment the number of blocks allocated */
+ /* Increment the number of blocks of this size */
+ free_list->allocated++;
+
+ /* Increment the total number of blocks allocated */
head->allocated++;
} /* end else */
@@ -957,8 +942,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -997,8 +980,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1043,7 +1024,8 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
/* Get the pointer to the native block info header in front of the native block to free */
temp = (H5FL_blk_list_t *)((
void *)((unsigned char *)block -
- sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
+ (sizeof(H5FL_blk_list_t) +
+ H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
/* Save the block's size for later */
free_size = temp->size;
@@ -1052,20 +1034,18 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
HDmemset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE);
#endif /* H5FL_DEBUG */
- /* check if there is a free list for native blocks of this size */
- if ((free_list = H5FL_blk_find_list(&(head->head), free_size)) == NULL) {
+ /* Check if there is a free list for native blocks of this size */
+ if (NULL == (free_list = H5FL__blk_find_list(&(head->head), free_size)))
/* No free list available, create a new list node and insert it to the queue */
- free_list = H5FL_blk_create_list(&(head->head), free_size);
- HDassert(free_list);
- } /* end if */
+ free_list = H5FL__blk_create_list(&(head->head), free_size);
+ HDassert(free_list);
/* Prepend the free'd native block to the front of the free list */
- if (free_list != NULL) {
- temp->next = free_list->list; /* Overwrites the size field in union */
- free_list->list = temp;
- } /* end if */
+ temp->next = free_list->list; /* Note: Overwrites the size field in union */
+ free_list->list = temp;
/* Increment the number of blocks on free list */
+ free_list->onlist++;
head->onlist++;
head->list_mem += free_size;
@@ -1100,8 +1080,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, March 23, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1180,44 +1158,70 @@ done:
static herr_t
H5FL__blk_gc_list(H5FL_blk_head_t *head)
{
+ H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list page node */
+
FUNC_ENTER_STATIC_NOERR
/* Loop through all the nodes in the block free list queue */
- while (head->head != NULL) {
- H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */
- void * temp; /* Temp. ptr to the free list page node */
+ blk_head = head->head;
+ while (blk_head != NULL) {
+ H5FL_blk_node_t *blk_next; /* Temp. ptr to the next free list node */
+ H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */
- temp = head->head->next;
+ /* Sanity check */
+ HDassert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list));
/* Loop through all the blocks in the free list, freeing them */
- list = head->head->list;
+ list = blk_head->list;
while (list != NULL) {
- void *next; /* Temp. ptr to the free list list node */
+ H5FL_blk_list_t *next; /* Temp. ptr to the free list list node */
+ /* Get the pointer to the next node */
next = list->next;
- /* Decrement the number of blocks & memory allocated from this PQ */
- head->allocated--;
- head->list_mem -= head->head->size;
-
- /* Decrement global count of free memory on "block" lists */
- H5FL_blk_gc_head.mem_freed -= head->head->size;
-
/* Free the block */
H5MM_free(list);
- list = (H5FL_blk_list_t *)next;
+ /* Advance to the next node */
+ list = next;
} /* end while */
- /* Free the free list node */
- head->head = H5FL_FREE(H5FL_blk_node_t, head->head);
+ /* Decrement the number of blocks allocated from this list */
+ blk_head->allocated -= blk_head->onlist;
+ head->allocated -= blk_head->onlist;
- /* Advance to the next free list */
- head->head = (H5FL_blk_node_t *)temp;
+ /* Decrement count of free memory on this "block" list */
+ head->list_mem -= (blk_head->onlist * blk_head->size);
+
+ /* Decrement global count of free memory on "block" lists */
+ H5FL_blk_gc_head.mem_freed -= (blk_head->onlist * blk_head->size);
+
+ /* Indicate no free nodes on the free list */
+ blk_head->list = NULL;
+ blk_head->onlist = 0;
+
+ /* Get pointer to next node */
+ blk_next = blk_head->next;
+
+ /* Check for list completely unused now */
+ if (0 == blk_head->allocated) {
+ /* Patch this node out of the PQ */
+ if (head->head == blk_head)
+ head->head = blk_head->next;
+ if (blk_head->prev)
+ blk_head->prev->next = blk_head->next;
+ if (blk_head->next)
+ blk_head->next->prev = blk_head->prev;
+
+ /* Free the free list node */
+ H5FL_FREE(H5FL_blk_node_t, blk_head);
+ } /* end if */
+
+ /* Advance to the next node */
+ blk_head = blk_next;
} /* end while */
/* Indicate no free nodes on the free list */
- head->head = NULL;
head->onlist = 0;
/* Double check that all the memory on this list is recycled */
@@ -1245,7 +1249,7 @@ H5FL__blk_gc(void)
H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */
herr_t ret_value = SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Walk through all the free lists, free()'ing the nodes */
gc_node = H5FL_blk_gc_head.first;
@@ -1328,7 +1332,7 @@ H5FL__blk_term(void)
} /* end H5FL__blk_term() */
/*-------------------------------------------------------------------------
- * Function: H5FL_arr_init
+ * Function: H5FL__arr_init
*
* Purpose: Initialize a free list for a arrays of certain type. Right now,
* this just adds the free list to the list of things to garbage collect.
@@ -1339,18 +1343,16 @@ H5FL__blk_term(void)
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FL_arr_init(H5FL_arr_head_t *head)
+H5FL__arr_init(H5FL_arr_head_t *head)
{
H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* return value*/
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate a new garbage collection node */
if (NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t))))
@@ -1377,7 +1379,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FL_arr_init() */
+} /* end H5FL__arr_init() */
/*-------------------------------------------------------------------------
* Function: H5FL_arr_free
@@ -1390,8 +1392,6 @@ done:
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1469,8 +1469,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1488,7 +1486,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Make certain the list is initialized first */
if (!head->init)
- if (H5FL_arr_init(head) < 0)
+ if (H5FL__arr_init(head) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
/* Sanity check that the number of elements is supported */
@@ -1515,10 +1513,13 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
} /* end if */
/* Otherwise allocate a node */
else {
- if (NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t) + mem_size)))
+ if (NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t) + mem_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Increment the number of blocks allocated in list */
+ /* Increment the number of blocks of this size */
+ head->list_arr[elem].allocated++;
+
+ /* Increment the number of blocks allocated in list, of all sizes */
head->allocated++;
} /* end else */
@@ -1543,8 +1544,6 @@ done:
* Programmer: Quincey Koziol
* Monday, December 23, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1580,8 +1579,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, March 25, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1654,34 +1651,35 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head)
for (u = 0; u < (unsigned)head->maxelem; u++) {
if (head->list_arr[u].onlist > 0) {
H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
-
- /* Calculate the total memory used on this list */
- total_mem = head->list_arr[u].onlist * head->list_arr[u].size;
/* For each free list being garbage collected, walk through the nodes and free them */
arr_free_list = head->list_arr[u].list;
while (arr_free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_arr_list_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = arr_free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
+ /* Free the node */
H5MM_free(arr_free_list);
- arr_free_list = (H5FL_arr_list_t *)tmp;
+ /* Advance to the next node */
+ arr_free_list = tmp;
} /* end while */
- /* Indicate no free nodes on the free list */
- head->list_arr[u].list = NULL;
- head->list_arr[u].onlist = 0;
+ /* Decrement the count of nodes allocated */
+ head->list_arr[u].allocated -= head->list_arr[u].onlist;
+ head->allocated -= head->list_arr[u].onlist;
/* Decrement count of free memory on this "array" list */
- head->list_mem -= total_mem;
+ head->list_mem -= (head->list_arr[u].onlist * head->list_arr[u].size);
/* Decrement global count of free memory on "array" lists */
- H5FL_arr_gc_head.mem_freed -= total_mem;
+ H5FL_arr_gc_head.mem_freed -= (head->list_arr[u].onlist * head->list_arr[u].size);
+
+ /* Indicate no free nodes on the free list */
+ head->list_arr[u].list = NULL;
+ head->list_arr[u].onlist = 0;
} /* end if */
} /* end for */
@@ -1805,8 +1803,6 @@ H5FL__arr_term(void)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1840,8 +1836,6 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1872,8 +1866,6 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1904,8 +1896,6 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
* Programmer: Quincey Koziol
* Saturday, April 3, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void *
@@ -1936,11 +1926,6 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
H5FL_fac_head_t *
@@ -2012,11 +1997,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2099,11 +2079,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2134,7 +2109,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
} /* end if */
/* Otherwise allocate a node */
else {
- if (NULL == (ret_value = H5FL_malloc(head->size)))
+ if (NULL == (ret_value = H5FL__malloc(head->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
@@ -2175,11 +2150,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2222,35 +2192,34 @@ static herr_t
H5FL__fac_gc_list(H5FL_fac_head_t *head)
{
H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */
- size_t total_mem; /* Total memory used on list */
FUNC_ENTER_STATIC_NOERR
- /* Calculate the total memory used on this list */
- total_mem = head->onlist * head->size;
-
/* For each free list being garbage collected, walk through the nodes and free them */
free_list = head->list;
while (free_list != NULL) {
- void *tmp; /* Temporary node pointer */
+ H5FL_fac_node_t *tmp; /* Temporary node pointer */
+ /* Get the pointer to the next node */
tmp = free_list->next;
- /* Decrement the count of nodes allocated and free the node */
- head->allocated--;
-
+ /* Free the block */
H5MM_free(free_list);
- free_list = (H5FL_fac_node_t *)tmp;
+ /* Advance to the next node */
+ free_list = tmp;
} /* end while */
+ /* Decrement the count of nodes allocated and free the node */
+ head->allocated -= head->onlist;
+
+ /* Decrement global count of free memory on "factory" lists */
+ H5FL_fac_gc_head.mem_freed -= (head->onlist * head->size);
+
/* Indicate no free nodes on the free list */
head->list = NULL;
head->onlist = 0;
- /* Decrement global count of free memory on "factory" lists */
- H5FL_fac_gc_head.mem_freed -= total_mem;
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FL__fac_gc_list() */
@@ -2304,11 +2273,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2414,8 +2378,6 @@ H5FL__fac_term_all(void)
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2470,10 +2432,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, August 2, 2000
*
- * Modifications: Neil Fortner
- * Wednesday, April 8, 2009
- * Added support for factory free lists
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2504,3 +2462,125 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_set_free_list_limits() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FL_get_free_list_sizes
+ *
+ * Purpose: Gets the current size of the different kinds of free lists.
+ * These lists are global for the entire library. The size returned
+ * included nodes that are freed and awaiting garbage collection /
+ * reallocation.
+ *
+ * Parameters:
+ * size_t *reg_size; OUT: The current size of all "regular" free list memory used
+ * size_t *arr_size; OUT: The current size of all "array" free list memory used
+ * size_t *blk_size; OUT: The current size of all "block" free list memory used
+ * size_t *fac_size; OUT: The current size of all "factory" free list memory used
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 6, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Retrieve the amount of "regular" memory used */
+ if (reg_size) {
+ H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of lists */
+
+ /* Walk through all the free lists, counting the amount of memory */
+ *reg_size = 0;
+ gc_node = H5FL_reg_gc_head.first;
+ while (gc_node != NULL) {
+ H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */
+
+ /* Sanity check */
+ HDassert(reg_list->init);
+
+ /* Add the amount of memory for this list */
+ *reg_size += (reg_list->size * reg_list->allocated);
+
+ /* Go on to the next free list */
+ gc_node = gc_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "array" memory used */
+ if (arr_size) {
+ H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */
+
+ /* Walk through all the free lists, counting the amount of memory */
+ *arr_size = 0;
+ gc_arr_node = H5FL_arr_gc_head.first;
+ while (gc_arr_node != NULL) {
+ H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */
+
+ /* Sanity check */
+ HDassert(head->init);
+
+ /* Check for any allocated elements in this list */
+ if (head->allocated > 0) {
+ unsigned u;
+
+ /* Walk through the free lists for array sizes */
+ for (u = 0; u < (unsigned)head->maxelem; u++)
+ /* Add the amount of memory for this size */
+ *arr_size += head->list_arr[u].allocated * head->list_arr[u].size;
+ } /* end if */
+
+ /* Go on to the next free list */
+ gc_arr_node = gc_arr_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "block" memory used */
+ if (blk_size) {
+ H5FL_blk_gc_node_t *gc_blk_node; /* Pointer into the list of things */
+
+ /* Walk through all the free lists */
+ gc_blk_node = H5FL_blk_gc_head.first;
+ *blk_size = 0;
+ while (gc_blk_node != NULL) {
+ H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list block node */
+
+ /* Loop through all the nodes in the block free list queue */
+ blk_head = gc_blk_node->pq->head;
+ while (blk_head != NULL) {
+ /* Add size of blocks on this list */
+ *blk_size += (blk_head->allocated * blk_head->size);
+
+ /* Get pointer to next node */
+ blk_head = blk_head->next;
+ } /* end while */
+
+ /* Go on to the next free list */
+ gc_blk_node = gc_blk_node->next;
+ } /* end while */
+ } /* end if */
+
+ /* Retrieve the amount of "factory" memory used */
+ if (fac_size) {
+ H5FL_fac_gc_node_t *gc_fac_node; /* Pointer into the list of things to garbage collect */
+
+ /* Walk through all the free lists */
+ gc_fac_node = H5FL_fac_gc_head.first;
+ *fac_size = 0;
+ while (gc_fac_node != NULL) {
+ H5FL_fac_head_t *fac_head = gc_fac_node->list; /* Head node for factory list */
+
+ /* Add size of blocks on this list */
+ *fac_size += (fac_head->allocated * fac_head->size);
+
+ /* Go on to the next free list to garbage collect */
+ gc_fac_node = gc_fac_node->next;
+ } /* end while */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FL_get_free_list_sizes() */
diff --git a/src/H5FLmodule.h b/src/H5FLmodule.h
index 0945608..95c0b49 100644
--- a/src/H5FLmodule.h
+++ b/src/H5FLmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5FL package. Including this header means that the source file
* is part of the H5FL package.
*/
-#ifndef _H5FLmodule_H
-#define _H5FLmodule_H
+#ifndef H5FLmodule_H
+#define H5FLmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_RESOURCE
#define H5_MY_PKG_INIT NO
-#endif /* _H5FLmodule_H */
+#endif /* H5FLmodule_H */
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 76ff377..42581ac 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,16 +15,14 @@
*
* Created: H5FLprivate.h
* Mar 23 2000
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Private non-prototype header.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifndef _H5FLprivate_H
-#define _H5FLprivate_H
+#ifndef H5FLprivate_H
+#define H5FLprivate_H
/* Public headers needed by this file */
#ifdef LATER
@@ -156,18 +154,20 @@ typedef union H5FL_blk_list_t {
/* Data structure for priority queue node of block free lists */
typedef struct H5FL_blk_node_t {
- size_t size; /* Size of the blocks in the list */
- H5FL_blk_list_t * list; /* List of free blocks */
- struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */
- struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */
+ size_t size; /* Size of the blocks in the list */
+ unsigned allocated; /* Number of blocks of this size allocated */
+ unsigned onlist; /* Number of blocks on free list */
+ H5FL_blk_list_t * list; /* List of free blocks */
+ struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */
+ struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */
} H5FL_blk_node_t;
/* Data structure for priority queue of native block free lists */
typedef struct H5FL_blk_head_t {
hbool_t init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
- unsigned onlist; /* Number of blocks on free list */
- size_t list_mem; /* Amount of memory in block on free list */
+ unsigned allocated; /* Total number of blocks allocated */
+ unsigned onlist; /* Total number of blocks on free list */
+ size_t list_mem; /* Total amount of memory in blocks on free list */
const char * name; /* Name of the type */
H5FL_blk_node_t *head; /* Pointer to first free list in queue */
} H5FL_blk_head_t;
@@ -229,15 +229,17 @@ typedef union H5FL_arr_list_t {
/* Data structure for each size of array element */
typedef struct H5FL_arr_node_t {
- size_t size; /* Size of the blocks in the list */
- unsigned onlist; /* Number of blocks on free list */
- H5FL_arr_list_t *list; /* List of free blocks */
+ size_t size; /* Size of the blocks in the list (in bytes) */
+ /* (Note: base_size + <# of elem> * elem_size) */
+ unsigned allocated; /* Number of blocks allocated of this element size */
+ unsigned onlist; /* Number of blocks on free list */
+ H5FL_arr_list_t *list; /* List of free blocks */
} H5FL_arr_node_t;
/* Data structure for free list of array blocks */
typedef struct H5FL_arr_head_t {
hbool_t init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
+ unsigned allocated; /* Total number of blocks allocated */
size_t list_mem; /* Amount of memory in block on free list */
const char * name; /* Name of the type */
int maxelem; /* Maximum number of elements in an array */
@@ -426,6 +428,8 @@ H5_DLL herr_t H5FL_garbage_coll(void);
H5_DLL herr_t H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim,
int arr_list_lim, int blk_global_lim, int blk_list_lim,
int fac_global_lim, int fac_list_lim);
+H5_DLL herr_t H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size,
+ size_t *fac_size);
H5_DLL int H5FL_term_interface(void);
#endif
diff --git a/src/H5FO.c b/src/H5FO.c
index cca5aa3..441d284 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FOprivate.h b/src/H5FOprivate.h
index e733356..7b51266 100644
--- a/src/H5FOprivate.h
+++ b/src/H5FOprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains library private information about the H5FO module
*/
-#ifndef _H5FOprivate_H
-#define _H5FOprivate_H
+#ifndef H5FOprivate_H
+#define H5FOprivate_H
#ifdef LATER
#include "H5FOpublic.h"
@@ -47,4 +47,4 @@ H5_DLL herr_t H5FO_top_decr(const H5F_t *f, haddr_t addr);
H5_DLL hsize_t H5FO_top_count(const H5F_t *f, haddr_t addr);
H5_DLL herr_t H5FO_top_dest(H5F_t *f);
-#endif /* _H5FOprivate_H */
+#endif /* H5FOprivate_H */
diff --git a/src/H5FS.c b/src/H5FS.c
index 22295d0..c85790c 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, May 2, 2006
*
* Purpose: Free space tracking functions.
@@ -35,7 +35,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -793,9 +793,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);
@@ -1209,9 +1206,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) {
@@ -1227,9 +1221,6 @@ H5FS__assert(const H5FS_t *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 5c6cd9d..39f0333 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FScache.c
* May 2 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement file free space metadata cache methods.
*
@@ -149,7 +149,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
*
*-------------------------------------------------------------------------
@@ -219,7 +218,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
*
*-------------------------------------------------------------------------
@@ -250,7 +248,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len
fspace->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature")
image += H5_SIZEOF_MAGIC;
@@ -333,7 +331,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -783,7 +780,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
*
*-------------------------------------------------------------------------
@@ -846,7 +842,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -993,7 +988,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l
H5_CHECKED_ASSIGN(old_sect_size, size_t, fspace->sect_size, hsize_t);
/* Magic number */
- if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature")
image += H5_SIZEOF_MAGIC;
@@ -1117,7 +1112,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 d7a986a..3862b53 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FSdbg.c
* May 9 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Dump debugging information about a free space manager
*
@@ -121,12 +121,13 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
(fspace->client == H5FS_CLIENT_FHEAP_ID
? "Fractal heap"
: (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown")));
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Total free space tracked:", fspace->tot_space);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Total free space tracked:", fspace->tot_space);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Total number of free space sections tracked:", fspace->tot_sect_count);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of serializable free space sections tracked:", fspace->serial_sect_count);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Number of ghost free space sections tracked:", fspace->ghost_sect_count);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of free space section classes:", (unsigned)fspace->nclasses);
@@ -134,11 +135,13 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Expand percent:", fspace->expand_percent);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"# of bits for section address space:", fspace->max_sect_addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Maximum section size:", fspace->max_sect_size);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Serialized sections address:", fspace->sect_addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Maximum section size:", fspace->max_sect_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Serialized sections address:", fspace->sect_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Serialized sections size used:", fspace->sect_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Serialized sections size allocated:", fspace->alloc_sect_size);
done:
diff --git a/src/H5FSint.c b/src/H5FSint.c
index 41c8176..0ab975b 100644
--- a/src/H5FSint.c
+++ b/src/H5FSint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5FSint.c
* Fall 2012
- * Dana Robinson <derobins@hdfgroup.org>
+ * Dana Robinson
*
* Purpose: Internal routines for free space managers.
*
diff --git a/src/H5FSmodule.h b/src/H5FSmodule.h
index 434e30c..a40c103 100644
--- a/src/H5FSmodule.h
+++ b/src/H5FSmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5FS package. Including this header means that the source file
* is part of the H5FS package.
*/
-#ifndef _H5FSmodule_H
-#define _H5FSmodule_H
+#ifndef H5FSmodule_H
+#define H5FSmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_FSPACE
#define H5_MY_PKG_INIT NO
-#endif /* _H5FSmodule_H */
+#endif /* H5FSmodule_H */
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index 09e2c7c..ba2cf03 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, May 2, 2006
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5FS package!"
#endif
-#ifndef _H5FSpkg_H
-#define _H5FSpkg_H
+#ifndef H5FSpkg_H
+#define H5FSpkg_H
/* Uncomment this macro to enable debugging output for free space manager */
/* #define H5FS_DEBUG */
@@ -240,4 +240,4 @@ H5_DLL herr_t H5FS__get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam);
H5_DLL int H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2);
#endif /* H5FS_TESTING */
-#endif /* _H5FSpkg_H */
+#endif /* H5FSpkg_H */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index 765c2f7..fdc5c91 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
*
* Created: H5FSprivate.h
* May 2 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Private header for library accessible file free space routines.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5FSprivate_H
-#define _H5FSprivate_H
+#ifndef H5FSprivate_H
+#define H5FSprivate_H
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
@@ -230,4 +230,4 @@ H5_DLL herr_t H5FS_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
H5_DLL herr_t H5FS_sect_debug(const H5FS_t *fspace, const H5FS_section_info_t *sect, FILE *stream, int indent,
int fwidth);
-#endif /* _H5FSprivate_H */
+#endif /* H5FSprivate_H */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index a2b68ed..6ba1bc3 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Monday, July 31, 2006
*
* Purpose: Free space tracking functions.
@@ -373,10 +373,11 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
if (fspace->sinfo_lock_count == 0) {
hbool_t release_sinfo_space =
FALSE; /* Flag to indicate section info space in file should be released */
- hbool_t flush_in_progress = FALSE; /* Is flushing in progress */
+ hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */
- /* Check whether cache is flush_in_progress */
- if (H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0)
+ /* Check whether cache-flush is in progress if closing is not. */
+ if (!closing_or_flushing &&
+ H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress")
/* Check if we actually protected the section info */
@@ -392,7 +393,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
cache_flags |= H5AC__DIRTIED_FLAG;
/* On file close or flushing, does not allow section info to shrink in size */
- if (f->shared->closing || flush_in_progress) {
+ if (closing_or_flushing) {
if (fspace->sect_size > fspace->alloc_sect_size)
cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG;
else
@@ -444,7 +445,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
/* Set flag to release section info space in file */
/* On file close or flushing, only need to release section info with size
bigger than previous section */
- if (f->shared->closing || flush_in_progress) {
+ if (closing_or_flushing) {
if (fspace->sect_size > fspace->alloc_sect_size)
release_sinfo_space = TRUE;
else
@@ -525,16 +526,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) {
@@ -544,12 +535,6 @@ H5FS__sect_serialize_size(H5FS_t *fspace)
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);
@@ -616,10 +601,6 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fl
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 */
@@ -675,10 +656,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 */
@@ -720,9 +697,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) {
@@ -860,10 +834,6 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sec
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, &sect->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")
@@ -873,10 +843,7 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sec
if (H5FS__sect_decrease(fspace, cls) < 0)
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 */
+ /* Decrement amount of free space managed */
fspace->tot_space -= sect->size;
done:
@@ -987,9 +954,6 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_
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);
@@ -1004,10 +968,9 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_
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, &sect->size);
- } /* end else */
/* Check if we need to create a new skip list for nodes of this size */
if (fspace_node == NULL) {
@@ -1035,9 +998,6 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_
/* (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++;
@@ -1100,10 +1060,6 @@ H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_secti
/* 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,
@@ -1153,22 +1109,13 @@ 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)
@@ -1207,8 +1154,8 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
/* Loop until no more merging */
if (fspace->sinfo->merge_list) {
do {
- H5SL_node_t * less_sect_node; /* Skip list node for section less than new section */
- H5SL_node_t * greater_sect_node; /* Skip list node for section greater than new section */
+ H5SL_node_t *less_sect_node; /* Skip list node for section less than new section */
+ H5SL_node_t *greater_sect_node = NULL; /* Skip list node for section greater than new section */
H5FS_section_info_t * tmp_sect; /* Temporary free space section */
H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */
hbool_t greater_sect_node_valid = FALSE; /* Indicate if 'greater than' section node is valid */
@@ -1314,10 +1261,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 {
@@ -1330,10 +1273,6 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
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) {
@@ -1377,20 +1316,7 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data)
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() */
@@ -1719,10 +1645,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 */
@@ -1862,10 +1784,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);
@@ -1873,11 +1791,6 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t **
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)
@@ -1892,10 +1805,6 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t **
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 */
@@ -1911,7 +1820,7 @@ done:
} /* H5FS_sect_find() */
/*-------------------------------------------------------------------------
- * 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
@@ -1924,13 +1833,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);
@@ -1943,10 +1852,10 @@ 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
@@ -1959,13 +1868,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);
@@ -1974,12 +1883,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() */
/*-------------------------------------------------------------------------
* Function: H5FS_sect_iterate
@@ -2006,10 +1915,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;
@@ -2025,14 +1930,11 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data)
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 */
@@ -2114,10 +2016,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint
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)) {
@@ -2130,9 +2028,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint
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);
@@ -2196,16 +2091,9 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint
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,
@@ -2217,10 +2105,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint
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, &sect->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")
@@ -2266,9 +2150,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;
@@ -2325,10 +2206,6 @@ H5FS__sect_assert(const H5FS_t *fspace)
/* 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));
@@ -2406,7 +2283,7 @@ H5FS__sect_assert(const H5FS_t *fspace)
*
* Return: TRUE/FALSE/FAIL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5FSstat.c b/src/H5FSstat.c
index 6c15dd5..2b18167 100644
--- a/src/H5FSstat.c
+++ b/src/H5FSstat.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5FStest.c b/src/H5FStest.c
index 4a778bd..cd452d1 100644
--- a/src/H5FStest.c
+++ b/src/H5FStest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index dd6bba3..aed5812 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Faccum.c
* Jan 10 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File metadata "accumulator" routines. (Used to
* cache small metadata I/Os and group them into a
@@ -95,7 +95,6 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 10 2008
*
*-------------------------------------------------------------------------
@@ -265,7 +264,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 11 2009
*
*-------------------------------------------------------------------------
@@ -407,7 +405,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 10 2008
*
*-------------------------------------------------------------------------
@@ -847,7 +844,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 10 2008
*
*-------------------------------------------------------------------------
@@ -1014,7 +1010,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 10 2008
*
*-------------------------------------------------------------------------
@@ -1057,7 +1052,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 a1039ec..d689737 100644
--- a/src/H5Fcwfs.c
+++ b/src/H5Fcwfs.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * 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 8bad2ee..5157180 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Wednesday, July 9, 2003
*
* Purpose: File object debugging functions.
@@ -37,7 +37,6 @@
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 1 1997
*
*-------------------------------------------------------------------------
@@ -73,9 +72,10 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
"File name (after resolving symlinks):", H5F_ACTUAL_NAME(f));
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "File access flags", f->shared->flags);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "File open reference count:", f->shared->nrefs);
- HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (abs)\n", indent, "", fwidth,
"Address of super block:", f->shared->sblock->base_addr);
- HDfprintf(stream, "%*s%-*s %Hu bytes\n", indent, "", fwidth, "Size of userblock:", userblock_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " bytes\n", indent, "", fwidth,
+ "Size of userblock:", userblock_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Superblock version number:", f->shared->sblock->super_vers);
@@ -100,16 +100,16 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
"Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]);
HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth,
"File status flags:", (unsigned)(f->shared->sblock->status_flags));
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth,
"Superblock extension address:", f->shared->sblock->ext_addr);
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth,
"Shared object header message table address:", f->shared->sohm_addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Shared object header message version number:", (unsigned)f->shared->sohm_vers);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of shared object header message indexes:", (unsigned)f->shared->sohm_nindexes);
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth,
"Address of driver information block:", f->shared->sblock->driver_addr);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index edfbf46..81ffcdf 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fdeprec.c
* October 1 2009
- * Quincey Koziol <koziol@hdfgroup.org>
+ * 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 05f1696..3f9a22f 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Defc.c
* December 13, 2010
- * Neil Fortner <nfortne2@hdfgroup.org>
+ * 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 01a0056..1aae0fd 100644
--- a/src/H5Ffake.c
+++ b/src/H5Ffake.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -32,7 +32,6 @@
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 2, 2006
*
*-------------------------------------------------------------------------
@@ -76,7 +75,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 2, 2006
*
*-------------------------------------------------------------------------
diff --git a/src/H5Fint.c b/src/H5Fint.c
index d91f379..a8039b2 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -72,6 +72,7 @@ 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);
@@ -79,6 +80,8 @@ 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__dest(H5F_t *f, hbool_t flush);
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);
@@ -88,6 +91,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 */
/*****************************/
@@ -102,6 +114,183 @@ 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; it is unnecessary to unwrap the VOL
+ * object before freeing it, as the object was not wrapped */
+ 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() */
+
/*-------------------------------------------------------------------------
* Function: H5F__set_vol_conn
*
@@ -227,24 +416,40 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
if (f->shared->efc)
efc_size = H5F__efc_max_nfiles(f->shared->efc);
if (H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set elink file cache size")
if (f->shared->page_buf != NULL) {
if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set page buffer size")
if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME,
&(f->shared->page_buf->min_meta_perc)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID,
"can't set minimum metadata fraction of page buffer")
if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) <
0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID,
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID,
"can't set minimum raw data fraction of page buffer")
} /* end if */
#ifdef H5_HAVE_PARALLEL
if (H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag")
if (H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag")
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ MPI_Comm mpi_comm;
+ MPI_Info mpi_info;
+
+ /* Retrieve and set MPI communicator */
+ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI communicator")
+ if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &mpi_comm) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI communicator")
+
+ /* Retrieve and set MPI info object */
+ if (H5P_get(old_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI info object")
+ if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI info object")
+ }
#endif /* H5_HAVE_PARALLEL */
if (H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) <
0)
@@ -275,7 +480,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
done:
/* Release the copy of the driver info, if it was set up */
- if (driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0)
+ if (driver_prop_copied && H5FD_free_driver_info(driver_prop.driver_id, driver_prop.driver_info) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -392,7 +597,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if (H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
} /* end if */
- } /* end if */
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -403,8 +608,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
olist.obj_type = H5I_GROUP;
if (H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
- } /* end if */
- } /* end if */
+ }
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -416,7 +621,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if (H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
} /* end if */
- } /* end if */
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -428,7 +633,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id
if (H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
} /* end if */
- } /* end if */
+ }
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
@@ -853,9 +1058,10 @@ done:
htri_t
H5F__is_hdf5(const char *name, hid_t fapl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
- htri_t ret_value = FAIL; /* Return value */
+ H5FD_t * file = NULL; /* Low-level file struct */
+ H5F_shared_t *shared = NULL; /* Shared part of file */
+ haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -866,10 +1072,20 @@ H5F__is_hdf5(const char *name, hid_t fapl_id)
if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file")
- /* The file is an hdf5 file if the hdf5 file signature can be found */
- if (H5FD_locate_signature(file, &sig_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature")
- ret_value = (HADDR_UNDEF != sig_addr);
+ /* If the file is already open, it's an HDF5 file
+ *
+ * If the file is open with an exclusive lock on an operating system that enforces
+ * mandatory file locks (like Windows), creating a new file handle and attempting
+ * to read through it will fail so we have to try this first.
+ */
+ if ((shared = H5F__sfile_search(file)) != NULL)
+ ret_value = TRUE;
+ else {
+ /* The file is an HDF5 file if the HDF5 file signature can be found */
+ if (H5FD_locate_signature(file, &sig_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature")
+ ret_value = (HADDR_UNDEF != sig_addr);
+ }
done:
/* Close the file */
@@ -1071,12 +1287,12 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F
f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA;
if (H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD")
- } /* end if */
+ }
else {
/* If no value for read attempts has been set, use the default */
if (!f->shared->read_attempts)
f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS;
- } /* end else */
+ }
/* Determine the # of bins for metdata read retries */
if (H5F_set_retries(f) < 0)
@@ -1134,6 +1350,8 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F
done:
if (!ret_value && f) {
+ HDassert(NULL == f->vol_obj);
+
if (!shared) {
/* Attempt to clean up some of the shared file structures */
if (f->shared->efc)
@@ -1144,15 +1362,10 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list")
f->shared = H5FL_FREE(H5F_shared_t, f->shared);
- } /* end if */
-
- /* Free VOL object */
- if (f->vol_obj)
- if (H5VL_free_object(f->vol_obj) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "unable to free VOL object")
+ }
f = H5FL_FREE(H5F_t, f);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__new() */
@@ -1168,12 +1381,12 @@ done:
* Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5F__dest(H5F_t *f, hbool_t flush)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -1417,9 +1630,21 @@ H5F__dest(H5F_t *f, hbool_t flush)
/* Free the non-shared part of the file */
f->open_name = (char *)H5MM_xfree(f->open_name);
f->actual_name = (char *)H5MM_xfree(f->actual_name);
- if (f->vol_obj && H5VL_free_object(f->vol_obj) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
- f->vol_obj = NULL;
+ if (f->vol_obj) {
+ void *vol_wrap_ctx = NULL;
+
+ /* If a VOL wrapping context is available, retrieve it
+ * and unwrap file VOL object
+ */
+ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context")
+ if (vol_wrap_ctx && (NULL == H5VL_object_unwrap(f->vol_obj)))
+ HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object")
+
+ if (H5VL_free_object(f->vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ f->vol_obj = NULL;
+ }
if (H5FO_top_dest(f) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file")
f->shared = NULL;
@@ -1429,6 +1654,51 @@ H5F__dest(H5F_t *f, hbool_t flush)
} /* end H5F__dest() */
/*-------------------------------------------------------------------------
+ * 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
@@ -1517,16 +1787,15 @@ 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 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 */
+ 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 */
FUNC_ENTER_NOAPI(NULL)
/*
- * If the driver has a `cmp' method then the driver is capable of
+ * If the driver has a 'cmp' method then the driver is capable of
* determining when two file handles refer to the same file and the
* library can insure that when the application opens a file twice
* that the two handles coordinate their operations appropriately.
@@ -1536,15 +1805,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
@@ -1627,8 +1894,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 */
@@ -1660,9 +1927,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)
@@ -1808,7 +2080,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 */
@@ -1868,7 +2140,7 @@ H5F__post_open(H5F_t *f)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__flush() */
+} /* end H5F__post_open() */
/*-------------------------------------------------------------------------
* Function: H5F_flush_phase1
@@ -1926,6 +2198,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*/
@@ -1958,6 +2235,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*/
@@ -2232,11 +2514,6 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
if (H5F__efc_try_close(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC")
- /* Delay flush until the shared file struct is closed, in H5F__dest. If the
- * application called H5Fclose, it would have been flushed in that function
- * (unless it will have been flushed in H5F__dest anyways).
- */
-
/* Destroy the H5F_t struct and decrement the reference count for the
* shared H5F_shared_t struct. If the reference count for the H5F_shared_t
* struct reaches zero then destroy it also.
@@ -2311,7 +2588,7 @@ H5F_get_id(H5F_t *file)
if ((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
file->id_exists = TRUE;
- } /* end if */
+ }
else {
/* Increment reference count on existing ID */
if (H5I_inc_ref(ret_value, FALSE) < 0)
@@ -2859,7 +3136,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
*
* While this problem is quire solvable, the required time and
* resources are lacking at present. Hence, for now, we don't
- * allow the get file image operation to be perfomed on files
+ * allow the get file image operation to be performed on files
* opened with the family file driver.
*
* Observe that the following test only looks at the top level
@@ -3448,6 +3725,19 @@ H5F__start_swmr_write(H5F_t *f)
setup = TRUE;
+ /* Place an advisory lock on the file */
+ if (H5F_USE_FILE_LOCKING(f)) {
+ /* Have to unlock on Windows as Win32 doesn't support changing the lock
+ * type (exclusive vs shared) with a second call.
+ */
+ if (H5FD_unlock(f->shared->lf) < 0) {
+ HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file")
+ }
+ 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")
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 40cc780..5a9d2c1 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fio.c
* Jan 10 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File I/O routines.
*
@@ -76,7 +76,6 @@
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*
*-------------------------------------------------------------------------
@@ -119,7 +118,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*
*-------------------------------------------------------------------------
@@ -163,7 +161,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 10 1997
*
*-------------------------------------------------------------------------
@@ -207,7 +204,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 ce892e0..7f0299a 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5F package. Including this header means that the source file
* is part of the H5F package.
*/
-#ifndef _H5Fmodule_H
-#define _H5Fmodule_H
+#ifndef H5Fmodule_H
+#define H5Fmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,43 @@
#define H5_MY_PKG_ERR H5E_FILE
#define H5_MY_PKG_INIT YES
-#endif /* _H5Fmodule_H */
+/**
+ * \defgroup H5F H5F
+ *
+ * Use the functions in this module to manage HDF5 files.
+ *
+ * In the code snippets below, we show the skeletal life cycle of an HDF5 file,
+ * when creating a new file (left) or when opening an existing file (right).
+ * File creation is essentially controlled through \ref FCPL, and file access to
+ * new and existing files is controlled through \ref FAPL. The file \c name and
+ * creation or access \c mode control the interaction with the underlying
+ * storage such as file systems.
+ *
+ * \Emph{Proper error handling is part of the life cycle.}
+ * <table>
+ * <tr><th>Create</th><th>Open</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5F_examples.c life_cycle
+ * </td>
+ * <td>
+ * \snippet H5F_examples.c life_cycle_w_open
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * In addition to general file management functions, there are three categories
+ * of functions that deal with advanced file management tasks and use cases:
+ * 1. The control of the HDF5 \ref MDC
+ * 2. The use of (MPI-) \ref PH5F HDF5
+ * 3. The \ref SWMR pattern
+ *
+ * \defgroup MDC Metadata Cache
+ * \ingroup H5F
+ * \defgroup PH5F Parallel
+ * \ingroup H5F
+ * \defgroup SWMR Single Writer Multiple Readers
+ * \ingroup H5F
+ */
+
+#endif /* H5Fmodule_H */
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 8adf46b..06f2a63 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -621,7 +621,7 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs)
} /* end H5F__mount_count_ids() */
/*-------------------------------------------------------------------------
- * Function: H5F_flush_mounts_recurse
+ * Function: H5F__flush_mounts_recurse
*
* Purpose: Flush a mount hierarchy, recursively
*
@@ -633,20 +633,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 */
@@ -659,7 +659,7 @@ H5F_flush_mounts_recurse(H5F_t *f)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_flush_mounts_recurse() */
+} /* end H5F__flush_mounts_recurse() */
/*-------------------------------------------------------------------------
* Function: H5F_flush_mounts
@@ -688,7 +688,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 0871ce7..97bfefd 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fmpi.c
* Jan 10 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: MPI-related routines.
*
@@ -68,35 +68,6 @@
/*******************/
#ifdef H5_HAVE_PARALLEL
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_mpi_handle
- *
- * Purpose: Retrieves MPI File handle.
- *
- * Return: Success: The size (positive)
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
-{
- herr_t ret_value = SUCCEED;
- hid_t fapl_id = H5I_INVALID_HID;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(f && f->shared);
-
- /* Dispatch to driver */
- if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_mpi_handle() */
-
/*-------------------------------------------------------------------------
* Function: H5F_mpi_get_rank
*
@@ -420,31 +391,4 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_mpi_retrieve_comm */
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_mpi_info
- *
- * Purpose: Retrieves MPI File info.
- *
- * Return: Success: The size (positive)
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(f && f->shared);
-
- /* Dispatch to driver */
- if ((ret_value = H5FD_get_mpi_info(f->shared->lf, (void **)f_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_mpi_info() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index e94c2fb..087c9c9 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5F package!"
#endif
-#ifndef _H5Fpkg_H
-#define _H5Fpkg_H
+#ifndef H5Fpkg_H
+#define H5Fpkg_H
/* Get package's private header */
#include "H5Fprivate.h"
@@ -304,6 +304,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 */
@@ -392,6 +393,11 @@ 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 */
/******************************/
@@ -399,7 +405,6 @@ H5FL_EXTERN(H5F_shared_t);
/* General routines */
H5_DLL herr_t H5F__post_open(H5F_t *f);
H5_DLL H5F_t * H5F__reopen(H5F_t *f);
-H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
@@ -409,6 +414,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);
@@ -471,6 +477,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 */
+#endif /* H5Fpkg_H */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index a1befea..5c5937b 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
* This file contains macros & information for file access
*/
-#ifndef _H5Fprivate_H
-#define _H5Fprivate_H
+#ifndef H5Fprivate_H
+#define H5Fprivate_H
/* Early typedefs to avoid circular dependencies */
typedef struct H5F_t H5F_t;
@@ -25,15 +25,15 @@ typedef struct H5F_t H5F_t;
#include "H5Fpublic.h"
/* Public headers needed by this file */
-#include "H5FDpublic.h" /* File drivers */
+#include "H5FDpublic.h" /* File drivers */
/* Private headers needed by this file */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
-#include "H5Pprivate.h" /* Property lists */
+#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
-#include "H5VMprivate.h" /* Vectors and arrays */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
/* Library Private Macros */
@@ -287,23 +287,36 @@ typedef struct H5F_t H5F_t;
(p) += 8; \
}
+/* clang-format off */
/* Address-related macros */
-#define H5F_addr_overflow(X, Z) \
- (HADDR_UNDEF == (X) || HADDR_UNDEF == (X) + (haddr_t)(Z) || (X) + (haddr_t)(Z) < (X))
-#define H5F_addr_defined(X) ((X) != HADDR_UNDEF)
+#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
+ HADDR_UNDEF==(X)+(haddr_t)(Z) || \
+ (X)+(haddr_t)(Z)<(X))
+#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF)
/* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making
* certain that X is not HADDR_UNDEF and then checking that X equals Y
*/
-#define H5F_addr_eq(X, Y) ((X) != HADDR_UNDEF && (X) == (Y))
-#define H5F_addr_ne(X, Y) (!H5F_addr_eq((X), (Y)))
-#define H5F_addr_lt(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) < (Y))
-#define H5F_addr_le(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) <= (Y))
-#define H5F_addr_gt(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) > (Y))
-#define H5F_addr_ge(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) >= (Y))
-#define H5F_addr_cmp(X, Y) (H5F_addr_eq((X), (Y)) ? 0 : (H5F_addr_lt((X), (Y)) ? -1 : 1))
-#define H5F_addr_pow2(N) ((haddr_t)1 << (N))
-#define H5F_addr_overlap(O1, L1, O2, L2) \
- (((O1) < (O2) && ((O1) + (L1)) > (O2)) || ((O1) >= (O2) && (O1) < ((O2) + (L2))))
+#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \
+ (X)==(Y))
+#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y)))
+#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)<(Y))
+#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)<=(Y))
+#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)>(Y))
+#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)>=(Y))
+#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \
+ (H5F_addr_lt((X), (Y)) ? -1 : 1))
+#define H5F_addr_pow2(N) ((haddr_t)1<<(N))
+#define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \
+ ((O1) >= (O2) && (O1) < ((O2) + (L2))))
+/* clang-format on */
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5F_MODULE
@@ -368,6 +381,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))
@@ -430,6 +444,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 */
/* Macros to encode/decode offset/length's for storing in the file */
@@ -491,7 +506,7 @@ typedef struct H5F_t H5F_t;
HDassert("bad sizeof size" && 0); \
}
-#define H5F_DECODE_LENGTH(f, p, l) H5F_DECODE_LENGTH_LEN(p, l, H5F_SIZEOF_SIZE(f))
+#define H5F_DECODE_LENGTH(f, p, l) DECODE_VAR(p, l, H5F_SIZEOF_SIZE(f))
/*
* Macros that check for overflows. These are somewhat dangerous to fiddle
@@ -517,17 +532,18 @@ typedef struct H5F_t H5F_t;
#define H5F_DEFAULT_CSET H5T_CSET_ASCII
/* ========= File Creation properties ============ */
-#define H5F_CRT_USER_BLOCK_NAME "block_size" /* Size of the file user block in bytes */
-#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" /* 1/2 rank for symbol table leaf nodes */
-#define H5F_CRT_SYM_LEAF_DEF 4
-#define H5F_CRT_BTREE_RANK_NAME "btree_rank" /* 1/2 rank for btree internal nodes */
-#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" /* Byte number in an address */
-#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" /* Byte number for object size */
-#define H5F_CRT_SUPER_VERS_NAME "super_version" /* Version number of the superblock */
-#define H5F_CRT_SHMSG_NINDEXES_NAME "num_shmsg_indexes" /* Number of shared object header message indexes */
-#define H5F_CRT_SHMSG_INDEX_TYPES_NAME "shmsg_message_types" /* Types of message in each index */
-#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize" /* Minimum size of messages in each index \
- */
+#define H5F_CRT_USER_BLOCK_NAME "block_size" /* Size of the file user block in bytes */
+#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" /* 1/2 rank for symbol table leaf nodes */
+#define H5F_CRT_SYM_LEAF_DEF 4
+#define H5F_CRT_BTREE_RANK_NAME "btree_rank" /* 1/2 rank for btree internal nodes */
+#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" /* Byte number in an address */
+#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" /* Byte number for object size */
+#define H5F_CRT_SUPER_VERS_NAME "super_version" /* Version number of the superblock */
+/* Number of shared object header message indexes */
+#define H5F_CRT_SHMSG_NINDEXES_NAME "num_shmsg_indexes"
+#define H5F_CRT_SHMSG_INDEX_TYPES_NAME "shmsg_message_types" /* Types of message in each index */
+/* Minimum size of messages in each index */
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize"
#define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */
#define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */
#define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */
@@ -574,10 +590,10 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME \
"clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) \
*/
-#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr" /* Nullify addresses of free-space managers */
- /* Private property used only by h5clear */
-#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" /* Skip EOF check */
- /* Private property used only by h5clear */
+#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr" /* Nullify addresses of free-space managers */
+/* Private property used only by h5clear */
+#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" /* Skip EOF check */
+/* Private property used only by h5clear */
#define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */
#define H5F_ACS_MDC_LOG_LOCATION_NAME "mdc_log_location" /* Name of metadata cache log location */
#define H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME \
@@ -594,6 +610,11 @@ typedef struct H5F_t H5F_t;
"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 */
@@ -629,13 +650,13 @@ typedef struct H5F_t H5F_t;
#define HDF5_BTREE_SNODE_IK_DEF 16
#define HDF5_BTREE_CHUNK_IK_DEF \
32 /* Note! this value is assumed \
- to be 32 for version 0 \
- of the superblock and \
- if it is changed, the code \
- must compensate. -QAK \
- */
+ to be 32 for version 0 \
+ of the superblock and \
+ if it is changed, the code \
+ must compensate. -QAK \
+ */
#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */
- /* See format specification on version 1 B-trees */
+/* See format specification on version 1 B-trees */
/* Default file space handling strategy */
#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
@@ -839,6 +860,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);
@@ -871,7 +893,6 @@ H5_DLL hsize_t H5F_get_alignment(const H5F_t *f);
H5_DLL hsize_t H5F_get_threshold(const H5F_t *f);
#ifdef H5_HAVE_PARALLEL
H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f);
-H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag);
#endif /* H5_HAVE_PARALLEL */
H5_DLL hbool_t H5F_use_mdc_logging(const H5F_t *f);
H5_DLL hbool_t H5F_start_mdc_log_on_access(const H5F_t *f);
@@ -934,13 +955,11 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f);
/* Parallel I/O (i.e. MPI) related routines */
#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle);
H5_DLL int H5F_mpi_get_rank(const H5F_t *f);
H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f);
H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh);
H5_DLL int H5F_mpi_get_size(const H5F_t *f);
H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm);
-H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info);
H5_DLL herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag);
H5_DLL herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag);
#endif /* H5_HAVE_PARALLEL */
@@ -962,4 +981,4 @@ H5_DLL herr_t H5F_cwfs_remove_heap(H5F_shared_t *shared, struct H5HG_heap_t *hea
/* Debugging functions */
H5_DLL herr_t H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth);
-#endif /* _H5Fprivate_H */
+#endif /* H5Fprivate_H */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index c6a5b76..89238b6 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5F module.
*/
-#ifndef _H5Fpublic_H
-#define _H5Fpublic_H
+#ifndef H5Fpublic_H
+#define H5Fpublic_H
/* Public header files needed by this file */
#include "H5public.h"
@@ -24,19 +24,19 @@
/* When this header is included from a private header, don't make calls to H5check() */
#undef H5CHECK
-#ifndef _H5private_H
+#ifndef H5private_H
#define H5CHECK H5check(),
-#else /* _H5private_H */
+#else /* H5private_H */
#define H5CHECK
-#endif /* _H5private_H */
+#endif /* H5private_H */
/* When this header is included from a private HDF5 header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5private_H
+#ifndef H5private_H
#define H5OPEN H5open(),
-#else /* _H5private_H */
+#else /* H5private_H */
#define H5OPEN
-#endif /* _H5private_H */
+#endif /* H5private_H */
/*
* These are the bits that can be passed to the `flags' argument of
@@ -47,50 +47,47 @@
* We're assuming that these constants are used rather early in the hdf5
* session.
*/
-#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */
-#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */
-#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */
-#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/
+#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< Absence of RDWR: read-only */
+#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< Open for read and write */
+#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< Overwrite existing files */
+#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< Fail if file already exists*/
/* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */
-#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */
+#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< Create non-existing files */
#define H5F_ACC_SWMR_WRITE \
- (H5CHECK 0x0020u) /*indicate that this file is \
- * open for writing in a \
- * single-writer/multi-reader (SWMR) \
- * scenario. Note that the \
- * process(es) opening the file \
- * for reading must open the file \
- * with RDONLY access, and use \
- * the special "SWMR_READ" access \
- * flag. */
+ (H5CHECK 0x0020u) /**< Indicate that this file is open for writing in a \
+ * single-writer/multi-reader (SWMR) scenario. \
+ * Note that the process(es) opening the file for reading \
+ * must open the file with #H5F_ACC_RDONLY and use the \
+ * #H5F_ACC_SWMR_READ access flag. */
#define H5F_ACC_SWMR_READ \
- (H5CHECK 0x0040u) /*indicate that this file is \
- * open for reading in a \
- * single-writer/multi-reader (SWMR) \
- * scenario. Note that the \
- * process(es) opening the file \
- * for SWMR reading must also \
- * open the file with the RDONLY \
- * flag. */
-
-/* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the
- * parent file. */
-#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */
+ (H5CHECK 0x0040u) /**< Indicate that this file is open for reading in a \
+ * single-writer/multi-reader (SWMR) scenario. Note that \
+ * the process(es) opening the file for SWMR reading must \
+ * also open the file with the #H5F_ACC_RDONLY flag. */
+
+/**
+ * Default property list identifier
+ *
+ * \internal Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the parent file.
+ * \internal ignore setting on lapl
+ */
+#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu)
/* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */
-#define H5F_OBJ_FILE (0x0001u) /* File objects */
-#define H5F_OBJ_DATASET (0x0002u) /* Dataset objects */
-#define H5F_OBJ_GROUP (0x0004u) /* Group objects */
-#define H5F_OBJ_DATATYPE (0x0008u) /* Named datatype objects */
-#define H5F_OBJ_ATTR (0x0010u) /* Attribute objects */
+#define H5F_OBJ_FILE (0x0001u) /**< File objects */
+#define H5F_OBJ_DATASET (0x0002u) /**< Dataset objects */
+#define H5F_OBJ_GROUP (0x0004u) /**< Group objects */
+#define H5F_OBJ_DATATYPE (0x0008u) /**< Named datatype objects */
+#define H5F_OBJ_ATTR (0x0010u) /**< Attribute objects */
#define H5F_OBJ_ALL (H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR)
-#define H5F_OBJ_LOCAL (0x0020u) /* Restrict search to objects opened through current file ID */
-/* (as opposed to objects opened through any file ID accessing this file) */
+#define H5F_OBJ_LOCAL \
+ (0x0020u) /**< Restrict search to objects opened through current file ID \
+ (as opposed to objects opened through any file ID accessing this file) */
#define H5F_FAMILY_DEFAULT (hsize_t)0
#ifdef H5_HAVE_PARALLEL
-/*
+/**
* Use this constant string as the MPI_Info key to set H5Fmpio debug flags.
* To turn on H5Fmpio debug flags, set the MPI_Info value with this key to
* have the value of a string consisting of the characters that turn on the
@@ -99,127 +96,150 @@
#define H5F_MPIO_DEBUG_KEY "H5F_mpio_debug_key"
#endif /* H5_HAVE_PARALLEL */
-/* The difference between a single file and a set of mounted files */
+/**
+ * The scope of an operation such as H5Fflush(), e.g.,
+ * a single file vs. a set of mounted files
+ */
typedef enum H5F_scope_t {
- H5F_SCOPE_LOCAL = 0, /*specified file handle only */
- H5F_SCOPE_GLOBAL = 1 /*entire virtual file */
+ H5F_SCOPE_LOCAL = 0, /**< The specified file handle only */
+ H5F_SCOPE_GLOBAL = 1 /**< The entire virtual file */
} H5F_scope_t;
-/* Unlimited file size for H5Pset_external() */
+/**
+ * Unlimited file size for H5Pset_external()
+ */
#define H5F_UNLIMITED ((hsize_t)(-1L))
-/* How does file close behave?
- * H5F_CLOSE_DEFAULT - Use the degree pre-defined by underlining VFL
- * H5F_CLOSE_WEAK - file closes only after all opened objects are closed
- * H5F_CLOSE_SEMI - if no opened objects, file is close; otherwise, file
- close fails
- * H5F_CLOSE_STRONG - if there are opened objects, close them first, then
- close file
+/**
+ * How does file close behave?
*/
typedef enum H5F_close_degree_t {
- H5F_CLOSE_DEFAULT = 0,
- H5F_CLOSE_WEAK = 1,
- H5F_CLOSE_SEMI = 2,
- H5F_CLOSE_STRONG = 3
+ H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlying VFD */
+ H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */
+ H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is closed; otherwise, file close fails */
+ H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */
} H5F_close_degree_t;
-/* Current "global" information about file */
+/**
+ * Current "global" information about file
+ */
+//! <!-- [H5F_info2_t_snip] -->
typedef struct H5F_info2_t {
struct {
- unsigned version; /* Superblock version # */
- hsize_t super_size; /* Superblock size */
- hsize_t super_ext_size; /* Superblock extension size */
+ unsigned version; /**< Superblock version # */
+ hsize_t super_size; /**< Superblock size */
+ hsize_t super_ext_size; /**< Superblock extension size */
} super;
struct {
- unsigned version; /* Version # of file free space management */
- hsize_t meta_size; /* Free space manager metadata size */
- hsize_t tot_space; /* Amount of free space in the file */
+ unsigned version; /**< Version # of file free space management */
+ hsize_t meta_size; /**< Free space manager metadata size */
+ hsize_t tot_space; /**< Amount of free space in the file */
} free;
struct {
- unsigned version; /* Version # of shared object header info */
- hsize_t hdr_size; /* Shared object header message header size */
- H5_ih_info_t msgs_info; /* Shared object header message index & heap size */
+ unsigned version; /**< Version # of shared object header info */
+ hsize_t hdr_size; /**< Shared object header message header size */
+ H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */
} sohm;
} H5F_info2_t;
+//! <!-- [H5F_info2_t_snip] -->
-/*
- * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
+/**
+ * Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT
* should not change other than adding new types to the end. These numbers
* might appear in files.
*
- * Note: please change the log VFD flavors array if you change this
- * enumeration.
+ * \internal Please change the log VFD flavors array if you change this
+ * enumeration.
*/
typedef enum H5F_mem_t {
- H5FD_MEM_NOLIST = -1, /* Data should not appear in the free list.
+ H5FD_MEM_NOLIST = -1, /**< Data should not appear in the free list.
* Must be negative.
*/
- H5FD_MEM_DEFAULT = 0, /* Value not yet set. Can also be the
+ H5FD_MEM_DEFAULT = 0, /**< Value not yet set. Can also be the
* datatype set in a larger allocation
* that will be suballocated by the library.
* Must be zero.
*/
- H5FD_MEM_SUPER = 1, /* Superblock data */
- H5FD_MEM_BTREE = 2, /* B-tree data */
- H5FD_MEM_DRAW = 3, /* Raw data (content of datasets, etc.) */
- H5FD_MEM_GHEAP = 4, /* Global heap data */
- H5FD_MEM_LHEAP = 5, /* Local heap data */
- H5FD_MEM_OHDR = 6, /* Object header data */
-
- H5FD_MEM_NTYPES /* Sentinel value - must be last */
+ H5FD_MEM_SUPER = 1, /**< Superblock data */
+ H5FD_MEM_BTREE = 2, /**< B-tree data */
+ H5FD_MEM_DRAW = 3, /**< Raw data (content of datasets, etc.) */
+ H5FD_MEM_GHEAP = 4, /**< Global heap data */
+ H5FD_MEM_LHEAP = 5, /**< Local heap data */
+ H5FD_MEM_OHDR = 6, /**< Object header data */
+
+ H5FD_MEM_NTYPES /**< Sentinel value - must be last */
} H5F_mem_t;
-/* Free space section information */
+/**
+ * Free space section information
+ */
+//! <!-- [H5F_sect_info_t_snip] -->
typedef struct H5F_sect_info_t {
- haddr_t addr; /* Address of free space section */
- hsize_t size; /* Size of free space section */
+ haddr_t addr; /**< Address of free space section */
+ hsize_t size; /**< Size of free space section */
} H5F_sect_info_t;
+//! <!-- [H5F_sect_info_t_snip] -->
-/* Library's format versions */
+/**
+ * Library's format versions
+ */
typedef enum H5F_libver_t {
H5F_LIBVER_ERROR = -1,
- H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
- H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
- H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */
- H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */
+ H5F_LIBVER_EARLIEST = 0, /**< Use the earliest possible format for storing objects */
+ H5F_LIBVER_V18 = 1, /**< Use the latest v18 format for storing objects */
+ H5F_LIBVER_V110 = 2, /**< Use the latest v110 format for storing objects */
+ H5F_LIBVER_V112 = 3, /**< Use the latest v112 format for storing objects */
H5F_LIBVER_NBOUNDS
} H5F_libver_t;
#define H5F_LIBVER_LATEST H5F_LIBVER_V112
-/* File space handling strategy */
+/**
+ * File space handling strategy
+ */
+//! <!-- [H5F_fspace_strategy_t_snip] -->
typedef enum H5F_fspace_strategy_t {
- H5F_FSPACE_STRATEGY_FSM_AGGR =
- 0, /* Mechanisms: free-space managers, aggregators, and virtual file drivers */
- /* This is the library default when not set */
+ H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file
+ drivers This is the library default when not set */
H5F_FSPACE_STRATEGY_PAGE =
- 1, /* Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers */
- H5F_FSPACE_STRATEGY_AGGR = 2, /* Mechanisms: aggregators and virtual file drivers */
- H5F_FSPACE_STRATEGY_NONE = 3, /* Mechanisms: virtual file drivers */
- H5F_FSPACE_STRATEGY_NTYPES /* must be last */
+ 1, /**< Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers */
+ H5F_FSPACE_STRATEGY_AGGR = 2, /**< Mechanisms: aggregators and virtual file drivers */
+ H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */
+ H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */
} H5F_fspace_strategy_t;
+//! <!-- [H5F_fspace_strategy_t_snip] -->
-/* Deprecated: File space handling strategy for release 1.10.0 */
-/* They are mapped to H5F_fspace_strategy_t as defined above from release 1.10.1 onwards */
+/**
+ * File space handling strategy for release 1.10.0
+ *
+ * \deprecated 1.10.1
+ */
typedef enum H5F_file_space_type_t {
- H5F_FILE_SPACE_DEFAULT = 0, /* Default (or current) free space strategy setting */
- H5F_FILE_SPACE_ALL_PERSIST = 1, /* Persistent free space managers, aggregators, virtual file driver */
- H5F_FILE_SPACE_ALL = 2, /* Non-persistent free space managers, aggregators, virtual file driver */
- /* This is the library default */
- H5F_FILE_SPACE_AGGR_VFD = 3, /* Aggregators, Virtual file driver */
- H5F_FILE_SPACE_VFD = 4, /* Virtual file driver */
- H5F_FILE_SPACE_NTYPES /* must be last */
+ H5F_FILE_SPACE_DEFAULT = 0, /**< Default (or current) free space strategy setting */
+ H5F_FILE_SPACE_ALL_PERSIST = 1, /**< Persistent free space managers, aggregators, virtual file driver */
+ H5F_FILE_SPACE_ALL = 2, /**< Non-persistent free space managers, aggregators, virtual file driver
+ This is the library default */
+ H5F_FILE_SPACE_AGGR_VFD = 3, /**< Aggregators, Virtual file driver */
+ H5F_FILE_SPACE_VFD = 4, /**< Virtual file driver */
+ H5F_FILE_SPACE_NTYPES /**< Sentinel */
} H5F_file_space_type_t;
-/* Data structure to report the collection of read retries for metadata items with checksum */
-/* Used by public routine H5Fget_metadata_read_retry_info() */
+//! <!-- [H5F_retry_info_t_snip] -->
#define H5F_NUM_METADATA_READ_RETRY_TYPES 21
+
+/**
+ * Data structure to report the collection of read retries for metadata items with checksum as
+ * used by H5Fget_metadata_read_retry_info()
+ */
typedef struct H5F_retry_info_t {
unsigned nbins;
uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES];
} H5F_retry_info_t;
+//! <!-- [H5F_retry_info_t_snip] -->
-/* Callback for H5Pset_object_flush_cb() in a file access property list */
+/**
+ * Callback for H5Pset_object_flush_cb() in a file access property list
+ */
typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
/*********************/
@@ -229,56 +249,1495 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
extern "C" {
#endif
-H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
-H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist);
-H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t access_plist);
-H5_DLL hid_t H5Freopen(hid_t file_id);
-H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
-H5_DLL herr_t H5Fclose(hid_t file_id);
-H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_id);
-H5_DLL hid_t H5Fget_create_plist(hid_t file_id);
-H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
-H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent);
-H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno);
-H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
-H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list);
-H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
-H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist);
-H5_DLL herr_t H5Funmount(hid_t loc, const char *name);
+/**
+ * \ingroup H5F
+ *
+ * \brief Checks if a file can be opened with a given file access property
+ * list
+ *
+ * \param[in] container_name Name of a file
+ * \fapl_id
+ *
+ * \return \htri_t
+ *
+ * \details H5Fis_accessible() checks if the file specified by \p
+ * container_name can be opened with the file access property list
+ * \p fapl_id.
+ *
+ * \note The H5Fis_accessible() function enables files to be checked with a
+ * given file access property list, unlike H5Fis_hdf5(), which only uses
+ * the default file driver when opening a file.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Creates an HDF5 file
+ *
+ * \param[in] filename Name of the file to create
+ * \param[in] flags File access flags. Allowable values are:
+ * - #H5F_ACC_TRUNC: Truncate file, if it already exists,
+ * erasing all data previously stored in the file
+ * - #H5F_ACC_EXCL: Fail if file already exists
+ * \fcpl_id
+ * \fapl_id
+ * \return \hid_t{file}
+ *
+ * \details H5Fcreate() is the primary function for creating HDF5 files; it
+ * creates a new HDF5 file with the specified name and property lists.
+ *
+ * The \p filename parameter specifies the name of the new file.
+ *
+ * The \p flags parameter specifies whether an existing file is to be
+ * overwritten. It should be set to either #H5F_ACC_TRUNC to overwrite
+ * an existing file or #H5F_ACC_EXCL, instructing the function to fail
+ * if the file already exists.
+ *
+ * New files are always created in read-write mode, so the read-write
+ * and read-only flags, #H5F_ACC_RDWR and #H5F_ACC_RDONLY,
+ * respectively, are not relevant in this function. Further note that
+ * a specification of #H5F_ACC_RDONLY will be ignored; the file will
+ * be created in read-write mode, regardless.
+ *
+ * More complex behaviors of file creation and access are controlled
+ * through the file creation and file access property lists,
+ * \p fcpl_id and \p fapl_id, respectively. The value of #H5P_DEFAULT
+ * for any property list value indicates that the library should use
+ * the default values for that appropriate property list.
+ *
+ * The return value is a file identifier for the newly-created file;
+ * this file identifier should be closed by calling H5Fclose() when
+ * it is no longer needed.
+ *
+ * \par Example
+ * \snippet H5F_examples.c minimal
+ *
+ * \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use
+ * exactly one.
+ *
+ * \note An additional flag, #H5F_ACC_DEBUG, prints debug information. This
+ * flag can be combined with one of the above values using the bit-wise
+ * OR operator (\c |), but it is used only by HDF5 library developers;
+ * \Emph{it is neither tested nor supported for use in applications}.
+ *
+ * \attention \Bold{Special case — File creation in the case of an already-open file:}
+ * If a file being created is already opened, by either a previous
+ * H5Fopen() or H5Fcreate() call, the HDF5 library may or may not
+ * detect that the open file and the new file are the same physical
+ * file. (See H5Fopen() regarding the limitations in detecting the
+ * re-opening of an already-open file.)\n
+ * If the library detects that the file is already opened,
+ * H5Fcreate() will return a failure, regardless of the use of
+ * #H5F_ACC_TRUNC.\n
+ * If the library does not detect that the file is already opened
+ * and #H5F_ACC_TRUNC is not used, H5Fcreate() will return a failure
+ * because the file already exists. Note that this is correct
+ * behavior.\n
+ * But if the library does not detect that the file is already
+ * opened and #H5F_ACC_TRUNC is used, H5Fcreate() will truncate the
+ * existing file and return a valid file identifier. Such a
+ * truncation of a currently-opened file will almost certainly
+ * result in errors. While unlikely, the HDF5 library may not be
+ * able to detect, and thus report, such errors.\n
+ * Applications should avoid calling H5Fcreate() with an already
+ * opened file.
+ *
+ * \since 1.0.0
+ *
+ * \see H5Fopen(), H5Fclose()
+ *
+ */
+H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Opens an existing HDF5 file
+ *
+ * \param[in] filename Name of the file to be opened
+ * \param[in] flags File access flags. Allowable values are:
+ * - #H5F_ACC_RDWR: Allows read and write access to file
+ * - #H5F_ACC_RDONLY: Allows read-only access to file
+ * - #H5F_ACC_RDWR \c | #H5F_ACC_SWMR_WRITE: Indicates that
+ * the file is open for writing in a
+ * single-writer/multi-writer (SWMR) scenario.
+ * - #H5F_ACC_RDONLY \c | #H5F_ACC_SWMR_READ: Indicates
+ * that the file is open for reading in a
+ * single-writer/multi-reader (SWMR) scenario.
+ * - An additional flag, #H5F_ACC_DEBUG, prints debug
+ * information. This flag can be combined with one of the
+ * above values using the bit-wise OR operator (\c |), but
+ * it is used only by HDF5 library developers;
+ * \Emph{it is neither tested nor supported} for use in
+ * applications.
+ * \fapl_id
+ * \return \hid_t{file}
+ *
+ * \details H5Fopen() is the primary function for accessing existing HDF5 files.
+ * This function opens the named file in the specified access mode and
+ * with the specified access property list.
+ *
+ * Note that H5Fopen() does not create a file if it does not already
+ * exist; see H5Fcreate().
+ *
+ * The \p filename parameter specifies the name of the file to be
+ * opened.
+ *
+ * The \p fapl_id parameter specifies the file access property list.
+ * Use of #H5P_DEFAULT specifies that default I/O access properties
+ * are to be used.
+ *
+ * The \p flags parameter specifies whether the file will be opened in
+ * read-write or read-only mode, #H5F_ACC_RDWR or #H5F_ACC_RDONLY,
+ * respectively. More complex behaviors of file access are controlled
+ * through the file-access property list.
+ *
+ * The return value is a file identifier for the open file; this file
+ * identifier should be closed by calling H5Fclose() when it is no
+ * longer needed.
+ *
+ * \par Example
+ * \snippet H5F_examples.c open
+ *
+ * \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use
+ * exactly one.
+ *
+ * \attention \Bold{Special cases — Multiple opens:} A file can often be opened
+ * with a new H5Fopen() call without closing an already-open
+ * identifier established in a previous H5Fopen() or H5Fcreate()
+ * call. Each such H5Fopen() call will return a unique identifier
+ * and the file can be accessed through any of these identifiers as
+ * long as the identifier remains valid. In such multiply-opened
+ * cases, the open calls must use the same flags argument and the
+ * file access property lists must use the same file close degree
+ * property setting (see the external link discussion below and
+ * H5Pset_fclose_degree()).\n
+ * In some cases, such as files on a local Unix file system, the
+ * HDF5 library can detect that a file is multiply opened and will
+ * maintain coherent access among the file identifiers.\n
+ * But in many other cases, such as parallel file systems or
+ * networked file systems, it is not always possible to detect
+ * multiple opens of the same physical file. In such cases, HDF5
+ * will treat the file identifiers as though they are accessing
+ * different files and will be unable to maintain coherent access.
+ * Errors are likely to result in these cases. While unlikely, the
+ * HDF5 library may not be able to detect, and thus report,
+ * such errors.\n
+ * It is generally recommended that applications avoid multiple
+ * opens of the same file.
+ *
+ * \attention \Bold{Special restriction on multiple opens of a file first
+ * opened by means of an external link:} When an external link is
+ * followed, the external file is always opened with the weak file
+ * close degree property setting, #H5F_CLOSE_WEAK (see
+ * H5Lcreate_external() and H5Pset_fclose_degree()). If the file is
+ * reopened with H5Fopen while it remains held open from such an
+ * external link call, the file access property list used in the
+ * open call must include the file close degree setting
+ * #H5F_CLOSE_WEAK or the open will fail.
+ *
+ * \version 1.10.0 The #H5F_ACC_SWMR_WRITE and #H5F_ACC_SWMR_READ flags were added.
+ *
+ * \see H5Fclose()
+ *
+ */
+H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns a new identifier for a previously-opened HDF5 file
+ *
+ * \param[in] file_id Identifier of a file for which an additional identifier
+ * is required
+ *
+ * \return \hid_t{file}
+ *
+ * \details H5Freopen() returns a new file identifier for an already-open HDF5
+ * file, as specified by \p file_id. Both identifiers share caches and
+ * other information. The only difference between the identifiers is
+ * that the new identifier is not mounted anywhere and no files are
+ * mounted on it.
+ *
+ * The new file identifier should be closed by calling H5Fclose() when
+ * it is no longer needed.
+ *
+ * \note Note that there is no circumstance under which H5Freopen() can
+ * actually open a closed file; the file must already be open and have an
+ * active \p file_id. E.g., one cannot close a file with H5Fclose() on
+ * \p file_id then use H5Freopen() on \p file_id to reopen it.
+ *
+ */
+H5_DLL hid_t H5Freopen(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Flushes all buffers associated with a file to storage
+ *
+ * \loc_id{object_id}
+ * \param[in] scope The scope of the flush action
+ *
+ * \return \herr_t
+ *
+ * \details H5Fflush() causes all buffers associated with a file to be
+ * immediately flushed to storage without removing the data from the
+ * cache.
+ *
+ * \p object_id can be any object associated with the file, including
+ * the file itself, a dataset, a group, an attribute, or a named
+ * datatype.
+ *
+ * \p scope specifies whether the scope of the flush action is
+ * global or local. Valid values are as follows:
+ * \scopes
+ *
+ * \par Example
+ * \snippet H5F_examples.c flush
+ *
+ * \attention HDF5 does not possess full control over buffering. H5Fflush()
+ * flushes the internal HDF5 buffers then asks the operating system
+ * (the OS) to flush the system buffers for the open files. After
+ * that, the OS is responsible for ensuring that the data is
+ * actually flushed to disk.
+ *
+ */
+H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
+/**
+ * \ingroup H5F
+ *
+ * \brief Terminates access to an HDF5 file
+ *
+ * \file_id
+ * \return \herr_t
+ *
+ * \details H5Fclose() terminates access to an HDF5 file (specified by
+ * \p file_id) by flushing all data to storage.
+ *
+ * If this is the last file identifier open for the file and no other
+ * access identifier is open (e.g., a dataset identifier, group
+ * identifier, or shared datatype identifier), the file will be fully
+ * closed and access will end.
+ *
+ * \par Example
+ * \snippet H5F_examples.c minimal
+ *
+ * \note \Bold{Delayed close:} Note the following deviation from the
+ * above-described behavior. If H5Fclose() is called for a file but one
+ * or more objects within the file remain open, those objects will remain
+ * accessible until they are individually closed. Thus, if the dataset
+ * \c data_sample is open when H5Fclose() is called for the file
+ * containing it, \c data_sample will remain open and accessible
+ * (including writable) until it is explicitly closed. The file will be
+ * automatically closed once all objects in the file have been closed.\n
+ * Be warned, however, that there are circumstances where it is not
+ * possible to delay closing a file. For example, an MPI-IO file close is
+ * a collective call; all of the processes that opened the file must
+ * close it collectively. The file cannot be closed at some time in the
+ * future by each process in an independent fashion. Another example is
+ * that an application using an AFS token-based file access privilege may
+ * destroy its AFS token after H5Fclose() has returned successfully. This
+ * would make any future access to the file, or any object within it,
+ * illegal.\n
+ * In such situations, applications must close all open objects in a file
+ * before calling H5Fclose. It is generally recommended to do so in all
+ * cases.
+ *
+ * \see H5Fopen()
+ *
+ */
+H5_DLL herr_t H5Fclose(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Deletes an HDF5 file
+ *
+ * \param[in] filename Name of the file to delete
+ * \fapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Fdelete() deletes an HDF5 file \p filename with a file access
+ * property list \p fapl_id. The \p fapl_id should be configured with
+ * the same VOL connector or VFD that was used to open the file.
+ *
+ * This API was introduced for use with the Virtual Object Layer
+ * (VOL). With the VOL, HDF5 "files" can map to arbitrary storage
+ * schemes such as object stores and relational database tables. The
+ * data created by these implementations may be inconvenient for a
+ * user to remove without a detailed knowledge of the storage scheme.
+ * H5Fdelete() gives VOL connector authors the ability to add
+ * connector-specific delete code to their connectors so that users
+ * can remove these "files" without detailed knowledge of the storage
+ * scheme.
+ *
+ * For a VOL connector, H5Fdelete() deletes the file in a way that
+ * makes sense for the specified VOL connector.
+ *
+ * For the native HDF5 connector, HDF5 files will be deleted via the
+ * VFDs, each of which will have to be modified to delete the files it
+ * creates.
+ *
+ * For all implementations, H5Fdelete() will first check if the file
+ * is an HDF5 file via H5Fis_accessible(). This is done to ensure that
+ * H5Fdelete() cannot be used as an arbitrary file deletion call.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns a file creation property list identifier
+ *
+ * \file_id
+ * \return \hid_t{file creation property list}
+ *
+ * \details H5Fget_create_plist() returns the file creation property list
+ * identifier identifying the creation properties used to create this
+ * file. This function is useful for duplicating properties when
+ * creating another file.
+ *
+ * The creation property list identifier should be released with
+ * H5Pclose().
+ *
+ */
+H5_DLL hid_t H5Fget_create_plist(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns a file access property list identifier
+ *
+ * \file_id
+ * \return \hid_t{file access property list}
+ *
+ * \details H5Fget_access_plist() returns the file access property list
+ * identifier of the specified file.
+ *
+ */
+H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Determines the read/write or read-only status of a file
+ *
+ * \file_id
+ * \param[out] intent Access mode flag as originally passed with H5Fopen()
+ *
+ * \return \herr_t
+ *
+ * \details Given the identifier of an open file, \p file_id, H5Fget_intent()
+ * retrieves the intended access mode" flag passed with H5Fopen() when
+ * the file was opened.
+ *
+ * The value of the flag is returned in \p intent. Valid values are as
+ * follows:
+ * \file_access
+ *
+ * \note The function will not return an error if intent is NULL; it will
+ * simply do nothing.
+ *
+ * \version 1.10.0 Function enhanced to work with SWMR functionality.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves a file's file number that uniquely identifies an open file
+ *
+ * \file_id
+ * \param[out] fileno A buffer to hold the file number
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_fileno() retrieves a file number for a file specified by the
+ * file identifier \p file_id and the pointer \p fnumber to the file
+ * number.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns the number of open object identifiers for an open file
+ *
+ * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files
+ * \param[in] types Type of object for which identifiers are to be returned
+ *
+ * \return Returns the number of open objects if successful; otherwise returns
+ * a negative value.
+ *
+ * \details Given the identifier of an open file, file_id, and the desired
+ * object types, types, H5Fget_obj_count() returns the number of open
+ * object identifiers for the file.
+ *
+ * To retrieve a count of open identifiers for open objects in all
+ * HDF5 application files that are currently open, pass the value
+ * #H5F_OBJ_ALL in \p file_id.
+ *
+ * The types of objects to be counted are specified in types as
+ * follows:
+ * \obj_types
+ *
+ * Multiple object types can be combined with the
+ * logical \c OR operator (|). For example, the expression
+ * \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and
+ * groups.
+ *
+ * \version 1.6.8, 1.8.2 Function return type changed to \c ssize_t.
+ * \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types
+ * of objects to be counted. #H5F_OBJ_LOCAL restricts the
+ * search to objects opened through current file identifier.
+ *
+ */
+H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5F
+ *
+ * \brief Returns a list of open object identifiers
+ *
+ * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files
+ * \param[in] types Type of object for which identifiers are to be returned
+ * \param[in] max_objs Maximum number of object identifiers to place into
+ * \p obj_id_list
+ * \param[out] obj_id_list Pointer to the returned buffer of open object
+ * identifiers
+ *
+ * \return Returns number of objects placed into \p obj_id_list if successful;
+ * otherwise returns a negative value.
+ *
+ * \details Given the file identifier \p file_id and the type of objects to be
+ * identified, types, H5Fget_obj_ids() returns the list of identifiers
+ * for all open HDF5 objects fitting the specified criteria.
+ *
+ * To retrieve identifiers for open objects in all HDF5 application
+ * files that are currently open, pass the value #H5F_OBJ_ALL in
+ * \p file_id.
+ *
+ * The types of object identifiers to be retrieved are specified in
+ * types using the codes listed for the same parameter in
+ * H5Fget_obj_count().
+ *
+ * To retrieve a count of open objects, use the H5Fget_obj_count()
+ * function. This count can be used to set the \p max_objs parameter.
+ *
+ * \version 1.8.2 Function return type changed to \c ssize_t and \p
+ * max_objs parameter datatype changed to \c size_t.
+ * \version 1.6.8 Function return type changed to \c ssize_t and \p
+ * max_objs parameter datatype changed to \c size_t.
+ * \since 1.6.0
+ *
+ */
+H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns pointer to the file handle from the virtual file driver
+ *
+ * \file_id
+ * \fapl_id{fapl}
+ * \param[out] file_handle Pointer to the file handle being used by the
+ * low-level virtual file driver
+ *
+ * \return \herr_t
+ *
+ * \details Given the file identifier \p file_id and the file access property
+ * list \p fapl_id, H5Fget_vfd_handle() returns a pointer to the file
+ * handle from the low-level file driver currently being used by the
+ * HDF5 library for file I/O.
+ *
+ * \note For most drivers, the value of \p fapl_id will be #H5P_DEFAULT. For
+ * the \c FAMILY or \c MULTI drivers, this value should be defined
+ * through the property list functions: H5Pset_family_offset() for the
+ * \c FAMILY driver and H5Pset_multi_type() for the \c MULTI driver
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
+/**
+ * \ingroup H5F
+ *
+ * \brief Mounts an HDF5 file
+ *
+ * \loc_id{loc}
+ * \param[in] name Name of the group onto which the file specified by \p child
+ * is to be mounted
+ * \file_id{child}
+ * \param[in] plist File mount property list identifier. Pass #H5P_DEFAULT!
+ *
+ * \return \herr_t
+ *
+ * \details H5Fmount() mounts the file specified by \p child onto the object
+ * specified by \p loc and \p name using the mount properties \p plist
+ * If the object specified by \p loc is a dataset, named datatype or
+ * attribute, then the file will be mounted at the location where the
+ * attribute, dataset, or named datatype is attached.
+ *
+ * \par Example
+ * \snippet H5F_examples.c mount
+ *
+ * \note To date, no file mount properties have been defined in HDF5. The
+ * proper value to pass for \p plist is #H5P_DEFAULT, indicating the
+ * default file mount property list.
+ *
+ */
+H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist);
+/**
+ * \ingroup H5F
+ *
+ * \brief Unounts an HDF5 file
+ *
+ * \loc_id{loc}
+ * \param[in] name Name of the mount point
+ *
+ * \return \herr_t
+ *
+ * \details Given a mount point, H5Funmount() dissociates the mount point's
+ * file from the file mounted there. This function does not close
+ * either file.
+ *
+ * The mount point can be either the group in the parent or the root
+ * group of the mounted file (both groups have the same name). If the
+ * mount point was opened before the mount then it is the group in the
+ * parent; if it was opened after the mount then it is the root group
+ * of the child.
+ *
+ */
+H5_DLL herr_t H5Funmount(hid_t loc, const char *name);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns the amount of free space in a file (in bytes)
+ *
+ * \file_id
+ *
+ * \return Returns the amount of free space in the file if successful;
+ * otherwise returns a negative value.
+ *
+ * \details Given the identifier of an open file, \p file_id,
+ * H5Fget_freespace() returns the amount of space that is unused by
+ * any objects in the file.
+ *
+ * The interpretation of this number depends on the configured free space
+ * management strategy. For example, if the HDF5 library only tracks free
+ * space in a file from a file open or create until that file is closed,
+ * then this routine will report the free space that has been created
+ * during that interval.
+ *
+ * \since 1.6.1
+ *
+ */
H5_DLL hssize_t H5Fget_freespace(hid_t file_id);
-H5_DLL herr_t H5Fget_filesize(hid_t file_id, hsize_t *size);
-H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
-H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
-H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len);
-H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr);
-H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
- size_t *cur_size_ptr, int *cur_num_entries_ptr);
-H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id);
-H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size);
-H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo);
-H5_DLL herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
-H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id);
-H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
- H5F_sect_info_t *sect_info /*out*/);
-H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
-H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
-H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
-H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
-H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
- /*OUT*/ hbool_t *is_enabled,
- /*OUT*/ hbool_t *is_currently_logging);
-H5_DLL herr_t H5Fformat_convert(hid_t fid);
-H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
-H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2],
- unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
-H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
-H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize);
-H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize);
+/**
+ * \ingroup H5F
+ *
+ * \brief Returns the size of an HDF5 file (in bytes)
+ *
+ * \file_id
+ * \param[out] size Size of the file, in bytes
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_filesize() returns the size of the HDF5 file specified by
+ * \p file_id.
+ *
+ * The returned size is that of the entire file, as opposed to only
+ * the HDF5 portion of the file. I.e., size includes the user block,
+ * if any, the HDF5 portion of the file, and any data that may have
+ * been appended beyond the data written through the HDF5 library.
+ *
+ * \since 1.6.3
+ *
+ */
+H5_DLL herr_t H5Fget_filesize(hid_t file_id, hsize_t *size);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves the file's end-of-allocation (EOA)
+ *
+ * \file_id
+ * \param[out] eoa The file's EOA
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_eoa() retrieves the file's EOA and returns it in the
+ * parameter eoa.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
+/**
+ * \ingroup H5F
+ *
+ * \brief Sets the file' EOA to the maximum of (EOA, EOF) + increment
+ *
+ * \file_id
+ * \param[in] increment The number of bytes to be added to the maximum of
+ * (EOA, EOF)
+ *
+ * \return \herr_t
+ *
+ * \details H5Fincrement_filesize() sets the file's EOA to the maximum of (EOA,
+ * EOF) + \p increment. The EOA is the end-of-file address stored in
+ * the file's superblock while EOF is the file's actual end-of-file.
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves a copy of the image of an existing, open file
+ *
+ * \file_id
+ * \param[out] buf_ptr Pointer to the buffer into which the image of the
+ * HDF5 file is to be copied. If \p buf_ptr is NULL,
+ * no data will be copied but the function’s return value
+ * will still indicate the buffer size required (or a
+ * negative value on error).
+ * \param[out] buf_len Size of the supplied buffer
+ *
+ * \return ssize_t
+ *
+ * \details H5Fget_file_image() retrieves a copy of the image of an existing,
+ * open file. This routine can be used with files opened using the
+ * SEC2 (or POSIX), STDIO, and Core (or Memory) virtual file drivers
+ * (VFDs).
+ *
+ * If the return value of H5Fget_file_image() is a positive value, it
+ * will be the length in bytes of the buffer required to store the
+ * file image. So if the file size is unknown, it can be safely
+ * determined with an initial H5Fget_file_image() call with buf_ptr
+ * set to NULL. The file image can then be retrieved with a second
+ * H5Fget_file_image() call with \p buf_len set to the initial call’s
+ * return value.
+ *
+ * While the current file size can also be retrieved with
+ * H5Fget_filesize(), that call may produce a larger value than is
+ * needed. The value returned by H5Fget_filesize() includes the user
+ * block, if it exists, and any unallocated space at the end of the
+ * file. It is safe in all situations to get the file size with
+ * H5Fget_file_image() and it often produces a value that is more
+ * appropriate for the size of a file image buffer.
+ *
+ * \note \Bold{Recommended Reading:} This function is part of the file image
+ * operations feature set. It is highly recommended to study the guide
+ * \ref_file_image_ops before using this feature set.
+ *
+ * \attention H5Pget_file_image() will fail, returning a negative value, if the
+ * file is too large for the supplied buffer.
+ *
+ * \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(),
+ * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks()
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len);
+/**
+ * \ingroup MDC
+ *
+ * \brief Obtains current metadata cache configuration for target file
+ *
+ * \file_id
+ * \param[in,out] config_ptr Pointer to the H5AC_cache_config_t instance in which
+ * the current metadata cache configuration is to be
+ * reported. The fields of this structure are discussed
+ * \ref H5AC-cache-config-t "here".
+ * \return \herr_t
+ *
+ * \note The \c in direction applies only to the H5AC_cache_config_t::version
+ * field. All other fields are out parameters.
+ *
+ * \details H5Fget_mdc_config() loads the current metadata cache configuration
+ * into the instance of H5AC_cache_config_t pointed to by the \p config_ptr
+ * parameter.\n
+ * The fields of the H5AC_cache_config_t structure are shown below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
+/**
+ * \ingroup MDC
+ *
+ * \brief Attempts to configure metadata cache of target file
+ *
+ * \file_id
+ * \param[in,out] config_ptr Pointer to the H5AC_cache_config_t instance
+ * containing the desired configuration.
+ * The fields of this structure are discussed
+ * \ref H5AC-cache-config-t "here".
+ * \return \herr_t
+ *
+ * \details H5Fset_mdc_config() attempts to configure the file's metadata cache
+ * according configuration supplied in \p config_ptr.
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
+/**
+ * \ingroup MDC
+ *
+ * \brief Obtains target file's metadata cache hit rate
+ *
+ * \file_id
+ * \param[out] hit_rate_ptr Pointer to the double in which the hit rate is returned. Note that
+ * \p hit_rate_ptr is undefined if the API call fails
+ * \return \herr_t
+ *
+ * \details H5Fget_mdc_hit_rate() queries the metadata cache of the target file to obtain its hit rate
+ * \Code{(cache hits / (cache hits + cache misses))} since the last time hit rate statistics
+ * were reset. If the cache has not been accessed since the last time the hit rate stats were
+ * reset, the hit rate is defined to be 0.0.
+ *
+ * The hit rate stats can be reset either manually (via H5Freset_mdc_hit_rate_stats()), or
+ * automatically. If the cache's adaptive resize code is enabled, the hit rate stats will be
+ * reset once per epoch. If they are reset manually as well, the cache may behave oddly.
+ *
+ * See the overview of the metadata cache in the special topics section of the user manual for
+ * details on the metadata cache and its adaptive resize algorithms.
+ *
+ */
+H5_DLL herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr);
+/**
+ * \ingroup MDC
+ *
+ * \brief Obtains current metadata cache size data for specified file
+ *
+ * \file_id
+ * \param[out] max_size_ptr Pointer to the location in which the current cache maximum size is to be
+ * returned, or NULL if this datum is not desired
+ * \param[out] min_clean_size_ptr Pointer to the location in which the current cache minimum clean
+ * size is to be returned, or NULL if that datum is not desired
+ * \param[out] cur_size_ptr Pointer to the location in which the current cache size is to be returned,
+ * or NULL if that datum is not desired
+ * \param[out] cur_num_entries_ptr Pointer to the location in which the current number of entries in
+ * the cache is to be returned, or NULL if that datum is not desired
+ * \returns \herr_t
+ *
+ * \details H5Fget_mdc_size() queries the metadata cache of the target file for the desired size
+ * information, and returns this information in the locations indicated by the pointer
+ * parameters. If any pointer parameter is NULL, the associated data is not returned.
+ *
+ * If the API call fails, the values returned via the pointer parameters are undefined.
+ *
+ * If adaptive cache resizing is enabled, the cache maximum size and minimum clean size
+ * may change at the end of each epoch. Current size and current number of entries can
+ * change on each cache access.
+ *
+ * Current size can exceed maximum size under certain conditions. See the overview of the
+ * metadata cache in the special topics section of the user manual for a discussion of this.
+ *
+ */
+H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, int *cur_num_entries_ptr);
+/**
+ * \ingroup MDC
+ *
+ * \brief Resets hit rate statistics counters for the target file
+ *
+ * \file_id
+ * \returns \herr_t
+ *
+ * \details
+ * \parblock
+ * H5Freset_mdc_hit_rate_stats() resets the hit rate statistics counters in the metadata cache
+ * associated with the specified file.
+ *
+ * If the adaptive cache resizing code is enabled, the hit rate statistics are reset at the beginning
+ * of each epoch. This API call allows you to do the same thing from your program.
+ *
+ * The adaptive cache resizing code may behave oddly if you use this call when adaptive cache resizing
+ * is enabled. However, the call should be useful if you choose to control metadata cache size from your
+ * program.
+ *
+ * See \ref_mdc_in_hdf5 for details about the metadata cache and the adaptive cache resizing
+ * algorithms. If you have not read, understood, and thought about the material covered in that
+ * documentation,
+ * you should not be using this API call.
+ * \endparblock
+ *
+ */
+H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves name of file to which object belongs
+ *
+ * \obj_id
+ * \param[out] name Buffer for the file name
+ * \param[in] size Size, in bytes, of the \p name buffer
+ *
+ * \return Returns the length of the file name if successful; otherwise returns
+ * a negative value.
+ *
+ * \details H5Fget_name() retrieves the name of the file to which the object \p
+ * obj_id belongs. The object can be a file, group, dataset,
+ * attribute, or named datatype.
+ *
+ * Up to \p size characters of the file name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application.
+ *
+ * If the length of the name, which determines the required value of
+ * size, is unknown, a preliminary H5Fget_name() call can be made by
+ * setting \p name to NULL. The return value of this call will be the
+ * size of the file name; that value plus one (1) can then be assigned
+ * to size for a second H5Fget_name() call, which will retrieve the
+ * actual name. (The value passed in with the parameter \p size must
+ * be one greater than size in bytes of the actual name in order to
+ * accommodate the null terminator; if \p size is set to the exact
+ * size of the name, the last byte passed back will contain the null
+ * terminator and the last character will be missing from the name
+ * passed back to the calling application.)
+ *
+ * If an error occurs, the buffer pointed to by \p name is unchanged
+ * and the function returns a negative value.
+ *
+ * \since 1.6.3
+ *
+ */
+H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves name of file to which object belongs
+ *
+ * \fgdta_obj_id
+ * \param[out] file_info Buffer for global file information
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_info2() returns global information for the file associated
+ * with the object identifier \p obj_id in the H5F_info2_t \c struct
+ * named \p file_info.
+ *
+ * \p obj_id is an identifier for any object in the file of interest.
+ *
+ * H5F_info2_t struct is defined in H5Fpublic.h as follows:
+ * \snippet this H5F_info2_t_snip
+ *
+ * The \c super sub-struct contains the following information:
+ * \li \c vers is the version number of the superblock.
+ * \li \c super_size is the size of the superblock.
+ * \li \c super_ext_size is the size of the superblock extension.
+ *
+ * The \c free sub-struct contains the following information:
+ * \li vers is the version number of the free-space manager.
+ * \li \c hdr_size is the size of the free-space manager header.
+ * \li \c tot_space is the total amount of free space in the file.
+ *
+ * The \c sohm sub-struct contains shared object header message
+ * information as follows:
+ * \li \c vers is the version number of the shared object header information.
+ * \li \c hdr_size is the size of the shared object header message.
+ * \li \c msgs_info is an H5_ih_info_t struct defined in H5public.h as
+ * follows: \snippet H5public.h H5_ih_info_t_snip
+ * \li \p index_size is the summed size of all the shared object
+ * header indexes. Each index might be either a B-tree or
+ * a list.
+ * \li \p heap_size is the size of the heap.
+ *
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *file_info);
+/**
+ * \ingroup SWMR
+ *
+ * \brief Retrieves the collection of read retries for metadata entries with checksum
+ *
+ * \file_id
+ * \param[out] info Struct containing the collection of read retries for metadata
+ * entries with checksum
+ * \return \herr_t\n
+ *
+ * \details \Bold{Failure Modes:}
+ * \li When the input identifier is not a file identifier.
+ * \li When the pointer to the output structure is NULL.
+ * \li When the memory allocation for \p retries failed.
+ *
+ * \details H5Fget_metadata_read_retry_info() retrieves information regarding the number
+ * of read retries for metadata entries with checksum for the file \p file_id.
+ * This information is reported in the H5F_retry_info_t struct defined in
+ * H5Fpublic.h as follows:
+ * \snippet this H5F_retry_info_t_snip
+ * \c nbins is the number of bins for each \c retries[i] of metadata entry \c i.
+ * It is calculated based on the current number of read attempts used in the
+ * library and logarithmic base 10.
+ *
+ * If read retries are incurred for a metadata entry \c i, the library will
+ * allocate memory for \Code{retries[i] (nbins * sizeof(uint32_t)} and store
+ * the collection of retries there. If there are no retries for a metadata entry
+ * \c i, \Code{retries[i]} will be NULL. After a call to this routine, users should
+ * free each \Code{retries[i]} that is non-NULL, otherwise resource leak will occur.
+ *
+ * For the library default read attempts of 100 for SWMR access, nbins will be 2
+ * as depicted below:
+ * \li \Code{retries[i][0]} is the number of 1 to 9 read retries.
+ * \li \Code{retries[i][1]} is the number of 10 to 99 read retries.
+ * For the library default read attempts of 1 for non-SWMR access, \c nbins will
+ * be 0 and each \Code{retries[i]} will be NULL.
+ *
+ * The following table lists the 21 metadata entries of \Code{retries[]}:
+ * <table>
+ * <tr>
+ * <th>Index for \Code{retries[]}</th>
+ * <th>Metadata entries<sup>*</sup></th>
+ * </tr>
+ * <tr><td>0</td><td>Object header (version 2)</td></tr>
+ * <tr><td>1</td><td>Object header chunk (version 2)</td></tr>
+ * <tr><td>2</td><td>B-tree header (version 2)</td></tr>
+ * <tr><td>3</td><td>B-tree internal node (version 2)</td></tr>
+ * <tr><td>4</td><td>B-tree leaf node (version 2)</td></tr>
+ * <tr><td>5</td><td>Fractal heap header</td></tr>
+ * <tr><td>6</td><td>Fractal heap direct block (optional checksum)</td></tr>
+ * <tr><td>7</td><td>Fractal heap indirect block</td></tr>
+ * <tr><td>8</td><td>Free-space header</td></tr>
+ * <tr><td>9</td><td>Free-space sections</td></tr>
+ * <tr><td>10</td><td>Shared object header message table</td></tr>
+ * <tr><td>11</td><td>Shared message record list</td></tr>
+ * <tr><td>12</td><td>Extensive array header</td></tr>
+ * <tr><td>13</td><td>Extensive array index block</td></tr>
+ * <tr><td>14</td><td>Extensive array super block</td></tr>
+ * <tr><td>15</td><td>Extensive array data block</td></tr>
+ * <tr><td>16</td><td>Extensive array data block page</td></tr>
+ * <tr><td>17</td><td>Fixed array super block</td></tr>
+ * <tr><td>18</td><td>Fixed array data block</td></tr>
+ * <tr><td>19</td><td>Fixed array data block page</td></tr>
+ * <tr><td>20</td><td>File's superblock (version 2)</td></tr>
+ * <tr><td colspan=2><sup>*</sup> All entries are of version 0 (zero) unless indicated
+ * otherwise.</td></tr>
+ * </table>
+ *
+ * \note On a system that is not atomic, the library might possibly read inconsistent
+ * metadata with checksum when performing single-writer/multiple-reader (SWMR)
+ * operations for an HDF5 file. Upon encountering such situations, the library
+ * will try reading the metadata again for a set number of times to attempt to
+ * obtain consistent data. The maximum number of read attempts used by the library
+ * will be either the value set via H5Pset_metadata_read_attempts() or the library
+ * default value when a value is not set.\n
+ * When the current number of metadata read attempts used in the library is unable
+ * to remedy the reading of inconsistent metadata on a system, the user can assess
+ * the information obtained via this routine to derive a different maximum value.
+ * The information can also be helpful for debugging purposes to identify potential
+ * issues with metadata flush dependencies and SWMR implementation in general.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
+/**
+ * \ingroup SWMR
+ *
+ * \brief Retrieves free-space section information for a file
+ *
+ * \file_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Fstart_swmr_write() will activate SWMR writing mode for a file
+ * associated with \p file_id. This routine will prepare and ensure
+ * the file is safe for SWMR writing as follows:
+ * \li Check that the file is opened with write access (#H5F_ACC_RDWR).
+ * \li Check that the file is opened with the latest library format to
+ * ensure data structures with check-summed metadata are used.
+ * \li Check that the file is not already marked in SWMR writing mode.
+ * \li Enable reading retries for check-summed metadata to remedy
+ * possible checksum failures from reading inconsistent metadata
+ * on a system that is not atomic.
+ * \li Turn off usage of the library's accumulator to avoid possible
+ * ordering problem on a system that is not atomic.
+ * \li Perform a flush of the file’s data buffers and metadata to set
+ * a consistent state for starting SWMR write operations.
+ *
+ * Library objects are groups, datasets, and committed datatypes. For
+ * the current implementation, groups and datasets can remain open when
+ * activating SWMR writing mode, but not committed datatypes. Attributes
+ * attached to objects cannot remain open either.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves free-space section information for a file
+ *
+ * \file_id
+ * \param[in] type The file memory allocation type
+ * \param[in] nsects The number of free-space sections
+ * \param[out] sect_info Array of instances of H5F_sect_info_t in which
+ * the free-space section information is to be returned
+ *
+ * \return Returns the number of free-space sections for the specified
+ * free-space manager in the file; otherwise returns a negative value.
+ *
+ * \details H5Fget_free_sections() retrieves free-space section information for
+ * the free-space manager with type that is associated with file
+ * \p file_id. If type is #H5FD_MEM_DEFAULT, this routine retrieves
+ * free-space section information for all the free-space managers in
+ * the file.
+ *
+ * Valid values for \p type are the following:
+ * \mem_types
+ *
+ * H5F_sect_info_t is defined as follows (in H5Fpublic.h):
+ * \snippet this H5F_sect_info_t_snip
+ *
+ * This routine retrieves free-space section information for \p nsects
+ * sections or at most the maximum number of sections in the specified
+ * free-space manager. If the number of sections is not known, a
+ * preliminary H5Fget_free_sections() call can be made by setting \p
+ * sect_info to NULL and the total number of free-space sections for
+ * the specified free-space manager will be returned. Users can then
+ * allocate space for entries in \p sect_info, each of which is
+ * defined as an H5F_sect_info_t \c struct.
+ *
+ * \attention \Bold{Failure Modes:} This routine will fail when the following
+ * is true:
+ * \li The library fails to retrieve the file creation property list
+ * associated with \p file_id.
+ * \li If the parameter \p sect_info is non-null, but the parameter
+ * \p nsects is equal to 0.
+ * \li The library fails to retrieve free-space section information
+ * for the file.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
+ H5F_sect_info_t *sect_info /*out*/);
+/**
+ * \ingroup H5F
+ *
+ * \brief Clears the external link open file cache
+ *
+ * \file_id
+ * \return \herr_t
+ *
+ * \details H5Fclear_elink_file_cache() evicts all the cached child files in
+ * the specified file’s external file cache, causing them to be closed
+ * if there is nothing else holding them open.
+ *
+ * H5Fclear_elink_file_cache() does not close the cache itself;
+ * subsequent external link traversals from the parent file will again
+ * cache the target file. See H5Pset_elink_file_cache_size() for
+ * information on closing the file cache.
+ *
+ * \see H5Pset_elink_file_cache_size(), H5Pget_elink_file_cache_size()
+ *
+ * \since 1.8.7
+ *
+ */
+H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Enables the switch of version bounds setting for a file
+ *
+ * \file_id
+ * \param[in] low The earliest version of the library that will be used for
+ * writing objects
+ * \param[in] high The latest version of the library that will be used for
+ * writing objects
+ *
+ * \return \herr_t
+ *
+ * \details H5Fset_libver_bounds() enables the switch of version bounds setting
+ * for an open file associated with \p file_id.
+ *
+ * For the parameters \p low and \p high, see the description for
+ * H5Pset_libver_bounds().
+ *
+ * \par Example
+ * \snippet H5F_examples.c libver_bounds
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
+/**
+ * \ingroup MDC
+ *
+ * \brief Starts logging metadata cache events if logging was previously enabled
+ *
+ * \file_id
+ *
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all \Emph{file metadata} reads and writes take place. File
+ * metadata is normally invisible to the user and is used by the
+ * library for purposes such as locating and indexing data. File
+ * metadata should not be confused with user metadata, which consists
+ * of attributes created by users and attached to HDF5 objects such
+ * as datasets via H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has been
+ * created that can be used by HDF5 developers for debugging and performance
+ * analysis. The functions that control this functionality will normally be
+ * of use to a very limited number of developers outside of The HDF Group.
+ * The functions have been documented to help users create logs that can
+ * be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is enabled
+ * via the H5Pset_mdc_log_options() function, which will modify the file
+ * access property list used to open or create a file. This function has
+ * a flag that determines whether logging begins at file open or starts
+ * in a paused state. Log messages can then be controlled via the
+ * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions.
+ * H5Pget_mdc_log_options() can be used to examine a file access property
+ * list, and H5Fget_mdc_logging_status() will return the current state of
+ * the logging flags.
+ *
+ * The log format is described in the \ref_mdc_logging document.
+ *
+ * \note Logging can only be started or stopped if metadata cache logging was enabled
+ * via H5Pset_mdc_log_options().\n
+ * When enabled and currently logging, the overhead of the logging feature will
+ * almost certainly be significant.\n
+ * The log file is opened when the HDF5 file is opened or created and not when
+ * this function is called for the first time.\n
+ * This function opens the log file and starts logging metadata cache operations
+ * for a particular file. Calling this function when logging has already been
+ * enabled will be considered an error.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
+/**
+ * \ingroup MDC
+ *
+ * \brief Stops logging metadata cache events if logging was previously enabled and is currently ongoing
+ *
+ * \file_id
+ *
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all \Emph{file metadata} reads and writes take place. File
+ * metadata is normally invisible to the user and is used by the
+ * library for purposes such as locating and indexing data. File
+ * metadata should not be confused with user metadata, which consists
+ * of attributes created by users and attached to HDF5 objects such
+ * as datasets via H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has been
+ * created that can be used by HDF5 developers for debugging and performance
+ * analysis. The functions that control this functionality will normally be
+ * of use to a very limited number of developers outside of The HDF Group.
+ * The functions have been documented to help users create logs that can
+ * be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is enabled
+ * via the H5Pset_mdc_log_options() function, which will modify the file
+ * access property list used to open or create a file. This function has
+ * a flag that determines whether logging begins at file open or starts
+ * in a paused state. Log messages can then be controlled via the
+ * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions.
+ * H5Pget_mdc_log_options() can be used to examine a file access property
+ * list, and H5Fget_mdc_logging_status() will return the current state of
+ * the logging flags.
+ *
+ * The log format is described in the \ref_mdc_logging document.
+ *
+ * \note Logging can only be started or stopped if metadata cache logging was enabled
+ * via H5Pset_mdc_log_options().\n
+ * This function only suspends the logging operations. The log file will remain
+ * open and will not be closed until the HDF5 file is closed.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
+/**
+ * \ingroup MDC
+ *
+ * \brief Gets the current metadata cache logging status
+ *
+ * \file_id
+ * \param[out] is_enabled Whether logging is enabled
+ * \param[out] is_currently_logging Whether events are currently being logged
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all \Emph{file metadata} reads and writes take place. File
+ * metadata is normally invisible to the user and is used by the
+ * library for purposes such as locating and indexing data. File
+ * metadata should not be confused with user metadata, which consists
+ * of attributes created by users and attached to HDF5 objects such
+ * as datasets via H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has been
+ * created that can be used by HDF5 developers for debugging and performance
+ * analysis. The functions that control this functionality will normally be
+ * of use to a very limited number of developers outside of The HDF Group.
+ * The functions have been documented to help users create logs that can
+ * be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is enabled
+ * via the H5Pset_mdc_log_options() function, which will modify the file
+ * access property list used to open or create a file. This function has
+ * a flag that determines whether logging begins at file open or starts
+ * in a paused state. Log messages can then be controlled via the
+ * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions.
+ * H5Pget_mdc_log_options() can be used to examine a file access property
+ * list, and H5Fget_mdc_logging_status() will return the current state of
+ * the logging flags.
+ *
+ * The log format is described in the \ref_mdc_logging document.
+ *
+ * \note Unlike H5Fstart_mdc_logging() and H5Fstop_mdc_logging(), this function can
+ * be called on any open file identifier.
+ *
+ * \since 1.10.0
+ */
+H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging);
+/**
+ * \ingroup SWMR
+ *
+ * \todo UFO?
+ */
+H5_DLL herr_t H5Fformat_convert(hid_t fid);
+/**
+ * \ingroup H5F
+ *
+ * \brief Resets the page buffer statistics
+ *
+ * \file_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Freset_page_buffering_stats() resets the page buffer statistics
+ * for a specified file identifier \p file_id.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves statistics about page access when it is enabled
+ *
+ * \file_id
+ * \param[out] accesses Two integer array for the number of metadata and raw
+ * data accesses to the page buffer
+ * \param[out] hits Two integer array for the number of metadata and raw data
+ * hits in the page buffer
+ * \param[out] misses Two integer array for the number of metadata and raw data
+ * misses in the page buffer
+ * \param[out] evictions Two integer array for the number of metadata and raw
+ * data evictions from the page buffer
+ * \param[out] bypasses Two integer array for the number of metadata and raw
+ * data accesses that bypass the page buffer
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_page_buffering_stats() retrieves page buffering statistics
+ * such as the number of metadata and raw data accesses (\p accesses),
+ * hits (\p hits), misses (\p misses), evictions (\p evictions), and
+ * accesses that bypass the page buffer (\p bypasses).
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2],
+ unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
+/**
+ * \ingroup MDC
+ *
+ * \brief Obtains information about a cache image if it exists
+ *
+ * \file_id
+ * \param[out] image_addr Offset of the cache image if it exists, or \c HADDR_UNDEF if it does not
+ * \param[out] image_size Length of the cache image if it exists, or 0 if it does not
+ * \returns \herr_t
+ *
+ * \details
+ * \parblock
+ * H5Fget_mdc_image_info() returns information about a cache image if it exists.
+ *
+ * When an HDF5 file is opened in Read/Write mode, any metadata cache image will
+ * be read and deleted from the file on the first metadata cache access (or, if
+ * persistent free space managers are enabled, on the first file space
+ * allocation / deallocation, or read of free space manager status, whichever
+ * comes first).
+ *
+ * Thus, if the file is opened Read/Write, H5Fget_mdc_image_info() should be called
+ * immediately after file open and before any other operation. If H5Fget_mdc_image_info()
+ * is called after the cache image is loaded, it will correctly report that no cache image
+ * exists, as the image will have already been read and deleted from the file. In the Read Only
+ * case, the function may be called at any time, as any cache image will not be deleted
+ * from the file.
+ * \endparblock
+ *
+ * \since 1.10.1
+ */
+H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves the setting for whether or not a file will create minimized
+ * dataset object headers
+ *
+ * \file_id
+ * \param[out] minimize Flag indicating whether the library will or will not
+ * create minimized dataset object headers
+ *
+ * \return \herr_t
+ *
+ * \details H5Fget_dset_no_attrs_hint() retrieves the no dataset attributes
+ * hint setting for the file specified by the file identifier \p
+ * file_id. This setting is used to inform the library to create
+ * minimized dataset object headers when \c TRUE.
+ *
+ * The setting's value is returned in the boolean pointer minimize.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize);
+/**
+ * \ingroup H5F
+ *
+ * \brief Sets the flag to create minimized dataset object headers
+ *
+ * \file_id
+ * \param[in] minimize Flag indicating whether the library will or will not
+ * create minimized dataset object headers
+ *
+ * \return \herr_t
+ *
+ * \details H5Fset_dset_no_attrs_hint() sets the no dataset attributes hint
+ * setting for the file specified by the file identifier \p file_id.
+ * If the boolean flag \p minimize is set to \c TRUE, then the library
+ * will create minimized dataset object headers in the file.
+ * \Bold{All} files that refer to the same file-on-disk will be
+ * affected by the most recent setting, regardless of the file
+ * identifier/handle (e.g., as returned by H5Fopen()). By setting the
+ * \p minimize flag to \c TRUE, the library expects that no attributes
+ * will be added to the dataset - attributes can be added, but they
+ * are appended with a continuation message, which can reduce
+ * performance.
+ *
+ * \attention This setting interacts with H5Pset_dset_no_attrs_hint(): if
+ * either is set to \c TRUE, then the created dataset's object header
+ * will be minimized.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize);
#ifdef H5_HAVE_PARALLEL
+/**
+ * \ingroup PH5F
+ *
+ * \brief Sets the MPI atomicity mode
+ *
+ * \file_id
+ * \param[in] flag Logical flag for atomicity setting. Valid values are:
+ * \li \c 1 -- Sets MPI file access to atomic mode.
+ * \li \c 0 -- Sets MPI file access to nonatomic mode.
+ * \returns \herr_t
+ *
+ * \par Motivation
+ * H5Fset_mpi_atomicity() is applicable only in parallel environments using MPI I/O.
+ * The function is one of the tools used to ensure sequential consistency. This means
+ * that a set of operations will behave as though they were performed in a serial
+ * order consistent with the program order.
+ *
+ * \details
+ * \parblock
+ * H5Fset_mpi_atomicity() sets MPI consistency semantics for data access to the file,
+ * \p file_id.
+ *
+ * If \p flag is set to \c 1, all file access operations will appear atomic, guaranteeing
+ * sequential consistency. If \p flag is set to \c 0, enforcement of atomic file access
+ * will be turned off.
+ *
+ * H5Fset_mpi_atomicity() is a collective function and all participating processes must
+ * pass the same values for \p file_id and \p flag.
+ *
+ * This function is available only when the HDF5 library is configured with parallel support
+ * (\Code{--enable-parallel}). It is useful only when used with the #H5FD_MPIO driver
+ * (see H5Pset_fapl_mpio()).
+ * \endparblock
+ *
+ * \attention
+ * \parblock
+ * H5Fset_mpi_atomicity() calls \Code{MPI_File_set_atomicity} underneath and is not supported
+ * if the execution platform does not support \Code{MPI_File_set_atomicity}. When it is
+ * supported and used, the performance of data access operations may drop significantly.
+ *
+ * In certain scenarios, even when \Code{MPI_File_set_atomicity} is supported, setting
+ * atomicity with H5Fset_mpi_atomicity() and \p flag set to 1 does not always yield
+ * strictly atomic updates. For example, some H5Dwrite() calls translate to multiple
+ * \Code{MPI_File_write_at} calls. This happens in all cases where the high-level file
+ * access routine translates to multiple lower level file access routines.
+ * The following scenarios will raise this issue:
+ * \li Non-contiguous file access using independent I/O
+ * \li Partial collective I/O using chunked access
+ * \li Collective I/O using filters or when data conversion is required
+ *
+ * This issue arises because MPI atomicity is a matter of MPI file access operations rather
+ * than HDF5 access operations. But the user is normally seeking atomicity at the HDF5 level.
+ * To accomplish this, the application must set a barrier after a write, H5Dwrite(), but before
+ * the next read, H5Dread(), in addition to calling H5Fset_mpi_atomicity().The barrier will
+ * guarantee that all underlying write operations execute atomically before the read
+ * operations starts. This ensures additional ordering semantics and will normally produce
+ * the desired behavior.
+ * \endparblock
+ *
+ * \see \ref_cons_semantics
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
+/**
+ * \ingroup PH5F
+ *
+ * \brief Retrieves the atomicity mode in use
+ *
+ * \file_id
+ * \param[out] flag Logical flag for atomicity setting. Valid values are:
+ * \li 1 -- MPI file access is set to atomic mode.
+ * \li 0 -- MPI file access is set to nonatomic mode.
+ * \returns \herr_t
+ *
+ * \details H5Fget_mpi_atomicity() retrieves the current consistency semantics mode for
+ * data access for the file \p file_id.
+ *
+ * Upon successful return, \p flag will be set to \c 1 if file access is set
+ * to atomic mode and \c 0 if file access is set to nonatomic mode.
+ *
+ * \see \ref_cons_semantics
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#endif /* H5_HAVE_PARALLEL */
@@ -289,27 +1748,103 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Macros */
-#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/
+#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /**< Print debug info \deprecated In which version? */
/* Typedefs */
-/* Current "global" information about file */
+/**
+ * Current "global" information about file
+ */
+//! <!-- [H5F_info1_t_snip] -->
typedef struct H5F_info1_t {
- hsize_t super_ext_size; /* Superblock extension size */
+ hsize_t super_ext_size; /**< Superblock extension size */
struct {
- hsize_t hdr_size; /* Shared object header message header size */
- H5_ih_info_t msgs_info; /* Shared object header message index & heap size */
+ hsize_t hdr_size; /**< Shared object header message header size */
+ H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */
} sohm;
} H5F_info1_t;
+//! <!-- [H5F_info1_t_snip] -->
/* Function prototypes */
-H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
+/**
+ * \ingroup H5F
+ *
+ * \brief Retrieves name of file to which object belongs
+ *
+ * \fgdta_obj_id
+ * \param[out] file_info Buffer for global file information
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function has been renamed from H5Fget_info() and is
+ * deprecated in favor of the macro #H5Fget_info or the function
+ * H5Fget_info2().
+ *
+ * \details H5Fget_info1() returns global information for the file associated
+ * with the object identifier \p obj_id in the H5F_info1_t \c struct
+ * named \p file_info.
+ *
+ * \p obj_id is an identifier for any object in the file of interest.
+ *
+ * H5F_info1_t struct is defined in H5Fpublic.h as follows:
+ * \snippet this H5F_info1_t_snip
+ *
+ * \c super_ext_size is the size of the superblock extension.
+ *
+ * The \c sohm sub-struct contains shared object header message
+ * information as follows:
+ * \li \c hdr_size is the size of the shared object header message.
+ * \li \c msgs_info is an H5_ih_info_t struct defined in H5public.h as
+ * follows: \snippet H5public.h H5_ih_info_t_snip
+ *
+ * \li \p index_size is the summed size of all the shared object
+ * header indexes. Each index might be either a B-tree or
+ * a list.
+ *
+ * \version 1.10.0 Function H5Fget_info() renamed to H5Fget_info1() and
+ * deprecated in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *file_info);
+/**
+ * \ingroup H5F
+ *
+ * \brief Sets thelatest version of the library to be used for writing objects
+ *
+ * \file_id
+ * \param[in] latest_format Latest format flag
+ *
+ * \return \herr_t
+ *
+ * \deprecated When?
+ *
+ * \todo In which version was this function deprecated?
+ *
+ */
H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
-H5_DLL htri_t H5Fis_hdf5(const char *filename);
+/**
+ * \ingroup H5F
+ *
+ * \brief Determines whether a file is in the HDF5 format
+ *
+ * \param[in] file_name File name
+ *
+ * \return \htri_t
+ *
+ * \deprecated When?
+ *
+ * \details H5Fis_hdf5() determines whether a file is in the HDF5 format.
+ *
+ * \todo In which version was this function deprecated?
+ *
+ */
+H5_DLL htri_t H5Fis_hdf5(const char *file_name);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
#endif
-#endif /* _H5Fpublic_H */
+#endif /* H5Fpublic_H */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 204049d..04792b4 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fquery.c
* Jan 10 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File structure query routines.
*
@@ -200,8 +200,8 @@ H5F_get_actual_name(const H5F_t *f)
* Function: H5F_get_extpath
*
* Purpose: Retrieve the file's 'extpath' flags
- * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's
- *location when searching the target file.
+ * This is used by H5L_extern_traverse() and H5D_build_file_prefix()
+ * to retrieve the main file's location when searching the target file.
*
* Return: 'extpath' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
@@ -213,6 +213,7 @@ H5F_get_extpath(const H5F_t *f)
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
+ HDassert(f->shared);
HDassert(f->shared->extpath);
FUNC_LEAVE_NOAPI(f->shared->extpath)
@@ -722,7 +723,6 @@ H5F_sieve_buf_size(const H5F_t *f)
* Failure: (should not happen)
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jul 8 2005
*
*-------------------------------------------------------------------------
@@ -1228,8 +1228,8 @@ H5F_get_null_fsm_addr(const H5F_t *f)
*
* Return: VOL class pointer for file, can't fail
*
- * Programmer: Quincey Koziol
- * Saturday, August 17, 2019
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
*
*-------------------------------------------------------------------------
*/
@@ -1271,8 +1271,8 @@ H5F_get_vol_obj(const H5F_t *f)
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Quincey Koziol
- * Saturday, August 17, 2019
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
*
*-------------------------------------------------------------------------
*/
@@ -1299,3 +1299,23 @@ H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info)
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/H5Fsfile.c b/src/H5Fsfile.c
index 79e6fbe..be45e78 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Fspace.c b/src/H5Fspace.c
index 33e4439..29495f1 100644
--- a/src/H5Fspace.c
+++ b/src/H5Fspace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fspace.c
* Dec 30 2013
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Space allocation routines for the file.
*
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 33451be..0c71dd2 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -309,7 +309,6 @@ done:
* Failure: FAIL
*
* Programmer: Bill Wendling
- * wendling@ncsa.uiuc.edu
* Sept 12, 2003
*
*-------------------------------------------------------------------------
@@ -882,12 +881,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Do the same kluge until we know for sure. VC */
#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */
- /* KLUGE ALERT!!
- *
- * H5F__super_ext_write_msg() expects f->shared->sblock to
- * be set -- verify that it is NULL, and then set it.
- * Set it back to NULL when we are done.
- */
+ /* KLUGE ALERT!!
+ *
+ * H5F__super_ext_write_msg() expects f->shared->sblock to
+ * be set -- verify that it is NULL, and then set it.
+ * Set it back to NULL when we are done.
+ */
HDassert(f->shared->sblock == NULL);
f->shared->sblock = sblock;
#endif /* JRM */
@@ -899,9 +898,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
"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)
@@ -1068,7 +1072,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 1b9ca8d..28ff82f 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Fsuper_cache.c
* Aug 15 2009
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement file superblock & driver info metadata cache methods.
*
@@ -291,7 +291,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -319,7 +318,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
*
*-------------------------------------------------------------------------
@@ -407,7 +405,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
*
*-------------------------------------------------------------------------
@@ -600,7 +597,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 19, 2013
*
*-------------------------------------------------------------------------
@@ -632,7 +628,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
*
*-------------------------------------------------------------------------
@@ -774,7 +769,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -808,7 +802,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -835,7 +828,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
*
*-------------------------------------------------------------------------
@@ -878,7 +870,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20 2013
*
*-------------------------------------------------------------------------
@@ -938,7 +929,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -971,7 +961,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
*
*-------------------------------------------------------------------------
@@ -1033,7 +1022,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 f02aa4d..1f5e7e2 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ftest.c
* Jan 3 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File testing routines.
*
@@ -253,3 +253,35 @@ H5F__same_file_test(hid_t file_id1, hid_t file_id2)
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/H5G.c b/src/H5G.c
index a15e500..f5d1dc5 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -181,7 +181,7 @@ H5G__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the group IDs */
+ /* Initialize the ID group for the group IDs */
if (H5I_register_type(H5I_GROUP_CLS) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface")
@@ -370,9 +370,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
- /* Get an atom for the group */
+ /* Get an ID for the group */
if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle")
done:
if (H5I_INVALID_HID == ret_value)
@@ -417,9 +417,9 @@ done:
hid_t
H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
- void * grp = NULL; /* Structure for new group */
- H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
- H5VL_loc_params_t loc_params;
+ void * grp = NULL; /* Structure for new group */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
@@ -448,9 +448,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
- /* Get an atom for the group */
+ /* Get an ID for the group */
if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle")
done:
/* Cleanup on failure */
@@ -726,15 +726,15 @@ H5Gclose(hid_t group_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
- /* Check args */
- if (NULL == H5I_object_verify(group_id, H5I_GROUP))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
+ /* Check arguments */
+ if (H5I_GROUP != H5I_get_type(group_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID")
- /* Decrement the counter on the group atom. It will be freed if the count
+ /* Decrement the counter on the group ID. It will be freed if the count
* reaches zero.
*/
if (H5I_dec_app_ref(group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "decrementing group ID failed")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index ee0b26e..dd147ae 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gbtree2.c
* Sep 9 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: v2 B-tree callbacks for indexing fields on links
*
@@ -70,23 +70,23 @@ 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, void *ctx);
-static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx);
-static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record,
- const void *_udata);
+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, void *ctx);
+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, void *ctx);
-static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx);
-static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record,
- const void *_udata);
+static herr_t H5G__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx);
+static herr_t H5G__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx);
+static herr_t H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record,
+ 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);
/*********************/
/* Package Variables */
@@ -99,11 +99,11 @@ const H5B2_class_t H5G_BT2_NAME[1] = {{
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_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_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 */
@@ -114,11 +114,11 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{
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 */
}};
/*****************************/
@@ -130,7 +130,7 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{
/*******************/
/*-------------------------------------------------------------------------
- * 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
@@ -138,19 +138,18 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{
* 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,
@@ -171,10 +170,10 @@ 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
*
@@ -187,19 +186,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_btree2_name_compare
@@ -228,17 +227,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);
@@ -261,7 +249,7 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int
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 */
@@ -273,7 +261,7 @@ done:
} /* H5G__dense_btree2_name_compare() */
/*-------------------------------------------------------------------------
- * Function: H5G_dense_btree2_name_encode
+ * Function: H5G__dense_btree2_name_encode
*
* Purpose: Encode native information into raw form for storing on disk
*
@@ -286,21 +274,21 @@ 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
*
@@ -313,21 +301,21 @@ 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
*
@@ -340,23 +328,23 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+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);
for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
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
*
@@ -369,22 +357,22 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_n
*-------------------------------------------------------------------------
*/
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
*
@@ -398,29 +386,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;
@@ -430,10 +406,10 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, in
*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
*
@@ -446,21 +422,21 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, in
*-------------------------------------------------------------------------
*/
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
*
@@ -473,21 +449,21 @@ 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
*
@@ -500,17 +476,17 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+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);
for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++)
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 a78384f..4713193 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gcache.c
* Feb 5 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement group metadata cache methods.
*
@@ -176,7 +176,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* magic */
- if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index 5bd2243..af188d8 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gcompact.c
* Sep 5 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for handling compact storage.
*
@@ -72,7 +72,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
*
*-------------------------------------------------------------------------
@@ -173,7 +172,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
*-------------------------------------------------------------------------
@@ -249,7 +247,7 @@ done:
} /* end H5G__compact_get_name_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5G_compact_remove_common_cb
+ * Function: H5G__compact_remove_common_cb
*
* Purpose: Common callback routine for deleting 'link' message for a
* particular name.
@@ -257,19 +255,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);
@@ -287,7 +284,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() */
/*-------------------------------------------------------------------------
* Function: H5G__compact_remove
@@ -318,7 +315,7 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const ch
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:
@@ -364,7 +361,7 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5RS
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:
@@ -427,7 +424,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
@@ -472,7 +468,6 @@ done:
* Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
@@ -517,7 +512,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 0b3f428..6100361 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gdense.c
* Sep 9 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Routines for operating on "dense" link storage for a
* group in a file.
@@ -241,7 +241,6 @@ typedef struct {
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 9 2006
*
*-------------------------------------------------------------------------
@@ -285,17 +284,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));
@@ -312,9 +305,6 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline)
/* 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) {
@@ -333,10 +323,7 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline)
/* 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 */
+ } /* end if */
done:
/* Close the open objects */
@@ -358,7 +345,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 11 2006
*
*-------------------------------------------------------------------------
@@ -384,18 +370,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))))
@@ -462,26 +440,25 @@ done:
} /* end H5G__dense_insert() */
/*-------------------------------------------------------------------------
- * 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.
@@ -495,7 +472,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_lookup
@@ -505,7 +482,6 @@ done:
* Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 11 2006
*
*-------------------------------------------------------------------------
@@ -541,7 +517,7 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, H5O_link
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 */
@@ -559,7 +535,7 @@ done:
} /* end H5G__dense_lookup() */
/*-------------------------------------------------------------------------
- * 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
@@ -567,19 +543,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,
@@ -596,30 +571,29 @@ 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 */
@@ -627,12 +601,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_lookup_by_idx
@@ -643,7 +617,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 7 2006
*
*-------------------------------------------------------------------------
@@ -713,7 +686,7 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type
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 */
@@ -743,7 +716,7 @@ done:
} /* end H5G__dense_lookup_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5G_dense_build_table_cb
+ * Function: H5G__dense_build_table_cb
*
* Purpose: Callback routine for building table of links from dense
* link storage.
@@ -752,18 +725,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);
@@ -779,7 +751,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_build_table
@@ -828,7 +800,7 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
/* 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)
+ 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 */
@@ -843,7 +815,7 @@ done:
} /* end H5G__dense_build_table() */
/*-------------------------------------------------------------------------
- * 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
@@ -851,18 +823,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
@@ -877,29 +848,28 @@ 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)
@@ -912,7 +882,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 */
@@ -932,7 +902,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_iterate
@@ -942,7 +912,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 11 2006
*
*-------------------------------------------------------------------------
@@ -1019,7 +988,7 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i
/* 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 */
@@ -1049,7 +1018,7 @@ done:
} /* end H5G__dense_iterate() */
/*-------------------------------------------------------------------------
- * 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
@@ -1057,19 +1026,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,
@@ -1091,30 +1059,29 @@ 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 */
@@ -1123,7 +1090,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 */
@@ -1131,7 +1098,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_get_name_by_idx
@@ -1142,7 +1109,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 19 2006
*
*-------------------------------------------------------------------------
@@ -1212,7 +1178,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
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 */
@@ -1251,27 +1217,26 @@ done:
} /* end H5G__dense_get_name_by_idx() */
/*-------------------------------------------------------------------------
- * 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,
@@ -1314,30 +1279,29 @@ 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;
@@ -1346,7 +1310,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 */
@@ -1356,7 +1320,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_remove
@@ -1366,7 +1330,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 12 2006
*
*-------------------------------------------------------------------------
@@ -1409,7 +1372,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:
@@ -1423,25 +1386,24 @@ done:
} /* end H5G__dense_remove() */
/*-------------------------------------------------------------------------
- * 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,
@@ -1452,23 +1414,22 @@ 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 */
@@ -1476,7 +1437,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) {
@@ -1499,7 +1460,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);
@@ -1559,7 +1520,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() */
/*-------------------------------------------------------------------------
* Function: H5G__dense_remove_by_idx
@@ -1570,7 +1531,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 14 2006
*
*-------------------------------------------------------------------------
@@ -1641,7 +1601,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 */
@@ -1678,7 +1638,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sep 12 2006
*
*-------------------------------------------------------------------------
@@ -1721,7 +1680,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 b5bfbf6..037669b 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gdeprec.c
* June 21 2006
- * James Laird <jlaird@ncsa.uiuc.edu>
+ * James Laird
*
* Purpose: Deprecated functions from the H5G interface. These
* functions are here for compatibility purposes and may be
@@ -141,10 +141,10 @@ H5G_map_obj_type(H5O_type_t obj_type)
* specified NAME. The group is opened for write access
* and it's object ID is returned.
*
- * The optional SIZE_HINT specifies how much file space to
- * reserve to store the names that will appear in this
- * group. If a non-positive value is supplied for the SIZE_HINT
- * then a default size is chosen.
+ * The SIZE_HINT parameter specifies how much file space to reserve
+ * to store the names that will appear in this group. This number
+ * must be less than or equal to UINT32_MAX. If zero is supplied
+ * for the SIZE_HINT then a default size is chosen.
*
* Note: Deprecated in favor of H5Gcreate2
*
@@ -174,6 +174,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
+ if (size_hint > UINT32_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX")
/* Check if we need to create a non-standard GCPL */
if (size_hint > 0) {
@@ -971,7 +973,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name,
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)
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 7d1c06d..2f1a2b4 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, September 19, 1997
*/
@@ -53,9 +53,6 @@
/* Package Variables */
/*********************/
-/* Declare extern the PQ free list for the wrapped strings */
-H5FL_BLK_EXTERN(str_buf);
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -76,7 +73,6 @@ H5FL_BLK_EXTERN(str_buf);
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 18 1997
*
*-------------------------------------------------------------------------
@@ -117,7 +113,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 18 1997
*
*-------------------------------------------------------------------------
@@ -182,7 +177,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 18 1997
*
*-------------------------------------------------------------------------
@@ -221,7 +215,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 18 1997
*
*-------------------------------------------------------------------------
@@ -292,7 +285,6 @@ done:
* Failure: Negative
*
* Programmer: Pedro Vicente
- * pvn@ncsa.uiuc.edu
* ???day, August ??, 2002
*
* Notes: 'depth' parameter determines how much of the group entry
@@ -370,7 +362,6 @@ H5G__ent_reset(H5G_entry_t *ent)
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
@@ -393,11 +384,8 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
/* Reset the new entry */
H5G__ent_reset(ent);
- /*
- * Add the new name to the heap.
- */
- name_offset = H5HL_insert(f, heap, HDstrlen(name) + 1, name);
- if (0 == name_offset || UFAIL == name_offset)
+ /* Add the new name to the heap */
+ if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap")
ent->name_off = name_offset;
@@ -485,14 +473,12 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
size_t lnk_offset; /* Offset to sym-link value */
/* Insert link value into local heap */
- if (UFAIL ==
- (lnk_offset = H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name)))
+ if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap")
ent->type = H5G_CACHED_SLINK;
ent->cache.slink.lval_offset = lnk_offset;
- } /* end case */
- break;
+ } break;
case H5L_TYPE_ERROR:
case H5L_TYPE_EXTERNAL:
@@ -513,7 +499,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 29 1997
*
*-------------------------------------------------------------------------
@@ -533,7 +518,7 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Name offset into private heap:", (unsigned long)(ent->name_off));
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object header address:", ent->header);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object header address:", ent->header);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cache info type:");
switch (ent->type) {
@@ -545,10 +530,10 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con
HDfprintf(stream, "Symbol Table\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached entry information:");
- HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth,
"B-tree address:", ent->cache.stab.btree_addr);
- HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth,
"Heap address:", ent->cache.stab.heap_addr);
break;
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 2b6be10..7488357 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gint.c
* April 5 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: General use, "internal" routines for groups.
*
@@ -83,6 +83,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);
/*********************/
/* Package Variables */
@@ -167,7 +168,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -696,7 +696,7 @@ H5G_unmount(H5G_t *grp)
} /* end H5G_unmount() */
/*-------------------------------------------------------------------------
- * Function: H5G_iterate_cb
+ * Function: H5G__iterate_cb
*
* Purpose: Callback function for iterating over links in a group
*
@@ -709,12 +709,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);
@@ -745,7 +745,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() */
/*-------------------------------------------------------------------------
* Function: H5G_iterate
@@ -792,7 +792,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter
/* 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)
+ 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:
@@ -808,7 +808,7 @@ done:
} /* end H5G_iterate() */
/*-------------------------------------------------------------------------
- * Function: H5G_free_visit_visited
+ * Function: H5G__free_visit_visited
*
* Purpose: Free the key for an object visited during a group traversal
*
@@ -820,17 +820,17 @@ 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
*
@@ -843,7 +843,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 */
@@ -856,7 +856,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);
@@ -972,7 +972,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata)
/* Iterate over links in group */
ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL,
- H5G_visit_cb, udata);
+ H5G__visit_cb, udata);
/* Restore location */
udata->curr_loc = old_loc;
@@ -990,7 +990,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() */
/*-------------------------------------------------------------------------
* Function: H5G_visit
@@ -1114,14 +1114,14 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o
/* 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)
+ 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 286f63e..629cb11 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Glink.c
* Nov 13 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Functions for handling links in groups.
*
@@ -58,10 +58,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);
/*********************/
/* Package Variables */
@@ -76,7 +76,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
@@ -88,21 +88,20 @@ 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
@@ -114,21 +113,20 @@ 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
@@ -139,17 +137,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;
@@ -159,10 +156,10 @@ 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
@@ -173,17 +170,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;
@@ -193,7 +189,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() */
/*-------------------------------------------------------------------------
* Function: H5G__ent_to_link
@@ -203,7 +199,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
*
*-------------------------------------------------------------------------
@@ -422,18 +417,18 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_orde
/* 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 */
@@ -541,7 +536,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 91daf1e..54c2cee 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gloc.c
* Sep 13 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for working with group "locations"
*
@@ -597,7 +597,7 @@ done:
} /* end H5G__loc_insert() */
/*-------------------------------------------------------------------------
- * Function: H5G_loc_exists_cb
+ * Function: H5G__loc_exists_cb
*
* Purpose: Callback for checking if an object exists
*
@@ -609,13 +609,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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_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)
@@ -631,7 +631,7 @@ H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_U
*own_loc = H5G_OWN_NONE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_loc_exists_cb() */
+} /* end H5G__loc_exists_cb() */
/*-------------------------------------------------------------------------
* Function: H5G_loc_exists
@@ -662,7 +662,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 */
@@ -781,9 +781,9 @@ done:
} /* end H5G__loc_info_cb() */
/*-------------------------------------------------------------------------
- * 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 1711863..fe26bd2 100644
--- a/src/H5Gmodule.h
+++ b/src/H5Gmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5G package. Including this header means that the source file
* is part of the H5G package.
*/
-#ifndef _H5Gmodule_H
-#define _H5Gmodule_H
+#ifndef H5Gmodule_H
+#define H5Gmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,96 @@
#define H5_MY_PKG_ERR H5E_SYM
#define H5_MY_PKG_INIT YES
-#endif /* _H5Gmodule_H */
+/**
+ * \defgroup H5G H5G
+ *
+ * \details \Bold{Groups in HDF5:} A group associates names with objects and
+ * provides a mechanism for mapping a name to an object. Since all
+ * objects appear in at least one group (with the possible exception of
+ * the root object) and since objects can have names in more than one
+ * group, the set of all objects in an HDF5 file is a directed
+ * graph. The internal nodes (nodes with out-degree greater than zero)
+ * must be groups while the leaf nodes (nodes with out-degree zero) are
+ * either empty groups or objects of some other type. Exactly one
+ * object in every non-empty file is the root object. The root object
+ * always has a positive in-degree because it is pointed to by the file
+ * super block.
+ *
+ * \Bold{Locating objects in the HDF5 file hierarchy:} An object name
+ * consists of one or more components separated from one another by
+ * slashes. An absolute name begins with a slash and the object is
+ * located by looking for the first component in the root object, then
+ * looking for the second component in the first object, etc., until
+ * the entire name is traversed. A relative name does not begin with a
+ * slash and the traversal begins at the location specified by the
+ * create or access function.
+ *
+ * \Bold{Group implementations in HDF5:} The original HDF5 group
+ * implementation provided a single indexed structure for link
+ * storage. A new group implementation, in HDF5 Release 1.8.0, enables
+ * more efficient compact storage for very small groups, improved link
+ * indexing for large groups, and other advanced features.
+ *
+ * \li The \Emph{original indexed} format remains the default. Links
+ * are stored in a B-tree in the group’s local heap.
+ * \li Groups created in the new \Emph{compact-or-indexed} format, the
+ * implementation introduced with Release 1.8.0, can be tuned for
+ * performance, switching between the compact and indexed formats
+ * at thresholds set in the user application.
+ * - The \Emph{compact} format will conserve file space and processing
+ * overhead when working with small groups and is particularly
+ * valuable when a group contains no links. Links are stored
+ * as a list of messages in the group’s header.
+ * - The \Emph{indexed} format will yield improved
+ * performance when working with large groups, e.g., groups
+ * containing thousands to millions of members. Links are stored in
+ * a fractal heap and indexed with an improved B-tree.
+ * \li The new implementation also enables the use of link names consisting of
+ * non-ASCII character sets (see H5Pset_char_encoding()) and is
+ * required for all link types other than hard or soft links, e.g.,
+ * external and user-defined links (see the \ref H5L APIs).
+ *
+ * The original group structure and the newer structures are not
+ * directly interoperable. By default, a group will be created in the
+ * original indexed format. An existing group can be changed to a
+ * compact-or-indexed format if the need arises; there is no capability
+ * to change back. As stated above, once in the compact-or-indexed
+ * format, a group can switch between compact and indexed as needed.
+ *
+ * Groups will be initially created in the compact-or-indexed format
+ * only when one or more of the following conditions is met:
+ * \li The low version bound value of the library version bounds property
+ * has been set to Release 1.8.0 or later in the file access property
+ * list (see H5Pset_libver_bounds()). Currently, that would require an
+ * H5Pset_libver_bounds() call with the low parameter set to
+ * #H5F_LIBVER_LATEST.\n When this property is set for an HDF5 file,
+ * all objects in the file will be created using the latest available
+ * format; no effort will be made to create a file that can be read by
+ * older libraries.
+ * \li The creation order tracking property, #H5P_CRT_ORDER_TRACKED, has been
+ * set in the group creation property list (see H5Pset_link_creation_order()).
+ *
+ * An existing group, currently in the original indexed format, will be
+ * converted to the compact-or-indexed format upon the occurrence of
+ * any of the following events:
+ * \li An external or user-defined link is inserted into the group.
+ * \li A link named with a string composed of non-ASCII characters is
+ * inserted into the group.
+ *
+ * The compact-or-indexed format offers performance improvements that
+ * will be most notable at the extremes, i.e., in groups with zero
+ * members and in groups with tens of thousands of members. But
+ * measurable differences may sometimes appear at a threshold as low as
+ * eight group members. Since these performance thresholds and criteria
+ * differ from application to application, tunable settings are
+ * provided to govern the switch between the compact and indexed
+ * formats (see H5Pset_link_phase_change()). Optimal thresholds will
+ * depend on the application and the operating environment.
+ *
+ * Future versions of HDF5 will retain the ability to create, read,
+ * write, and manipulate all groups stored in either the original
+ * indexed format or the compact-or-indexed format.
+ *
+ */
+
+#endif /* H5Gmodule_H */
diff --git a/src/H5Gname.c b/src/H5Gname.c
index fecabbf..cc8eaf4 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gname.c
* Sep 12 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for handling group hierarchy paths.
*
@@ -77,14 +77,11 @@ 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);
-#ifdef NOT_YET
-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, 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 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 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);
/*********************/
/* Package Variables */
@@ -114,7 +111,6 @@ H5FL_BLK_EXTERN(str_buf);
* Failure: Ptr to the null terminator of NAME.
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -198,28 +194,28 @@ done:
} /* end H5G_normalize() */
/*-------------------------------------------------------------------------
- * 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);
@@ -260,23 +256,23 @@ 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 */
@@ -285,7 +281,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);
@@ -320,7 +316,7 @@ H5G_build_fullpath(const char *prefix, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_build_fullpath() */
+} /* end H5G__build_fullpath() */
/*-------------------------------------------------------------------------
* Function: H5G_build_fullpath_refstr_str
@@ -330,7 +326,7 @@ done:
* Return: Success: Non-NULL, combined path
* Failure: NULL
*
- * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu
+ * Programmer: Quincey Koziol
* Tuesday, October 11, 2005
*
*-------------------------------------------------------------------------
@@ -351,49 +347,11 @@ 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() */
-#ifdef NOT_YET
-
-/*-------------------------------------------------------------------------
- * Function: H5G_name_build_refstr_refstr
- *
- * Purpose: Build a full path from a prefix & base pair of reference counted
- * strings
- *
- * Return: Pointer to reference counted string on success, NULL on error
- *
- * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu
- *
- * 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)
-{
- 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
-
- /* Get the pointer to the prefix */
- prefix = H5RS_get_str(prefix_r);
-
- /* Get the pointer to the raw src user path */
- name = H5RS_get_str(name_r);
-
- /* Create reference counted string for path */
- ret_value = H5G_build_fullpath(prefix, name);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_build_fullpath_refstr_refstr() */
-#endif /* NOT_YET */
-
/*-------------------------------------------------------------------------
* Function: H5G__name_init
*
@@ -433,7 +391,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
*
*-------------------------------------------------------------------------
@@ -536,10 +494,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
@@ -620,7 +574,7 @@ H5G_name_reset(H5G_name_t *name)
*
* Return: Success
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: August 22, 2002
*
@@ -648,7 +602,7 @@ H5G_name_free(H5G_name_t *name)
} /* end H5G_name_free() */
/*-------------------------------------------------------------------------
- * Function: H5G_name_move_path
+ * Function: H5G__name_move_path
*
* Purpose: Update a user or canonical path after an object moves
*
@@ -661,15 +615,15 @@ 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,
- const char *dst_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 */
size_t path_len; /* Length of path */
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);
@@ -746,23 +700,23 @@ 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 */
@@ -771,7 +725,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);
@@ -890,7 +844,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)++;
@@ -941,7 +895,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)--;
@@ -955,7 +909,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 */
@@ -967,7 +921,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*/
@@ -996,7 +950,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 */
@@ -1024,7 +978,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() */
/*-------------------------------------------------------------------------
* Function: H5G_name_replace
@@ -1038,7 +992,7 @@ done:
*
* Return: Success: 0, Failure: -1
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: June 11, 2002
*
@@ -1149,17 +1103,17 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS
/* 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 */
@@ -1169,7 +1123,7 @@ done:
} /* end H5G_name_replace() */
/*-------------------------------------------------------------------------
- * Function: H5G_get_name_by_addr_cb
+ * Function: H5G__get_name_by_addr_cb
*
* Purpose: Callback for retrieving object's name by address
*
@@ -1183,7 +1137,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, void *_udata)
+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 */
H5G_loc_t obj_loc; /* Location of object */
@@ -1192,7 +1146,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, v
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);
@@ -1242,7 +1196,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() */
/*-------------------------------------------------------------------------
* Function: H5G_get_name_by_addr
@@ -1290,7 +1244,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,
+ 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)
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 628b91b..9a7da0f 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gnode.c
* Jun 26 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Functions for handling symbol table nodes. A
* symbol table node is a small collection of symbol
@@ -70,20 +70,20 @@ 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, void *_udata);
+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, 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, const void *key, const void *udata);
+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, const void *key, const void *udata);
/*********************/
/* Package Variables */
@@ -93,19 +93,19 @@ static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, const
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 */
@@ -123,7 +123,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.
*
@@ -134,40 +134,37 @@ 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);
@@ -176,27 +173,26 @@ 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);
@@ -205,10 +201,10 @@ 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.
*
@@ -220,12 +216,12 @@ 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)
+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);
@@ -243,7 +239,7 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const
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() */
/*-------------------------------------------------------------------------
* Function: H5G__node_free
@@ -253,7 +249,6 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jan 15 2003
*
*-------------------------------------------------------------------------
@@ -292,7 +287,6 @@ H5G__node_free(H5G_node_t *sym)
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -348,7 +342,7 @@ done:
} /* end H5G__node_create() */
/*-------------------------------------------------------------------------
- * 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
@@ -363,15 +357,12 @@ done:
* Failure: FAIL (same as LT_KEY<RT_KEY)
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key)
+H5G__node_cmp2(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;
@@ -379,7 +370,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key)
const char * s1, *s2;
int ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(udata && udata->heap);
@@ -397,10 +388,10 @@ 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)
@@ -419,15 +410,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;
@@ -435,7 +423,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);
@@ -457,10 +445,10 @@ 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.
@@ -480,13 +468,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, void *_udata)
+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;
H5G_node_t * sn = NULL;
@@ -495,7 +482,7 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, void
const char * s;
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/*
* Check arguments.
@@ -539,7 +526,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() */
/*-------------------------------------------------------------------------
* Function: H5G__node_insert
@@ -568,7 +555,6 @@ done:
* Failure: H5B_INS_ERROR, NEW_NODE_P might not be initialized.
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 24 1997
*
*-------------------------------------------------------------------------
@@ -707,7 +693,7 @@ done:
} /* end H5G__node_insert() */
/*-------------------------------------------------------------------------
- * 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
@@ -735,9 +721,9 @@ done:
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-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*/)
+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*/)
{
H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
H5G_bt_rm_t * udata = (H5G_bt_rm_t *)_udata;
@@ -747,7 +733,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);
@@ -917,7 +903,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() */
/*-------------------------------------------------------------------------
* Function: H5G__node_iterate
@@ -927,7 +913,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 24 1997
*
*-------------------------------------------------------------------------
@@ -1341,7 +1326,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 19 2006
*
*-------------------------------------------------------------------------
@@ -1448,7 +1432,6 @@ H5G__node_iterate_size(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t H5_
* 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 ac22770..7ebd65a 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gobj.c
* Sep 5 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for abstract handling of objects in groups.
*
@@ -80,7 +80,7 @@ typedef struct {
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned idx, void *_udata);
+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);
/*********************/
@@ -103,7 +103,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
*
*-------------------------------------------------------------------------
@@ -157,7 +156,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 29 2005
*
*-------------------------------------------------------------------------
@@ -287,7 +285,6 @@ done:
* Failure: FAIL if error occurred
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 11 2007
*
*-------------------------------------------------------------------------
@@ -342,7 +339,7 @@ done:
} /* end H5G__obj_get_linfo() */
/*-------------------------------------------------------------------------
- * 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.
@@ -350,19 +347,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);
@@ -373,11 +369,11 @@ 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).
@@ -385,18 +381,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);
@@ -409,7 +404,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() */
/*-------------------------------------------------------------------------
* Function: H5G_obj_insert
@@ -423,7 +418,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
*-------------------------------------------------------------------------
@@ -509,7 +503,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")
@@ -542,7 +536,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,
+ 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")
@@ -691,7 +685,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 27 2006
*
*-------------------------------------------------------------------------
@@ -1021,7 +1014,7 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5
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);
@@ -1071,7 +1064,7 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5
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() */
/*-------------------------------------------------------------------------
@@ -1082,7 +1075,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 26 2005
*
*-------------------------------------------------------------------------
@@ -1134,7 +1126,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 84f59dc..f6ac791 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -323,7 +323,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);
@@ -398,5 +398,5 @@ 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 3df520f..b0adf30 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, September 18, 1997
*
* Purpose: This file contains declarations which are visible
@@ -23,19 +23,19 @@
#error "Do not include this file outside the H5G package!"
#endif
-#ifndef _H5Gpkg_H
-#define _H5Gpkg_H
+#ifndef H5Gpkg_H
+#define H5Gpkg_H
/* Get package's private header */
#include "H5Gprivate.h"
/* Other private headers needed by this file */
-#include "H5B2private.h" /* v2 B-trees */
+#include "H5B2private.h" /* v2 B-trees */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5HFprivate.h" /* Fractal heaps */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5SLprivate.h" /* Skip lists */
+#include "H5HFprivate.h" /* Fractal heaps */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
@@ -46,10 +46,11 @@
/* Size of a symbol table node on disk */
#define H5G_NODE_SIZE(f) \
- ( /* General metadata fields */ \
- H5_SIZEOF_MAGIC + 1 /* Version */ \
- + 1 /* Reserved */ \
- + 2 /* Number of symbols */ \
+ ( /* General metadata fields */ \
+ H5_SIZEOF_MAGIC /*magic number */ \
+ + 1 /* Version */ \
+ + 1 /* Reserved */ \
+ + 2 /* Number of symbols */ \
\
/* Entries */ \
+ ((2 * H5F_SYM_LEAF_K(f)) * (unsigned)H5G_SIZEOF_ENTRY_FILE(f)))
@@ -65,10 +66,10 @@
* symbol table entry.
*/
typedef enum H5G_cache_type_t {
- H5G_CACHED_ERROR = -1, /*force enum to be signed */
+ H5G_CACHED_ERROR = -1, /*force enum to be signed */
H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
H5G_CACHED_STAB = 1, /*symbol table, `stab' */
- H5G_CACHED_SLINK = 2, /*symbolic link */
+ H5G_CACHED_SLINK = 2, /*symbolic link */
H5G_NCACHED /*THIS MUST BE LAST */
} H5G_cache_type_t;
@@ -87,7 +88,7 @@ typedef union H5G_cache_t {
} stab;
struct {
- size_t lval_offset; /*link value offset */
+ size_t lval_offset; /*link value offset */
} slink;
} H5G_cache_t;
@@ -156,7 +157,7 @@ typedef struct {
typedef struct H5G_bt_common_t {
/* downward */
const char *name; /*points to temporary memory */
- H5HL_t * heap; /*symbol table heap */
+ H5HL_t * heap; /*symbol table heap */
} H5G_bt_common_t;
/*
@@ -203,10 +204,10 @@ typedef struct H5G_bt_lkp_t {
*/
typedef struct H5G_bt_it_it_t {
/* downward */
- H5HL_t * heap; /*symbol table heap */
- hsize_t skip; /*initial entries to skip */
- H5G_lib_iterate_t op; /*iteration operator */
- void * op_data; /*user-defined operator data */
+ H5HL_t * heap; /*symbol table heap */
+ hsize_t skip; /*initial entries to skip */
+ H5G_lib_iterate_t op; /*iteration operator */
+ void * op_data; /*user-defined operator data */
/* upward */
hsize_t *final_ent; /*final entry looked at */
@@ -480,4 +481,4 @@ H5_DLL herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent
H5_DLL herr_t H5G__verify_cached_stabs_test(hid_t gid);
#endif /* H5G_TESTING */
-#endif /* _H5Gpkg_H */
+#endif /* H5Gpkg_H */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 4ce7396..409d790 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,23 +15,23 @@
*
* Created: H5Gprivate.h
* Jul 11 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Library-visible declarations.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Gprivate_H
-#define _H5Gprivate_H
+#ifndef H5Gprivate_H
+#define H5Gprivate_H
/* Include package's public header */
#include "H5Gpublic.h"
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Bprivate.h" /* B-trees */
-#include "H5Fprivate.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Bprivate.h" /* B-trees */
+#include "H5Fprivate.h" /* File access */
#include "H5RSprivate.h" /* Reference-counted strings */
/*
@@ -42,7 +42,7 @@
((sizeof_size) + /*offset of name into heap */ \
(sizeof_addr) + /*address of object header */ \
4 + /*entry type */ \
- 4 + /*reserved */ \
+ 4 + /*reserved */ \
H5G_SIZEOF_SCRATCH) /*scratch pad space */
#define H5G_SIZEOF_ENTRY_FILE(F) H5G_SIZEOF_ENTRY(H5F_SIZEOF_ADDR(F), H5F_SIZEOF_SIZE(F))
@@ -60,12 +60,16 @@
/* Definitions for link info settings */
#define H5G_CRT_LINK_INFO_NAME "link info"
#define H5G_CRT_LINK_INFO_SIZE sizeof(H5O_linfo_t)
-#define H5G_CRT_LINK_INFO_DEF \
- { \
- H5G_CRT_LINFO_TRACK_CORDER, H5G_CRT_LINFO_INDEX_CORDER, H5G_CRT_LINFO_MAX_CORDER, \
- H5G_CRT_LINFO_CORDER_BT2_ADDR, H5G_CRT_LINFO_NLINKS, H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
- H5G_CRT_LINFO_NAME_BT2_ADDR \
- }
+/* clang-format off */
+#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_TRACK_CORDER, \
+ H5G_CRT_LINFO_INDEX_CORDER, \
+ H5G_CRT_LINFO_MAX_CORDER, \
+ H5G_CRT_LINFO_CORDER_BT2_ADDR, \
+ H5G_CRT_LINFO_NLINKS, \
+ H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
+ H5G_CRT_LINFO_NAME_BT2_ADDR \
+ }
+/* clang-format on */
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
@@ -79,12 +83,16 @@
/* Definitions for group info settings */
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
-#define H5G_CRT_GROUP_INFO_DEF \
- { \
- H5G_CRT_GINFO_LHEAP_SIZE_HINT, H5G_CRT_GINFO_STORE_LINK_PHASE_CHANGE, H5G_CRT_GINFO_MAX_COMPACT, \
- H5G_CRT_GINFO_MIN_DENSE, H5G_CRT_GINFO_STORE_EST_ENTRY_INFO, H5G_CRT_GINFO_EST_NUM_ENTRIES, \
- H5G_CRT_GINFO_EST_NAME_LEN \
- }
+/* clang-format off */
+#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
+ H5G_CRT_GINFO_STORE_LINK_PHASE_CHANGE, \
+ H5G_CRT_GINFO_MAX_COMPACT, \
+ H5G_CRT_GINFO_MIN_DENSE, \
+ H5G_CRT_GINFO_STORE_EST_ENTRY_INFO, \
+ H5G_CRT_GINFO_EST_NUM_ENTRIES, \
+ H5G_CRT_GINFO_EST_NAME_LEN \
+ }
+/* clang-format on */
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5G_MODULE
@@ -283,4 +291,4 @@ H5_DLL herr_t H5G_root_loc(H5F_t *f, H5G_loc_t *loc);
H5_DLL herr_t H5G_root_free(H5G_t *grp);
H5_DLL H5G_t *H5G_rootof(H5F_t *f);
-#endif /* _H5Gprivate_H */
+#endif /* H5Gprivate_H */
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 0ee4fa6..7f1faf8 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,14 +15,14 @@
*
* Created: H5Gpublic.h
* Jul 11 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Public declarations for the H5G package
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Gpublic_H
-#define _H5Gpublic_H
+#ifndef H5Gpublic_H
+#define H5Gpublic_H
/* System headers needed by this file */
#include <sys/types.h>
@@ -41,22 +41,31 @@
/* Public Typedefs */
/*******************/
-/* Types of link storage for groups */
+//! <!-- [H5G_storage_t_snip] -->
+/**
+ * Types of link storage for groups
+ */
typedef enum H5G_storage_type_t {
- H5G_STORAGE_TYPE_UNKNOWN = -1, /* Unknown link storage type */
- H5G_STORAGE_TYPE_SYMBOL_TABLE, /* Links in group are stored with a "symbol table" */
- /* (this is sometimes called "old-style" groups) */
- H5G_STORAGE_TYPE_COMPACT, /* Links are stored in object header */
- H5G_STORAGE_TYPE_DENSE /* Links are stored in fractal heap & indexed with v2 B-tree */
+ H5G_STORAGE_TYPE_UNKNOWN = -1, /**< Unknown link storage type */
+ H5G_STORAGE_TYPE_SYMBOL_TABLE, /**< Links in group are stored with a "symbol table" */
+ /**< (this is sometimes called "old-style" groups) */
+ H5G_STORAGE_TYPE_COMPACT, /**< Links are stored in object header */
+ H5G_STORAGE_TYPE_DENSE /**< Links are stored in fractal heap & indexed with v2 B-tree */
} H5G_storage_type_t;
+//! <!-- [H5G_storage_t_snip] -->
-/* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */
+//! <!-- [H5G_info_t_snip] -->
+/**
+ * Information struct for group for
+ * H5Gget_info(), H5Gget_info_by_name(), and H5Gget_info_by_idx()
+ */
typedef struct H5G_info_t {
- H5G_storage_type_t storage_type; /* Type of storage for links in group */
- hsize_t nlinks; /* Number of links in group */
- int64_t max_corder; /* Current max. creation order value for group */
- hbool_t mounted; /* Whether group has a file mounted on it */
+ H5G_storage_type_t storage_type; /**< Type of storage for links in group */
+ hsize_t nlinks; /**< Number of links in group */
+ int64_t max_corder; /**< Current max. creation order value for group */
+ hbool_t mounted; /**< Whether group has a file mounted on it */
} H5G_info_t;
+//! <!-- [H5G_info_t_snip] -->
/********************/
/* Public Variables */
@@ -69,18 +78,344 @@ typedef struct H5G_info_t {
extern "C" {
#endif
-H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id);
-H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
-H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id);
-H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a new group and links it into the file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to create
+ * \lcpl_id
+ * \gcpl_id
+ * \gapl_id
+ *
+ * \return \hid_t{group}
+ *
+ * \details H5Gcreate2() creates a new group in a file. After a
+ * group has been created, links to datasets and to other groups
+ * can be added.
+ *
+ * The \p loc_id and \p name parameters specify where the group
+ * is located. \p loc_id may be a file, group, dataset, named
+ * datatype or attribute in the file. If an attribute, dataset,
+ * or named datatype is specified for \p loc_id then the group
+ * will be created at the location where the attribute, dataset,
+ * or named datatype is attached. \p name is the link to the group;
+ * \p name may be either an absolute path in the file (the links
+ * from the root group to the new group) or a relative path from
+ * \p loc_id (the link(s) from the group specified by \p loc_id
+ * to the new group).
+ *
+ * \p lcpl_id, \p gcpl_id, and \p gapl_id are property list
+ * identifiers. These property lists govern how the link to the
+ * group is created, how the group is created, and how the group
+ * can be accessed in the future, respectively. #H5P_DEFAULT can
+ * be passed in if the default properties are appropriate for
+ * these property lists. Currently, there are no APIs for the
+ * group access property list; use #H5P_DEFAULT.
+ *
+ * The group identifier should be closed by H5Gclose() when access
+ * is no longer required to prevent resource leaks.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gopen2(), H5Gclose()
+ *
+ */
+H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a new empty group without linking it into the file structure
+ *
+ * \fgdta_loc_id
+ * \gcpl_id
+ * \gapl_id
+ *
+ * \return \hid_t{group}
+ *
+ * \details H5Gcreate_anon() creates a new empty group in the file
+ * specified by \p loc_id. With default settings, H5Gcreate_anon()
+ * provides similar functionality to that provided by
+ * H5Gcreate1(), with the differences described in the list below.
+ *
+ * The new group’s creation and access properties are specified
+ * in \p gcpl_id and \p gapl_id, respectively.
+ *
+ * H5Gcreate_anon() returns a new group identifier. This identifier
+ * must be linked into the HDF5 file structure with H5Olink()
+ * or it will be deleted from the file when the file is closed.
+ *
+ * The differences between this function and H5Gcreate1() are
+ * as follows:
+ *
+ * \li H5Gcreate1() does not provide for the use of custom property
+ * lists; H5Gcreate1() always uses default properties.
+ * \li H5Gcreate_anon() neither provides the new group’s name
+ * nor links it into the HDF5 file structure; those actions
+ * must be performed separately through a call to H5Olink(),
+ * which offers greater control over linking.
+ * \li H5Gcreate_anon() does not directly provide a hint mechanism
+ * for the group’s heap size. Comparable information can be
+ * included in the group creation property list \p gcpl_id through
+ * a H5Pset_local_heap_size_hint() call.
+ *
+ * A group created with this function should be closed with
+ * H5Gclose() when the group is no longer needed so that resource
+ * leaks will not develop.
+ *
+ * \see H5Olink(), H5Dcreate(), Using Identifiers
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Opens an existing group in a file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to open
+ * \gapl_id
+ *
+ * \return \hid_t{group}
+ *
+ * \details H5Gopen2() opens an existing group, \p name, at the location
+ * specified by \p loc_id.
+ *
+ * With default settings, H5Gopen2() provides similar functionality
+ * to that provided by H5Gopen(). The only difference is that
+ * H5Gopen2() can provide a group access property list, \p gapl_id.
+ *
+ * H5Gopen2() returns a group identifier for the group that was
+ * opened. This group identifier should be released by H5Gclose()
+ * when it is no longer needed to prevent resource leaks.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
+H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Gets a group creation property list identifier
+ *
+ * \group_id
+ *
+ * \return \hid_t{creation property list}
+ *
+ * \details H5Gget_create_plist() returns an identifier for the group creation
+ * property list associated with the group specified by \p group_id.
+ *
+ * The creation property list identifier should be released with
+ * H5Gclose() to prevent resource leaks.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
+H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Retrieves information about a group
+ *
+ * \fgdta_loc_id
+ * \param[out] ginfo Struct in which group information is returned
+ *
+ * \return \hid_t{group}
+ *
+ * \details H5Gget_info() retrieves information about the group at location
+ * specified by \p loc_id. The information is returned in the \p ginfo.
+ *
+ * \p ginfo is an H5G_info_t struct and is defined (in H5Gpublic.h)
+ * as follows:
+ *
+ * \snippet this H5G_info_t_snip
+ * Possible values of \p storage_type are:
+ * \storage_type
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Retrieves information about a group by its name
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to query
+ * \param[out] ginfo Struct in which group information is returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Gget_info_by_name() retrieves information about the group \p name
+ * at location specified by \p loc_id. The information is returned in
+ * the \p ginfo struct.
+ *
+ * If \p loc_id specifies the group for which information is queried,
+ * then the group's \p name can be a dot (.).
+ *
+ * \p ginfo is an H5G_info_t struct and is defined (in H5Gpublic.h)
+ * as follows:
+ *
+ * \snippet this H5G_info_t_snip
+ * Possible values of \p storage_type are:
+ * \storage_type
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *ginfo, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Retrieves information about a group, according to the group’s
+ * position within an index
+ *
+ * \fgdta_loc_id
+ * \param[in] group_name Name of the group to query
+ * \param[in] idx_type Transient index identifying object
+ * \param[in] order Transient index identifying object
+ * \param[in] n Position in the index of the group to query
+ * \param[out] ginfo Struct in which group information is returned
+ * \lapl_id
+ *
+ * \return Returns
+ * \li The size of the object name if successful, or
+ * \li 0 if no name is associated with the group identifier, or
+ * \li negative value, if failure occurred
+ *
+ * \details H5Gget_info_by_idx() retrieves the same information
+ * about a group as retrieved by the function H5Gget_info(),
+ * but the means of identifying the group differs; the group is
+ * identified by position in an index rather than by name.
+ *
+ * \p loc_id and \p group_name specify the group containing
+ * the group for which information is sought. The groups in \p
+ * group_name are indexed by \p idx_type; the group for which
+ * information is retrieved is identified in that index by index
+ * order, \p order, and index position, \p n.
+ *
+ * If \p loc_id specifies the group containing the group for
+ * which information is queried, \p group_name can be a dot (.).
+ *
+ * Valid values for \p index_type are as follows:
+ * \indexes
+ * The order in which the index is to be examined, as specified
+ * by \p order, can be one of the following:
+ * \orders
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo, hid_t lapl_id);
-H5_DLL herr_t H5Gclose(hid_t group_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Flushes all buffers associated with a group to disk
+ *
+ * \group_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Gflush() causes all buffers associated with a group to be
+ * immediately flushed to disk without removing the data from
+ * the cache.
+ *
+ * \attention
+ * HDF5 does not possess full control over buffering. H5G_FLUSH
+ * flushes the internal HDF5 buffers and then asks the operating
+ * system (the OS) to flush the system buffers for the open
+ * files. After that, the OS is responsible for ensuring that
+ * the data is actually flushed to disk.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
H5_DLL herr_t H5Gflush(hid_t group_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Refreshes all buffers associated with a group
+ *
+ * \group_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Grefresh() causes all buffers associated with a group to be
+ * cleared and immediately re-loaded with updated contents from disk.
+ *
+ * This function essentially closes the group, evicts all
+ * metadata associated with it from the cache, and then re-opens
+ * the group. The reopened group is automatically re-registered
+ * with the same identifier.
+ *
+ * \since 1.8.0
+ *
+ * \see H5Gcreate2(), H5Gclose()
+ *
+ */
H5_DLL herr_t H5Grefresh(hid_t group_id);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Closes the specified group
+ *
+ * \group_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Gclose() releases resources used by a group which was
+ * opened by H5Gcreate() or H5Gopen(). After closing a group,
+ * \p group_id cannot be used again until another H5Gcreate()
+ * or H5Gopen() is called on it.
+ *
+ * Failure to release a group with this call will result in
+ * resource leaks.
+ *
+ * \par Example
+ * \snippet H5F_examples.c mount
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Gclose(hid_t group_id);
+
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
* Use of these symbols is deprecated.
@@ -104,56 +439,647 @@ H5_DLL herr_t H5Grefresh(hid_t group_id);
/* Typedefs */
-/*
+//! <!-- [H5G_obj_t_snip] -->
+/**
* An object has a certain type. The first few numbers are reserved for use
* internally by HDF5. Users may add their own types with higher values. The
- * values are never stored in the file -- they only exist while an
- * application is running. An object may satisfy the `isa' function for more
- * than one type.
+ * values are never stored in the file -- they only exist while an application
+ * is running. An object may satisfy the `isa' function for more than one type.
+ *
+ * \deprecated
*/
typedef enum H5G_obj_t {
- H5G_UNKNOWN = -1, /* Unknown object type */
- H5G_GROUP, /* Object is a group */
- H5G_DATASET, /* Object is a dataset */
- H5G_TYPE, /* Object is a named data type */
- H5G_LINK, /* Object is a symbolic link */
- H5G_UDLINK, /* Object is a user-defined link */
- H5G_RESERVED_5, /* Reserved for future use */
- H5G_RESERVED_6, /* Reserved for future use */
- H5G_RESERVED_7 /* Reserved for future use */
+ H5G_UNKNOWN = -1, /**< Unknown object type */
+ H5G_GROUP, /**< Object is a group */
+ H5G_DATASET, /**< Object is a dataset */
+ H5G_TYPE, /**< Object is a named data type */
+ H5G_LINK, /**< Object is a symbolic link */
+ H5G_UDLINK, /**< Object is a user-defined link */
+ H5G_RESERVED_5, /**< Reserved for future use */
+ H5G_RESERVED_6, /**< Reserved for future use */
+ H5G_RESERVED_7 /**< Reserved for future use */
} H5G_obj_t;
+//! <!-- [H5G_obj_t_snip] -->
-/* Prototype for H5Giterate() operator */
+//! <!-- [H5G_iterate_t_snip] -->
+/**
+ * Callback for H5Giterate()
+ *
+ * \deprecated
+ */
typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data);
+//! <!-- [H5G_iterate_t_snip] -->
-/* Information about an object */
+//! <!-- [H5G_stat_t_snip] -->
+/**
+ * Information about an object
+ *
+ * \deprecated
+ */
typedef struct H5G_stat_t {
- unsigned long fileno[2]; /*file number */
- unsigned long objno[2]; /*object number */
- unsigned nlink; /*number of hard links to object*/
- H5G_obj_t type; /*basic object type */
- time_t mtime; /*modification time */
- size_t linklen; /*symbolic link value length */
- H5O_stat_t ohdr; /* Object header information */
+ unsigned long fileno[2]; /**< file number */
+ unsigned long objno[2]; /**< object number */
+ unsigned nlink; /**< number of hard links to object*/
+ H5G_obj_t type; /**< basic object type */
+ time_t mtime; /**< modification time */
+ size_t linklen; /**< symbolic link value length */
+ H5O_stat_t ohdr; /**< Object header information */
} H5G_stat_t;
+//! <!-- [H5G_stat_t_snip] -->
/* Function prototypes */
-H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint);
-H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name);
-H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id,
- const char *new_name);
-H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name);
-H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name);
-H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/);
-H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
-H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf);
-H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data);
-H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
-H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
- H5G_stat_t *statbuf /*out*/);
-H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a new group and links it into the file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to create
+ * \param[in] size_hint The number of bytes to reserve for the names
+ * that will appear in the group
+ *
+ * \return \hid_t{group}
+ *
+ * \deprecated This function is deprecated in favor of H5Gcreate2().
+ *
+ * \details H5Gcreate1() creates a new group with the specified name at the
+ * specified location, \p loc_id. \p loc_id may be a file, group,
+ * dataset, named datatype or attribute. If an attribute, dataset, or
+ * named datatype is specified for \p loc_id then the group will be
+ * created at the location where the attribute, dataset, or named
+ * datatype is attached. The name, name, must not already be taken by
+ * some other object and all parent groups must already exist.
+ *
+ * \p name can be a relative path based at \p loc_id or an absolute
+ * path from the root of the file. Use of this function requires that
+ * any intermediate groups specified in the path already exist.
+ *
+ * The length of a group name, or of the name of any object within a
+ * group, is not limited.
+ *
+ * \p size_hint is a hint for the number of bytes to reserve to store
+ * the names which will be eventually added to the new group. This
+ * value must be between 0 and UINT32_MAX (inclusive). If this
+ * parameter is zero, a default value will be used.
+ *
+ * The return value is a group identifier for the open group. This
+ * group identifier should be closed by calling H5Gclose() when it is
+ * no longer needed.
+ *
+ * See H5Gcreate_anon() for a discussion of the differences between
+ * H5Gcreate1() and H5Gcreate_anon().
+ *
+ * \par Example
+ * \snippet H5F_examples.c mount
+ *
+ * \version 1.8.0 Function H5Gcreate() renamed to H5Gcreate1() and deprecated
+ * in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Opens an existing group for modification and returns a group
+ * identifier for that group
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to open
+ *
+ * \return \hid_t{group}
+ *
+ * \deprecated This function is deprecated in favor of H5Gopen2().
+ *
+ * \details H5Gopen1() opens an existing group, \p name, at the location
+ * specified by \p loc_id.
+ *
+ * H5Gopen1() returns a group identifier for the group that was
+ * opened. This group identifier should be released by calling
+ * H5Gclose() when it is no longer needed.
+ *
+ * \version 1.8.0 The function H5Gopen() was renamed to H5Gopen1()
+ * and deprecated in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a link of the specified type from \p new_name to \p
+ * cur_name
+ *
+ * \fg_loc_id{cur_loc_id}
+ * \param[in] type Link type
+ * \param[in] cur_name Name of the existing object
+ * \param[in] new_name New name for the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Glink() creates a new name for an object that has some current
+ * name, possibly one of many names it currently has.
+ *
+ * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify
+ * the name of an existing object and both names are interpreted
+ * relative to \p cur_loc_id, which is either a file identifier or a
+ * group identifier.
+ *
+ * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything
+ * and is interpreted at lookup time relative to the group which
+ * contains the final component of \p new_name. For instance, if \p
+ * cur_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a
+ * request is made for \Code{./x/y/bar}, then the actual object looked
+ * up is \Code{./x/y/./foo}.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a link of the specified type from \p cur_name to \p
+ * new_name
+ *
+ * \fg_loc_id{cur_loc_id}
+ * \param[in] cur_name Name of the existing object
+ * \param[in] type Link type
+ * \fg_loc_id{new_loc_id}
+ * \param[in] new_name New name for the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Glink2() creates a new name for an object that has some current
+ * name, possibly one of many names it currently has.
+ *
+ * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify the
+ * name of an existing object and both names are interpreted relative
+ * to \p cur_loc_id and \p new_loc_id, respectively, which are either
+ * file identifiers or group identifiers.
+ *
+ * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything
+ * and is interpreted at lookup time relative to the group which
+ * contains the final component of \p new_name. For instance, if \p
+ * current_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a
+ * request is made for \Code{./x/y/bar}, then the actual object looked
+ * up is \Code{./x/y/./foo}.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id,
+ const char *new_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Renames an object within an HDF5 file
+ *
+ * \fg_loc_id{src_loc_id}
+ * \param[in] src_name Object's original name
+ * \param[in] dst_name Object's new name
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Gmove() renames an object within an HDF5 file. The original name,
+ * \p src_name, is unlinked from the group graph and the new name, \p
+ * dst_name, is inserted as an atomic operation. Both names are
+ * interpreted relative to \p loc_id, which is either a file or a group
+ * identifier.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gmove(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Renames an object within an HDF5 file
+ *
+ * \fg_loc_id{src_loc_id}
+ * \param[in] src_name Object's original name
+ * \fg_loc_id{dst_loc_id}
+ * \param[in] dst_name Object's new name
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Gmove2() renames an object within an HDF5 file. The original name,
+ * \p src_name, is unlinked from the group graph and the new name, \p
+ * dst_name, is inserted as an atomic operation.
+ *
+ * \p src_name and \p dst_name are interpreted relative to \p
+ * src_loc_id and \p dst_loc_id, respectively, which are either file or
+ * group identifiers.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gmove2(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Removes the link to an object from a group
+ *
+ * \fg_loc_id{loc_id}
+ * \param[in] name Name of the object to unlink
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Ldelete().
+ *
+ * \details H5Gunlink() removes the object specified by \p name from the group
+ * graph and decrements the link count for the object to which \p name
+ * points. This action eliminates any association between name and the
+ * object to which name pointed.
+ *
+ * Object headers keep track of how many hard links refer to an object;
+ * when the link count reaches zero, the object can be removed from the
+ * file. Objects which are open are not removed until all identifiers
+ * to the object are closed.
+ *
+ * If the link count reaches zero, all file space associated with the
+ * object will be released, i.e., identified in memory as freespace. If
+ * any object identifier is open for the object, the space will not be
+ * released until after the object identifier is closed.
+ *
+ * Note that space identified as freespace is available for re-use only
+ * as long as the file remains open; once a file has been closed, the
+ * HDF5 library loses track of freespace. See “Freespace Management” in
+ * the HDF5 User's Guide for further details.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gunlink(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns the name of the object that the symbolic link points to
+ *
+ * \fg_loc_id{loc_id}
+ * \param[in] name Symbolic link to the object whose name is to be returned
+ * \param[in] size Maximum number of characters of value to be returned
+ * \param[out] buf A buffer to hold the name of the object being sought
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Lget_val().
+ *
+ * \details H5Gget_linkval() returns up to size characters of the name of the
+ * object that the symbolic link name points to.
+ *
+ * The parameter \p loc_id is a file or group identifier.
+ *
+ * The parameter \p name must be a symbolic link pointing to the
+ * desired object and must be defined relative to \p loc_id.
+ *
+ * If size is smaller than the size of the returned object name, then
+ * the name stored in the buffer value will not be \c NULL terminated.
+ *
+ * This function fails if \p name is not a symbolic link. The presence
+ * of a symbolic link can be tested by passing zero for \p size and \p
+ * NULL for value.
+ *
+ * This function should be used only after H5Lget_info1() (or the
+ * deprecated function H5Gget_objinfo()) has been called to verify that
+ * name is a symbolic link.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Sets comment for specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object whose comment is to be set or reset
+ * name must be \Code{'.'} (dot) if \p loc_id fully specifies
+ * the object for which the comment is to be set.
+ * \param[in] comment The new comment
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Oset_comment().
+ *
+ * \details H5Gset_comment() sets the comment for the object specified by \p
+ * loc_id and name to comment. Any previously existing comment is
+ * overwritten.
+ *
+ * \p loc_id can specify any object in the file. name can be one of the
+ * following:
+ * \li The name of the object relative to \p loc_id
+ * \li An absolute name of the object, starting from \c /, the file’s
+ * root group
+ * \li A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * If \p comment is the empty string or a null pointer, the comment
+ * message is removed from the object.
+ *
+ * Comments should be relatively short, null-terminated, ASCII strings.
+ *
+ * Comments can be attached to any object that has an object header,
+ * e.g., datasets, groups, and named datatypes, but not symbolic links.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Retrieves comment for specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object whose comment is to be set or reset
+ * name must be \Code{'.'} (dot) if \p loc_id fully specifies
+ * the object for which the comment is to be set.
+ * \param[in] bufsize Maximum number of comment characters to be returned in \p buf.
+ * \param[in] buf The comment
+ *
+ * \return Returns the number of characters in the comment, counting the \c NULL
+ * terminator, if successful; the value returned may be larger than
+ * \p bufsize. Otherwise returns a negative value.
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Oget_comment().
+ *
+ * \details H5Gget_comment() retrieves the comment for the the object specified
+ * by \p loc_id and \p name. The comment is returned in the buffer \p
+ * buf.
+ *
+ * \p loc_id can specify any object in the file. name can be one of the
+ * following:
+ * \li The name of the object relative to \p loc_id
+ * \li An absolute name of the object, starting from \c /, the file’s
+ * root group
+ * \li A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * At most bufsize characters, including a null-terminator, are
+ * returned in \p buf. The returned value is not null-terminated if the
+ * comment is longer than the supplied buffer. If the size of the
+ * comment is unknown, a preliminary \p H5Gget_comment() call will
+ * return the size of the comment, including space for the
+ * null-terminator.
+ *
+ * If an object does not have a comment, the empty string is returned
+ * in comment.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Iterates over the entries of a group invoking a callback for each
+ * entry encountered
+ *
+ * \fg_loc_id
+ * \param[in] name Group over which the iteration is performed
+ * \param[in,out] idx Location at which to begin the iteration
+ * \param[in] op Operation to be performed on an object at each step of the
+ * iteration
+ * \param[in,out] op_data Data associated with the operation
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Literate1().
+ *
+ * \details H5Giterate() iterates over the members of name in the file or group
+ * specified with \p loc_id. For each object in the group, the \p
+ * op_data and some additional information, specified below, are passed
+ * to the operator function. The iteration begins with the \p idx
+ * object in the group and the next element to be processed by the
+ * operator is returned in \p idx. If \p idx is NULL, then the iterator
+ * starts at the first group member; since no stopping point is
+ * returned in this case, the iterator cannot be restarted if one of
+ * the calls to its operator returns non-zero. H5Giterate() does not
+ * recursively follow links into subgroups of the specified group.
+ *
+ * The prototype for \ref H5G_iterate_t is:
+ * \snippet this H5G_iterate_t_snip
+ *
+ * The operation receives the group identifier for the group being
+ * iterated over, \p group, the name of the current object within
+ * the group, \p name, and the pointer to the operator data
+ * passed in to H5Giterate(), \p op_data.
+ *
+ * The return values from an operator are:
+ * \li Zero causes the iterator to continue, returning zero when all
+ * group members have been processed.
+ * \li Positive causes the iterator to immediately return that positive
+ * value, indicating short-circuit success. The iterator can be
+ * restarted at the next group member.
+ * \li Negative causes the iterator to immediately return that value,
+ * indicating failure. The iterator can be restarted at the next
+ * group member.
+ *
+ * H5Giterate() assumes that the membership of the group identified by
+ * \p name remains unchanged through the iteration. If the membership
+ * changes during the iteration, the function's behavior is undefined.
+ *
+ * H5Giterate() is not recursive. In particular, if a member of \p name
+ * is found to be a group, call it \c subgroup_a, H5Giterate() does not
+ * examine the members of \c subgroup_a. When recursive iteration is
+ * required, the application must handle the recursion, explicitly
+ * calling H5Giterate() on discovered subgroups.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns number of objects in the group specified by its identifier
+ *
+ * \fg_loc_id
+ * \param[out] num_objs Number of objects in the group
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Gget_info().
+ *
+ * \details H5Gget_num_objs() returns number of objects in a group. Group is
+ * specified by its identifier \p loc_id. If a file identifier is
+ * passed in, then the number of objects in the root group is returned.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns information about an object.
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object for which status is being sought
+ * \param[in] follow_link Link flag
+ * \param[out] statbuf Buffer in which to return information about the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the functions H5Oget_info()
+ * and H5Lget_info1().
+ *
+ * \details H5Gget_objinfo() returns information about the specified object
+ * through the \p statbuf argument.
+ *
+ * A file or group identifier, \p loc_id, and an object name, \p name,
+ * relative to \p loc_id, are commonly used to specify the
+ * object. However, if the object identifier is already known to the
+ * application, an alternative approach is to use that identifier, \c
+ * obj_id, in place of \p loc_id, and a dot (\c .) in place of \p
+ * name. Thus, the alternative versions of the first portion of an
+ * H5Gget_objinfo() call would be as follows:
+ * \code
+ * H5Gget_objinfo (loc_id name ...)
+ * H5Gget_objinfo (obj_id . ...)
+ * \endcode
+ *
+ * If the object is a symbolic link and follow_link is zero (0), then
+ * the information returned describes the link itself; otherwise the
+ * link is followed and the information returned describes the object
+ * to which the link points. If \p follow_link is non-zero but the
+ * final symbolic link is dangling (does not point to anything), then
+ * an error is returned. The \p statbuf fields are undefined for an
+ * error. The existence of an object can be tested by calling this
+ * function with a \c NULL \p statbuf.
+ *
+ * H5Gget_objinfo() fills in the following data structure (defined in
+ * H5Gpublic.h):
+ * \snippet this H5G_stat_t_snip
+ *
+ * where \ref H5O_stat_t (defined in H5Opublic.h) is:
+ * \snippet H5Opublic.h H5O_stat_t_snip
+ *
+ * \attention Some systems will be able to record the time accurately but unable
+ * to retrieve the correct time; such systems (e.g., Irix64) will
+ * report an \c mtime value of 0 (zero).
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \version 1.6.1 Two new fields were added to the \ref H5G_stat_t struct in
+ * this release.
+ *
+ */
+H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
+ H5G_stat_t *statbuf /*out*/);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns a name of an object specified by an index
+ *
+ * \fg_loc_id
+ * \param[in] idx Transient index identifying object
+ * \param[in,out] name Pointer to user-provided buffer the object name
+ * \param[in] size Name length
+ *
+ * \return Returns the size of the object name if successful, or 0 if no name is
+ * associated with the group identifier. Otherwise returns a negative
+ * value.
+ *
+ * \deprecated This function is deprecated in favor of the function H5Lget_name_by_idx().
+ *
+ * \details H5Gget_objname_by_idx() returns a name of the object specified by
+ * the index \p idx in the group \p loc_id.
+ *
+ * The group is specified by a group identifier \p loc_id. If
+ * preferred, a file identifier may be passed in \p loc_id; that file's
+ * root group will be assumed.
+ *
+ * \p idx is the transient index used to iterate through the objects in
+ * the group. The value of \p idx is any nonnegative number less than
+ * the total number of objects in the group, which is returned by the
+ * function H5Gget_num_objs(). Note that this is a transient index; an
+ * object may have a different index each time a group is opened.
+ *
+ * The object name is returned in the user-specified buffer \p name.
+ *
+ * If the size of the provided buffer \p name is less or equal the
+ * actual object name length, the object name is truncated to
+ * \Code{max_size - 1} characters.
+ *
+ * Note that if the size of the object's name is unkown, a preliminary
+ * call to H5Gget_objname_by_idx() with \p name set to \c NULL will
+ * return the length of the object's name. A second call to
+ * H5Gget_objname_by_idx() can then be used to retrieve the actual
+ * name.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \since 1.6.0
+ *
+ */
+H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns the type of an object specified by an index
+ *
+ * \fg_loc_id
+ * \param[in] idx Transient index identifying object
+ *
+ * \return Returns the type of the object if successful. Otherwise returns a
+ * negative value.
+ *
+ * \deprecated This function is deprecated in favor of the function H5Oget_info().
+ *
+ * \details H5Gget_objtype_by_idx() returns the type of the object specified by
+ * the index \p idx in the group \p loc_id.
+ *
+ * The group is specified by a group identifier \p loc_id. If
+ * preferred, a file identifier may be passed in \p loc_id; that file's
+ * root group will be assumed.
+ *
+ * \p idx is the transient index used to iterate through the objects in
+ * the group. This parameter is described in more detail in the
+ * discussion of H5Gget_objname_by_idx().
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \version 1.6.0 The function return type changed from \c int to the enumerated
+ * type \ref H5G_obj_t.
+ * \since 1.6.0
+ *
+ */
H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -161,4 +1087,4 @@ H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
#ifdef __cplusplus
}
#endif
-#endif /* _H5Gpublic_H */
+#endif /* H5Gpublic_H */
diff --git a/src/H5Groot.c b/src/H5Groot.c
index 83d8909..997d187 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Groot.c
* Apr 8 2009
- * Neil Fortner <nfortne2@hdfgroup.org>
+ * Neil Fortner
*
* Purpose: Functions for operating on the root group.
*
@@ -126,7 +126,6 @@ H5G_rootof(H5F_t *f)
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -357,7 +356,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 688fed1..54b28b5 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Friday, September 19, 1997
*
*/
@@ -117,7 +117,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
*
*-------------------------------------------------------------------------
@@ -151,11 +150,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")
/* Insert name into the heap */
- if (UFAIL == (name_offset = H5HL_insert(f, heap, (size_t)1, "")))
+ if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap")
- /*
- * B-tree's won't work if the first name isn't at the beginning
+ /* B-trees won't work if the first name isn't at the beginning
* of the heap.
*/
HDassert(0 == name_offset);
@@ -183,7 +181,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 1 1997
*
*-------------------------------------------------------------------------
@@ -240,7 +237,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@uiuc.edu
* Nov 7 2005
*
*-------------------------------------------------------------------------
@@ -294,7 +290,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 1 1997
*
*-------------------------------------------------------------------------
@@ -306,7 +301,7 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_ln
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);
@@ -321,7 +316,7 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_ln
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() */
/*-------------------------------------------------------------------------
@@ -511,7 +506,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs
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);
@@ -578,7 +573,7 @@ done:
if (ltable.lnks && H5G__link_release_table(&ltable) < 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() */
/*-------------------------------------------------------------------------
@@ -665,7 +660,7 @@ done:
} /* end H5G__stab_bh_size() */
/*-------------------------------------------------------------------------
- * 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
@@ -679,14 +674,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);
@@ -703,7 +698,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 */
/*-------------------------------------------------------------------------
* Function: H5G__stab_get_name_by_idx
@@ -758,7 +753,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;
@@ -794,7 +789,7 @@ done:
} /* end H5G__stab_get_name_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5G_stab_lookup_cb
+ * Function: H5G__stab_lookup_cb
*
* Purpose: B-tree 'find' callback to retrieve location for an object
*
@@ -808,12 +803,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)
@@ -823,7 +818,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() */
/*-------------------------------------------------------------------------
* Function: H5G__stab_lookup
@@ -833,7 +828,6 @@ done:
* Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
@@ -870,7 +864,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 */
@@ -886,7 +880,7 @@ done:
} /* end H5G__stab_lookup() */
/*-------------------------------------------------------------------------
- * 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
@@ -900,13 +894,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);
@@ -923,7 +917,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 */
/*-------------------------------------------------------------------------
* Function: H5G__stab_lookup_by_idx
@@ -933,7 +927,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 7 2006
*
*-------------------------------------------------------------------------
@@ -975,7 +968,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;
@@ -1015,7 +1008,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 994ed49..d2f3f90 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Monday, October 17, 2005
*
* Purpose: Group testing functions.
@@ -798,7 +798,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 7b2085a..6b2ae7d 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Gtraverse.c
* Sep 13 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for traversing group hierarchy
*
@@ -345,7 +345,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 20 2006
*
*-------------------------------------------------------------------------
@@ -450,7 +449,6 @@ done:
* resolved.
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -797,7 +795,6 @@ done:
* traversed.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 13 2005
*
*-------------------------------------------------------------------------
@@ -820,7 +817,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 5f8ca97..73281a4 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HF.c
* Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Implements a "fractal heap" for storing variable-
* length objects in a file.
@@ -78,52 +78,50 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
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() */
/*-------------------------------------------------------------------------
* Function: H5HF_create
@@ -134,7 +132,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
*
*-------------------------------------------------------------------------
@@ -156,7 +153,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 */
@@ -169,11 +166,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 */
@@ -201,7 +198,6 @@ done:
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 18 2006
*
*-------------------------------------------------------------------------
@@ -235,11 +231,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 */
@@ -266,7 +262,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 17 2006
*
*-------------------------------------------------------------------------
@@ -296,7 +291,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
*
*-------------------------------------------------------------------------
@@ -327,7 +321,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
*
*-------------------------------------------------------------------------
@@ -365,7 +358,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 {
@@ -392,7 +385,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 9 2006
*
*-------------------------------------------------------------------------
@@ -425,7 +417,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) {
@@ -433,7 +425,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 {
@@ -453,7 +445,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 20 2015
*
*-------------------------------------------------------------------------
@@ -514,7 +505,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 18 2006
*
*-------------------------------------------------------------------------
@@ -558,7 +548,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 {
@@ -590,7 +580,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2006
*
*-------------------------------------------------------------------------
@@ -660,7 +649,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sept 11 2006
*
*-------------------------------------------------------------------------
@@ -704,7 +692,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 {
@@ -724,7 +712,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 15 2006
*
*-------------------------------------------------------------------------
@@ -768,7 +755,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 {
@@ -788,7 +775,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 17 2006
*
*-------------------------------------------------------------------------
@@ -808,7 +794,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;
@@ -827,8 +813,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 */
@@ -850,10 +836,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 */
@@ -884,7 +870,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 68c97be..353d7d7 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFbtree2.c
* Aug 7 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: v2 B-tree callbacks for "huge" object tracker
*
@@ -434,8 +434,8 @@ H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nr
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len,
- nrecord->id);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth,
+ "Record:", nrecord->addr, nrecord->len, nrecord->id);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_indir_debug() */
@@ -636,8 +636,9 @@ H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr,
- nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE ", %" PRIuHSIZE "}\n",
+ indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask,
+ nrecord->obj_size, nrecord->id);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_filt_indir_debug() */
@@ -818,7 +819,8 @@ H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrec
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE "}\n", indent, "", fwidth,
+ "Record:", nrecord->addr, nrecord->len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_dir_debug() */
@@ -1028,8 +1030,8 @@ H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *
FUNC_ENTER_STATIC_NOERR
- HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr,
- nrecord->len, nrecord->filter_mask, nrecord->obj_size);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE "}\n", indent, "", fwidth,
+ "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF__huge_bt2_filt_dir_debug() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 6f13098..fde5a4f 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFcache.c
* Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Implement fractal heap metadata cache methods.
*
@@ -209,7 +209,7 @@ H5HF__hdr_prefix_decode(H5HF_hdr_t *hdr, const uint8_t **image_ref)
HDassert(image);
/* Magic number */
- if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "wrong fractal heap header signature")
image += H5_SIZEOF_MAGIC;
@@ -238,7 +238,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 27 2006
*
*-------------------------------------------------------------------------
@@ -287,7 +286,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
*
*-------------------------------------------------------------------------
@@ -334,7 +332,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
@@ -484,7 +482,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_
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 */
@@ -569,7 +567,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_
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 */
@@ -577,7 +575,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_
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)
@@ -853,7 +851,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:
@@ -979,7 +977,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 */
@@ -994,7 +992,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED
HDassert(iblock->size == len);
/* Magic number */
- if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap indirect block signature")
image += H5_SIZEOF_MAGIC;
@@ -1019,7 +1017,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")
@@ -1118,7 +1116,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)
@@ -1253,7 +1251,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5
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 {
@@ -1268,7 +1266,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5
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 */
@@ -1531,7 +1529,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:
@@ -1761,7 +1759,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo
/* 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 */
@@ -1833,7 +1831,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo
image = dblock->blk;
/* Magic number */
- if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap direct block signature")
image += H5_SIZEOF_MAGIC;
@@ -1855,7 +1853,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo
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 */
@@ -1886,7 +1884,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)
@@ -2241,7 +2239,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le
/* 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 */
@@ -2296,7 +2294,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le
/* 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 */
@@ -2334,7 +2332,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le
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 */
@@ -2348,7 +2346,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le
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 */
@@ -2548,7 +2546,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 5c4f9df..a244035 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFdbg.c
* Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Dump debugging information about a fractal heap
*
@@ -75,7 +75,7 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth);
+static herr_t H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth);
/*********************/
/* Package Variables */
@@ -97,7 +97,6 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int i
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 20 2015
*
*-------------------------------------------------------------------------
@@ -154,30 +153,29 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length")
/* Display the heap ID */
- HDfprintf(stream, "%*s%-*s (%c, %Hu, %Zu)\n", indent, "", fwidth, "Heap ID info: (type, offset, length)",
- id_type, obj_off, obj_len);
+ HDfprintf(stream, "%*s%-*s (%c, %" PRIuHSIZE " , %zu)\n", indent, "", fwidth,
+ "Heap ID info: (type, offset, length)", id_type, obj_off, obj_len);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_id_print() */
/*-------------------------------------------------------------------------
- * 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.
@@ -192,9 +190,9 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi
*/
/* Creation parameter values */
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", dtable->cparam.width);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Starting block size:", dtable->cparam.start_block_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Max. direct block size:", dtable->cparam.max_direct_size);
HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth,
"Max. index size:", dtable->cparam.max_index);
@@ -202,7 +200,8 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi
"Starting # of rows in root indirect block:", dtable->cparam.start_root_rows);
/* Run-time varying parameter values */
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Table's root address:", dtable->table_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Table's root address:", dtable->table_addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Current # of rows in root indirect block:", dtable->curr_root_rows);
@@ -213,11 +212,11 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi
"Max. # of direct rows in any indirect block:", dtable->max_direct_rows);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"# of bits for IDs in first row:", dtable->first_row_bits);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"# of IDs in first row:", dtable->num_id_first_row);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5HF_dtable_debug() */
+} /* end H5HF__dtable_debug() */
/*-------------------------------------------------------------------------
* Function: H5HF_hdr_print
@@ -227,7 +226,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
*
*-------------------------------------------------------------------------
@@ -253,42 +251,47 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i
*/
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Heap is:", hdr->man_dtable.curr_root_rows > 0 ? "Indirect" : "Direct");
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "Objects stored in 'debugging' format:", hdr->debug_objs);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "'Write once' flag:", hdr->write_once);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Objects stored in 'debugging' format:", hdr->debug_objs ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "'Write once' flag:", hdr->write_once ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Free space in managed blocks:", hdr->total_man_free);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Managed space data block size:", hdr->man_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
+ "Managed space data block size:", hdr->man_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Total managed space allocated:", hdr->man_alloc_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Offset of managed space iterator:", hdr->man_iter_off);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Number of managed objects in heap:", hdr->man_nobjs);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Address of free space manager for managed blocks:", hdr->fs_addr);
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Max. size of managed object:", (unsigned long)hdr->max_man_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "'Huge' object space used:", hdr->huge_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
+ "'Huge' object space used:", hdr->huge_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Number of 'huge' objects in heap:", hdr->huge_nobjs);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "ID of next 'huge' object:", hdr->huge_next_id);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
+ "ID of next 'huge' object:", hdr->huge_next_id);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Address of v2 B-tree for 'huge' objects:", hdr->huge_bt2_addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "'Tiny' object space used:", hdr->tiny_size);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
+ "'Tiny' object space used:", hdr->tiny_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Number of 'tiny' objects in heap:", 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) {
HDfprintf(stream, "%*sI/O filter Info...\n", indent, "");
if (hdr->man_dtable.curr_root_rows == 0) {
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Compressed size of root direct block:", hdr->pline_root_direct_size);
HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3),
"Filter mask for root direct block:", hdr->pline_root_direct_filter_mask);
@@ -304,7 +307,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i
HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3),
"Root indirect block flags:", hdr->root_iblock_flags);
HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3),
- "Root indirect block pointer:", hdr->root_iblock);
+ "Root indirect block pointer:", (void *)hdr->root_iblock);
if (hdr->root_iblock)
H5HF_iblock_print(hdr->root_iblock, dump_internal, stream, indent + 3, fwidth);
} /* end if */
@@ -320,7 +323,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
*
*-------------------------------------------------------------------------
@@ -364,7 +366,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 13 2006
*
*-------------------------------------------------------------------------
@@ -417,7 +418,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
len = end - start;
HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count);
- HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9),
+ HDfprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9),
temp_str, start, len);
udata->sect_count++;
@@ -447,7 +448,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
*
*-------------------------------------------------------------------------
@@ -492,12 +492,12 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Address of fractal heap that owns this block:", hdr->heap_addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Offset of direct block in heap:", dblock->block_off);
blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size);
/* Allocate space for the free space markers */
if (NULL == (marker = (uint8_t *)H5MM_calloc(dblock->size)))
@@ -543,7 +543,7 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
amount_free = 0;
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:",
- ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) /
+ (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) /
(double)(dblock->size - blk_prefix_size)));
/*
@@ -569,7 +569,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Feb 23 2012
*
*-------------------------------------------------------------------------
@@ -601,11 +600,11 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Address of fractal heap that owns this block:", hdr->heap_addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth,
"Offset of indirect block in heap:", iblock->block_off);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows:", iblock->nrows);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of rows:", iblock->max_rows);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
@@ -625,11 +624,11 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st
HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
if (hdr->filter_len > 0)
- HDfprintf(stream, "%*s%-*s %9a/%6Zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
- iblock->ents[off].addr, iblock->filt_ents[off].size,
+ HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6),
+ temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size,
iblock->filt_ents[off].filter_mask);
else
- HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
+ HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
iblock->ents[off].addr);
} /* end for */
} /* end for */
@@ -649,7 +648,7 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st
size_t off = (u * hdr->man_dtable.cparam.width) + v;
HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
- HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
+ HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
iblock->ents[off].addr);
} /* end for */
} /* end for */
@@ -662,12 +661,12 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st
HDfprintf(stream, "%*sFractal Indirect Block Internal Information:\n", indent, "");
/* Print general information */
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Reference count:", iblock->rc);
/* Print parent's information */
HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3),
- "Parent indirect block address:", iblock->parent);
+ "Parent indirect block address:", (void *)iblock->parent);
if (iblock->parent)
H5HF_iblock_print(iblock->parent, TRUE, stream, indent + 6, fwidth);
} /* end if */
@@ -683,7 +682,6 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 7 2006
*
*-------------------------------------------------------------------------
@@ -692,10 +690,10 @@ herr_t
H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t hdr_addr,
unsigned nrows)
{
- H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */
- H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */
- hbool_t did_protect; /* Whether we protected the indirect block or not */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */
+ H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */
+ hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -741,7 +739,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 13 2006
*
*-------------------------------------------------------------------------
@@ -769,14 +766,10 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
: (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW
? "first row"
: (sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW ? "normal row" : "unknown"))));
- HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth,
+ HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth,
"Section address:", sect->sect_info.addr);
- HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth,
+ HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\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)) <
@@ -795,7 +788,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 3a5cf08..628dcc4 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFdblock.c
* Apr 10 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Direct block routines for fractal heaps.
*
@@ -77,7 +77,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
*
*-------------------------------------------------------------------------
@@ -110,7 +109,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
/* 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 */
@@ -156,7 +155,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
/* 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 */
@@ -165,8 +164,8 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
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)),
- free_space, dblock->parent, dblock->par_entry)))
+ 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")
/* Check what to do with section node */
@@ -184,7 +183,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
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 */
@@ -194,7 +193,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
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)
@@ -212,7 +211,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 17 2006
*
*-------------------------------------------------------------------------
@@ -264,7 +262,7 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_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)
@@ -325,7 +323,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 13 2006
*
*-------------------------------------------------------------------------
@@ -373,8 +370,8 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_
} /* 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 */
@@ -390,7 +387,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_
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);
@@ -399,13 +396,13 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_
if (min_dblock_size > next_size) {
HDfprintf(
stderr,
- "%s: Skipping direct block sizes not supported, min_dblock_size = %Zu, next_size = %Zu\n",
+ "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n",
FUNC, min_dblock_size, next_size);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet")
} /* 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*/
@@ -426,7 +423,6 @@ done:
* Return: Pointer to direct block on success, NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 17 2006
*
*-------------------------------------------------------------------------
@@ -508,7 +504,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 8 2006
*
*-------------------------------------------------------------------------
@@ -538,7 +533,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_
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 */
@@ -589,7 +584,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_
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 */
@@ -617,7 +612,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 7 2006
*
*-------------------------------------------------------------------------
@@ -674,24 +668,23 @@ done:
} /* end H5HF__man_dblock_delete() */
/*-------------------------------------------------------------------------
- * 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.
@@ -700,7 +693,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)
@@ -715,4 +708,4 @@ 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 217c174..5a1f950 100644
--- a/src/H5HFdtable.c
+++ b/src/H5HFdtable.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFdtable.c
* Apr 10 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: "Doubling table" routines for fractal heaps.
*
@@ -66,27 +66,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.
@@ -127,25 +126,24 @@ 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.
@@ -153,9 +151,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) {
@@ -166,33 +161,29 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi
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.
@@ -212,27 +203,26 @@ 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.
@@ -247,27 +237,26 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t 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.
@@ -277,24 +266,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, unsigned start_col,
- unsigned num_entries)
+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 */
unsigned end_row; /* Row for last block covered */
@@ -302,7 +290,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned
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.
@@ -317,12 +305,6 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned
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;
@@ -351,8 +333,5 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned
acc_span_size = dtable->row_block_size[start_row] * ((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 7a17012..cd5ba23 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFhdr.c
* Apr 10 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Heap header routines for fractal heaps.
*
@@ -85,25 +85,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.
@@ -124,7 +123,7 @@ H5HF_hdr_alloc(H5F_t *f)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_hdr_alloc() */
+} /* end H5HF__hdr_alloc() */
/*-------------------------------------------------------------------------
* Function: H5HF_hdr_free_space
@@ -135,13 +134,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 */
@@ -150,7 +148,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.
@@ -177,27 +175,26 @@ 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.
@@ -206,7 +203,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 */
@@ -215,28 +212,27 @@ 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.
@@ -251,46 +247,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)
+ else if (H5HF__hdr_compute_free_space(hdr, u) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL,
"can't initialize direct block free space for indirect block")
} /* 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.
@@ -298,38 +293,37 @@ 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.
@@ -363,7 +357,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
@@ -387,7 +381,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")
@@ -475,7 +469,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")
@@ -499,11 +493,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__hdr_protect
@@ -513,7 +507,6 @@ done:
* Return: Pointer to indirect block on success, NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 5 2010
*
*-------------------------------------------------------------------------
@@ -555,24 +548,23 @@ done:
} /* end H5HF__hdr_protect() */
/*-------------------------------------------------------------------------
- * 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);
@@ -587,27 +579,26 @@ 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);
@@ -625,25 +616,24 @@ 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);
@@ -652,25 +642,24 @@ 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);
@@ -680,36 +669,34 @@ 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)
@@ -717,27 +704,26 @@ 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.
@@ -749,32 +735,31 @@ 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.
@@ -789,30 +774,29 @@ 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.
@@ -824,27 +808,26 @@ 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.
@@ -853,7 +836,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 */
@@ -861,27 +844,26 @@ 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.
@@ -889,7 +871,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 */
@@ -897,7 +879,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__hdr_skip_blocks
@@ -907,7 +889,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 3 2006
*
*-------------------------------------------------------------------------
@@ -931,11 +912,11 @@ H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_e
/* 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 */
@@ -958,7 +939,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 14 2006
*
*-------------------------------------------------------------------------
@@ -989,17 +969,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 */
@@ -1019,7 +999,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 */
@@ -1037,17 +1017,17 @@ 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")
@@ -1064,7 +1044,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size)
/* 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]);
+ 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) */
@@ -1106,7 +1086,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size)
"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")
@@ -1130,7 +1110,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")
@@ -1145,24 +1125,23 @@ done:
} /* end H5HF__hdr_update_iter() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1172,7 +1151,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 */
@@ -1180,7 +1159,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__hdr_reverse_iter
@@ -1191,7 +1170,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 31 2006
*
*-------------------------------------------------------------------------
@@ -1213,7 +1191,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")
@@ -1221,7 +1199,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 */
@@ -1246,12 +1224,12 @@ 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")
@@ -1266,7 +1244,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 */
@@ -1282,7 +1260,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 */
@@ -1298,7 +1276,8 @@ 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,
@@ -1308,11 +1287,11 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr)
"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")
@@ -1343,7 +1322,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 17 2006
*
*-------------------------------------------------------------------------
@@ -1359,10 +1337,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;
@@ -1379,7 +1356,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 +1364,23 @@ done:
} /* end H5HF__hdr_empty() */
/*-------------------------------------------------------------------------
- * 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 +1388,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 +1401,7 @@ H5HF_hdr_free(H5HF_hdr_t *hdr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_hdr_free() */
+} /* end H5HF__hdr_free() */
/*-------------------------------------------------------------------------
* Function: H5HF__hdr_delete
@@ -1435,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 58b231f..b1043a6 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFhuge.c
* Aug 7 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Routines for "huge" objects in fractal heap
*
@@ -62,7 +62,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);
@@ -86,7 +86,6 @@ static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 7 2006
*
*-------------------------------------------------------------------------
@@ -114,32 +113,32 @@ H5HF__huge_bt2_create(H5HF_hdr_t *hdr)
if (hdr->huge_ids_direct) {
if (hdr->filter_len > 0) {
bt2_cparam.rrec_size =
- (size_t)((unsigned)hdr->sizeof_addr /* Address of object */
- + (unsigned)hdr->sizeof_size /* Length of object */
- + (unsigned)4 /* Filter mask for filtered object */
- + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */
+ (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */
+ + (unsigned)hdr->sizeof_size /* Length of object */
+ + (unsigned)4 /* Filter mask for filtered object */
+ + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */
bt2_cparam.cls = H5HF_HUGE_BT2_FILT_DIR;
} /* end if */
else {
- bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */
- + (unsigned)hdr->sizeof_size); /* Length of object */
+ bt2_cparam.rrec_size = (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */
+ + (unsigned)hdr->sizeof_size); /* Length of object */
bt2_cparam.cls = H5HF_HUGE_BT2_DIR;
} /* end else */
} /* end if */
else {
if (hdr->filter_len > 0) {
bt2_cparam.rrec_size =
- (size_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */
- + (unsigned)hdr->sizeof_size /* Length of filtered object */
- + (unsigned)4 /* Filter mask for filtered object */
- + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */
- + (unsigned)hdr->sizeof_size); /* Unique ID for object */
+ (uint32_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */
+ + (unsigned)hdr->sizeof_size /* Length of filtered object */
+ + (unsigned)4 /* Filter mask for filtered object */
+ + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */
+ + (unsigned)hdr->sizeof_size); /* Unique ID for object */
bt2_cparam.cls = H5HF_HUGE_BT2_FILT_INDIR;
} /* end if */
else {
- bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */
- + (unsigned)hdr->sizeof_size /* Length of object */
- + (unsigned)hdr->sizeof_size); /* Unique ID for object */
+ bt2_cparam.rrec_size = (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */
+ + (unsigned)hdr->sizeof_size /* Length of object */
+ + (unsigned)hdr->sizeof_size); /* Unique ID for object */
bt2_cparam.cls = H5HF_HUGE_BT2_INDIR;
} /* end else */
} /* end else */
@@ -161,22 +160,21 @@ done:
} /* end H5HF__huge_bt2_create() */
/*-------------------------------------------------------------------------
- * 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.
@@ -189,10 +187,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 */
@@ -231,10 +225,10 @@ H5HF_huge_init(H5HF_hdr_t *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)
@@ -242,18 +236,17 @@ H5HF_huge_init(H5HF_hdr_t *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.
@@ -279,7 +272,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__huge_insert
@@ -289,7 +282,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 7 2006
*
*-------------------------------------------------------------------------
@@ -305,9 +297,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.
@@ -355,11 +344,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
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;
@@ -393,10 +377,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
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)
@@ -416,9 +396,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
/* 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)
@@ -438,7 +415,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
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) {
@@ -448,11 +425,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
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;
@@ -462,10 +434,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id)
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 +453,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_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:
@@ -500,7 +468,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
@@ -591,7 +558,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
@@ -677,7 +643,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
@@ -828,7 +793,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Feb 21 2007
*
*-------------------------------------------------------------------------
@@ -906,7 +870,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sept 11 2006
*
*-------------------------------------------------------------------------
@@ -941,7 +904,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sept 11 2006
*
*-------------------------------------------------------------------------
@@ -976,7 +938,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
@@ -1069,7 +1030,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:
@@ -1084,7 +1045,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
@@ -1130,7 +1090,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 */
@@ -1147,7 +1107,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 94d7bcb..9b69ec1 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFiblock.c
* Apr 10 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Indirect block routines for fractal heaps.
*
@@ -90,7 +90,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
*
*-------------------------------------------------------------------------
@@ -156,7 +155,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 17 2006
*
*-------------------------------------------------------------------------
@@ -180,24 +178,23 @@ done:
} /* end H5HF__iblock_unpin() */
/*-------------------------------------------------------------------------
- * 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);
@@ -213,7 +210,7 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_iblock_incr() */
+} /* end H5HF__iblock_incr() */
/*-------------------------------------------------------------------------
* Function: H5HF__iblock_decr
@@ -223,7 +220,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 27 2006
*
*-------------------------------------------------------------------------
@@ -287,7 +283,7 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock)
} /* end if */
else {
/* Destroy the 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")
} /* end else */
} /* end if */
@@ -297,24 +293,23 @@ done:
} /* end H5HF__iblock_decr() */
/*-------------------------------------------------------------------------
- * 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);
@@ -325,7 +320,7 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_iblock_dirty() */
+} /* end H5HF__iblock_dirty() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_iblock_root_create
@@ -335,7 +330,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -408,7 +402,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")
@@ -436,9 +430,9 @@ 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 */
@@ -449,7 +443,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) */
@@ -471,7 +465,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:
@@ -486,7 +480,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 17 2006
*
*-------------------------------------------------------------------------
@@ -512,7 +505,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];
@@ -532,7 +525,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;
@@ -645,7 +638,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 */
@@ -653,8 +646,8 @@ 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:
@@ -669,7 +662,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jun 12 2006
*
*-------------------------------------------------------------------------
@@ -777,7 +769,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 */
@@ -785,8 +777,8 @@ 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:
@@ -804,7 +796,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 31 2006
*
*-------------------------------------------------------------------------
@@ -865,12 +856,12 @@ 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 */
@@ -895,7 +886,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 6 2006
*
*-------------------------------------------------------------------------
@@ -928,11 +918,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;
@@ -962,7 +952,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 6 2006
*
*-------------------------------------------------------------------------
@@ -996,7 +985,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
/* 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 */
@@ -1065,7 +1054,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
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")
@@ -1097,7 +1086,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p
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)
@@ -1111,7 +1100,6 @@ done:
* Return: Pointer to indirect block on success, NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 17 2006
*
*-------------------------------------------------------------------------
@@ -1240,7 +1228,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Aug 17 2006
*
*-------------------------------------------------------------------------
@@ -1285,24 +1272,23 @@ done:
} /* end H5HF__man_iblock_unprotect() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1312,7 +1298,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 */
@@ -1341,12 +1327,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_iblock_detach
@@ -1356,7 +1342,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 31 2006
*
*-------------------------------------------------------------------------
@@ -1464,7 +1449,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 */
@@ -1567,22 +1552,21 @@ done:
} /* end H5HF__man_iblock_detach() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1594,7 +1578,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_iblock_delete
@@ -1608,7 +1592,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
*
*-------------------------------------------------------------------------
@@ -1670,7 +1653,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr
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) <
@@ -1796,7 +1779,6 @@ done:
* Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Jan 14 2018
*
*-------------------------------------------------------------------------
@@ -1821,7 +1803,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t *
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 */
@@ -1845,7 +1827,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t *
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 */
@@ -1862,24 +1844,23 @@ done:
} /* end H5HF__man_iblock_par_info() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1889,7 +1870,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)
@@ -1909,4 +1890,4 @@ 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 30c4190..673c543 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFiter.c
* Apr 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Block iteration routines for fractal heaps.
*
@@ -68,7 +68,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
@@ -77,15 +77,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.
@@ -96,7 +95,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_iter_start_offset
@@ -107,7 +106,6 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter)
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 24 2006
*
*-------------------------------------------------------------------------
@@ -215,7 +213,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o
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")
@@ -259,22 +257,21 @@ done:
} /* end H5HF__man_iter_start_offset() */
/*-------------------------------------------------------------------------
- * 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.
@@ -287,10 +284,10 @@ 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
@@ -298,19 +295,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_indirect_t *iblock,
- unsigned start_entry)
+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.
@@ -333,7 +329,7 @@ H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indire
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 */
@@ -347,10 +343,10 @@ 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
@@ -358,17 +354,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.
@@ -408,25 +403,24 @@ 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.
@@ -443,28 +437,27 @@ 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.
@@ -490,28 +483,27 @@ 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.
@@ -534,7 +526,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 */
@@ -545,26 +537,25 @@ 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, unsigned *entry,
- H5HF_indirect_t **block)
+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.
@@ -583,64 +574,24 @@ H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsig
*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.
@@ -648,4 +599,4 @@ 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 2a77dbb..427be00 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFman.c
* Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: "Managed" object routines for fractal heaps.
*
@@ -89,7 +89,6 @@ static herr_t H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operato
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 13 2006
*
*-------------------------------------------------------------------------
@@ -146,7 +145,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 */
@@ -190,7 +189,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:
@@ -207,22 +206,22 @@ done:
} /* end H5HF__man_insert() */
/*-------------------------------------------------------------------------
- * 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.
@@ -241,7 +240,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_get_obj_off
@@ -251,7 +250,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
*
*-------------------------------------------------------------------------
@@ -286,7 +284,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
*
*-------------------------------------------------------------------------
@@ -300,9 +297,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
* H5AC__NO_FLAGS_SET or
* H5AC__READ_ONLY_FLAG
*/
- haddr_t dblock_addr; /* Direct block address */
+ haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
size_t dblock_size; /* Direct block size */
- unsigned dblock_cache_flags; /* Flags for unprotecting direct block */
+ unsigned dblock_cache_flags = 0; /* Flags for unprotecting direct block */
hsize_t obj_off; /* Object's offset in heap */
size_t obj_len; /* Object's length in heap */
size_t blk_off; /* Offset of object in block */
@@ -438,7 +435,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 17 2006
*
*-------------------------------------------------------------------------
@@ -458,7 +454,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:
@@ -473,7 +469,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2006
*
*-------------------------------------------------------------------------
@@ -494,7 +489,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:
@@ -509,7 +504,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sept 11 2006
*
*-------------------------------------------------------------------------
@@ -544,7 +538,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 15 2006
*
*-------------------------------------------------------------------------
@@ -552,9 +545,9 @@ done:
herr_t
H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id)
{
- H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */
- H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */
- hbool_t did_protect; /* Whether we protected the indirect block or not */
+ H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */
+ H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */
+ hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */
hsize_t obj_off; /* Object's offset in heap */
size_t obj_len; /* Object's length in heap */
size_t dblock_size; /* Direct block size */
@@ -636,7 +629,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 */
@@ -647,7 +640,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 efbc622..7fab611 100644
--- a/src/H5HFmodule.h
+++ b/src/H5HFmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5HF package. Including this header means that the source file
* is part of the H5HF package.
*/
-#ifndef _H5HFmodule_H
-#define _H5HFmodule_H
+#ifndef H5HFmodule_H
+#define H5HFmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_HEAP
#define H5_MY_PKG_INIT NO
-#endif /* _H5HFmodule_H */
+#endif /* H5HFmodule_H */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 73b7f0a..893a65d 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, February 24, 2006
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5HF package!"
#endif
-#ifndef _H5HFpkg_H
-#define _H5HFpkg_H
+#ifndef H5HFpkg_H
+#define H5HFpkg_H
/* Get package's private header */
#include "H5HFprivate.h"
@@ -221,9 +221,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 */
@@ -296,7 +293,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;
@@ -363,7 +360,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) */
@@ -609,46 +606,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, 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, unsigned start_col,
- unsigned num_entries);
+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, 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, size_t min_dblock_size);
H5_DLL herr_t H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node);
@@ -658,9 +654,9 @@ H5_DLL H5HF_indirect_t *H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock
H5HF_indirect_t *par_iblock, unsigned par_entry,
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, haddr_t dblock_addr);
+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, haddr_t *child_addr);
+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);
H5_DLL herr_t H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned nrows,
@@ -668,7 +664,7 @@ H5_DLL herr_t H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_ad
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, H5HF_free_section_t **ret_sec_node);
@@ -682,11 +678,11 @@ H5_DLL H5HF_direct_t *H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_a
H5_DLL herr_t H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **par_iblock,
unsigned *par_entry, hbool_t *par_did_protect, 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, size_t *obj_len_p);
+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);
H5_DLL herr_t H5HF__man_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj);
H5_DLL herr_t H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj);
@@ -694,7 +690,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, size_t *obj_len_p);
H5_DLL herr_t H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p);
@@ -715,38 +711,26 @@ 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, void *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, 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_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, 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, H5HF_operator_t op, void *op_data);
+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, H5HF_indirect_t *iblock,
- unsigned start_entry);
-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, 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, 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 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, H5HF_block_iter_t *biter, unsigned entry);
+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, unsigned *entry,
+ H5HF_indirect_t **block);
+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);
@@ -761,22 +745,22 @@ H5_DLL herr_t H5HF__space_delete(H5HF_hdr_t *hdr);
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, size_t sect_size, H5HF_indirect_t *parent,
- unsigned par_entry);
+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, const H5HF_free_section_t *sect,
- haddr_t *dblock_addr, size_t *dblock_size);
+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
@@ -794,4 +778,4 @@ H5_DLL herr_t H5HF_get_tiny_info_test(const H5HF_t *fh, size_t *max_len, hbool
H5_DLL herr_t H5HF_get_huge_info_test(const H5HF_t *fh, hsize_t *next_id, hbool_t *ids_direct);
#endif /* H5HF_TESTING */
-#endif /* _H5HFpkg_H */
+#endif /* H5HFpkg_H */
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 6b6fd67..3263b4e 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
*
* Created: H5HFprivate.h
* Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Private header for library accessible fractal heap routines.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5HFprivate_H
-#define _H5HFprivate_H
+#ifndef H5HFprivate_H
+#define H5HFprivate_H
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
@@ -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) */
-typedef struct H5HF_t H5HF_t;
+/* 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, void *op_data /*in,out*/);
@@ -125,4 +127,15 @@ 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 */
-#endif /* _H5HFprivate_H */
+/* 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 3e437a9..eec41a4 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Monday, May 1, 2006
*
* Purpose: Free space section routines for fractal heaps
@@ -64,11 +64,11 @@ typedef struct {
/********************/
/* Shared routines */
-static herr_t H5HF_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, 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, H5HF_indirect_t *parent);
+static herr_t H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr);
+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, H5HF_indirect_t *parent);
/* 'single' section routines */
static herr_t H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_section_t *sect);
@@ -87,12 +87,12 @@ static herr_t H5HF__sect_single_shrink(H5FS_section_info_t **_sect, void *udata)
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, hsize_t sect_size, hbool_t is_first,
- unsigned row, unsigned col, unsigned nentries,
- H5HF_free_section_t *under_sect);
+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, H5HF_free_section_t *sect, H5HF_direct_t *dblock);
+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);
/* 'row' section callbacks */
@@ -113,16 +113,16 @@ static herr_t H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_s
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, haddr_t sect_off, hsize_t sect_size,
- H5HF_indirect_t *iblock, hsize_t iblock_off, unsigned row,
- unsigned col, unsigned nentries);
+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);
static herr_t H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, 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, H5HF_indirect_t *iblock,
- H5HF_free_section_t *row_sect);
-static herr_t H5HF_sect_indirect_decr(H5HF_free_section_t *sect);
+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_revive_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect);
static herr_t H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
H5HF_indirect_t *sect_iblock);
@@ -130,25 +130,26 @@ static herr_t H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF
hbool_t *alloc_from_start);
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, const H5HF_free_section_t *sect, uint8_t *buf);
+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, 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);
+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, 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);
/*********************/
/* Package Variables */
@@ -247,8 +248,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 */
@@ -276,7 +277,7 @@ H5FL_DEFINE(H5HF_free_section_t);
/*******************/
/*-------------------------------------------------------------------------
- * Function: H5HF_sect_init_cls
+ * Function: H5FS__sect_init_cls
*
* Purpose: Initialize the common class structure
*
@@ -289,12 +290,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);
@@ -309,15 +310,15 @@ 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
*
@@ -330,12 +331,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);
@@ -344,7 +345,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 */
@@ -352,10 +353,10 @@ 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
*
@@ -369,12 +370,12 @@ done:
*-------------------------------------------------------------------------
*/
static H5HF_free_section_t *
-H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t sect_state)
+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));
@@ -397,10 +398,10 @@ H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5F
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
*
@@ -414,11 +415,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);
@@ -433,28 +434,27 @@ 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_indirect_t *parent, unsigned par_entry)
+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.
@@ -463,13 +463,13 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent
/* 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)))
+ (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 */
@@ -485,7 +485,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_sect_single_new() */
+} /* end H5HF__sect_single_new() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_single_locate_parent
@@ -495,7 +495,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* October 24 2006
*
*-------------------------------------------------------------------------
@@ -523,7 +522,7 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_sect
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 */
@@ -557,7 +556,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 8 2006
*
*-------------------------------------------------------------------------
@@ -597,23 +595,22 @@ done:
} /* end H5HF__sect_single_revive() */
/*-------------------------------------------------------------------------
- * 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, haddr_t *dblock_addr,
- size_t *dblock_size)
+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.
@@ -640,7 +637,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, h
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5HF_sect_single_dblock_info() */
+} /* end H5HF__sect_single_dblock_info() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_single_reduce
@@ -652,7 +649,6 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, h
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 31 2006
*
*-------------------------------------------------------------------------
@@ -717,7 +713,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);
@@ -725,7 +721,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 */
@@ -741,7 +737,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 */
@@ -840,7 +836,7 @@ H5HF__sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
/* Create free list section node */
if (NULL ==
- (new_sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED)))
+ (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 */
@@ -1045,7 +1041,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 */
@@ -1099,14 +1095,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:
@@ -1152,8 +1147,8 @@ 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);
@@ -1200,7 +1195,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5
} /* H5HF__sect_single_valid() */
/*-------------------------------------------------------------------------
- * Function: H5HF_sect_row_create
+ * Function: H5HF__sect_row_create
*
* Purpose: Create a new 'row' section
*
@@ -1214,13 +1209,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, unsigned row, unsigned col,
- unsigned nentries, H5HF_free_section_t *under_sect)
+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);
@@ -1229,7 +1224,7 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsi
/* Create 'row' free space section node */
/* ("inherits" underlying indirect section's state) */
- if (NULL == (sect = H5HF_sect_node_new(
+ 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")
@@ -1246,27 +1241,26 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsi
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_direct_t *dblock)
+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.
@@ -1284,7 +1278,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direc
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 */
@@ -1293,7 +1287,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direc
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HF_sect_row_from_single() */
+} /* end H5HF__sect_row_from_single() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_row_revive
@@ -1303,7 +1297,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 6 2006
*
*-------------------------------------------------------------------------
@@ -1350,7 +1343,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 6 2006
*
*-------------------------------------------------------------------------
@@ -1424,7 +1416,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 10 2006
*
*-------------------------------------------------------------------------
@@ -1457,24 +1448,23 @@ done:
} /* end H5HF__sect_row_first() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1484,10 +1474,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_row_parent_removed
@@ -1498,7 +1488,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
*
*-------------------------------------------------------------------------
@@ -1571,7 +1560,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 */
@@ -1612,7 +1601,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:
@@ -1651,7 +1640,7 @@ H5HF__sect_row_serialize(const H5FS_section_class_t *cls, const H5FS_section_inf
/* 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")
@@ -1736,24 +1725,22 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_i
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)
@@ -1797,7 +1784,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)
@@ -1883,7 +1870,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)
@@ -1920,7 +1907,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:
@@ -1953,7 +1940,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 */
@@ -2015,10 +2002,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)
@@ -2057,31 +2044,30 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent,
/* Print indirect section header */
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)
} /* H5HF__sect_row_debug() */
/*-------------------------------------------------------------------------
- * 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.
@@ -2092,27 +2078,26 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect)
: 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.
@@ -2120,15 +2105,15 @@ 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
*
@@ -2142,19 +2127,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 */
@@ -2162,10 +2147,10 @@ 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
*
@@ -2179,25 +2164,25 @@ 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.
@@ -2205,19 +2190,18 @@ 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_indirect_t *iblock,
- hsize_t iblock_off, unsigned row, unsigned col, unsigned nentries)
+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.
@@ -2226,15 +2210,15 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5H
HDassert(nentries);
/* Create free space section node */
- if (NULL == (sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, sect_size,
- (iblock ? H5FS_SECT_LIVE : H5FS_SECT_SERIALIZED))))
+ 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")
/* Set the 'indirect' specific fields */
if (iblock) {
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 */
@@ -2247,7 +2231,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5H
sect->u.indirect.num_entries = nentries;
/* Compute span size of indirect section */
- sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries);
+ sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries);
HDassert(sect->u.indirect.span_size > 0);
/* This indirect section doesn't (currently) have a parent */
@@ -2264,28 +2248,27 @@ 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_free_section_t *row_sect)
+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.
@@ -2296,9 +2279,9 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_s
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, 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)))
+ 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")
/* Set # of direct rows covered */
@@ -2322,11 +2305,11 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_s
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() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_indirect_init_rows
@@ -2337,7 +2320,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 6 2006
*
*-------------------------------------------------------------------------
@@ -2451,7 +2433,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_
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(
+ 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")
@@ -2488,20 +2470,20 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_
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 */
for (v = 0; v < row_entries; v++) {
- hbool_t did_protect; /* Whether we protected the indirect block or not */
+ hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */
/* Try to get the child section's indirect block, if it's available */
if (sect->sect_info.state == H5FS_SECT_LIVE) {
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")
@@ -2520,8 +2502,8 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_
child_iblock = NULL;
/* Create free space section node */
- if (NULL == (child_sect = H5HF_sect_indirect_new(hdr, curr_off, (hsize_t)0, child_iblock,
- curr_off, 0, 0, child_nentries)))
+ 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")
/* Initialize rows for new indirect section */
@@ -2592,7 +2574,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 3 2006
*
*-------------------------------------------------------------------------
@@ -2636,8 +2617,8 @@ 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, iblock->block_off,
- start_row, start_col, nentries)))
+ 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")
/* Initialize rows for new indirect section */
@@ -2654,31 +2635,30 @@ 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)
} /* end H5HF__sect_indirect_add() */
/*-------------------------------------------------------------------------
- * 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.
@@ -2697,19 +2677,19 @@ 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() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_indirect_revive_row
@@ -2719,7 +2699,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 3 2006
*
*-------------------------------------------------------------------------
@@ -2765,7 +2744,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 10 2006
*
*-------------------------------------------------------------------------
@@ -2787,7 +2765,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 */
@@ -2822,7 +2800,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 10 2006
*
*-------------------------------------------------------------------------
@@ -2884,7 +2861,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h
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)
@@ -3001,8 +2978,8 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h
/* Create peer indirect section */
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)))
+ (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")
/* Set up direct row & indirect entry information for peer section */
@@ -3076,7 +3053,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 */
@@ -3093,7 +3070,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 10 2006
*
*-------------------------------------------------------------------------
@@ -3133,7 +3109,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned
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)
@@ -3229,8 +3205,8 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned
/* Update the number of entries in current section & calculate it's span size */
/* (Will use this to compute the section address for the peer section */
sect->u.indirect.num_entries = new_nentries;
- sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, sect->u.indirect.row,
- sect->u.indirect.col, new_nentries);
+ 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);
/* Compute address of peer indirect section */
@@ -3239,9 +3215,9 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned
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, sect->sect_info.size, iblock,
- iblock_off, peer_start_row, peer_start_col,
- peer_nentries)))
+ 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")
/* Set up direct row & indirect entry information for peer section */
@@ -3305,7 +3281,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned
/* 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:
@@ -3315,7 +3291,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 */
@@ -3323,24 +3299,23 @@ done:
} /* end H5HF__sect_indirect_reduce() */
/*-------------------------------------------------------------------------
- * 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/<can't fail>
*
* 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);
@@ -3348,13 +3323,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_indirect_first
@@ -3364,7 +3339,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
*
*-------------------------------------------------------------------------
@@ -3408,22 +3382,21 @@ done:
} /* end H5HF__sect_indirect_first() */
/*-------------------------------------------------------------------------
- * 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.
@@ -3433,7 +3406,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_indirect_merge_row
@@ -3475,9 +3448,9 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H
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 */
@@ -3653,12 +3626,12 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H
/* 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 */
@@ -3737,8 +3710,8 @@ 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, sect->sect_info.size,
- par_iblock, par_block_off, par_row, par_col, 1)))
+ 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")
/* No rows of direct blocks covered in parent, reset direct row information */
@@ -3759,7 +3732,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)
@@ -3813,7 +3786,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:
@@ -3821,7 +3794,7 @@ done:
} /* end H5HF__sect_indirect_shrink() */
/*-------------------------------------------------------------------------
- * Function: H5HF_sect_indirect_serialize
+ * Function: H5HF__sect_indirect_serialize
*
* Purpose: Serialize a "live" indirect section into a buffer
*
@@ -3835,11 +3808,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, uint8_t *buf)
+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);
@@ -3849,7 +3822,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, u
/* 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 */
@@ -3874,7 +3847,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, u
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5HF_sect_indirect_serialize() */
+} /* H5HF__sect_indirect_serialize() */
/*-------------------------------------------------------------------------
* Function: H5HF__sect_indirect_deserialize
@@ -3925,8 +3898,8 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sec
UINT16DECODE(buf, nentries);
/* Create free space section node */
- if (NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, NULL, iblock_off, start_row,
- start_col, nentries)))
+ 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")
/* Compute start entry */
@@ -3954,7 +3927,7 @@ done:
} /* H5HF__sect_indirect_deserialize() */
/*-------------------------------------------------------------------------
- * Function: H5HF_sect_indirect_free
+ * Function: H5HF__sect_indirect_free
*
* Purpose: Free a 'indirect' section node
*
@@ -3968,12 +3941,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);
@@ -3984,22 +3957,21 @@ 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
*
@@ -4012,7 +3984,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 */
@@ -4021,7 +3993,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);
@@ -4094,15 +4066,15 @@ 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
*
@@ -4116,9 +4088,9 @@ 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, FILE *stream, int indent, int fwidth)
+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);
@@ -4129,4 +4101,4 @@ H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int inde
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of entries:", 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 5f0ef22..d62267c 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFspace.c
* May 2 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Space allocation routines for fractal heaps.
*
@@ -80,7 +80,6 @@
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -142,7 +141,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 15 2006
*
*-------------------------------------------------------------------------
@@ -186,7 +184,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -224,7 +221,7 @@ done:
} /* end H5HF__space_find() */
/*-------------------------------------------------------------------------
- * 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
@@ -234,18 +231,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.
@@ -267,7 +263,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__space_revert_root
@@ -279,7 +275,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Feb 23 2012
*
*-------------------------------------------------------------------------
@@ -299,7 +294,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:
@@ -307,7 +302,7 @@ done:
} /* end H5HF__space_revert_root() */
/*-------------------------------------------------------------------------
- * 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
@@ -317,19 +312,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.
@@ -343,7 +337,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")
@@ -357,7 +351,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() */
/*-------------------------------------------------------------------------
* Function: H5HF__space_create_root
@@ -370,7 +364,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Feb 24 2012
*
*-------------------------------------------------------------------------
@@ -392,7 +385,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock)
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:
@@ -408,7 +401,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14 2007
*
*-------------------------------------------------------------------------
@@ -452,7 +444,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 24 2006
*
*-------------------------------------------------------------------------
@@ -489,7 +480,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -513,9 +503,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)
@@ -543,7 +530,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 7 2006
*
*-------------------------------------------------------------------------
@@ -578,7 +564,6 @@ done:
* Failure: negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* July 10 2006
*
*-------------------------------------------------------------------------
@@ -589,9 +574,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 1a8db49..5e5d06a 100644
--- a/src/H5HFstat.c
+++ b/src/H5HFstat.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Monday, March 6, 2006
*
* Purpose: Fractal heap metadata statistics functions.
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index 633149b..84734d2 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Thursday, February 3, 2006
*
* Purpose: Fractal heap testing functions.
@@ -178,24 +178,19 @@ 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 : "<nil>"));
- 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 : "<nil>"));
- if (!cparam1->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)
+ else 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) {
- if ((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name)))
+ else if(cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) {
+ 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 1bf255d..eca177c 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HFtiny.c
* Aug 14 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Routines for "tiny" objects in fractal heap
*
@@ -58,7 +58,7 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data);
+static herr_t H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data);
/*********************/
/* Package Variables */
@@ -73,22 +73,21 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operato
/*******************/
/*-------------------------------------------------------------------------
- * 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.
@@ -116,32 +115,28 @@ 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.
@@ -173,32 +168,31 @@ H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
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.
@@ -220,28 +214,27 @@ 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, void *op_data)
+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.
@@ -251,8 +244,8 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
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)
@@ -271,27 +264,26 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
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.
@@ -301,32 +293,31 @@ 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, void *op_data)
+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.
@@ -336,33 +327,32 @@ H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_da
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.
@@ -371,17 +361,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 fe02993..cae23a7 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, March 27, 1998
*
* Purpose: Operations on the global heap. The global heap is the set of
@@ -132,7 +132,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);
@@ -221,7 +221,7 @@ done:
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI_TAG(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5HG__create() */
/*-------------------------------------------------------------------------
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index bcd7221..379e6f6 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HGcache.c
* Feb 5 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement global heap metadata cache methods.
*
@@ -122,7 +122,7 @@ H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, const H5F_t *f)
HDassert(f);
/* Magic number */
- if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad global heap collection signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index 7fc3347..51a74ec 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Wednesday, July 9, 2003
*
* Purpose: Global Heap object debugging functions.
@@ -68,7 +68,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 3698d02..a75dea5 100644
--- a/src/H5HGmodule.h
+++ b/src/H5HGmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5HG package. Including this header means that the source file
* is part of the H5HG package.
*/
-#ifndef _H5HGmodule_H
-#define _H5HGmodule_H
+#ifndef H5HGmodule_H
+#define H5HGmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_HEAP
#define H5_MY_PKG_INIT NO
-#endif /* _H5HGmodule_H */
+#endif /* H5HGmodule_H */
diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h
index 84a4b03..5c0fbe8 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Wednesday, July 9, 2003
*
* Purpose: This file contains declarations which are visible
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5HG package!"
#endif
-#ifndef _H5HGpkg_H
-#define _H5HGpkg_H
+#ifndef H5HGpkg_H
+#define H5HGpkg_H
/* Get package's private header */
#include "H5HGprivate.h"
@@ -136,4 +136,4 @@ struct H5HG_heap_t {
H5_DLL herr_t H5HG__free(H5HG_heap_t *heap);
H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags);
-#endif /* _H5HGpkg_H */
+#endif /* H5HGpkg_H */
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index af0d312..d8e6b46 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -6,17 +6,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, March 27, 1998
*/
-#ifndef _H5HGprivate_H
-#define _H5HGprivate_H
+#ifndef H5HGprivate_H
+#define H5HGprivate_H
/* Private headers needed by this file. */
#include "H5Fprivate.h" /* File access */
@@ -70,4 +70,4 @@ H5_DLL size_t H5HG_get_free_size(const H5HG_heap_t *h);
/* Debugging functions */
H5_DLL herr_t H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth);
-#endif /* _H5HGprivate_H */
+#endif /* H5HGprivate_H */
diff --git a/src/H5HGquery.c b/src/H5HGquery.c
index d9ad81a..c24a414 100644
--- a/src/H5HGquery.c
+++ b/src/H5HGquery.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Wednesday, July 20, 2011
*
* Purpose: Query routines for global heaps.
diff --git a/src/H5HL.c b/src/H5HL.c
index c5fa65a..ca83445 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HL.c
* Jul 16 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Heap functions for the local heaps used by symbol
* tables to store names (among other things).
@@ -392,7 +392,7 @@ BEGIN_FUNC(PRIV, ERR, void *, NULL, NULL, H5HL_offset_into(const H5HL_t *heap, s
ret_value = heap->dblk_image + offset;
CATCH
- /* No special processing on errors */
+/* No special processing on errors */
END_FUNC(PRIV) /* end H5HL_offset_into() */
/*-------------------------------------------------------------------------
@@ -508,27 +508,31 @@ END_FUNC(STATIC) /* end H5HL__dirty() */
*
* Purpose: Inserts a new item into the heap.
*
- * Return: Success: Offset of new item within heap.
- * Failure: UFAIL
+ * Return: Success: SUCCEED
+ * Offset set to location of new item within heap
+ *
+ * Failure: FAIL
+ * Offset set to SIZE_MAX
*
* Programmer: Robb Matzke
* Jul 17 1997
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
- H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
+ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out))
H5HL_free_t *fl = NULL, *last_fl = NULL;
- size_t offset = 0;
size_t need_size;
+ size_t offset = 0;
hbool_t found;
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(buf_size > 0);
HDassert(buf);
+ HDassert(offset_out);
/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
@@ -539,20 +543,18 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
if (FAIL == H5HL__dirty(heap))
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
- /*
- * In order to keep the free list descriptors aligned on word boundaries,
+ /* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
* a word.
*/
need_size = H5HL_ALIGN(buf_size);
- /*
- * Look for a free slot large enough for this object and which would
+ /* Look for a free slot large enough for this object and which would
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) {
if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) {
- /* a big enough free block was found */
+ /* A big enough free block was found */
offset = fl->offset;
fl->offset += need_size;
fl->size -= need_size;
@@ -562,20 +564,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
break;
}
else if (fl->size == need_size) {
- /* free block of exact size found */
+ /* Free block of exact size found */
offset = fl->offset;
fl = H5HL__remove_free(heap, fl);
found = TRUE;
break;
}
else if (!last_fl || last_fl->offset < fl->offset) {
- /* track free space that's closest to end of heap */
+ /* Track free space that's closest to end of heap */
last_fl = fl;
}
} /* end for */
- /*
- * If no free chunk was large enough, then allocate more space and
+ /* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
* can extend that free chunk. Otherwise we'll have to make another
* free chunk. If the heap must expand, we double its size.
@@ -587,7 +588,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
htri_t was_extended; /* Whether the local heap's data segment on disk was extended */
/* At least double the heap's size, making certain there's enough room
- * for the new object */
+ * for the new object
+ */
need_more = MAX(need_size, heap->dblk_size);
/* If there is no last free block or it's not at the end of the heap,
@@ -657,8 +659,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
}
} /* end if */
else {
- /*
- * Create a new free list element large enough that we can
+ /* Create a new free list element large enough that we can
* take some space out of it right away.
*/
offset = old_dblk_size;
@@ -700,11 +701,10 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
- /* Set return value */
- ret_value = offset;
+ *offset_out = offset;
CATCH
- /* No special processing on errors */
+ /* No special processing on exit */
END_FUNC(PRIV) /* H5HL_insert() */
@@ -930,7 +930,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
- H5HL_t * heap; /* Heap data structure */
+ H5HL_t * heap = NULL; /* Heap data structure */
/* check arguments */
HDassert(f);
@@ -977,7 +977,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
- H5HL_t * heap; /* Heap data structure */
+ H5HL_t * heap = NULL; /* Heap data structure */
/* check arguments */
HDassert(f);
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index c9ba520..b46280e 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HLcache.c
* Feb 5 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement local heap metadata cache methods.
*
@@ -161,7 +161,7 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t *
HDassert(udata);
/* Check magic number */
- if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature")
image += H5_SIZEOF_MAGIC;
@@ -466,11 +466,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 */
@@ -745,7 +745,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 5695e80..76e4ec0 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Wednesday, July 9, 2003
*
* Purpose: Local Heap object debugging functions.
@@ -64,10 +64,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap");
HDfprintf(stream, "%*sLocal Heap...\n", indent, "");
- HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Header size (in bytes):", (unsigned long)h->prfx_size);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size);
/* Traverse the free list and check that all free blocks fall within
* the heap and that no two free blocks point to the same region of
@@ -81,7 +80,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
char temp_str[32];
HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block);
- HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str,
+ HDfprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str,
freelist->offset, freelist->size);
if ((freelist->offset + freelist->size) > h->dblk_size)
HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n");
@@ -103,7 +102,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
if (h->dblk_size)
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:",
- ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
+ (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
/* Print the data in a VMS-style octal dump */
H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c
index 2d2a539..f771de5 100644
--- a/src/H5HLdblk.c
+++ b/src/H5HLdblk.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HLdblk.c
* Summer 2012
- * Dana Robinson <derobins@hdfgroup.org>
+ * Dana Robinson
*
* Purpose: Data block routines for local heaps.
*
diff --git a/src/H5HLint.c b/src/H5HLint.c
index 0bbb381..069bad8 100644
--- a/src/H5HLint.c
+++ b/src/H5HLint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HLint.c
* Oct 12 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Local heap internal routines.
*
diff --git a/src/H5HLmodule.h b/src/H5HLmodule.h
index 109c05f..3004809 100644
--- a/src/H5HLmodule.h
+++ b/src/H5HLmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5HL package. Including this header means that the source file
* is part of the H5HL package.
*/
-#ifndef _H5HLmodule_H
-#define _H5HLmodule_H
+#ifndef H5HLmodule_H
+#define H5HLmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_HEAP
#define H5_MY_PKG_INIT NO
-#endif /* _H5HLmodule_H */
+#endif /* H5HLmodule_H */
diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h
index be007c7..dbac1b9 100644
--- a/src/H5HLpkg.h
+++ b/src/H5HLpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Wednesday, July 9, 2003
*
* Purpose: This file contains declarations which are visible
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5HL package!"
#endif
-#ifndef _H5HLpkg_H
-#define _H5HLpkg_H
+#ifndef H5HLpkg_H
+#define H5HLpkg_H
/* Get package's private header */
#include "H5HLprivate.h"
@@ -145,4 +145,4 @@ H5_DLL H5HL_dblk_t *H5HL__dblk_new(H5HL_t *heap);
H5_DLL herr_t H5HL__dblk_dest(H5HL_dblk_t *dblk);
H5_DLL herr_t H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size);
-#endif /* _H5HLpkg_H */
+#endif /* H5HLpkg_H */
diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c
index 152f501..90f6c74 100644
--- a/src/H5HLprfx.c
+++ b/src/H5HLprfx.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5HLprfx.c
* Summer 2012
- * Dana Robinson <derobins@hdfgroup.org>
+ * Dana Robinson
*
* Purpose: Prefix routines for local heaps.
*
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 6489513..5c98846 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,14 +15,14 @@
*
* Created: H5HLprivate.h
* Jul 16 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Private declarations for the H5HL (local heap) package.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5HLprivate_H
-#define _H5HLprivate_H
+#ifndef H5HLprivate_H
+#define H5HLprivate_H
/* Private headers needed by this file. */
#include "H5private.h" /* Generic Functions */
@@ -57,7 +57,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/);
H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr);
H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size);
H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size);
-H5_DLL size_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf);
+H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset);
H5_DLL void * H5HL_offset_into(const H5HL_t *heap, size_t offset);
H5_DLL H5HL_t *H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags);
H5_DLL herr_t H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size);
diff --git a/src/H5HP.c b/src/H5HP.c
index 15ff46c..d164223 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -45,10 +45,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);
@@ -58,11 +58,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
@@ -78,13 +78,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;
@@ -111,15 +111,15 @@ 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
@@ -135,13 +135,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;
@@ -168,15 +168,15 @@ 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
@@ -192,13 +192,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;
@@ -236,15 +236,15 @@ 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
@@ -260,13 +260,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;
@@ -304,7 +304,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() */
/*--------------------------------------------------------------------------
NAME
@@ -485,11 +485,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 */
@@ -609,11 +609,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 */
@@ -684,21 +684,21 @@ H5HP_change(H5HP_t *heap, int val, void *_obj)
/* Restore heap condition */
if (val < old_val) {
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 */
} /* 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 */
@@ -766,11 +766,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 */
@@ -838,11 +838,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/H5HPprivate.h b/src/H5HPprivate.h
index 0148ca6..50020bc 100644
--- a/src/H5HPprivate.h
+++ b/src/H5HPprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5HP module
*/
-#ifndef _H5HPprivate_H
-#define _H5HPprivate_H
+#ifndef H5HPprivate_H
+#define H5HPprivate_H
/**************************************/
/* Public headers needed by this file */
@@ -65,4 +65,4 @@ H5_DLL herr_t H5HP_incr(H5HP_t *heap, unsigned amt, void *obj);
H5_DLL herr_t H5HP_decr(H5HP_t *heap, unsigned amt, void *obj);
H5_DLL herr_t H5HP_close(H5HP_t *heap);
-#endif /* _H5HPprivate_H */
+#endif /* H5HPprivate_H */
diff --git a/src/H5I.c b/src/H5I.c
index 4b1e911..efb4fd5 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -6,66 +6,38 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * FILE: H5I.c - Internal storage routines for handling "IDs"
- *
- * REMARKS: IDs which allow objects (void * currently) to be bundled
- * into "types" for more general storage.
- *
- * DESIGN: The types are stored in an array of pointers to store each
- * type in an element. Each "type" node contains a link to a
- * hash table to manage the IDs in each type. Allowed types are
- * values within the range 1 to H5I_MAX_NUM_TYPES and are given out
- * at run-time. Types used by the library are stored in global
- * variables defined in H5Ipublic.h.
+ * H5I.c - Public routines for handling IDs
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Imodule.h" /* This source code file is part of the H5I module */
-#define H5T_FRIEND /* Suppress error about including H5Tpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
-#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 "H5Gprivate.h" /* Groups */
+#include "H5Fprivate.h" /* Files */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5SLprivate.h" /* Skip Lists */
-#include "H5Tpkg.h" /* Datatypes */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5Pprivate.h" /* Property lists */
+/****************/
/* 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))
-
-/* 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 */
- unsigned app_count; /* ref. count of application visible atoms */
- 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 */
- H5SL_t * ids; /* Pointer to skip list that stores IDs */
-} H5I_id_type_t;
+/******************/
+/* Local Typedefs */
+/******************/
typedef struct {
H5I_search_func_t app_cb; /* Application's callback routine */
@@ -78,119 +50,28 @@ typedef struct {
void * op_data; /* Application's user data */
} H5I_iterate_pub_ud_t;
-/* User data for iterator callback for retrieving an ID corresponding to an object pointer */
-typedef struct {
- const void *object; /* object pointer to search for */
- H5I_type_t obj_type; /* type of object we are searching for */
- hid_t ret_id; /* ID returned */
-} H5I_get_id_ud_t;
+/********************/
+/* Package Typedefs */
+/********************/
-/* User data for iterator callback for ID iteration */
-typedef struct {
- H5I_search_func_t user_func; /* 'User' function to invoke */
- void * user_udata; /* User data to pass to 'user' function */
- hbool_t app_ref; /* Whether this is an appl. ref. call */
- H5I_type_t obj_type; /* Type of object we are iterating over */
-} H5I_iterate_ud_t;
+/********************/
+/* Local Prototypes */
+/********************/
-/* User data for H5I__clear_type_cb */
-typedef struct {
- H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */
- hbool_t force; /* Whether to always remove the id */
- hbool_t app_ref; /* Whether this is an appl. ref. call */
-} H5I_clear_type_ud_t;
-
-/* Package initialization variable */
-hbool_t H5_PKG_INIT_VAR = FALSE;
-
-/*-------------------- Locally scoped variables -----------------------------*/
-
-/* Array of pointers to atomic types */
-static H5I_id_type_t *H5I_id_type_list_g[H5I_MAX_NUM_TYPES];
-
-/* Variable to keep track of the number of types allocated. Its value is the */
-/* next type ID to be handed out, so it is always one greater than the number */
-/* of types. */
-/* Starts at 1 instead of 0 because it makes trace output look nicer. If more */
-/* types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h */
-/* and/or increase size of hid_t */
-static int H5I_next_type = (int)H5I_NTYPES;
-
-/* Declare a free list to manage the H5I_id_info_t struct */
-H5FL_DEFINE_STATIC(H5I_id_info_t);
-
-/* Declare a free list to manage the H5I_id_type_t struct */
-H5FL_DEFINE_STATIC(H5I_id_type_t);
-
-/* Declare a free list to manage the H5I_class_t struct */
-H5FL_DEFINE_STATIC(H5I_class_t);
-
-H5FL_EXTERN(H5VL_object_t);
-
-/*--------------------- Local function prototypes ---------------------------*/
-static void * H5I__unwrap(void *obj_ptr, H5I_type_t type);
-static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
-static int H5I__destroy_type(H5I_type_t type);
-static void * 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);
-static int H5I__inc_type_ref(H5I_type_t type);
-static int H5I__get_type_ref(H5I_type_t type);
-static int H5I__search_cb(void *obj, hid_t id, void *_udata);
-static H5I_id_info_t *H5I__find_id(hid_t id);
-static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata);
-static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
-static int H5I__id_dump_cb(void *_item, void *_key, void *_udata);
+static int H5I__search_cb(void *obj, hid_t id, void *_udata);
+static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata);
-/*-------------------------------------------------------------------------
- * Function: H5I_term_package
- *
- * Purpose: Terminate the H5I interface: release all memory, reset all
- * global variables to initial values. This only happens if all
- * types have been destroyed from other interfaces.
- *
- * Return: Success: Positive if any action was taken that might
- * affect some other interface; zero otherwise.
- *
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_term_package(void)
-{
- int n = 0;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if (H5_PKG_INIT_VAR) {
- H5I_id_type_t *type_ptr; /* Pointer to ID type */
- int type; /* Type of ID */
-
- /* How many types are still being used? */
- for (type = 0; type < H5I_next_type; type++)
- if ((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids)
- n++;
-
- /* If no types are used then clean up */
- if (0 == n) {
- for (type = 0; type < H5I_next_type; type++) {
- type_ptr = H5I_id_type_list_g[type];
- if (type_ptr) {
- HDassert(NULL == type_ptr->ids);
- type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr);
- H5I_id_type_list_g[type] = NULL;
- n++;
- } /* end if */
- } /* end for */
-
- /* Mark interface closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end if */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(n)
-} /* end H5I_term_package() */
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
/*-------------------------------------------------------------------------
* Function: H5Iregister_type
@@ -210,10 +91,10 @@ H5I_term_package(void)
*-------------------------------------------------------------------------
*/
H5I_type_t
-H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func)
+H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I_free_t free_func)
{
- H5I_class_t *cls = NULL; /* New ID class */
- H5I_type_t new_type; /* New ID type value */
+ H5I_class_t *cls = NULL; /* New ID class */
+ H5I_type_t new_type = H5I_BADID; /* New ID type value */
H5I_type_t ret_value = H5I_BADID; /* Return value */
FUNC_ENTER_API(H5I_BADID)
@@ -222,35 +103,35 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func)
/* Generate a new H5I_type_t value */
/* Increment the number of types */
- if (H5I_next_type < H5I_MAX_NUM_TYPES) {
- new_type = (H5I_type_t)H5I_next_type;
- H5I_next_type++;
- } /* end if */
+ if (H5I_next_type_g < H5I_MAX_NUM_TYPES) {
+ new_type = (H5I_type_t)H5I_next_type_g;
+ H5I_next_type_g++;
+ }
else {
hbool_t done; /* Indicate that search was successful */
- int i; /* Local index variable */
+ int i;
/* Look for a free type to give out */
done = FALSE;
for (i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == FALSE; i++) {
- if (NULL == H5I_id_type_list_g[i]) {
+ if (NULL == H5I_type_info_array_g[i]) {
/* Found a free type ID */
new_type = (H5I_type_t)i;
done = TRUE;
- } /* end if */
- } /* end for */
+ }
+ }
/* Verify that we found a type to give out */
if (done == FALSE)
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded")
- } /* end else */
+ }
/* Allocate new ID class */
- if (NULL == (cls = H5FL_CALLOC(H5I_class_t)))
+ if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t))))
HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed")
/* Initialize class fields */
- cls->type_id = new_type;
+ cls->type = new_type;
cls->flags = H5I_CLASS_IS_APPLICATION;
cls->reserved = reserved;
cls->free_func = free_func;
@@ -266,71 +147,12 @@ done:
/* Clean up on error */
if (ret_value < 0)
if (cls)
- cls = H5FL_FREE(H5I_class_t, cls);
+ cls = H5MM_xfree(cls);
FUNC_LEAVE_API(ret_value)
} /* end H5Iregister_type() */
/*-------------------------------------------------------------------------
- * Function: H5I_register_type
- *
- * Purpose: Creates a new type of ID's to give out.
- * The class is initialized or its reference count is incremented
- * (if it is already initialized).
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5I_register_type(const H5I_class_t *cls)
-{
- H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(cls);
- HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES);
-
- /* Initialize the type */
- if (NULL == H5I_id_type_list_g[cls->type_id]) {
- /* Allocate the type information for new type */
- if (NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "ID type allocation failed")
- H5I_id_type_list_g[cls->type_id] = type_ptr;
- } /* end if */
- else {
- /* Get the pointer to the existing type */
- type_ptr = H5I_id_type_list_g[cls->type_id];
- } /* end else */
-
- /* Initialize the ID type structure for new types */
- if (type_ptr->init_count == 0) {
- type_ptr->cls = cls;
- type_ptr->id_count = 0;
- type_ptr->nextid = cls->reserved;
- if (NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed")
- } /* end if */
-
- /* Increment the count of the times this type has been initialized */
- type_ptr->init_count++;
-
-done:
- if (ret_value < 0) { /* Clean up on error */
- if (type_ptr) {
- if (type_ptr->ids)
- H5SL_close(type_ptr->ids);
- (void)H5FL_FREE(H5I_id_type_t, type_ptr);
- } /* end if */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register_type() */
-
-/*-------------------------------------------------------------------------
* Function: H5Itype_exists
*
* Purpose: Query function to inform the user if a given type is
@@ -351,10 +173,10 @@ H5Itype_exists(H5I_type_t type)
/* Validate parameter */
if (H5I_IS_LIB_TYPE(type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
- if (NULL == H5I_id_type_list_g[type])
+ if (NULL == H5I_type_info_array_g[type])
ret_value = FALSE;
done:
@@ -371,8 +193,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: James Laird
- * Nathaniel Furrer
+ * Programmer: James Laird
+ * Nathaniel Furrer
* Friday, April 23, 2004
*
*-------------------------------------------------------------------------
@@ -380,7 +202,7 @@ done:
herr_t
H5Inmembers(H5I_type_t type, hsize_t *num_members)
{
- int ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "It*h", type, num_members);
@@ -392,9 +214,9 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members)
* the private interface handle it, because the public interface throws
* an error when the supplied type does not exist.
*/
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
- if (NULL == H5I_id_type_list_g[type])
+ if (NULL == H5I_type_info_array_g[type])
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist")
if (num_members) {
@@ -404,92 +226,13 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members")
H5_CHECKED_ASSIGN(*num_members, hsize_t, members, int64_t);
- } /* end if */
+ }
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Inmembers() */
/*-------------------------------------------------------------------------
- * Function: H5I_nmembers
- *
- * Purpose: Returns the number of members in a type.
- *
- * Return: Success: Number of members; zero if the type is empty
- * or has been deleted.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, March 24, 1999
- *
- *-------------------------------------------------------------------------
- */
-int64_t
-H5I_nmembers(H5I_type_t type)
-{
- H5I_id_type_t *type_ptr; /* Pointer to the ID type */
- int64_t ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Validate parameter */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
- if (NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0)
- HGOTO_DONE(0);
-
- /* Set return value */
- H5_CHECKED_ASSIGN(ret_value, int64_t, type_ptr->id_count, uint64_t);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_nmembers() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I__unwrap
- *
- * Purpose: Unwraps the object pointer for the 'item' that corresponds
- * to an ID.
- *
- * Return: Pointer to the unwrapped pointer (can't fail)
- *
- * Programmer: Quincey Koziol
- * Friday, October 19, 2018
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5I__unwrap(void *obj_ptr, H5I_type_t type)
-{
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Sanity checks */
- HDassert(obj_ptr);
-
- /* The stored object pointer might be an H5VL_object_t, in which
- * case we'll need to get the wrapped object struct (H5F_t *, etc.).
- */
- if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- const H5VL_object_t *vol_obj;
-
- vol_obj = (const H5VL_object_t *)obj_ptr;
- ret_value = H5VL_object_data(vol_obj);
- } /* end if */
- else if (H5I_DATATYPE == type) {
- H5T_t *dt = (H5T_t *)obj_ptr;
-
- ret_value = (void *)H5T_get_actual_type(dt);
- } /* end if */
- else
- ret_value = obj_ptr;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__unwrap() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iclear_type
*
* Purpose: Removes all objects from the type, calling the free
@@ -498,8 +241,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
*
*-------------------------------------------------------------------------
@@ -522,116 +265,9 @@ done:
} /* end H5Iclear_type() */
/*-------------------------------------------------------------------------
- * Function: H5I_clear_type
- *
- * Purpose: Removes all objects from the type, calling the free
- * function for each object regardless of the reference count.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Robb Matzke
- * Wednesday, March 24, 1999
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
-{
- H5I_clear_type_ud_t udata; /* udata struct for callback */
- int ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Validate parameters */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
-
- udata.type_ptr = H5I_id_type_list_g[type];
- if (udata.type_ptr == NULL || udata.type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
-
- /* Finish constructing udata */
- udata.force = force;
- udata.app_ref = app_ref;
-
- /* Attempt to free all ids in the type */
- if (H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't free ids in type")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_clear_type() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I__clear_type_cb
- *
- * Purpose: Attempts to free the specified ID, calling the free
- * function for the object.
- *
- * Return: TRUE/FALSE/FAIL
- *
- * Programmer: Neil Fortner
- * Friday, July 10, 2015
- *
- *-------------------------------------------------------------------------
- */
-static htri_t
-H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata)
-{
- H5I_id_info_t * id = (H5I_id_info_t *)_id; /* Current ID being worked with */
- H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */
- htri_t ret_value = FALSE; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Sanity checks */
- HDassert(id);
- HDassert(udata);
- HDassert(udata->type_ptr);
-
- /* Do nothing to the object if the reference count is larger than
- * one and forcing is off.
- */
- if (udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) {
- /* Check for a 'free' function and call it, if it exists */
- if (udata->type_ptr->cls->free_func &&
- (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */
- if (udata->force) {
-#ifdef H5I_DEBUG
- if (H5DEBUG(I)) {
- HDfprintf(H5DEBUG(I),
- "H5I: free type=%d obj=0x%08lx "
- "failure ignored\n",
- (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr));
- } /* end if */
-#endif /*H5I_DEBUG*/
-
- /* Indicate node should be removed from list */
- ret_value = TRUE;
- } /* end if */
- } /* end if */
- else {
- /* Indicate node should be removed from list */
- ret_value = TRUE;
- } /* end else */
-
- /* Remove ID if requested */
- if (ret_value) {
- /* Free ID info */
- id = H5FL_FREE(H5I_id_info_t, id);
-
- /* Decrement the number of IDs in the type */
- udata->type_ptr->id_count--;
- } /* end if */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__clear_type_cb() */
-
-/*-------------------------------------------------------------------------
* Function: H5Idestroy_type
*
- * Purpose: Destroys a type along with all atoms in that type
+ * Purpose: Destroys a type along with all IDs in that type
* regardless of 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
@@ -639,8 +275,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
*
*-------------------------------------------------------------------------
*/
@@ -662,62 +298,9 @@ done:
} /* end H5Idestroy_type() */
/*-------------------------------------------------------------------------
- * Function: H5I__destroy_type
- *
- * Purpose: Destroys a type along with all atoms in that type
- * regardless of 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.
- *
- * Return: SUCCEED/FAIL
- *
- * 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 */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Validate parameter */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
-
- type_ptr = H5I_id_type_list_g[type];
- if (type_ptr == NULL || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
-
- /* Close/clear/destroy all IDs for this type */
- H5E_BEGIN_TRY
- {
- H5I_clear_type(type, TRUE, FALSE);
- }
- H5E_END_TRY /*don't care about errors*/
-
- /* Check if we should release the ID class */
- if (type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION)
- type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls);
-
- if (H5SL_close(type_ptr->ids) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list")
- type_ptr->ids = NULL;
-
- type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr);
- H5I_id_type_list_g[type] = NULL;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__destroy_type() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iregister
*
- * Purpose: Public interface to H5I_register.
+ * Purpose: Register an object.
*
* Return: Success: New object ID
* Failure: H5I_INVALID_HID
@@ -733,7 +316,7 @@ H5Iregister(H5I_type_t type, const void *object)
H5TRACE2("i", "It*x", type, object);
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type")
ret_value = H5I_register(type, object, TRUE);
@@ -742,196 +325,6 @@ done:
} /* end H5Iregister() */
/*-------------------------------------------------------------------------
- * Function: H5I_register
- *
- * Purpose: Registers an OBJECT in a TYPE and returns an ID for it.
- * This routine does _not_ check for unique-ness of the objects,
- * if you register an object twice, you will get two different
- * IDs for it. This routine does make certain that each ID in a
- * type is unique. IDs are created by getting a unique number
- * for the type the ID is in and incorporating the type into
- * the ID which is returned to the user.
- *
- * Return: Success: New object ID
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
-{
- H5I_id_type_t *type_ptr = NULL; /* ptr to the type */
- H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */
- hid_t new_id = -1; /* new ID */
- hid_t ret_value = H5I_INVALID_HID; /* return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
- type_ptr = H5I_id_type_list_g[type];
- if ((NULL == type_ptr) || (type_ptr->init_count <= 0))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type")
- if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
- HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
-
- /* Create the struct & its ID */
- new_id = H5I_MAKE(type, type_ptr->nextid);
- id_ptr->id = new_id;
- id_ptr->count = 1; /* initial reference count */
- id_ptr->app_count = !!app_ref;
- id_ptr->obj_ptr = object;
-
- /* Insert into the type */
- if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list")
- type_ptr->id_count++;
- type_ptr->nextid++;
-
- /* Sanity check for the 'nextid' getting too large and wrapping around */
- HDassert(type_ptr->nextid <= ID_MASK);
-
- /* Set return value */
- ret_value = new_id;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_register_using_existing_id
- *
- * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
- * This routine will check to ensure the supplied ID is not already
- * in use, and ensure that it is a valid ID for the given type,
- * but will NOT check to ensure the OBJECT is not already
- * registered (thus, it is possible to register one object under
- * multiple IDs).
- *
- * NOTE: Intended for use in refresh calls, where we have to close
- * and re-open the underlying data, then hook the object back
- * up to the original ID.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
-{
- H5I_id_type_t *type_ptr; /* ptr to the type */
- H5I_id_info_t *id_ptr; /* ptr to the new ID information */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- HDassert(object);
-
- /* Make sure ID is not already in use */
- if (NULL != (id_ptr = H5I__find_id(existing_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use")
-
- /* Make sure type number is valid */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
-
- /* Get type pointer from list of types */
- type_ptr = H5I_id_type_list_g[type];
-
- if (NULL == type_ptr || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
-
- /* Make sure requested ID belongs to object's type */
- if (H5I_TYPE(existing_id) != type)
- HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID")
-
- /* Allocate new structure to house this ID */
- if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
- HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Create the struct & insert requested ID */
- id_ptr->id = existing_id;
- id_ptr->count = 1; /* initial reference count*/
- id_ptr->app_count = !!app_ref;
- id_ptr->obj_ptr = object;
-
- /* Insert into the type */
- if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list")
- type_ptr->id_count++;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register_using_existing_id() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_subst
- *
- * Purpose: Substitute a new object pointer for the specified ID.
- *
- * Return: Success: Non-NULL previous object pointer associated
- * with the specified ID.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Saturday, February 27, 2010
- *
- *-------------------------------------------------------------------------
- */
-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 */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* General lookup of the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
-
- /* Get the old object pointer to return */
- ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
-
- /* Set the new object pointer for the ID */
- id_ptr->obj_ptr = new_object;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_subst() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_object
- *
- * Purpose: Find an object pointer for the specified ID.
- *
- * Return: Success: Non-NULL object pointer associated with the
- * specified ID
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5I_object(hid_t id)
-{
- H5I_id_info_t *id_ptr; /* Pointer to the new atom */
- void * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOERR
-
- /* General lookup of the ID */
- if (NULL != (id_ptr = H5I__find_id(id))) {
- /* Get the object pointer to return */
- ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_object() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iobject_verify
*
* Purpose: Find an object pointer for the specified ID, verifying that
@@ -945,93 +338,26 @@ H5I_object(hid_t id)
*-------------------------------------------------------------------------
*/
void *
-H5Iobject_verify(hid_t id, H5I_type_t id_type)
+H5Iobject_verify(hid_t id, H5I_type_t type)
{
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API(NULL)
- H5TRACE2("*x", "iIt", id, id_type);
+ H5TRACE2("*x", "iIt", id, type);
/* Validate parameters */
- if (H5I_IS_LIB_TYPE(id_type))
+ if (H5I_IS_LIB_TYPE(type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
- if (id_type < 1 || (int)id_type >= H5I_next_type)
+ if (type < 1 || (int)type >= H5I_next_type_g)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type")
- ret_value = H5I_object_verify(id, id_type);
+ ret_value = H5I_object_verify(id, type);
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iobject_verify() */
/*-------------------------------------------------------------------------
- * Function: H5I_object_verify
- *
- * Purpose: Find an object pointer for the specified ID, verifying that
- * its in a particular type.
- *
- * Return: Success: Non-NULL object pointer associated with the
- * specified ID.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 31, 2002
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5I_object_verify(hid_t id, H5I_type_t id_type)
-{
- H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */
- void * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOERR
-
- HDassert(id_type >= 1 && (int)id_type < H5I_next_type);
-
- /* Verify that the type of the ID is correct & lookup the ID */
- if (id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) {
- /* Get the object pointer to return */
- ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5I_object_verify() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_get_type
- *
- * Purpose: Given an object ID return the type to which it
- * belongs. The ID need not be the ID of an object which
- * currently exists because the type number is encoded
- * in the object ID.
- *
- * Return: Success: A positive integer (corresponding to an H5I_type_t
- * enum value for library ID types, but not for user
- * ID types).
- * Failure: H5I_BADID
- *
- * Programmer: Robb Matzke
- * Friday, February 19, 1999
- *
- *-------------------------------------------------------------------------
- */
-H5I_type_t
-H5I_get_type(hid_t id)
-{
- H5I_type_t ret_value = H5I_BADID; /* Return value */
-
- FUNC_ENTER_NOAPI_NOERR
-
- if (id > 0)
- ret_value = H5I_TYPE(id);
-
- HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_get_type() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iget_type
*
* Purpose: The public version of H5I_get_type(), obtains a type number
@@ -1056,7 +382,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))
+ if (ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type_g || NULL == H5I_object(id))
HGOTO_DONE(H5I_BADID);
done:
@@ -1064,56 +390,6 @@ done:
} /* end H5Iget_type() */
/*-------------------------------------------------------------------------
- * Function: H5I_is_file_object
- *
- * Purpose: Convenience function to determine if an ID represents
- * a file object.
- *
- * In H5O calls, you can't use object_verify to ensure
- * the ID was of the correct class since there's no
- * H5I_OBJECT ID class.
- *
- * Return: Success: TRUE/FALSE
- * Failure: FAIL
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5I_is_file_object(hid_t id)
-{
- H5I_type_t id_type = H5I_get_type(id);
- htri_t ret_value = FAIL;
-
- FUNC_ENTER_NOAPI(FAIL);
-
- /* Fail if the ID type is out of range */
- if (id_type < 1 || id_type >= H5I_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID type out of range");
-
- /* 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) {
- ret_value = TRUE;
- }
- else if (H5I_DATATYPE == id_type) {
-
- H5T_t *dt = NULL;
-
- if (NULL == (dt = (H5T_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct");
-
- ret_value = H5T_is_named(dt);
- }
- else {
- ret_value = FALSE;
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5I_is_file_object() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iremove_verify
*
* Purpose: Removes the specified ID from its type, first checking that the
@@ -1125,141 +401,30 @@ done:
* calling H5I_object().
* Failure: NULL
*
- * Programmer: James Laird
- * Nathaniel Furrer
+ * Programmer: James Laird
+ * Nathaniel Furrer
*
*-------------------------------------------------------------------------
*/
void *
-H5Iremove_verify(hid_t id, H5I_type_t id_type)
+H5Iremove_verify(hid_t id, H5I_type_t type)
{
void *ret_value = NULL; /* Return value */
FUNC_ENTER_API(NULL)
- H5TRACE2("*x", "iIt", id, id_type);
+ H5TRACE2("*x", "iIt", id, type);
- if (H5I_IS_LIB_TYPE(id_type))
+ if (H5I_IS_LIB_TYPE(type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
/* Remove the id */
- ret_value = H5I__remove_verify(id, id_type);
+ ret_value = H5I__remove_verify(id, type);
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iremove_verify() */
/*-------------------------------------------------------------------------
- * Function: H5I__remove_verify
- *
- * Purpose: Removes the specified ID from its type, first checking that
- * the ID's type is the same as the ID type supplied as an argument
- *
- * Return: Success: A pointer to the object that was removed, the
- * same pointer which would have been found by
- * calling H5I_object().
- * Failure: NULL
- *
- * Programmer: James Laird
- * Nat Furrer
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5I__remove_verify(hid_t id, H5I_type_t id_type)
-{
- void *ret_value = NULL; /*return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Argument checking will be performed by H5I_remove() */
-
- /* Verify that the type of the ID is correct */
- if (id_type == H5I_TYPE(id))
- ret_value = H5I_remove(id);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__remove_verify() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I__remove_common
- *
- * Purpose: Common code to remove a specified ID from its type.
- *
- * Return: Success: A pointer to the object that was removed, the
- * same pointer which would have been found by
- * calling H5I_object().
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * October 3, 2013
- *
- *-------------------------------------------------------------------------
- */
-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 */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(type_ptr);
-
- /* Get the ID node for the ID */
- if (NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list")
-
- ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */
- curr_id = H5FL_FREE(H5I_id_info_t, curr_id);
-
- /* Decrement the number of IDs in the type */
- (type_ptr->id_count)--;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__remove_common() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_remove
- *
- * Purpose: Removes the specified ID from its type.
- *
- * Return: Success: A pointer to the object that was removed, the
- * same pointer which would have been found by
- * calling H5I_object().
- * Failure: NULL
- *
- * 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 */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Check arguments */
- type = H5I_TYPE(id);
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number")
- type_ptr = H5I_id_type_list_g[type];
- if (type_ptr == NULL || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type")
-
- /* Remove the node from the type */
- if (NULL == (ret_value = H5I__remove_common(type_ptr, id)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_remove() */
-
-/*-------------------------------------------------------------------------
* Function: H5Idec_ref
*
* Purpose: Decrements the number of references outstanding for an ID.
@@ -1295,163 +460,6 @@ done:
} /* end H5Idec_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I_dec_ref
- *
- * Purpose: Decrements the number of references outstanding for an ID.
- * This will fail if the type is not a reference counted type.
- * The ID type's 'free' function will be called for the ID
- * if the reference count for the ID reaches 0 and a free
- * function has been defined at type creation time.
- *
- * Return: Success: New reference count
- *
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_dec_ref(hid_t id)
-{
- H5I_id_info_t *id_ptr; /* Pointer to the new ID */
- int ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- /* Sanity check */
- HDassert(id >= 0);
-
- /* General lookup of the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
-
- /* If this is the last reference to the object then invoke the type's
- * free method on the object. If the free method is undefined or
- * successful then remove the object from the type; otherwise leave
- * the object in the type without decrementing the reference
- * count. If the reference count is more than one then decrement the
- * reference count without calling the free method.
- *
- * Beware: the free method may call other H5I functions.
- *
- * If an object is closing, we can remove the ID even though the free
- * method might fail. This can happen when a mandatory filter fails to
- * write when a dataset is closed and the chunk cache is flushed to the
- * 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 */
-
- /* Get the ID's type */
- type_ptr = H5I_id_type_list_g[H5I_TYPE(id)];
-
- /* (Casting away const OK -QAK) */
- if (!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) {
- /* Remove the node from the type */
- if (NULL == H5I__remove_common(type_ptr, id))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node")
- ret_value = 0;
- } /* end if */
- else
- ret_value = -1;
- } /* end if */
- else {
- --(id_ptr->count);
- ret_value = (int)id_ptr->count;
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_dec_ref() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_dec_app_ref
- *
- * Purpose: H5I_dec_ref wrapper for case of modifying the application ref.
- * count for an ID as well as normal reference count.
- *
- * Return: Success: New app. reference count
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sept 16, 2010
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_dec_app_ref(hid_t id)
-{
- H5I_id_info_t *id_ptr; /* Pointer to the new ID */
- int ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- /* Sanity check */
- HDassert(id >= 0);
-
- /* Call regular decrement reference count routine */
- if ((ret_value = H5I_dec_ref(id)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count")
-
- /* Check if the ID still exists */
- if (ret_value > 0) {
- /* General lookup of the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
-
- /* Adjust app_ref */
- --(id_ptr->app_count);
- HDassert(id_ptr->count >= id_ptr->app_count);
-
- /* Set return value */
- ret_value = (int)id_ptr->app_count;
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_dec_app_ref() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_dec_app_ref_always_close
- *
- * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID,
- * even when the free routine fails
- *
- * Return: Success: New app. reference count
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_dec_app_ref_always_close(hid_t id)
-{
- int ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- /* Sanity check */
- HDassert(id >= 0);
-
- /* Call application decrement reference count routine */
- ret_value = H5I_dec_app_ref(id);
-
- /* Check for failure */
- if (ret_value < 0) {
- /*
- * If an object is closing, we can remove the ID even though the free
- * method might fail. This can happen when a mandatory filter fails to
- * write when a dataset is closed and the chunk cache is flushed to the
- * file. We have to close the dataset anyway. (SLU - 2010/9/7)
- */
- H5I_remove(id);
-
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_dec_app_ref_always_close() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iinc_ref
*
* Purpose: Increments the number of references outstanding for an ID.
@@ -1464,7 +472,7 @@ done:
int
H5Iinc_ref(hid_t id)
{
- int ret_value; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", id);
@@ -1482,43 +490,6 @@ done:
} /* end H5Iinc_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I_inc_ref
- *
- * Purpose: Increment the reference count for an object.
- *
- * Return: Success: The new reference count
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_inc_ref(hid_t id, hbool_t app_ref)
-{
- H5I_id_info_t *id_ptr; /* Pointer to the ID */
- int ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- /* Sanity check */
- HDassert(id >= 0);
-
- /* General lookup of the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
-
- /* Adjust reference counts */
- ++(id_ptr->count);
- if (app_ref)
- ++(id_ptr->app_count);
-
- /* Set return value */
- ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_inc_ref() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iget_ref
*
* Purpose: Retrieves the number of references outstanding for an ID.
@@ -1531,7 +502,7 @@ done:
int
H5Iget_ref(hid_t id)
{
- int ret_value; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", id);
@@ -1549,38 +520,6 @@ done:
} /* end H5Iget_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I_get_ref
- *
- * Purpose: Retrieve the reference count for an object.
- *
- * Return: Success: The reference count
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_get_ref(hid_t id, hbool_t app_ref)
-{
- H5I_id_info_t *id_ptr; /* Pointer to the ID */
- int ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- /* Sanity check */
- HDassert(id >= 0);
-
- /* General lookup of the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
-
- /* Set return value */
- ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_get_ref() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iinc_type_ref
*
* Purpose: Increments the number of references outstanding for an ID type.
@@ -1593,13 +532,13 @@ done:
int
H5Iinc_type_ref(H5I_type_t type)
{
- int ret_value; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Is", "It", type);
/* Check arguments */
- if (type <= 0 || (int)type >= H5I_next_type)
+ if (type <= 0 || (int)type >= H5I_next_type_g)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type")
if (H5I_IS_LIB_TYPE(type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type")
@@ -1613,45 +552,12 @@ done:
} /* end H5Iinc_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I__inc_type_ref
- *
- * Purpose: Increment the reference count for an ID type.
- *
- * Return: Success: The new reference count
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5I__inc_type_ref(H5I_type_t type)
-{
- H5I_id_type_t *type_ptr; /* Pointer to the type */
- int ret_value = -1; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(type > 0 && (int)type < H5I_next_type);
-
- /* Check arguments */
- type_ptr = H5I_id_type_list_g[type];
- if (NULL == type_ptr)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type")
-
- /* Set return value */
- ret_value = (int)(++(type_ptr->init_count));
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__inc_type_ref() */
-
-/*-------------------------------------------------------------------------
* Function: H5Idec_type_ref
*
* 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
+ * destroyed along with all IDs in that type regardless of
+ * 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.
@@ -1687,58 +593,6 @@ done:
} /* end H5Idec_type_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I_dec_type_ref
- *
- * 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
- * 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
- * return value of 0 means that the type will have to be
- * re-initialized before it can be used again (and should probably
- * be set to H5I_UNINIT).
- *
- * Return: Success: Number of references to type
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-int
-H5I_dec_type_ref(H5I_type_t type)
-{
- H5I_id_type_t *type_ptr; /* Pointer to the ID type */
- herr_t ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI((-1))
-
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number")
-
- type_ptr = H5I_id_type_list_g[type];
- if (type_ptr == NULL || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type")
-
- /* Decrement the number of users of the atomic type. If this is the
- * last user of the type then release all atoms from the type and
- * free all memory it used. The free function is invoked for each atom
- * being freed.
- */
- if (1 == type_ptr->init_count) {
- H5I__destroy_type(type);
- ret_value = 0;
- } /* end if */
- else {
- --(type_ptr->init_count);
- ret_value = (herr_t)type_ptr->init_count;
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_dec_type_ref() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iget_type_ref
*
* Purpose: Retrieves the number of references outstanding for a type.
@@ -1751,13 +605,13 @@ done:
int
H5Iget_type_ref(H5I_type_t type)
{
- int ret_value; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Is", "It", type);
/* Check arguments */
- if (type <= 0 || (int)type >= H5I_next_type)
+ if (type <= 0 || (int)type >= H5I_next_type_g)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type")
if (H5I_IS_LIB_TYPE(type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type")
@@ -1771,40 +625,6 @@ done:
} /* end H5Iget_ref() */
/*-------------------------------------------------------------------------
- * Function: H5I__get_type_ref
- *
- * Purpose: Retrieve the reference count for an ID type.
- *
- * Return: Success: The reference count
- *
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5I__get_type_ref(H5I_type_t type)
-{
- H5I_id_type_t *type_ptr; /* Pointer to the type */
- int ret_value = -1; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(type >= 0);
-
- /* Check arguments */
- type_ptr = H5I_id_type_list_g[type];
- if (!type_ptr)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
-
- /* Set return value */
- ret_value = (int)type_ptr->init_count;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__get_type_ref() */
-
-/*-------------------------------------------------------------------------
* Function: H5Iis_valid
*
* Purpose: Check if the given id is valid. An id is valid if it is in
@@ -1817,16 +637,16 @@ done:
htri_t
H5Iis_valid(hid_t id)
{
- H5I_id_info_t *id_ptr; /* ptr to the ID */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "i", id);
/* Find the ID */
- if (NULL == (id_ptr = H5I__find_id(id)))
+ if (NULL == (info = H5I__find_id(id)))
ret_value = FALSE;
- else if (!id_ptr->app_count) /* Check if the found id is an internal id */
+ else if (!info->app_count) /* Check if the found id is an internal id */
ret_value = FALSE;
done:
@@ -1890,8 +710,8 @@ H5I__search_cb(void *obj, hid_t id, void *_udata)
void *
H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key)
{
- H5I_search_ud_t udata; /* Context for iteration */
- void * ret_value; /* Return value */
+ H5I_search_ud_t udata; /* Context for iteration */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_API(NULL)
H5TRACE3("*x", "Itx*x", type, func, key);
@@ -1936,9 +756,9 @@ done:
static int
H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
{
- H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */
- herr_t cb_ret_val; /* User callback return value */
- int ret_value = H5_ITER_ERROR; /* Callback return value */
+ H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */
+ herr_t cb_ret_val = FAIL; /* User callback return value */
+ int ret_value = H5_ITER_ERROR; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -1982,8 +802,8 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata)
herr_t
H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data)
{
- H5I_iterate_pub_ud_t int_udata; /* Internal user data */
- herr_t ret_value; /* Return value */
+ H5I_iterate_pub_ud_t int_udata; /* Internal user data */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "Itx*x", type, op, op_data);
@@ -2003,146 +823,48 @@ done:
} /* end H5Iiterate() */
/*-------------------------------------------------------------------------
- * Function: H5I__iterate_cb
- *
- * Purpose: Callback routine for H5I_iterate, invokes "user" callback
- * function, and then sets return value, based on the result of
- * that callback.
- *
- * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
- * Failure: H5_ITER_ERROR (-1)
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
-{
- H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
- H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */
- int ret_value = H5_ITER_CONT; /* Callback return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Only invoke the callback function if this ID is visible externally and
- * its reference count is positive.
- */
- if ((!udata->app_ref) || (item->app_count > 0)) {
- H5I_type_t type = udata->obj_type;
- void * obj_ptr;
- herr_t cb_ret_val;
-
- /* The stored object pointer might be an H5VL_object_t, in which
- * case we'll need to get the wrapped object struct (H5F_t *, etc.).
- */
- obj_ptr = H5I__unwrap((void *)item->obj_ptr, type);
-
- /* Invoke callback function */
- cb_ret_val =
- (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */
-
- /* Set the return value based on the callback's return value */
- if (cb_ret_val > 0)
- 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 */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__iterate_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_iterate
- *
- * Purpose: Apply function FUNC to each member of type TYPE (with
- * non-zero application reference count if app_ref is TRUE).
- * Stop if FUNC returns a non zero value (i.e. anything
- * other than H5_ITER_CONT).
- *
- * If FUNC returns a positive value (i.e. H5_ITER_STOP),
- * return SUCCEED.
- *
- * If FUNC returns a negative value (i.e. H5_ITER_ERROR),
- * return FAIL.
+ * Function: H5Iget_file_id
*
- * The FUNC should take a pointer to the object and the
- * udata as arguments and return non-zero to terminate
- * siteration, and zero to continue.
+ * Purpose: Obtains the file ID given an object ID. The user has to
+ * close this ID.
*
- * Limitation: Currently there is no way to start the iteration from
- * where a previous iteration left off.
+ * Return: Success: The file ID associated with the object
*
- * Return: SUCCEED/FAIL
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref)
+hid_t
+H5Iget_file_id(hid_t obj_id)
{
- H5I_id_type_t *type_ptr; /* Pointer to the type */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
- type_ptr = H5I_id_type_list_g[type];
-
- /* Only iterate through ID list if it is initialized and there are IDs in type */
- if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) {
- H5I_iterate_ud_t iter_udata; /* User data for iteration callback */
- herr_t iter_status; /* Iteration status */
-
- /* Set up iterator user data */
- iter_udata.user_func = func;
- iter_udata.user_udata = udata;
- iter_udata.app_ref = app_ref;
- iter_udata.obj_type = type;
-
- /* Iterate over IDs */
- if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
- } /* end if */
+ H5I_type_t type; /* ID type */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_iterate() */
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE1("i", "i", obj_id);
-/*-------------------------------------------------------------------------
- * Function: H5I__find_id
- *
- * Purpose: Given an object ID find the info struct that describes the
- * object.
- *
- * Return: Success: A pointer to the object's info struct.
- *
- * Failure: NULL
- *
- *-------------------------------------------------------------------------
- */
-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 */
+ /* Get object type */
+ type = H5I_TYPE(obj_id);
- FUNC_ENTER_STATIC_NOERR
+ /* Call internal function */
+ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type ||
+ H5I_ATTR == type) {
+ H5VL_object_t *vol_obj; /* Object of obj_id */
- /* Check arguments */
- type = H5I_TYPE(id);
- if (type <= H5I_BADID || (int)type >= H5I_next_type)
- HGOTO_DONE(NULL)
- type_ptr = H5I_id_type_list_g[type];
- if (!type_ptr || type_ptr->init_count <= 0)
- HGOTO_DONE(NULL)
+ /* Get the VOL object */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Locate the ID node for the ID */
- ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id);
+ /* Get the file ID */
+ if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
+ }
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__find_id() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Iget_file_id() */
/*-------------------------------------------------------------------------
* Function: H5Iget_name
@@ -2153,10 +875,7 @@ done:
*
* Failure: -1
*
- * NOTE: Not safe for arbitrary VOL connectors as it relies on
- * private H5G calls.
- *
- * Comments: Public function
+ * Notes:
* If 'name' is non-NULL then write up to 'size' bytes into that
* buffer and always return the length of the entry name.
* Otherwise 'size' is ignored and the function does not store the name,
@@ -2171,9 +890,9 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_t * vol_obj = NULL; /* Object stored in ID */
H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
@@ -2194,255 +913,3 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iget_name() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Iget_file_id
- *
- * Purpose: Obtains the file ID given an object ID. The user has to
- * close this ID.
- *
- * Return: Success: The file ID associated with the object
- *
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5Iget_file_id(hid_t obj_id)
-{
- H5I_type_t type; /* ID type */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("i", "i", obj_id);
-
- /* Get object type */
- type = H5I_TYPE(obj_id);
-
- /* Call internal function */
- if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type ||
- H5I_ATTR == type) {
- H5VL_object_t *vol_obj; /* Object of obj_id */
-
- /* Get the VOL object */
- if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
-
- /* Get the file ID */
- if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
- } /* end if */
- else
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Iget_file_id() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I__find_id_cb
- *
- * Purpose: Callback for searching for an ID with a specific pointer
- *
- * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
- * Failure: H5_ITER_ERROR (-1)
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
-{
- H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
- H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */
- H5I_type_t type = udata->obj_type;
- const void * obj_ptr = NULL;
- int ret_value = H5_ITER_CONT; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Sanity check */
- HDassert(item);
- HDassert(udata);
-
- /* Get a pointer to the VOL connector's data */
- obj_ptr = H5I__unwrap(item->obj_ptr, type);
-
- /* Check for a match */
- if (obj_ptr == udata->object) {
- udata->ret_id = item->id;
- ret_value = H5_ITER_STOP;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I__find_id_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_find_id
- *
- * Purpose: Return the ID of an object by searching through the ID list
- * for the type.
- *
- * Return: SUCCEED/FAIL
- * (id will be set to H5I_INVALID_HID on errors or not found)
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
-{
- H5I_id_type_t *type_ptr; /* Pointer to the type */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(id);
-
- *id = H5I_INVALID_HID;
-
- type_ptr = H5I_id_type_list_g[type];
- if (!type_ptr || type_ptr->init_count <= 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
-
- /* Only iterate through ID list if it is initialized and there are IDs in type */
- if (type_ptr->init_count > 0 && type_ptr->id_count > 0) {
- H5I_get_id_ud_t udata; /* User data */
- herr_t iter_status; /* Iteration status */
-
- /* Set up iterator user data */
- udata.object = object;
- udata.obj_type = type;
- udata.ret_id = H5I_INVALID_HID;
-
- /* Iterate over IDs for the ID type */
- if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
-
- *id = udata.ret_id;
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_find_id() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I__id_dump_cb
- *
- * Purpose: Dump the contents of an ID to stderr for debugging.
- *
- * Return: H5_ITER_CONT (always)
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
-{
- H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
- H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
- H5G_name_t * path = NULL; /* Path to file object */
- const void * obj_ptr = NULL; /* Pointer to VOL connector object */
-
- 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));
-
- /* Get the group location, so we get get the name */
- switch (type) {
- case H5I_GROUP: {
- const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
-
- obj_ptr = H5VL_object_data(vol_obj);
- if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
- path = H5G_nameof((const H5G_t *)obj_ptr);
- break;
- }
-
- case H5I_DATASET: {
- const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr;
-
- obj_ptr = H5VL_object_data(vol_obj);
- if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
- path = H5D_nameof((const H5D_t *)obj_ptr);
- break;
- }
-
- case H5I_DATATYPE: {
- const H5T_t *dt = (const H5T_t *)item->obj_ptr;
-
- obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
- path = H5T_nameof((const H5T_t *)obj_ptr);
- break;
- }
-
- /* TODO: Maps will have to be added when they are supported in the
- * native VOL connector.
- */
- case H5I_MAP:
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_ATTR:
- case H5I_VFL:
- case H5I_VOL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_SPACE_SEL_ITER:
- case H5I_NTYPES:
- default:
- break; /* Other types of IDs are not stored in files */
- }
-
- if (path) {
- if (path->user_path_r)
- HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r));
- if (path->full_path_r)
- HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r));
- }
-
- FUNC_LEAVE_NOAPI(H5_ITER_CONT)
-} /* end H5I__id_dump_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5I_dump_ids_for_type
- *
- * Purpose: Dump the contents of a type to stderr for debugging.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5I_dump_ids_for_type(H5I_type_t type)
-{
- H5I_id_type_t *type_ptr = NULL;
-
- FUNC_ENTER_NOAPI_NOERR
-
- HDfprintf(stderr, "Dumping ID type %d\n", (int)type);
- type_ptr = H5I_id_type_list_g[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);
-
- /* List */
- if (type_ptr->id_count > 0) {
- HDfprintf(stderr, " List:\n");
- H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type);
- }
- }
- else
- HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n");
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5I_dump_ids_for_type() */
diff --git a/src/H5Idbg.c b/src/H5Idbg.c
new file mode 100644
index 0000000..71937e8
--- /dev/null
+++ b/src/H5Idbg.c
@@ -0,0 +1,204 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * H5Idbg.c - Debugging routines for handling IDs
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Imodule.h" /* This source code file is part of the H5I module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
+#include "H5RSprivate.h" /* Reference-counted strings */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static int H5I__id_dump_cb(void *_item, void *_key, void *_udata);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__id_dump_cb
+ *
+ * Purpose: Dump the contents of an ID to stderr for debugging.
+ *
+ * Return: H5_ITER_CONT (always)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
+{
+ H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID node */
+ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
+ const H5G_name_t *path = NULL; /* Path to file object */
+ const void * object = NULL; /* Pointer to VOL connector object */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDfprintf(stderr, " id = %" PRIdHID "\n", info->id);
+ HDfprintf(stderr, " count = %u\n", info->count);
+ HDfprintf(stderr, " obj = 0x%8p\n", info->object);
+ HDfprintf(stderr, " marked = %d\n", info->marked);
+
+ /* Get the group location, so we get get the name */
+ switch (type) {
+ case H5I_GROUP: {
+ const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object;
+
+ object = H5VL_object_data(vol_obj);
+ if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5G_nameof((const H5G_t *)object);
+ break;
+ }
+
+ case H5I_DATASET: {
+ const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object;
+
+ object = H5VL_object_data(vol_obj);
+ if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
+ path = H5D_nameof((const H5D_t *)object);
+ break;
+ }
+
+ case H5I_DATATYPE: {
+ const H5T_t *dt = (const H5T_t *)info->object;
+
+ H5_GCC_DIAG_OFF("cast-qual")
+ object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
+ H5_GCC_DIAG_ON("cast-qual")
+
+ path = H5T_nameof((const H5T_t *)object);
+ break;
+ }
+
+ /* TODO: Maps will have to be added when they are supported in the
+ * native VOL connector.
+ */
+ case H5I_MAP:
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ break; /* Other types of IDs are not stored in files */
+ }
+
+ if (path) {
+ if (path->user_path_r)
+ HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r));
+ if (path->full_path_r)
+ HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r));
+ }
+
+ FUNC_LEAVE_NOAPI(H5_ITER_CONT)
+} /* end H5I__id_dump_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dump_ids_for_type
+ *
+ * Purpose: Dump the contents of a type to stderr for debugging.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_dump_ids_for_type(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL;
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ HDfprintf(stderr, "Dumping ID type %d\n", (int)type);
+ type_info = H5I_type_info_array_g[type];
+
+ if (type_info) {
+
+ H5I_id_info_t *item = NULL;
+ H5I_id_info_t *tmp = NULL;
+
+ /* Header */
+ HDfprintf(stderr, " init_count = %u\n", type_info->init_count);
+ HDfprintf(stderr, " reserved = %u\n", type_info->cls->reserved);
+ HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_info->id_count);
+ HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_info->nextid);
+
+ /* List */
+ if (type_info->id_count > 0) {
+ HDfprintf(stderr, " List:\n");
+ /* Normally we care about the callback's return value
+ * (H5I_ITER_CONT, etc.), but this is an iteration over all
+ * the IDs so we don't care.
+ *
+ * XXX: Update this to emit an error message on errors?
+ */
+ HDfprintf(stderr, " (HASH TABLE)\n");
+ HASH_ITER(hh, type_info->hash_table, item, tmp)
+ {
+ H5I__id_dump_cb((void *)item, NULL, (void *)&type);
+ }
+ }
+ }
+ else
+ HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n");
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5I_dump_ids_for_type() */
diff --git a/src/H5Iint.c b/src/H5Iint.c
new file mode 100644
index 0000000..e512d4b
--- /dev/null
+++ b/src/H5Iint.c
@@ -0,0 +1,1524 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * H5Iint.c - Private routines for handling IDs
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Imodule.h" /* This source code file is part of the H5I module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Ipkg.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Combine a Type number and an ID index into an ID */
+#define H5I_MAKE(g, i) ((((hid_t)(g)&TYPE_MASK) << ID_BITS) | ((hid_t)(i)&ID_MASK))
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* User data for iterator callback for retrieving an ID corresponding to an object pointer */
+typedef struct {
+ const void *object; /* object pointer to search for */
+ H5I_type_t obj_type; /* type of object we are searching for */
+ hid_t ret_id; /* ID returned */
+} H5I_get_id_ud_t;
+
+/* User data for iterator callback for ID iteration */
+typedef struct {
+ H5I_search_func_t user_func; /* 'User' function to invoke */
+ void * user_udata; /* User data to pass to 'user' function */
+ hbool_t app_ref; /* Whether this is an appl. ref. call */
+ H5I_type_t obj_type; /* Type of object we are iterating over */
+} H5I_iterate_ud_t;
+
+/* User data for H5I__clear_type_cb */
+typedef struct {
+ H5I_type_info_t *type_info; /* Pointer to the type's info to be cleared */
+ hbool_t force; /* Whether to always remove the ID */
+ hbool_t app_ref; /* Whether this is an appl. ref. call */
+} H5I_clear_type_ud_t;
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static void * H5I__unwrap(void *object, H5I_type_t type);
+static herr_t H5I__mark_node(void *_id, void *key, void *udata);
+static void * H5I__remove_common(H5I_type_info_t *type_info, hid_t id);
+static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+/* Declared extern in H5Ipkg.h and documented there */
+H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES];
+int H5I_next_type_g = (int)H5I_NTYPES;
+
+/* Declare a free list to manage the H5I_id_info_t struct */
+H5FL_DEFINE_STATIC(H5I_id_info_t);
+
+/* Whether deletes are actually marks (for mark-and-sweep) */
+hbool_t H5I_marking_g = FALSE;
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_term_package
+ *
+ * Purpose: Terminate the H5I interface: release all memory, reset all
+ * global variables to initial values. This only happens if all
+ * types have been destroyed from other interfaces.
+ *
+ * Return: Success: Positive if any action was taken that might
+ * affect some other interface; zero otherwise.
+ *
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_term_package(void)
+{
+ int in_use = 0; /* Number of ID types still in use */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if (H5_PKG_INIT_VAR) {
+ H5I_type_info_t *type_info = NULL; /* Pointer to ID type */
+ int i;
+
+ /* Count the number of types still in use */
+ for (i = 0; i < H5I_next_type_g; i++)
+ if ((type_info = H5I_type_info_array_g[i]) && type_info->hash_table)
+ in_use++;
+
+ /* If no types are still being used then clean up */
+ if (0 == in_use) {
+ for (i = 0; i < H5I_next_type_g; i++) {
+ type_info = H5I_type_info_array_g[i];
+ if (type_info) {
+ HDassert(NULL == type_info->hash_table);
+ type_info = H5MM_xfree(type_info);
+ H5I_type_info_array_g[i] = NULL;
+ in_use++;
+ }
+ }
+
+ /* Mark interface closed */
+ if (0 == in_use)
+ H5_PKG_INIT_VAR = FALSE;
+ }
+ }
+
+ FUNC_LEAVE_NOAPI(in_use)
+} /* end H5I_term_package() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_register_type
+ *
+ * Purpose: Creates a new type of ID's to give out.
+ * The class is initialized or its reference count is incremented
+ * (if it is already initialized).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_register_type(const H5I_class_t *cls)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type*/
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(cls);
+ HDassert(cls->type > 0 && (int)cls->type < H5I_MAX_NUM_TYPES);
+
+ /* Initialize the type */
+ if (NULL == H5I_type_info_array_g[cls->type]) {
+ /* Allocate the type information for new type */
+ if (NULL == (type_info = (H5I_type_info_t *)H5MM_calloc(sizeof(H5I_type_info_t))))
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "ID type allocation failed")
+ H5I_type_info_array_g[cls->type] = type_info;
+ }
+ else {
+ /* Get the pointer to the existing type */
+ type_info = H5I_type_info_array_g[cls->type];
+ }
+
+ /* Initialize the ID type structure for new types */
+ if (type_info->init_count == 0) {
+ type_info->cls = cls;
+ type_info->id_count = 0;
+ type_info->nextid = cls->reserved;
+ type_info->last_id_info = NULL;
+ type_info->hash_table = NULL;
+ }
+
+ /* Increment the count of the times this type has been initialized */
+ type_info->init_count++;
+
+done:
+ /* Clean up on error */
+ if (ret_value < 0)
+ if (type_info)
+ H5MM_free(type_info);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_register_type() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_nmembers
+ *
+ * Purpose: Returns the number of members in a type.
+ *
+ * Return: Success: Number of members; zero if the type is empty
+ * or has been deleted.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, March 24, 1999
+ *
+ *-------------------------------------------------------------------------
+ */
+int64_t
+H5I_nmembers(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ int64_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Validate parameter */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+ if (NULL == (type_info = H5I_type_info_array_g[type]) || type_info->init_count <= 0)
+ HGOTO_DONE(0);
+
+ /* Set return value */
+ H5_CHECKED_ASSIGN(ret_value, int64_t, type_info->id_count, uint64_t);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_nmembers() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__unwrap
+ *
+ * Purpose: Unwraps the object pointer for the 'item' that corresponds
+ * to an ID.
+ *
+ * Return: Pointer to the unwrapped pointer (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Friday, October 19, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5I__unwrap(void *object, H5I_type_t type)
+{
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(object);
+
+ /* The stored object pointer might be an H5VL_object_t, in which
+ * case we'll need to get the wrapped object struct (H5F_t *, etc.).
+ */
+ if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
+ const H5VL_object_t *vol_obj;
+
+ vol_obj = (const H5VL_object_t *)object;
+ ret_value = H5VL_object_data(vol_obj);
+ }
+ else if (H5I_DATATYPE == type) {
+ H5T_t *dt = (H5T_t *)object;
+
+ ret_value = (void *)H5T_get_actual_type(dt);
+ }
+ else
+ ret_value = object;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__unwrap() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_clear_type
+ *
+ * Purpose: Removes all objects from the type, calling the free
+ * function for each object regardless of the reference count.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, March 24, 1999
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
+{
+ H5I_clear_type_ud_t udata; /* udata struct for callback */
+ H5I_id_info_t * item = NULL;
+ H5I_id_info_t * tmp = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Validate parameters */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+
+ udata.type_info = H5I_type_info_array_g[type];
+ if (udata.type_info == NULL || udata.type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Finish constructing udata */
+ udata.force = force;
+ udata.app_ref = app_ref;
+
+ /* Clearing a type is done in two phases (mark-and-sweep). This is because
+ * the type's free callback can free other IDs, potentially corrupting
+ * the data structure during the traversal.
+ */
+
+ /* Set marking flag */
+ H5I_marking_g = TRUE;
+
+ /* Mark nodes for deletion */
+ HASH_ITER(hh, udata.type_info->hash_table, item, tmp)
+ {
+ if (!item->marked)
+ if (H5I__mark_node((void *)item, NULL, (void *)&udata) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed while clearing the ID type")
+ }
+
+ /* Unset marking flag */
+ H5I_marking_g = FALSE;
+
+ /* Perform sweep */
+ HASH_ITER(hh, udata.type_info->hash_table, item, tmp)
+ {
+ if (item->marked) {
+ HASH_DELETE(hh, udata.type_info->hash_table, item);
+ item = H5FL_FREE(H5I_id_info_t, item);
+ }
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_clear_type() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__mark_node
+ *
+ * Purpose: Attempts to mark the node for freeing and calls the free
+ * function for the object, if any
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Neil Fortner
+ * Friday, July 10, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
+{
+ H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */
+ H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */
+ hbool_t mark = FALSE;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(info);
+ HDassert(udata);
+ HDassert(udata->type_info);
+
+ /* Do nothing to the object if the reference count is larger than
+ * one and forcing is off.
+ */
+ if (udata->force || (info->count - (!udata->app_ref * info->app_count)) <= 1) {
+ /* Check for a 'free' function and call it, if it exists */
+ H5_GCC_DIAG_OFF("cast-qual")
+ if (udata->type_info->cls->free_func &&
+ (udata->type_info->cls->free_func)((void *)info->object) < 0) {
+ if (udata->force) {
+#ifdef H5I_DEBUG
+ if (H5DEBUG(I)) {
+ HDfprintf(H5DEBUG(I),
+ "H5I: free type=%d obj=0x%08lx "
+ "failure ignored\n",
+ (int)udata->type_info->cls->type, (unsigned long)(info->object));
+ }
+#endif /* H5I_DEBUG */
+
+ /* Indicate node should be removed from list */
+ mark = TRUE;
+ }
+ }
+ else {
+ /* Indicate node should be removed from list */
+ mark = TRUE;
+ }
+ H5_GCC_DIAG_ON("cast-qual")
+
+ /* Remove ID if requested */
+ if (mark) {
+ /* Mark ID for deletion */
+ info->marked = TRUE;
+
+ /* Decrement the number of IDs in the type */
+ udata->type_info->id_count--;
+ }
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5I__mark_node() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__destroy_type
+ *
+ * Purpose: Destroys a type along with all IDs in that type
+ * regardless of 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.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Nathaniel Furrer
+ * James Laird
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I__destroy_type(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Validate parameter */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+
+ type_info = H5I_type_info_array_g[type];
+ if (type_info == NULL || type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Close/clear/destroy all IDs for this type */
+ H5E_BEGIN_TRY
+ {
+ H5I_clear_type(type, TRUE, FALSE);
+ }
+ H5E_END_TRY /* don't care about errors */
+
+ /* Check if we should release the ID class */
+ if (type_info->cls->flags & H5I_CLASS_IS_APPLICATION)
+ type_info->cls = H5MM_xfree_const(type_info->cls);
+
+ HASH_CLEAR(hh, type_info->hash_table);
+ type_info->hash_table = NULL;
+
+ type_info = H5MM_xfree(type_info);
+
+ H5I_type_info_array_g[type] = NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__destroy_type() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_register
+ *
+ * Purpose: Registers an OBJECT in a TYPE and returns an ID for it.
+ * This routine does _not_ check for unique-ness of the objects,
+ * if you register an object twice, you will get two different
+ * IDs for it. This routine does make certain that each ID in a
+ * type is unique. IDs are created by getting a unique number
+ * for the type the ID is in and incorporating the type into
+ * the ID which is returned to the user.
+ *
+ * Return: Success: New object ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * info = NULL; /* Pointer to the new ID information */
+ hid_t new_id = H5I_INVALID_HID; /* New ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Check arguments */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ type_info = H5I_type_info_array_g[type];
+ if ((NULL == type_info) || (type_info->init_count <= 0))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type")
+ if (NULL == (info = H5FL_CALLOC(H5I_id_info_t)))
+ HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
+
+ /* Create the struct & its ID */
+ new_id = H5I_MAKE(type, type_info->nextid);
+ info->id = new_id;
+ info->count = 1; /* initial reference count */
+ info->app_count = !!app_ref;
+ info->object = object;
+ info->marked = FALSE;
+
+ /* Insert into the type */
+ HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info);
+ type_info->id_count++;
+ type_info->nextid++;
+
+ /* Sanity check for the 'nextid' getting too large and wrapping around */
+ HDassert(type_info->nextid <= ID_MASK);
+
+ /* Set the most recent ID to this object */
+ type_info->last_id_info = info;
+
+ /* Set return value */
+ ret_value = new_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_register() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_register_using_existing_id
+ *
+ * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
+ * This routine will check to ensure the supplied ID is not already
+ * in use, and ensure that it is a valid ID for the given type,
+ * but will NOT check to ensure the OBJECT is not already
+ * registered (thus, it is possible to register one object under
+ * multiple IDs).
+ *
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the object back
+ * up to the original ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * info = NULL; /* Pointer to the new ID information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ HDassert(object);
+
+ /* Make sure ID is not already in use */
+ if (NULL != (info = H5I__find_id(existing_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use")
+
+ /* Make sure type number is valid */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+
+ /* Get type pointer from list of types */
+ type_info = H5I_type_info_array_g[type];
+
+ if (NULL == type_info || type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Make sure requested ID belongs to object's type */
+ if (H5I_TYPE(existing_id) != type)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID")
+
+ /* Allocate new structure to house this ID */
+ if (NULL == (info = H5FL_CALLOC(H5I_id_info_t)))
+ HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Create the struct & insert requested ID */
+ info->id = existing_id;
+ info->count = 1; /* initial reference count*/
+ info->app_count = !!app_ref;
+ info->object = object;
+ info->marked = FALSE;
+
+ /* Insert into the type */
+ HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info);
+ type_info->id_count++;
+
+ /* Set the most recent ID to this object */
+ type_info->last_id_info = info;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_register_using_existing_id() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_subst
+ *
+ * Purpose: Substitute a new object pointer for the specified ID.
+ *
+ * Return: Success: Non-NULL previous object pointer associated
+ * with the specified ID.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, February 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_subst(hid_t id, const void *new_object)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID's info */
+ void * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count")
+
+ /* Get the old object pointer to return */
+ H5_GCC_DIAG_OFF("cast-qual")
+ ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
+ H5_GCC_DIAG_ON("cast-qual")
+
+ /* Set the new object pointer for the ID */
+ info->object = new_object;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_subst() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_object
+ *
+ * Purpose: Find an object pointer for the specified ID.
+ *
+ * Return: Success: Non-NULL object pointer associated with the
+ * specified ID
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_object(hid_t id)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+ void * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* General lookup of the ID */
+ if (NULL != (info = H5I__find_id(id))) {
+ /* Get the object pointer to return */
+ H5_GCC_DIAG_OFF("cast-qual")
+ ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
+ H5_GCC_DIAG_ON("cast-qual")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_object() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_object_verify
+ *
+ * Purpose: Find an object pointer for the specified ID, verifying that
+ * its in a particular type.
+ *
+ * Return: Success: Non-NULL object pointer associated with the
+ * specified ID.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 31, 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_object_verify(hid_t id, H5I_type_t type)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+ void * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ HDassert(type >= 1 && (int)type < H5I_next_type_g);
+
+ /* Verify that the type of the ID is correct & lookup the ID */
+ if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) {
+ /* Get the object pointer to return */
+ H5_GCC_DIAG_OFF("cast-qual")
+ ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
+ H5_GCC_DIAG_ON("cast-qual")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5I_object_verify() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_type
+ *
+ * Purpose: Given an object ID return the type to which it
+ * belongs. The ID need not be the ID of an object which
+ * currently exists because the type number is encoded
+ * in the object ID.
+ *
+ * Return: Success: A positive integer (corresponding to an H5I_type_t
+ * enum value for library ID types, but not for user
+ * ID types).
+ * Failure: H5I_BADID
+ *
+ * Programmer: Robb Matzke
+ * Friday, February 19, 1999
+ *
+ *-------------------------------------------------------------------------
+ */
+H5I_type_t
+H5I_get_type(hid_t id)
+{
+ H5I_type_t ret_value = H5I_BADID; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOERR
+
+ if (id > 0)
+ ret_value = H5I_TYPE(id);
+
+ HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type_g);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_get_type() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_is_file_object
+ *
+ * Purpose: Convenience function to determine if an ID represents
+ * a file object.
+ *
+ * In H5O calls, you can't use object_verify to ensure
+ * the ID was of the correct class since there's no
+ * H5I_OBJECT ID class.
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5I_is_file_object(hid_t id)
+{
+ H5I_type_t type = H5I_get_type(id);
+ htri_t ret_value = FAIL;
+
+ FUNC_ENTER_NOAPI(FAIL);
+
+ /* Fail if the ID type is out of range */
+ if (type < 1 || type >= H5I_NTYPES)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID type out of range");
+
+ /* Return TRUE if the ID is a file object (dataset, group, map, or committed
+ * datatype), FALSE otherwise.
+ */
+ if (H5I_DATASET == type || H5I_GROUP == type || H5I_MAP == type)
+ ret_value = TRUE;
+ else if (H5I_DATATYPE == type) {
+
+ H5T_t *dt = NULL;
+
+ if (NULL == (dt = (H5T_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct");
+
+ ret_value = H5T_is_named(dt);
+ }
+ else
+ ret_value = FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5I_is_file_object() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__remove_verify
+ *
+ * Purpose: Removes the specified ID from its type, first checking that
+ * the ID's type is the same as the ID type supplied as an argument
+ *
+ * Return: Success: A pointer to the object that was removed, the
+ * same pointer which would have been found by
+ * calling H5I_object().
+ * Failure: NULL
+ *
+ * Programmer: James Laird
+ * Nat Furrer
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I__remove_verify(hid_t id, H5I_type_t type)
+{
+ void *ret_value = NULL; /*return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Argument checking will be performed by H5I_remove() */
+
+ /* Verify that the type of the ID is correct */
+ if (type == H5I_TYPE(id))
+ ret_value = H5I_remove(id);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__remove_verify() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__remove_common
+ *
+ * Purpose: Common code to remove a specified ID from its type.
+ *
+ * Return: Success: A pointer to the object that was removed, the
+ * same pointer which would have been found by
+ * calling H5I_object().
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * October 3, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the current ID */
+ void * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(type_info);
+
+ /* Delete or mark the node */
+ HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), info);
+ if (info) {
+ HDassert(!info->marked);
+ if (!H5I_marking_g)
+ HASH_DELETE(hh, type_info->hash_table, info);
+ else
+ info->marked = TRUE;
+ }
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from hash table")
+
+ /* Check if this ID was the last one accessed */
+ if (type_info->last_id_info == info)
+ type_info->last_id_info = NULL;
+
+ H5_GCC_DIAG_OFF("cast-qual")
+ ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
+ H5_GCC_DIAG_ON("cast-qual")
+
+ if (!H5I_marking_g)
+ info = H5FL_FREE(H5I_id_info_t, info);
+
+ /* Decrement the number of IDs in the type */
+ (type_info->id_count)--;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__remove_common() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_remove
+ *
+ * Purpose: Removes the specified ID from its type.
+ *
+ * Return: Success: A pointer to the object that was removed, the
+ * same pointer which would have been found by
+ * calling H5I_object().
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5I_remove(hid_t id)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ H5I_type_t type = H5I_BADID; /* ID's type */
+ void * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
+ type = H5I_TYPE(id);
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number")
+ type_info = H5I_type_info_array_g[type];
+ if (type_info == NULL || type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type")
+
+ /* Remove the node from the type */
+ if (NULL == (ret_value = H5I__remove_common(type_info, id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_remove() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_ref
+ *
+ * Purpose: Decrements the number of references outstanding for an ID.
+ * This will fail if the type is not a reference counted type.
+ * The ID type's 'free' function will be called for the ID
+ * if the reference count for the ID reaches 0 and a free
+ * function has been defined at type creation time.
+ *
+ * Return: Success: New reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_ref(hid_t id)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
+
+ /* If this is the last reference to the object then invoke the type's
+ * free method on the object. If the free method is undefined or
+ * successful then remove the object from the type; otherwise leave
+ * the object in the type without decrementing the reference
+ * count. If the reference count is more than one then decrement the
+ * reference count without calling the free method.
+ *
+ * Beware: the free method may call other H5I functions.
+ *
+ * If an object is closing, we can remove the ID even though the free
+ * method might fail. This can happen when a mandatory filter fails to
+ * write when a dataset is closed and the chunk cache is flushed to the
+ * file. We have to close the dataset anyway. (SLU - 2010/9/7)
+ */
+ if (1 == info->count) {
+ H5I_type_info_t *type_info; /*ptr to the type */
+
+ /* Get the ID's type */
+ type_info = H5I_type_info_array_g[H5I_TYPE(id)];
+
+ H5_GCC_DIAG_OFF("cast-qual")
+ /* (Casting away const OK -QAK) */
+ if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object) >= 0) {
+ /* Remove the node from the type */
+ if (NULL == H5I__remove_common(type_info, id))
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node")
+ ret_value = 0;
+ } /* end if */
+ else
+ ret_value = -1;
+ H5_GCC_DIAG_ON("cast-qual")
+ } /* end if */
+ else {
+ --(info->count);
+ ret_value = (int)info->count;
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_app_ref
+ *
+ * Purpose: Wrapper for case of modifying the application ref.
+ * count for an ID as well as normal reference count.
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Sept 16, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_app_ref(hid_t id)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* Call regular decrement reference count routine */
+ if ((ret_value = H5I_dec_ref(id)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+
+ /* Check if the ID still exists */
+ if (ret_value > 0) {
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
+
+ /* Adjust app_ref */
+ --(info->app_count);
+ HDassert(info->count >= info->app_count);
+
+ /* Set return value */
+ ret_value = (int)info->app_count;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_app_ref_always_close
+ *
+ * Purpose: Wrapper for case of always closing the ID, even when the free
+ * routine fails
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_app_ref_always_close(hid_t id)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* Call application decrement reference count routine */
+ ret_value = H5I_dec_app_ref(id);
+
+ /* Check for failure */
+ if (ret_value < 0) {
+ /*
+ * If an object is closing, we can remove the ID even though the free
+ * method might fail. This can happen when a mandatory filter fails to
+ * write when a dataset is closed and the chunk cache is flushed to the
+ * file. We have to close the dataset anyway. (SLU - 2010/9/7)
+ */
+ H5I_remove(id);
+
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref_always_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_inc_ref
+ *
+ * Purpose: Increment the reference count for an object.
+ *
+ * Return: Success: The new reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_inc_ref(hid_t id, hbool_t app_ref)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
+
+ /* Adjust reference counts */
+ ++(info->count);
+ if (app_ref)
+ ++(info->app_count);
+
+ /* Set return value */
+ ret_value = (int)(app_ref ? info->app_count : info->count);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_inc_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_ref
+ *
+ * Purpose: Retrieve the reference count for an object.
+ *
+ * Return: Success: The reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_get_ref(hid_t id, hbool_t app_ref)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
+
+ /* Set return value */
+ ret_value = (int)(app_ref ? info->app_count : info->count);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_get_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__inc_type_ref
+ *
+ * Purpose: Increment the reference count for an ID type.
+ *
+ * Return: Success: The new reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I__inc_type_ref(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(type > 0 && (int)type < H5I_next_type_g);
+
+ /* Check arguments */
+ type_info = H5I_type_info_array_g[type];
+ if (NULL == type_info)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type")
+
+ /* Set return value */
+ ret_value = (int)(++(type_info->init_count));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__inc_type_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_type_ref
+ *
+ * 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 IDs in that type regardless of
+ * 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
+ * return value of 0 means that the type will have to be
+ * re-initialized before it can be used again (and should probably
+ * be set to H5I_UNINIT).
+ *
+ * Return: Success: Number of references to type
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_type_ref(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ herr_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number")
+
+ type_info = H5I_type_info_array_g[type];
+ if (type_info == NULL || type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type")
+
+ /* Decrement the number of users of the ID type. If this is the
+ * last user of the type then release all IDs from the type and
+ * free all memory it used. The free function is invoked for each ID
+ * being freed.
+ */
+ if (1 == type_info->init_count) {
+ H5I__destroy_type(type);
+ ret_value = 0;
+ }
+ else {
+ --(type_info->init_count);
+ ret_value = (herr_t)type_info->init_count;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_type_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__get_type_ref
+ *
+ * Purpose: Retrieve the reference count for an ID type.
+ *
+ * Return: Success: The reference count
+ *
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I__get_type_ref(H5I_type_t type)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(type >= 0);
+
+ /* Check arguments */
+ type_info = H5I_type_info_array_g[type];
+ if (!type_info)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type")
+
+ /* Set return value */
+ ret_value = (int)type_info->init_count;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__get_type_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__iterate_cb
+ *
+ * Purpose: Callback routine for H5I_iterate, invokes "user" callback
+ * function, and then sets return value, based on the result of
+ * that callback.
+ *
+ * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
+ * Failure: H5_ITER_ERROR (-1)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
+{
+ H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID info */
+ H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Only invoke the callback function if this ID is visible externally and
+ * its reference count is positive.
+ */
+ if ((!udata->app_ref) || (info->app_count > 0)) {
+ H5I_type_t type = udata->obj_type;
+ void * object;
+ herr_t cb_ret_val;
+
+ /* The stored object pointer might be an H5VL_object_t, in which
+ * case we'll need to get the wrapped object struct (H5F_t *, etc.).
+ */
+ H5_GCC_DIAG_OFF("cast-qual")
+ object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
+ H5_GCC_DIAG_ON("cast-qual")
+
+ /* Invoke callback function */
+ cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_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 */
+ else if (cb_ret_val < 0)
+ ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__iterate_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_iterate
+ *
+ * Purpose: Apply function FUNC to each member of type TYPE (with
+ * non-zero application reference count if app_ref is TRUE).
+ * Stop if FUNC returns a non zero value (i.e. anything
+ * other than H5_ITER_CONT).
+ *
+ * If FUNC returns a positive value (i.e. H5_ITER_STOP),
+ * return SUCCEED.
+ *
+ * If FUNC returns a negative value (i.e. H5_ITER_ERROR),
+ * return FAIL.
+ *
+ * The FUNC should take a pointer to the object and the
+ * udata as arguments and return non-zero to terminate
+ * siteration, and zero to continue.
+ *
+ * Limitation: Currently there is no way to start the iteration from
+ * where a previous iteration left off.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+ type_info = H5I_type_info_array_g[type];
+
+ /* Only iterate through ID list if it is initialized and there are IDs in type */
+ if (type_info && type_info->init_count > 0 && type_info->id_count > 0) {
+ H5I_iterate_ud_t iter_udata; /* User data for iteration callback */
+ H5I_id_info_t * item = NULL;
+ H5I_id_info_t * tmp = NULL;
+
+ /* Set up iterator user data */
+ iter_udata.user_func = func;
+ iter_udata.user_udata = udata;
+ iter_udata.app_ref = app_ref;
+ iter_udata.obj_type = type;
+
+ /* Iterate over IDs */
+ HASH_ITER(hh, type_info->hash_table, item, tmp)
+ {
+ if (!item->marked) {
+ int ret = H5I__iterate_cb((void *)item, NULL, (void *)&iter_udata);
+ if (H5_ITER_ERROR == ret)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
+ if (H5_ITER_STOP == ret)
+ break;
+ }
+ }
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_iterate() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__find_id
+ *
+ * Purpose: Given an object ID find the info struct that describes the
+ * object.
+ *
+ * Return: Success: A pointer to the object's info struct.
+ *
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5I_id_info_t *
+H5I__find_id(hid_t id)
+{
+ H5I_type_t type; /* ID's type */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * id_info = NULL; /* ID's info */
+ H5I_id_info_t * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Check arguments */
+ type = H5I_TYPE(id);
+ if (type <= H5I_BADID || (int)type >= H5I_next_type_g)
+ HGOTO_DONE(NULL)
+ type_info = H5I_type_info_array_g[type];
+ if (!type_info || type_info->init_count <= 0)
+ HGOTO_DONE(NULL)
+
+ /* Check for same ID as we have looked up last time */
+ if (type_info->last_id_info && type_info->last_id_info->id == id)
+ id_info = type_info->last_id_info;
+ else {
+ HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), id_info);
+
+ /* Remember this ID */
+ type_info->last_id_info = id_info;
+ }
+
+ /* Set return value */
+ ret_value = id_info;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__find_id() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__find_id_cb
+ *
+ * Purpose: Callback for searching for an ID with a specific pointer
+ *
+ * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1)
+ * Failure: H5_ITER_ERROR (-1)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
+{
+ H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID info */
+ H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */
+ H5I_type_t type = udata->obj_type;
+ const void * object = NULL;
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(info);
+ HDassert(udata);
+
+ /* Get a pointer to the VOL connector's data */
+ H5_GCC_DIAG_OFF("cast-qual")
+ object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
+ H5_GCC_DIAG_ON("cast-qual")
+
+ /* Check for a match */
+ if (object == udata->object) {
+ udata->ret_id = info->id;
+ ret_value = H5_ITER_STOP;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__find_id_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_find_id
+ *
+ * Purpose: Return the ID of an object by searching through the ID list
+ * for the type.
+ *
+ * Return: SUCCEED/FAIL
+ * (id will be set to H5I_INVALID_HID on errors or not found)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
+{
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(id);
+
+ *id = H5I_INVALID_HID;
+
+ type_info = H5I_type_info_array_g[type];
+ if (!type_info || type_info->init_count <= 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Only iterate through ID list if it is initialized and there are IDs in type */
+ if (type_info->init_count > 0 && type_info->id_count > 0) {
+ H5I_get_id_ud_t udata; /* User data */
+ H5I_id_info_t * item = NULL;
+ H5I_id_info_t * tmp = NULL;
+
+ /* Set up iterator user data */
+ udata.object = object;
+ udata.obj_type = type;
+ udata.ret_id = H5I_INVALID_HID;
+
+ /* Iterate over IDs for the ID type */
+ HASH_ITER(hh, type_info->hash_table, item, tmp)
+ {
+ int ret = H5I__find_id_cb((void *)item, NULL, (void *)&udata);
+ if (H5_ITER_ERROR == ret)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed")
+ if (H5_ITER_STOP == ret)
+ break;
+ }
+
+ *id = udata.ret_id;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_find_id() */
diff --git a/src/H5Imodule.h b/src/H5Imodule.h
index d26bb71..a2174d7 100644
--- a/src/H5Imodule.h
+++ b/src/H5Imodule.h
@@ -5,28 +5,33 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Saturday, September 12, 2015
+ * Programmer: Quincey Koziol
+ * Saturday, September 12, 2015
*
- * Purpose: This file contains declarations which define macros for the
- * H5I package. Including this header means that the source file
- * is part of the H5I package.
+ * Purpose: This file contains declarations which define macros for the
+ * H5I package. Including this header means that the source file
+ * is part of the H5I package.
*/
-#ifndef _H5Imodule_H
-#define _H5Imodule_H
+#ifndef H5Imodule_H
+#define H5Imodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
- * reporting macros.
+ * reporting macros.
*/
#define H5I_MODULE
#define H5_MY_PKG H5I
#define H5_MY_PKG_ERR H5E_ATOM
#define H5_MY_PKG_INIT NO
-#endif /* _H5Imodule_H */
+/**\defgroup H5I H5I
+ * \brief Identifier Interface
+ * \todo Describe concisely what the functions in this module are about.
+ */
+
+#endif /* H5Imodule_H */
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index 13ae793..1bcea26 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, May 15, 2003
*
* Purpose: This file contains declarations which are visible only within
@@ -23,20 +23,27 @@
#error "Do not include this file outside the H5I package!"
#endif
-#ifndef _H5Ipkg_H
-#define _H5Ipkg_H
+#ifndef H5Ipkg_H
+#define H5Ipkg_H
/* Get package's private header */
#include "H5Iprivate.h"
-/* Other private headers needed by this file */
+/* uthash is an external, header-only hash table implementation.
+ *
+ * We include the file directly in src/ and #define a few functions
+ * to use our internal memory calls.
+ */
+#define uthash_malloc(sz) H5MM_malloc(sz)
+#define uthash_free(ptr, sz) H5MM_free(ptr) /* Ignoring sz is intentional */
+#include "uthash.h"
/**************************/
/* Package Private Macros */
/**************************/
/*
- * Number of bits to use for ID Type in each atom. Increase if more types
+ * Number of bits to use for ID Type in each ID. Increase if more types
* are needed (though this will decrease the number of available IDs per
* type). This is the only number that must be changed since all other bit
* field sizes and masks are calculated from TYPE_BITS.
@@ -47,26 +54,70 @@
#define H5I_MAX_NUM_TYPES TYPE_MASK
/*
- * Number of bits to use for the Atom index in each atom (assumes 8-bit
+ * Number of bits to use for the ID index in each ID (assumes 8-bit
* bytes). We don't use the sign bit.
*/
#define ID_BITS ((sizeof(hid_t) * 8) - (TYPE_BITS + 1))
#define ID_MASK (((hid_t)1 << ID_BITS) - 1)
-/* Map an atom to an ID type number */
+/* Map an ID to an ID type number */
#define H5I_TYPE(a) ((H5I_type_t)(((hid_t)(a) >> ID_BITS) & TYPE_MASK))
/****************************/
/* Package Private Typedefs */
/****************************/
+/* ID information structure used */
+typedef struct H5I_id_info_t {
+ hid_t id; /* ID for this info */
+ unsigned count; /* Ref. count for this ID */
+ unsigned app_count; /* Ref. count of application visible IDs */
+ const void *object; /* Pointer associated with the ID */
+
+ /* Hash table ID fields */
+ hbool_t marked; /* Marked for deletion */
+ UT_hash_handle hh; /* Hash table handle (must be LAST) */
+} H5I_id_info_t;
+
+/* Type information structure used */
+typedef struct H5I_type_info_t {
+ 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 object */
+ H5I_id_info_t * last_id_info; /* Info for most recent ID looked up */
+ H5I_id_info_t * hash_table; /* Hash table pointer for this ID type */
+} H5I_type_info_t;
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+/* Array of pointers to ID types */
+H5_DLLVAR H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES];
+
+/* Variable to keep track of the number of types allocated. Its value is the
+ * next type ID to be handed out, so it is always one greater than the number
+ * of types.
+ * Starts at 1 instead of 0 because it makes trace output look nicer. If more
+ * types (or IDs within a type) are needed, adjust TYPE_BITS in H5Ipkg.h
+ * and/or increase size of hid_t
+ */
+H5_DLLVAR int H5I_next_type_g;
+
/******************************/
/* Package Private Prototypes */
/******************************/
+H5_DLL int H5I__destroy_type(H5I_type_t type);
+H5_DLL void *H5I__remove_verify(hid_t id, H5I_type_t type);
+H5_DLL int H5I__inc_type_ref(H5I_type_t type);
+H5_DLL int H5I__get_type_ref(H5I_type_t type);
+H5_DLL H5I_id_info_t *H5I__find_id(hid_t id);
+
/* Testing functions */
#ifdef H5I_TESTING
H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached);
#endif /* H5I_TESTING */
-#endif /*_H5Ipkg_H*/
+#endif /*H5Ipkg_H*/
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index d4d1721..dd7485d 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,8 +17,8 @@
*---------------------------------------------------------------------------*/
/* avoid re-inclusion */
-#ifndef _H5Iprivate_H
-#define _H5Iprivate_H
+#ifndef H5Iprivate_H
+#define H5Iprivate_H
/* Include package's public header */
#include "H5Ipublic.h"
@@ -42,7 +42,7 @@
/****************************/
typedef struct H5I_class_t {
- H5I_type_t type_id; /* Class ID for the type */
+ H5I_type_t type; /* Class "value" for the type */
unsigned flags; /* Class behavior flags */
unsigned reserved; /* Number of reserved IDs for this type */
/* [A specific number of type entries may be
@@ -86,7 +86,7 @@ H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*o
/* Functions that manipulate objects */
H5_DLL void * H5I_object(hid_t id);
-H5_DLL void * H5I_object_verify(hid_t id, H5I_type_t id_type);
+H5_DLL void * H5I_object_verify(hid_t id, H5I_type_t type);
H5_DLL void * H5I_remove(hid_t id);
H5_DLL void * H5I_subst(hid_t id, const void *new_object);
H5_DLL htri_t H5I_is_file_object(hid_t id);
@@ -99,4 +99,4 @@ H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hboo
/* Debugging functions */
H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type);
-#endif /* _H5Iprivate_H */
+#endif /* H5Iprivate_H */
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 433671b..6442a0d 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,51 +15,68 @@
* This file contains function prototypes for each exported function in
* the H5I module.
*/
-#ifndef _H5Ipublic_H
-#define _H5Ipublic_H
+#ifndef H5Ipublic_H
+#define H5Ipublic_H
/* Public headers needed by this file */
#include "H5public.h"
-/*
- * Library type values. Start with `1' instead of `0' because it makes the
- * tracing output look better when hid_t values are large numbers. Change the
- * TYPE_BITS in H5I.c if the MAXID gets larger than 32 (an assertion will
- * fail otherwise).
+/**
+ * Library type values.
+ * \internal Library type values. Start with `1' instead of `0' because it
+ * makes the tracing output look better when hid_t values are large
+ * numbers. Change the TYPE_BITS in H5I.c if the MAXID gets larger
+ * than 32 (an assertion will fail otherwise).
*
- * When adding types here, add a section to the 'misc19' test in test/tmisc.c
- * to verify that the H5I{inc|dec|get}_ref() routines work correctly with it.
+ * When adding types here, add a section to the 'misc19' test in
+ * test/tmisc.c to verify that the H5I{inc|dec|get}_ref() routines
+ * work correctly with it. \endinternal
*/
+//! <!-- [H5I_type_t_snip] -->
typedef enum H5I_type_t {
- H5I_UNINIT = (-2), /* uninitialized type */
- H5I_BADID = (-1), /* invalid Type */
- H5I_FILE = 1, /* type ID for File objects */
- H5I_GROUP, /* type ID for Group objects */
- H5I_DATATYPE, /* type ID for Datatype objects */
- H5I_DATASPACE, /* type ID for Dataspace objects */
- H5I_DATASET, /* type ID for Dataset objects */
- H5I_MAP, /* type ID for Map objects */
- H5I_ATTR, /* type ID for Attribute objects */
- H5I_VFL, /* type ID for virtual file layer */
- H5I_VOL, /* type ID for virtual object layer */
- H5I_GENPROP_CLS, /* type ID for generic property list classes */
- H5I_GENPROP_LST, /* type ID for generic property lists */
- H5I_ERROR_CLASS, /* type ID for error classes */
- H5I_ERROR_MSG, /* type ID for error messages */
- H5I_ERROR_STACK, /* type ID for error stacks */
- H5I_SPACE_SEL_ITER, /* type ID for dataspace selection iterator */
- H5I_NTYPES /* number of library types, MUST BE LAST! */
+ H5I_UNINIT = (-2), /**< uninitialized type */
+ H5I_BADID = (-1), /**< invalid Type */
+ H5I_FILE = 1, /**< type ID for File objects */
+ H5I_GROUP, /**< type ID for Group objects */
+ H5I_DATATYPE, /**< type ID for Datatype objects */
+ H5I_DATASPACE, /**< type ID for Dataspace objects */
+ H5I_DATASET, /**< type ID for Dataset objects */
+ H5I_MAP, /**< type ID for Map objects */
+ H5I_ATTR, /**< type ID for Attribute objects */
+ H5I_VFL, /**< type ID for virtual file layer */
+ H5I_VOL, /**< type ID for virtual object layer */
+ H5I_GENPROP_CLS, /**< type ID for generic property list classes */
+ H5I_GENPROP_LST, /**< type ID for generic property lists */
+ H5I_ERROR_CLASS, /**< type ID for error classes */
+ H5I_ERROR_MSG, /**< type ID for error messages */
+ H5I_ERROR_STACK, /**< type ID for error stacks */
+ H5I_SPACE_SEL_ITER, /**< type ID for dataspace selection iterator */
+ H5I_NTYPES /**< number of library types, MUST BE LAST! */
} H5I_type_t;
+//! <!-- [H5I_type_t_snip] -->
-/* Type of atoms to return to users */
+/**
+ * Type of IDs to return to users
+ */
typedef int64_t hid_t;
+
+#define PRIdHID PRId64
+#define PRIxHID PRIx64
+#define PRIXHID PRIX64
+#define PRIoHID PRIo64
+
+/**
+ * The size of identifiers
+ */
#define H5_SIZEOF_HID_T H5_SIZEOF_INT64_T
-/* An invalid object ID. This is also negative for error return. */
+/**
+ * An invalid object ID. This is also negative for error return.
+ */
#define H5I_INVALID_HID (-1)
-/*
- * Function for freeing objects. This function will be called with an object
+/**
+ * A function for freeing objects. This function will be called with an object
* ID type number and a pointer to the object. The function should free the
* object and return non-negative to indicate that the object
* can be removed from the ID type. If the function returns negative
@@ -67,11 +84,19 @@ typedef int64_t hid_t;
*/
typedef herr_t (*H5I_free_t)(void *);
-/* Type of the function to compare objects & keys */
+/**
+ * The type of a function to compare objects & keys
+ */
+//! <!-- [H5I_search_func_t_snip] -->
typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key);
+//! <!-- [H5I_search_func_t_snip] -->
-/* Type of the H5Iiterate callback function */
+/**
+ * The type of H5Iiterate() callback functions
+ */
+//! <!-- [H5I_iterate_func_t_snip] -->
typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata);
+//! <!-- [H5I_iterate_func_t_snip] -->
#ifdef __cplusplus
extern "C" {
@@ -79,28 +104,564 @@ extern "C" {
/* Public API functions */
-H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object);
-H5_DLL void * H5Iobject_verify(hid_t id, H5I_type_t id_type);
-H5_DLL void * H5Iremove_verify(hid_t id, H5I_type_t id_type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Registers an object under a type and returns an ID for it
+ *
+ * \param[in] type The identifier of the type of the new ID
+ * \param[in] object Pointer to object for which a new ID is created
+ *
+ * \return \hid_t{object}
+ *
+ * \details H5Iregister() creates and returns a new ID for an object.
+ *
+ * \details The \p type parameter is the identifier for the ID type to which
+ * this new ID will belong. This identifier must have been created by
+ * a call to H5Iregister_type().
+ *
+ * \details The \p object parameter is a pointer to the memory which the new ID
+ * will be a reference to. This pointer will be stored by the library
+ * and returned via a call to H5Iobject_verify().
+ *
+ */
+H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object);
+/**
+ * \ingroup H5I
+ *
+ * \brief Returns the object referenced by an ID
+ *
+ * \param[in] id ID to be dereferenced
+ * \param[in] type The identifier type
+
+ *
+ * \return Pointer to the object referenced by \p id on success, NULL on failure.
+ *
+ * \details H5Iobject_verify() returns a pointer to the memory referenced by id
+ * after verifying that \p id is of type \p type. This function is
+ * analogous to dereferencing a pointer in C with type checking.
+ *
+ * \note H5Iobject_verify() does not change the ID it is called on in any way
+ * (as opposed to H5Iremove_verify(), which removes the ID from its
+ * type’s hash table).
+ *
+ * \see H5Iregister()
+ *
+ */
+H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Removes an ID from its type
+ *
+ * \param[in] id The ID to be removed from its type
+ * \param[in] type The identifier type
+
+ *
+ * \return Returns a pointer to the memory referred to by \p id on success,
+ * NULL on failure.
+ *
+ * \details H5Iremove_verify() first ensures that \p id belongs to \p type.
+ * If so, it removes \p id from its type and returns the pointer
+ * to the memory it referred to. This pointer is the same pointer that
+ * was placed in storage by H5Iregister(). If id does not belong to
+ * \p type, then NULL is returned.
+ *
+ * The \p id parameter is the ID which is to be removed from its type.
+ *
+ * The \p type parameter is the identifier for the ID type which \p id
+ * is supposed to belong to. This identifier must have been created by
+ * a call to H5Iregister_type().
+ *
+ * \note This function does NOT deallocate the memory that \p id refers to.
+ * The pointer returned by H5Iregister() must be deallocated by the user
+ * to avoid memory leaks.
+ *
+ */
+H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Retrieves the type of an object
+ *
+ * \obj_id{id}
+ *
+ * \return Returns the object type if successful; otherwise #H5I_BADID.
+ *
+ * \details H5Iget_type() retrieves the type of the object identified by
+ * \p id.
+ *
+ * Valid types returned by the function are:
+ * \id_types
+ *
+ * If no valid type can be determined or the identifier submitted is
+ * invalid, the function returns #H5I_BADID.
+ *
+ * This function is of particular use in determining the type of
+ * object closing function (H5Dclose(), H5Gclose(), etc.) to call
+ * after a call to H5Rdereference().
+ *
+ * \note Note that this function returns only the type of object that \p id
+ * would identify if it were valid; it does not determine whether \p id
+ * is valid identifier. Validity can be determined with a call to
+ * H5Iis_valid().
+ *
+ */
H5_DLL H5I_type_t H5Iget_type(hid_t id);
-H5_DLL hid_t H5Iget_file_id(hid_t id);
-H5_DLL ssize_t H5Iget_name(hid_t id, char *name /*out*/, size_t size);
-H5_DLL int H5Iinc_ref(hid_t id);
-H5_DLL int H5Idec_ref(hid_t id);
-H5_DLL int H5Iget_ref(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Retrieves an identifier for the file containing the specified object
+ *
+ * \obj_id{id}
+ *
+ * \return \hid_t{file}
+ *
+ * \details H5Iget_file_id() returns the identifier of the file associated with
+ * the object referenced by \p id.
+ *
+ * \note Note that the HDF5 library permits an application to close a file
+ * while objects within the file remain open. If the file containing the
+ * object \p id is still open, H5Iget_file_id() will retrieve the
+ * existing file identifier. If there is no existing file identifier for
+ * the file, i.e., the file has been closed, H5Iget_file_id() will reopen
+ * the file and return a new file identifier. In either case, the file
+ * identifier must eventually be released using H5Fclose().
+ *
+ * \since 1.6.3
+ *
+ */
+H5_DLL hid_t H5Iget_file_id(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Retrieves a name of an object based on the object identifier
+ *
+ * \obj_id{id}
+ * \param[out] name A buffer for thename associated with the identifier
+ * \param[in] size The size of the \p name buffer; usually the size of
+ * the name in bytes plus 1 for a NULL terminator
+ *
+ * \return ssize_t
+ *
+ * \details H5Iget_name() retrieves a name for the object identified by \p id.
+ *
+ * \details Up to size characters of the name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application.
+ *
+ * If the length of the name, which determines the required value of
+ * \p size, is unknown, a preliminary H5Iget_name() call can be made.
+ * The return value of this call will be the size in bytes of the
+ * object name. That value, plus 1 for a NULL terminator, is then
+ * assigned to size for a second H5Iget_name() call, which will
+ * retrieve the actual name.
+ *
+ * If the object identified by \p id is an attribute, as determined
+ * via H5Iget_type(), H5Iget_name() retrieves the name of the object
+ * to which that attribute is attached. To retrieve the name of the
+ * attribute itself, use H5Aget_name().
+ *
+ * If there is no name associated with the object identifier or if the
+ * name is NULL, H5Iget_name() returns 0 (zero).
+ *
+ * \note Note that an object in an HDF5 file may have multiple paths if there
+ * are multiple links pointing to it. This function may return any one of
+ * these paths. When possible, H5Iget_name() returns the path with which
+ * the object was opened.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL ssize_t H5Iget_name(hid_t id, char *name /*out*/, size_t size);
+/**
+ * \ingroup H5I
+ *
+ * \brief Increments the reference count for an object
+ *
+ * \obj_id{id}
+ *
+ * \return Returns a non-negative reference count of the object ID after
+ * incrementing it if successful; otherwise a negative value is
+ * returned.
+ *
+ * \details H5Iinc_ref() increments the reference count of the object
+ * identified by \p id.
+ *
+ * The reference count for an object ID is attached to the information
+ * about an object in memory and has no relation to the number of
+ * links to an object on disk.
+ *
+ * The reference count for a newly created object will be 1. Reference
+ * counts for objects may be explicitly modified with this function or
+ * with H5Idec_ref(). When an object ID's reference count reaches
+ * zero, the object will be closed. Calling an object ID's \c close
+ * function decrements the reference count for the ID which normally
+ * closes the object, but if the reference count for the ID has been
+ * incremented with this function, the object will only be closed when
+ * the reference count reaches zero with further calls to H5Idec_ref()
+ * or the object ID's \c close function.
+ *
+ * If the object ID was created by a collective parallel call (such as
+ * H5Dcreate(), H5Gopen(), etc.), the reference count should be
+ * modified by all the processes which have copies of the ID.
+ * Generally this means that group, dataset, attribute, file and named
+ * datatype IDs should be modified by all the processes and that all
+ * other types of IDs are safe to modify by individual processes.
+ *
+ * This function is of particular value when an application is
+ * maintaining multiple copies of an object ID. The object ID can be
+ * incremented when a copy is made. Each copy of the ID can then be
+ * safely closed or decremented and the HDF5 object will be closed
+ * when the reference count for that that object drops to zero.
+ *
+ * \since 1.6.2
+ *
+ */
+H5_DLL int H5Iinc_ref(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Decrements the reference count for an object
+ *
+ * \obj_id{id}
+ *
+ * \return Returns a non-negative reference count of the object ID after
+ * decrementing it, if successful; otherwise a negative value is
+ * returned.
+ *
+ * \details H5Idec_ref() decrements the reference count of the object
+ * identified by \p id.
+ *
+ * The reference count for an object ID is attached to the information
+ * about an object in memory and has no relation to the number of
+ * links to an object on disk.
+ *
+ * The reference count for a newly created object will be 1. Reference
+ * counts for objects may be explicitly modified with this function or
+ * with H5Iinc_ref(). When an object identifier’s reference count
+ * reaches zero, the object will be closed. Calling an object
+ * identifier’s \c close function decrements the reference count for
+ * the identifier which normally closes the object, but if the
+ * reference count for the identifier has been incremented with
+ * H5Iinc_ref(), the object will only be closed when the reference
+ * count reaches zero with further calls to this function or the
+ * object identifier’s \c close function.
+ *
+ * If the object ID was created by a collective parallel call (such as
+ * H5Dcreate(), H5Gopen(), etc.), the reference count should be
+ * modified by all the processes which have copies of the ID.
+ * Generally this means that group, dataset, attribute, file and named
+ * datatype IDs should be modified by all the processes and that all
+ * other types of IDs are safe to modify by individual processes.
+ *
+ * This function is of particular value when an application is
+ * maintaining multiple copies of an object ID. The object ID can be
+ * incremented when a copy is made. Each copy of the ID can then be
+ * safely closed or decremented and the HDF5 object will be closed
+ * when the reference count for that that object drops to zero.
+ *
+ * \since 1.6.2
+ *
+ */
+H5_DLL int H5Idec_ref(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Retrieves the reference count for an object
+ *
+ * \obj_id{id}
+ *
+ * \return Returns a non-negative current reference count of the object
+ * identifier if successful; otherwise a negative value is returned.
+ *
+ * \details H5Iget_ref() retrieves the reference count of the object identified
+ * by \p id.
+ *
+ * The reference count for an object identifier is attached to the
+ * information about an object in memory and has no relation to the
+ * number of links to an object on disk.
+ *
+ * The function H5Iis_valid() is used to determine whether a specific
+ * object identifier is valid.
+ *
+ * \since 1.6.2
+ *
+ */
+H5_DLL int H5Iget_ref(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Creates and returns a new ID type
+ *
+ * \param[in] hash_size Minimum hash table size (in entries) used to store IDs
+ * for the new type
+ * \param[in] reserved Number of reserved IDs for the new type
+ * \param[in] free_func Function used to deallocate space for a single ID
+ *
+ * \return Returns the type identifier on success, negative on failure.
+ *
+ * \details H5Iregister_type() allocates space for a new ID type and returns an
+ * identifier for it.
+ *
+ * The \p hash_size parameter indicates the minimum size of the hash
+ * table used to store IDs in the new type.
+ *
+ * The \p reserved parameter indicates the number of IDs in this new
+ * type to be reserved. Reserved IDs are valid IDs which are not
+ * associated with any storage within the library.
+ *
+ * The \p free_func parameter is a function pointer to a function
+ * which returns an herr_t and accepts a \c void*. The purpose of this
+ * function is to deallocate memory for a single ID. It will be called
+ * by H5Iclear_type() and H5Idestroy_type() on each ID. This function
+ * is NOT called by H5Iremove_verify(). The \c void* will be the same
+ * pointer which was passed in to the H5Iregister() function. The \p
+ * free_func function should return 0 on success and -1 on failure.
+ *
+ */
H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func);
-H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
-H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
-H5_DLL int H5Iinc_type_ref(H5I_type_t type);
-H5_DLL int H5Idec_type_ref(H5I_type_t type);
-H5_DLL int H5Iget_type_ref(H5I_type_t type);
-H5_DLL void * H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
-H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
-H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members);
-H5_DLL htri_t H5Itype_exists(H5I_type_t type);
-H5_DLL htri_t H5Iis_valid(hid_t id);
+/**
+ * \ingroup H5I
+ *
+ * \brief Deletes all identifiers of the given type
+ *
+ * \param[in] type Identifier of identifier type which is to be cleared of identifiers
+ * \param[in] force Whether or not to force deletion of all identifiers
+ *
+ * \return \herr_t
+ *
+ * \details H5Iclear_type() deletes all identifiers of the type identified by
+ * the argument \p type.
+ *
+ * The identifier type's free function is first called on all of these
+ * identifiers to free their memory, then they are removed from the
+ * type.
+ *
+ * If the \p force flag is set to false, only those identifiers whose
+ * reference counts are equal to 1 will be deleted, and all other
+ * identifiers will be entirely unchanged. If the force flag is true,
+ * all identifiers of this type will be deleted.
+ *
+ */
+H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
+/**
+ * \ingroup H5I
+ *
+ * \brief Removes an identifier type and all identifiers within that type
+ *
+ * \param[in] type Identifier of identifier type which is to be destroyed
+ *
+ * \return \herr_t
+ *
+ * \details H5Idestroy_type deletes an entire identifier type \p type. All
+ * identifiers of this type are destroyed and no new identifiers of
+ * this type can be registered.
+ *
+ * The type’s free function is called on all of the identifiers which
+ * are deleted by this function, freeing their memory. In addition,
+ * all memory used by this type’s hash table is freed.
+ *
+ * Since the H5I_type_t values of destroyed identifier types are
+ * reused when new types are registered, it is a good idea to set the
+ * variable holding the value of the destroyed type to #H5I_UNINIT.
+ *
+ */
+H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Increments the reference count on an ID type
+ *
+ * \param[in] type The identifier of the type whose reference count is to be incremented
+ *
+ * \return Returns the current reference count on success, negative on failure.
+ *
+ * \details H5Iinc_type_ref() increments the reference count on an ID type. The
+ * reference count is used by the library to indicate when an ID type
+ * can be destroyed.
+ *
+ * The type parameter is the identifier for the ID type whose
+ * reference count is to be incremented. This identifier must have
+ * been created by a call to H5Iregister_type().
+ *
+ */
+H5_DLL int H5Iinc_type_ref(H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Decrements the reference count on an identifier type
+ *
+ * \param[in] type The identifier of the type whose reference count is to be decremented
+ *
+ * \return Returns the current reference count on success, negative on failure.
+ *
+ * \details H5Idec_type_ref() decrements the reference count on an identifier
+ * type. The reference count is used by the library to indicate when
+ * an identifier type can be destroyed. If the reference count reaches
+ * zero, this function will destroy it.
+ *
+ * The type parameter is the identifier for the identifier type whose
+ * reference count is to be decremented. This identifier must have
+ * been created by a call to H5Iregister_type().
+ *
+ */
+H5_DLL int H5Idec_type_ref(H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Retrieves the reference count on an ID type
+ *
+ * \param[in] type The identifier of the type whose reference count is to be retieved
+ *
+ * \return Returns the current reference count on success, negative on failure.
+ *
+ * \details H5Iget_type_ref() retrieves the reference count on an ID type. The
+ * reference count is used by the library to indicate when an ID type
+ * can be destroyed.
+ *
+ * The type parameter is the identifier for the ID type whose
+ * reference count is to be retrieved. This identifier must have been
+ * created by a call to H5Iregister_type().
+ *
+ */
+H5_DLL int H5Iget_type_ref(H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Finds the memory referred to by an ID within the given ID type such
+ * that some criterion is satisfied
+ *
+ * \param[in] type The identifier of the type to be searched
+ * \param[in] func The function defining the search criteria
+ * \param[in] key A key for the search function
+ *
+ * \return Returns a pointer to the object which satisfies the search function
+ * on success, NULL on failure.
+ *
+ * \details H5Isearch() searches through a given ID type to find an object that
+ * satisfies the criteria defined by \p func. If such an object is
+ * found, the pointer to the memory containing this object is
+ * returned. Otherwise, NULL is returned. To do this, \p func is
+ * called on every member of type \p type. The first member to satisfy
+ * \p func is returned.
+ *
+ * The \p type parameter is the identifier for the ID type which is to
+ * be searched. This identifier must have been created by a call to
+ * H5Iregister_type().
+ *
+ * The parameter \p func is a function pointer to a function which
+ * takes three parameters. The first parameter is a \c void* and will
+ * be a pointer to the object to be tested. This is the same object
+ * that was placed in storage using H5Iregister(). The second
+ * parameter is a hid_t and is the ID of the object to be tested. The
+ * last parameter is a \c void*. This is the \p key parameter and can
+ * be used however the user finds helpful, or it can be ignored if it
+ * is not needed. \p func returns 0 if the object it is testing does
+ * not pass its criteria. A non-zero value should be returned if the
+ * object does pass its criteria. H5I_search_func_t is defined in
+ * H5Ipublic.h and is shown below.
+ * \snippet this H5I_search_func_t_snip
+ * The \p key parameter will be passed to the search function as a
+ * parameter. It can be used to further define the search at run-time.
+ *
+ */
+H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
+/**
+ * \ingroup H5I
+ *
+ * \brief Calls a callback for each member of the identifier type specified
+ *
+ * \param[in] type The identifier type
+ * \param[in] op The callback function
+ * \param[in,out] op_data The data for the callback function
+ *
+ * \return The last value returned by \p op
+ *
+ * \details H5Iiterate() calls the callback function \p op for each member of
+ * the identifier type \p type. The callback function type for \p op,
+ * H5I_iterate_func_t, is defined in H5Ipublic.h as:
+ * \snippet this H5I_iterate_func_t_snip
+ * \p op takes as parameters the identifier and a pass through of
+ * \p op_data, and returns an herr_t.
+ *
+ * A positive return from op will cause the iteration to stop and
+ * H5Iiterate() will return the value returned by \p op. A negative
+ * return from \p op will cause the iteration to stop and H5Iiterate()
+ * will return failure. A zero return from \p op will allow iteration
+ * to continue, as long as there are other identifiers remaining in
+ * type.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
+/**
+ * \ingroup H5I
+ *
+ * \brief Returns the number of identifiers in a given identifier type
+ *
+ * \param[in] type The identifier type
+ * \param[out] num_members Number of identifiers of the specified identifier type
+ *
+ * \return \herr_t
+ *
+ * \details H5Inmembers() returns the number of identifiers of the identifier
+ * type specified in \p type.
+ *
+ * The number of identifiers is returned in \p num_members. If no
+ * identifiers of this type have been registered, the type does not
+ * exist, or it has been destroyed, \p num_members is returned with
+ * the value 0.
+ *
+ */
+H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members);
+/**
+ * \ingroup H5I
+ *
+ * \brief Determines whether an identifier type is registered
+ *
+ * \param[in] type Identifier type
+ *
+ * \return \htri_t
+ *
+ * \details H5Itype_exists() determines whether the given identifier type,
+ * \p type, is registered with the library.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Itype_exists(H5I_type_t type);
+/**
+ * \ingroup H5I
+ *
+ * \brief Determines whether an identifier is valid
+ *
+ * \obj_id{id}
+ *
+ * \return \htri_t
+ *
+ * \details H5Iis_valid() determines whether the identifier \p id is valid.
+ *
+ * \details Valid identifiers are those that have been obtained by an
+ * application and can still be used to access the original target.
+ * Examples of invalid identifiers include:
+ * \li Out of range values: negative, for example
+ * \li Previously-valid identifiers that have been released:
+ * for example, a dataset identifier for which the dataset has
+ * been closed
+ *
+ * H5Iis_valid() can be used with any type of identifier: object
+ * identifier, property list identifier, attribute identifier, error
+ * message identifier, etc. When necessary, a call to H5Iget_type()
+ * can determine the type of the object that \p id identifies.
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL htri_t H5Iis_valid(hid_t id);
#ifdef __cplusplus
}
#endif
-#endif /* _H5Ipublic_H */
+#endif /* H5Ipublic_H */
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 8bd03f0..7f4ca7a 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -6,15 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgoup.org>
- * Tuesday, July 27, 2010
- *
- * Purpose: ID testing functions.
+/*
+ * H5Itest.c - ID testing functions
*/
/****************/
@@ -28,7 +26,6 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */
diff --git a/src/H5L.c b/src/H5L.c
index 6e89353..b7f2752 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -95,7 +95,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*/);
static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path,
@@ -151,15 +151,15 @@ static size_t H5L_table_used_g = 0;
static H5L_class_t *H5L_table_g = NULL;
/*-------------------------------------------------------------------------
- * Function: H5L_init
+ * Function: H5L_init
*
- * Purpose: Initialize the interface from some other package.
+ * Purpose: Initialize the interface from some other package.
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Thursday, July 13, 2006
*
*-------------------------------------------------------------------------
@@ -177,13 +177,13 @@ done:
} /* end H5L_init() */
/*-------------------------------------------------------------------------
- * Function: H5L__init_package
+ * Function: H5L__init_package
*
- * Purpose: Initialize information specific to H5L interface.
+ * Purpose: Initialize information specific to H5L interface.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Tuesday, January 24, 2006
*
*-------------------------------------------------------------------------
@@ -204,13 +204,13 @@ done:
} /* end H5L_init_package() */
/*-------------------------------------------------------------------------
- * Function: H5L_term_package
+ * Function: H5L_term_package
*
- * Purpose: Terminate any resources allocated in H5L__init_package.
+ * Purpose: Terminate any resources allocated in H5L__init_package.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Tuesday, January 24, 2006
*
*-------------------------------------------------------------------------
@@ -248,9 +248,9 @@ H5L_term_package(void)
* are interpreted relative to SRC_LOC_ID and DST_LOC_ID,
* which are either file IDs or group ID.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Wednesday, March 29, 2006
*
*-------------------------------------------------------------------------
@@ -291,13 +291,13 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set location paramter for source object */
+ /* Set location parameter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.loc_data.loc_by_name.name = src_name;
loc_params1.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params1.obj_type = H5I_get_type(src_loc_id);
- /* Set location paramter for destination object */
+ /* Set location parameter for destination object */
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
@@ -338,9 +338,9 @@ done:
* time and target. The new link can have a different name
* and be in a different location than the original.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Wednesday, March 29, 2006
*
*-------------------------------------------------------------------------
@@ -381,13 +381,13 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set location paramter for source object */
+ /* Set location parameter for source object */
loc_params1.type = H5VL_OBJECT_BY_NAME;
loc_params1.loc_data.loc_by_name.name = src_name;
loc_params1.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params1.obj_type = H5I_get_type(src_loc_id);
- /* Set location paramter for destination object */
+ /* Set location parameter for destination object */
loc_params2.type = H5VL_OBJECT_BY_NAME;
loc_params2.loc_data.loc_by_name.name = dst_name;
loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
@@ -432,9 +432,9 @@ done:
* LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar'
* then the actual object looked up is `./x/y/./foo'.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 6, 1998
*
*-------------------------------------------------------------------------
@@ -503,9 +503,9 @@ done:
* NEW_NAME are interpreted relative to CUR_LOC_ID and
* NEW_LOC_ID, which are either file IDs or group IDs.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 6, 1998
*
*-------------------------------------------------------------------------
@@ -606,9 +606,9 @@ done:
* The link class of the new link must already be registered
* with the library.
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Tuesday, December 13, 2005
*
*-------------------------------------------------------------------------
@@ -671,9 +671,9 @@ done:
* object is open, then the reclamation of the file space is
* delayed until all handles to the object are closed).
*
- * Return: SUCCEED/FAIL
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 6, 1998
*
*-------------------------------------------------------------------------
@@ -716,20 +716,20 @@ done:
} /* end H5Ldelete() */
/*-------------------------------------------------------------------------
- * Function: H5Ldelete_by_idx
+ * Function: H5Ldelete_by_idx
*
- * Purpose: Removes the specified link from the group graph and
- * decrements the link count for the object to which it
- * points, according to the order within an index.
+ * Purpose: Removes the specified link from the group graph and
+ * decrements the link count for the object to which it
+ * points, according to the order within an index.
*
- * If the link count reaches zero then all file-space
- * associated with the object will be reclaimed (but if the
- * object is open, then the reclamation of the file space is
- * delayed until all handles to the object are closed).
+ * If the link count reaches zero then all file-space
+ * associated with the object will be reclaimed (but if the
+ * object is open, then the reclamation of the file space is
+ * delayed until all handles to the object are closed).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 13, 2006
*
*-------------------------------------------------------------------------
@@ -779,20 +779,20 @@ done:
} /* end H5Ldelete_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5Lget_val
+ * Function: H5Lget_val
*
- * Purpose: Returns the link value of a link whose name is NAME. For
+ * Purpose: Returns the link value of a link whose name is NAME. For
* symbolic links, this is the path to which the link points,
* including the null terminator. For user-defined links, it
* is the link buffer.
*
* At most SIZE bytes are copied to the BUF result buffer.
*
- * Return: Success: Non-negative with the link value in BUF.
+ * Return: Success: Non-negative with the link value in BUF.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 13, 1998
*
*-------------------------------------------------------------------------
@@ -834,19 +834,19 @@ done:
} /* end H5Lget_val() */
/*-------------------------------------------------------------------------
- * Function: H5Lget_val_by_idx
+ * Function: H5Lget_val_by_idx
*
- * Purpose: Returns the link value of a link, according to the order of
+ * Purpose: Returns the link value of a link, according to the order of
* an index. For symbolic links, this is the path to which the
* link points, including the null terminator. For user-defined
* links, it is the link buffer.
*
* At most SIZE bytes are copied to the BUF result buffer.
*
- * Return: Success: Non-negative with the link value in BUF.
- * Failure: Negative
+ * Return: Success: Non-negative with the link value in BUF.
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 13, 2006
*
*-------------------------------------------------------------------------
@@ -902,7 +902,7 @@ done:
*
* Return: Success: TRUE/FALSE/FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, March 16, 2007
*
*-------------------------------------------------------------------------
@@ -947,14 +947,14 @@ done:
} /* end H5Lexists() */
/*-------------------------------------------------------------------------
- * Function: H5Lget_info2
+ * Function: H5Lget_info2
*
- * Purpose: Gets metadata for a link.
+ * Purpose: Gets metadata for a link.
*
- * Return: Success: Non-negative with information in LINFO
+ * Return: Success: Non-negative with information in LINFO
* Failure: Negative
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Wednesday, June 21, 2006
*
*-------------------------------------------------------------------------
@@ -996,15 +996,15 @@ done:
} /* end H5Lget_info2() */
/*-------------------------------------------------------------------------
- * Function: H5Lget_info_by_idx2
+ * Function: H5Lget_info_by_idx2
*
- * Purpose: Gets metadata for a link, according to the order within an
+ * Purpose: Gets metadata for a link, according to the order within an
* index.
*
- * Return: Success: Non-negative with information in LINFO
- * Failure: Negative
+ * Return: Success: Non-negative with information in LINFO
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 6, 2006
*
*-------------------------------------------------------------------------
@@ -1054,9 +1054,9 @@ done:
} /* end H5Lget_info_by_idx2() */
/*-------------------------------------------------------------------------
- * Function: H5Lregister
+ * Function: H5Lregister
*
- * Purpose: Registers a class of user-defined links, or changes the
+ * Purpose: Registers a class of user-defined links, or changes the
* behavior of an existing class.
*
* The link class passed in will override any existing link
@@ -1065,9 +1065,9 @@ done:
* H5L_LINK_CLASS_T_VERS), a link class ID, and a traversal
* function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1115,16 +1115,16 @@ done:
} /* end H5Lregister() */
/*-------------------------------------------------------------------------
- * Function: H5Lunregister
+ * Function: H5Lunregister
*
- * Purpose: Unregisters a class of user-defined links, preventing them
+ * Purpose: Unregisters a class of user-defined links, preventing them
* from being traversed, queried, moved, etc.
*
* A link class can be re-registered using H5Lregister().
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1159,7 +1159,7 @@ done:
* FALSE if it is unregistered
* FAIL on error (if the class is not a valid UD class ID)
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1199,9 +1199,9 @@ done:
* Return: Success: Non-negative length of name, with information
* in NAME buffer
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 11, 2006
*
*-------------------------------------------------------------------------
@@ -1401,8 +1401,8 @@ done:
* library, or the negative value returned by one
* of the operators.
*
- * Programmer: Quincey Koziol
- * November 24 2007
+ * Programmer: Quincey Koziol
+ * November 24 2007
*
*-------------------------------------------------------------------------
*/
@@ -1528,27 +1528,27 @@ done:
*/
/*-------------------------------------------------------------------------
- * Function: H5L_find_class_idx
+ * Function: H5L__find_class_idx
*
- * Purpose: Given a link class ID, return the offset in the global array
+ * Purpose: Given a link class ID, return the offset in the global array
* that holds all the registered link classes.
*
- * Return: Success: Non-negative index of entry in global
+ * Return: Success: Non-negative index of entry in global
* link class table.
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
*/
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)
@@ -1556,18 +1556,18 @@ H5L_find_class_idx(H5L_type_t id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_find_class_idx */
+} /* end H5L__find_class_idx */
/*-------------------------------------------------------------------------
- * Function: H5L_find_class
+ * Function: H5L_find_class
*
- * Purpose: Given a link class ID return a pointer to a global struct that
- * defines the link class.
+ * Purpose: Given a link class ID return a pointer to a global struct that
+ * defines the link class.
*
- * Return: Success: Ptr to entry in global link class table.
- * Failure: NULL
+ * Return: Success: Ptr to entry in global link class table.
+ * Failure: NULL
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1581,7 +1581,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 */
@@ -1592,16 +1592,16 @@ done:
} /* end H5L_find_class */
/*-------------------------------------------------------------------------
- * Function: H5L_register
+ * Function: H5L_register
*
- * Purpose: Registers a class of user-defined links, or changes the
+ * Purpose: Registers a class of user-defined links, or changes the
* behavior of an existing class.
*
* See H5Lregister for full documentation.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1645,15 +1645,15 @@ done:
} /* end H5L_register */
/*-------------------------------------------------------------------------
- * Function: H5L_unregister
+ * Function: H5L_unregister
*
- * Purpose: Unregisters a class of user-defined links.
+ * Purpose: Unregisters a class of user-defined links.
*
* See H5Lunregister for full documentation.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, July 10, 2006
*
*-------------------------------------------------------------------------
@@ -1687,14 +1687,14 @@ done:
} /* end H5L_unregister() */
/*-------------------------------------------------------------------------
- * Function: H5L_link
+ * Function: H5L_link
*
- * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for
- * full documentation.
+ * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for
+ * full documentation.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Tuesday, December 13, 2005
*
*-------------------------------------------------------------------------
@@ -1730,13 +1730,13 @@ done:
} /* end H5L_link() */
/*-------------------------------------------------------------------------
- * Function: H5L_link_object
+ * Function: H5L_link_object
*
- * Purpose: Creates a new object and a link to it.
+ * Purpose: Creates a new object and a link to it.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, April 9, 2007
*
*-------------------------------------------------------------------------
@@ -1771,13 +1771,13 @@ done:
} /* end H5L_link_object() */
/*-------------------------------------------------------------------------
- * Function: H5L__link_cb
+ * Function: H5L__link_cb
*
- * Purpose: Callback for creating a link to an object.
+ * Purpose: Callback for creating a link to an object.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, September 19, 2005
*
*-------------------------------------------------------------------------
@@ -1971,7 +1971,7 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
/* Check for flags present in creation property list */
- if (lcpl_id != H5P_DEFAULT && lcpl_id != H5P_LINK_CREATE_DEFAULT) {
+ if (lcpl_id != H5P_DEFAULT) {
unsigned crt_intmd_group;
/* Get link creation property list */
@@ -2017,20 +2017,20 @@ done:
} /* end H5L__create_real() */
/*-------------------------------------------------------------------------
- * Function: H5L_create_hard
+ * Function: H5L__create_hard
*
- * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 6, 1998
*
*-------------------------------------------------------------------------
*/
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)
+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 */
H5F_t * link_file = NULL; /* Pointer to file to link to */
@@ -2041,7 +2041,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_
hbool_t loc_valid = FALSE;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(cur_loc);
@@ -2086,28 +2086,28 @@ 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.
*
* Return: SUCCEED/FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 6, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
-H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id)
+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);
@@ -2132,17 +2132,17 @@ done:
H5MM_xfree(norm_target);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_create_soft() */
+} /* end H5L__create_soft() */
/*-------------------------------------------------------------------------
- * Function: H5L__create_ud
+ * Function: H5L__create_ud
*
- * Purpose: Creates a user-defined link. See H5Lcreate_ud for
+ * Purpose: Creates a user-defined link. See H5Lcreate_ud for
* full documentation.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Friday, May 19, 2006
*
*-------------------------------------------------------------------------
@@ -2166,7 +2166,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_
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*/
@@ -2192,13 +2192,13 @@ done:
} /* end H5L__create_ud() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_val_real
+ * Function: H5L__get_val_real
*
- * Purpose: Retrieve link value from a link object
+ * Purpose: Retrieve link value from a link object
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 13 2006
*
*-------------------------------------------------------------------------
@@ -2247,13 +2247,13 @@ done:
} /* end H5L__get_val_real() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_val_cb
+ * Function: H5L__get_val_cb
*
- * Purpose: Callback for retrieving link value or udata.
+ * Purpose: Callback for retrieving link value or udata.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, September 20, 2005
*
*-------------------------------------------------------------------------
@@ -2284,31 +2284,31 @@ done:
} /* end H5L__get_val_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_get_val
+ * Function: H5L__get_val
*
- * Purpose: Returns the value of a symbolic link or the udata for a
+ * Purpose: Returns the value of a symbolic link or the udata for a
* user-defined link.
*
- * Return: Success: Non-negative, with at most SIZE bytes of the
- * link value copied into the BUF buffer. If the
- * link value is larger than SIZE characters
- * counting the null terminator then the BUF
- * result will not be null terminated.
+ * Return: Success: Non-negative, with at most SIZE bytes of the
+ * link value copied into the BUF buffer. If the
+ * link value is larger than SIZE characters
+ * counting the null terminator then the BUF
+ * result will not be null terminated.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, April 13, 1998
*
*-------------------------------------------------------------------------
*/
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);
@@ -2324,17 +2324,17 @@ H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t si
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L_get_val() */
+} /* H5L__get_val() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_val_by_idx_cb
+ * Function: H5L__get_val_by_idx_cb
*
- * Purpose: Callback for retrieving a link's value according to an
+ * Purpose: Callback for retrieving a link's value according to an
* index's order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 13 2006
*
*-------------------------------------------------------------------------
@@ -2377,7 +2377,7 @@ done:
} /* end H5L__get_val_by_idx_cb() */
/*-------------------------------------------------------------------------
- * 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
@@ -2390,13 +2390,13 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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);
@@ -2415,17 +2415,17 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5L__delete_cb
+ * Function: H5L__delete_cb
*
- * Purpose: Callback for deleting a link. This routine
+ * Purpose: Callback for deleting a link. This routine
* actually deletes the link
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, September 19, 2005
*
*-------------------------------------------------------------------------
@@ -2467,24 +2467,24 @@ done:
} /* end H5L__delete_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_delete
+ * Function: H5L__delete
*
- * Purpose: Delete a link from a group.
+ * Purpose: Delete a link from a group.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, September 17, 1998
*
*-------------------------------------------------------------------------
*/
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);
@@ -2505,16 +2505,16 @@ done:
H5MM_xfree(norm_name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_delete() */
+} /* end H5L__delete() */
/*-------------------------------------------------------------------------
- * Function: H5L__delete_by_idx_cb
+ * Function: H5L__delete_by_idx_cb
*
- * Purpose: Callback for removing a link according to an index's order.
+ * Purpose: Callback for removing a link according to an index's order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 13 2006
*
*-------------------------------------------------------------------------
@@ -2547,7 +2547,7 @@ done:
} /* end H5L__delete_by_idx_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_delete_by_idx
+ * Function: H5L__delete_by_idx
*
* Purpose: Internal routine to delete a link according to its index
* within a group.
@@ -2560,13 +2560,13 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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);
@@ -2584,18 +2584,18 @@ H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_delete_by_idx() */
+} /* end H5L__delete_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5L__move_dest_cb
+ * Function: H5L__move_dest_cb
*
- * Purpose: Second callback for moving and renaming an object. This routine
+ * Purpose: Second callback for moving and renaming an object. This routine
* inserts a new link into the group returned by the traversal.
* It is called by H5L__move_cb.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, April 3, 2006
*
*-------------------------------------------------------------------------
@@ -2699,15 +2699,15 @@ done:
} /* end H5L__move_dest_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L__move_cb
+ * Function: H5L__move_cb
*
- * Purpose: Callback for moving and renaming an object. This routine
+ * Purpose: Callback for moving and renaming an object. This routine
* replaces the names of open objects with the moved object
* in the path
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Friday, April 3, 2006
*
*-------------------------------------------------------------------------
@@ -2813,9 +2813,9 @@ done:
} /* end H5L__move_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_move
+ * Function: H5L__move
*
- * Purpose: Atomically move or copy a link.
+ * Purpose: Atomically move or copy a link.
*
* Creates a copy of a link in a new destination with a new name.
* SRC_LOC and SRC_NAME together define the link's original
@@ -2825,16 +2825,16 @@ done:
* If copy_flag is FALSE, the original link is removed
* (effectively moving the link).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, May 1, 2006
*
*-------------------------------------------------------------------------
*/
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)
+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;
H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
@@ -2842,7 +2842,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);
@@ -2851,7 +2851,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
HDassert(dst_name && *dst_name);
/* Check for flags present in creation property list */
- if (lcpl_id != H5P_DEFAULT && lcpl_id != H5P_LINK_CREATE_DEFAULT) {
+ if (lcpl_id != H5P_DEFAULT) {
unsigned crt_intmd_group;
if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
@@ -2890,17 +2890,17 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5L__exists_final_cb
+ * Function: H5L__exists_final_cb
*
- * Purpose: Callback for checking whether a link exists, as the final
+ * Purpose: Callback for checking whether a link exists, as the final
* component of a path
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, March 16 2007
*
*-------------------------------------------------------------------------
@@ -2925,14 +2925,14 @@ H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT
} /* end H5L__exists_final_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L__exists_inter_cb
+ * Function: H5L__exists_inter_cb
*
- * Purpose: Callback for checking whether a link exists, as an intermediate
+ * Purpose: Callback for checking whether a link exists, as an intermediate
* component of a path
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, December 31 2015
*
*-------------------------------------------------------------------------
@@ -2984,16 +2984,16 @@ done:
} /* end H5L__exists_inter_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_exists_tolerant
+ * Function: H5L_exists_tolerant
*
- * Purpose: Returns whether a link exists in a group
+ * Purpose: Returns whether a link exists in a group
*
- * Note: Same as H5L_exists, except that missing links are reported
- * as 'FALSE' instead of causing failures
+ * 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
+ * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, December 31 2015
*
*-------------------------------------------------------------------------
@@ -3050,27 +3050,27 @@ done:
} /* H5L_exists_tolerant() */
/*-------------------------------------------------------------------------
- * Function: H5L_exists
+ * Function: H5L__exists
*
- * Purpose: Returns whether a link exists in a group
+ * Purpose: Returns whether a link exists in a group
*
- * Note: Same as H5L_exists_tolerant, except that missing links are reported
- * as failures
+ * Note: Same as H5L_exists_tolerant, except that missing links are reported
+ * as failures
*
- * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
+ * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, March 16 2007
*
*-------------------------------------------------------------------------
*/
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, "/"))
@@ -3086,16 +3086,16 @@ H5L_exists(const H5G_loc_t *loc, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L_exists() */
+} /* H5L__exists() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_info_cb
+ * Function: H5L__get_info_cb
*
- * Purpose: Callback for retrieving a link's metadata
+ * Purpose: Callback for retrieving a link's metadata
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, April 17 2006
*
*-------------------------------------------------------------------------
@@ -3126,13 +3126,13 @@ done:
} /* end H5L__get_info_cb() */
/*-------------------------------------------------------------------------
- * Function: H5L_get_info
+ * Function: H5L_get_info
*
- * Purpose: Returns metadata about a link.
+ * Purpose: Returns metadata about a link.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Monday, April 17 2006
*
*-------------------------------------------------------------------------
@@ -3156,14 +3156,14 @@ done:
} /* H5L_get_info() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_info_by_idx_cb
+ * Function: H5L__get_info_by_idx_cb
*
- * Purpose: Callback for retrieving a link's metadata according to an
+ * Purpose: Callback for retrieving a link's metadata according to an
* index's order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, November 6 2006
*
*-------------------------------------------------------------------------
@@ -3206,7 +3206,7 @@ done:
} /* end H5L__get_info_by_idx_cb() */
/*-------------------------------------------------------------------------
- * 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.
@@ -3216,13 +3216,13 @@ done:
*-------------------------------------------------------------------------
*/
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*/)
+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);
@@ -3241,17 +3241,17 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5L__get_name_by_idx_cb
+ * Function: H5L__get_name_by_idx_cb
*
- * Purpose: Callback for retrieving a link's name according to an
+ * Purpose: Callback for retrieving a link's name according to an
* index's order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 11 2006
*
*-------------------------------------------------------------------------
@@ -3284,7 +3284,7 @@ done:
} /* end H5L__get_name_by_idx_cb() */
/*-------------------------------------------------------------------------
- * 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.
@@ -3294,13 +3294,13 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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);
@@ -3324,19 +3324,18 @@ H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_get_name_by_idx() */
+} /* end H5L__get_name_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5L__link_copy_file
+ * Function: H5L__link_copy_file
*
* Purpose: Copy a link and the object it points to from one file to
* another.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 29 2006
+ * Programmer: Quincey Koziol
+ * Sep 29 2006
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c
index 843469f..3568696 100644
--- a/src/H5Ldeprec.c
+++ b/src/H5Ldeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 3e7ebdc..22d100e 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -117,7 +117,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
size_t fname_len; /* Length of external link file name */
unsigned intent; /* File access permissions */
H5L_elink_cb_t cb_info; /* Callback info struct */
- hid_t fapl_id = -1; /* File access property list for external link's file */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list for external link's file */
void * ext_obj = NULL; /* External link's object */
hid_t ext_obj_id = H5I_INVALID_HID; /* ID for external link's object */
H5I_type_t opened_type; /* ID type of external link's object */
@@ -288,7 +288,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED *link_name, const void *_udata, size
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 5c2d022..54b94a4 100644
--- a/src/H5Lmodule.h
+++ b/src/H5Lmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5L package. Including this header means that the source file
* is part of the H5L package.
*/
-#ifndef _H5Lmodule_H
-#define _H5Lmodule_H
+#ifndef H5Lmodule_H
+#define H5Lmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,12 @@
#define H5_MY_PKG_ERR H5E_LINK
#define H5_MY_PKG_INIT YES
-#endif /* _H5Lmodule_H */
+/**\defgroup H5L H5L
+ * \brief Link Interface
+ * \todo Describe concisely what the functions in this module are about.
+ *
+ * \defgroup TRAV Link Traversal
+ * \ingroup H5L
+ */
+
+#endif /* H5Lmodule_H */
diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h
index 2e1ac61..e37eb10 100644
--- a/src/H5Lpkg.h
+++ b/src/H5Lpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: James Laird <matzke@llnl.gov>
+ * Programmer: James Laird
* Friday, December 1, 2005
*
* Purpose: This file contains declarations which are visible
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5L package!"
#endif
-#ifndef _H5Lpkg_H
-#define _H5Lpkg_H
+#ifndef H5Lpkg_H
+#define H5Lpkg_H
/* Get package's private header */
#include "H5Lprivate.h"
@@ -47,9 +47,26 @@
/* Package Private Prototypes */
/******************************/
-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 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);
+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);
-#endif /* _H5Lpkg_H */
+#endif /* H5Lpkg_H */
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 1302ee4..e339d46 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
* This file contains private information about the H5L module
* for dealing with links in an HDF5 file.
*/
-#ifndef _H5Lprivate_H
-#define _H5Lprivate_H
+#ifndef H5Lprivate_H
+#define H5Lprivate_H
/* Include package's public header */
#include "H5Lpublic.h"
/* Private headers needed by this file */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
/**************************/
/* Library Private Macros */
@@ -36,12 +36,16 @@
#define H5L_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group" /* Create intermediate groups flag */
/* ======== Link access property names ======== */
-#define H5L_ACS_NLINKS_NAME "max soft links" /* Number of soft links to traverse */
-#define H5L_ACS_ELINK_PREFIX_NAME "external link prefix" /* External link prefix */
-#define H5L_ACS_ELINK_FAPL_NAME "external link fapl" /* file access property list for external link access \
- */
-#define H5L_ACS_ELINK_FLAGS_NAME "external link flags" /* file access flags for external link traversal */
-#define H5L_ACS_ELINK_CB_NAME "external link callback" /* callback function for external link traversal */
+/* Number of soft links to traverse */
+#define H5L_ACS_NLINKS_NAME "max soft links"
+/* External link prefix */
+#define H5L_ACS_ELINK_PREFIX_NAME "external link prefix"
+/* file access property list for external link access */
+#define H5L_ACS_ELINK_FAPL_NAME "external link fapl"
+/* file access flags for external link traversal */
+#define H5L_ACS_ELINK_FLAGS_NAME "external link flags"
+/* callback function for external link traversal */
+#define H5L_ACS_ELINK_CB_NAME "external link callback"
/****************************/
/* Library Private Typedefs */
@@ -106,36 +110,19 @@ typedef struct H5L_elink_cb_t {
/******************************/
/* General operations on links */
-H5_DLL herr_t H5L_init(void);
-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, H5L_iterate2_t op, void *op_data);
+H5_DLL herr_t H5L_init(void);
+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 htri_t H5L_exists_tolerant(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_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, H5L_iterate2_t op, void *op_data);
/* User-defined link functions */
H5_DLL herr_t H5L_register(const H5L_class_t *cls);
H5_DLL herr_t H5L_unregister(H5L_type_t id);
H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
-#endif /* _H5Lprivate_H */
+#endif /* H5Lprivate_H */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 1833bc9..bf1de86 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,27 +21,34 @@
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Lpublic_H
-#define _H5Lpublic_H
+#ifndef H5Lpublic_H
+#define H5Lpublic_H
/* Public headers needed by this file */
-#include "H5public.h" /* Generic Functions */
-#include "H5Ipublic.h" /* IDs */
-#include "H5Opublic.h" /* Object Headers */
-#include "H5Tpublic.h" /* Datatypes */
+#include "H5public.h" /* Generic Functions */
+#include "H5Ipublic.h" /* IDs */
+#include "H5Opublic.h" /* Object Headers */
+#include "H5Tpublic.h" /* Datatypes */
/*****************/
/* Public Macros */
/*****************/
-/* Maximum length of a link's name */
-/* (encoded in a 32-bit unsigned integer) */
+/**
+ * \brief Maximum length of a link's name
+ *
+ * The maximum length of a link's name is encoded in a 32-bit unsigned integer.
+ */
#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
-/* Macro to indicate operation occurs on same location */
+/**
+ * \brief Macro to indicate operation occurs on same location
+ */
#define H5L_SAME_LOC (hid_t)0
-/* Current version of the H5L_class_t struct */
+/**
+ * \brief Current version of the H5L_class_t struct
+ */
#define H5L_LINK_CLASS_T_VERS 1
#ifdef __cplusplus
@@ -52,87 +59,123 @@ extern "C" {
/* Public Typedefs */
/*******************/
-/* Link class types.
- * Values less than 64 are reserved for the HDF5 library's internal use.
- * 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 .
- * These values can never change because they appear in HDF5 files.
+/**
+ * \brief Link class types.
+ *
+ * Values less than 64 are reserved for the HDF5 library's internal use. 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
+ * mailto:help@hdfgroup.org. These values can never change because they appear
+ * in HDF5 files.
*/
typedef enum {
- H5L_TYPE_ERROR = (-1), /* Invalid link type id */
- H5L_TYPE_HARD = 0, /* Hard link id */
- H5L_TYPE_SOFT = 1, /* Soft link id */
- H5L_TYPE_EXTERNAL = 64, /* External link id */
- H5L_TYPE_MAX = 255 /* Maximum link type id */
+ H5L_TYPE_ERROR = (-1), /**< Invalid link type id */
+ H5L_TYPE_HARD = 0, /**< Hard link id */
+ H5L_TYPE_SOFT = 1, /**< Soft link id */
+ H5L_TYPE_EXTERNAL = 64, /**< External link id */
+ H5L_TYPE_MAX = 255 /**< Maximum link type id */
} H5L_type_t;
-#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */
-#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. \
- */
+/**
+ * \brief Maximum value link value for "built-in" link types
+ */
+#define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT
+/**
+ * \brief Link ids at or above this value are "user-defined" link types.
+ */
+#define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL
+/**
+ * \brief Maximum link id value for "user-defined" link types.
+ */
+#define H5L_TYPE_UD_MAX H5L_TYPE_MAX
-/* Information struct for link (for H5Lget_info2/H5Lget_info_by_idx2)
- * H5O_token_t version used in VOL layer and future public API calls
+/**
+ * \brief Information struct for links
*/
+//! <!-- [H5L_info2_t_snip] -->
typedef struct {
- H5L_type_t type; /* Type of link */
- hbool_t corder_valid; /* Indicate if creation order is valid */
- int64_t corder; /* Creation order */
- H5T_cset_t cset; /* Character set of link name */
+ H5L_type_t type; /**< Type of link */
+ hbool_t corder_valid; /**< Indicate if creation order is valid */
+ int64_t corder; /**< Creation order */
+ H5T_cset_t cset; /**< Character set of link name */
union {
- H5O_token_t token; /* Token of location that hard link points to */
- size_t val_size; /* Size of a soft link or UD link value */
+ H5O_token_t token; /**< Token of location that hard link points to */
+ size_t val_size; /**< Size of a soft link or user-defined link value */
} u;
} H5L_info2_t;
+//! <!-- [H5L_info2_t_snip] -->
/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
* functions defined below.
*/
/* Callback prototypes for user-defined links */
-/* Link creation callback */
+/**
+ * \brief Link creation callback
+ */
typedef herr_t (*H5L_create_func_t)(const char *link_name, hid_t loc_group, const void *lnkdata,
size_t lnkdata_size, hid_t lcpl_id);
-
-/* Callback for when the link is moved */
+/**
+ * \brief Callback for link move
+ */
typedef herr_t (*H5L_move_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
size_t lnkdata_size);
-
-/* Callback for when the link is copied */
+/**
+ * \brief Callback for link copy
+ */
typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
size_t lnkdata_size);
-
-/* Callback during link traversal */
+/**
+ * \brief Callback during link traversal
+ */
typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id);
-
-/* Callback for when the link is deleted */
+/**
+ * \brief Callback for link deletion
+ */
typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, const void *lnkdata,
size_t lnkdata_size);
-
-/* Callback for querying the link */
-/* Returns the size of the buffer needed */
+/**
+ * \brief Callback for querying the link.
+ *
+ * Returns the size of the buffer needed.
+ */
typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size,
void *buf /*out*/, size_t buf_size);
+/**
+ * \brief Link prototype
+ *
+ * The H5L_class_t struct can be used to override the behavior of a
+ * "user-defined" link class. Users should populate the struct with callback
+ * functions defined elsewhere.
+ */
+//! <!-- [H5L_class_t_snip] -->
typedef struct {
- int version; /* Version number of this struct */
- H5L_type_t id; /* Link type ID */
- const char * comment; /* Comment for debugging */
- H5L_create_func_t create_func; /* Callback during link creation */
- H5L_move_func_t move_func; /* Callback after moving link */
- H5L_copy_func_t copy_func; /* Callback after copying link */
- H5L_traverse_func_t trav_func; /* Callback during link traversal */
- H5L_delete_func_t del_func; /* Callback for link deletion */
- H5L_query_func_t query_func; /* Callback for queries */
+ int version; /**< Version number of this struct */
+ H5L_type_t id; /**< Link type ID */
+ const char * comment; /**< Comment for debugging */
+ H5L_create_func_t create_func; /**< Callback during link creation */
+ H5L_move_func_t move_func; /**< Callback after moving link */
+ H5L_copy_func_t copy_func; /**< Callback after copying link */
+ H5L_traverse_func_t trav_func; /**< Callback during link traversal */
+ H5L_delete_func_t del_func; /**< Callback for link deletion */
+ H5L_query_func_t query_func; /**< Callback for queries */
} H5L_class_t;
+//! <!-- [H5L_class_t_snip] -->
-/* Prototype for H5Literate2/H5Literate_by_name2() operator
- * H5O_token_t version used in VOL layer and future public API calls
+/**
+ * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator
+ *
+ * The H5O_token_t version is used in the VOL layer and future public API calls.
*/
+//! <!-- [H5L_iterate2_t_snip] -->
typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
+//! <!-- [H5L_iterate2_t_snip] -->
-/* Callback for external link traversal */
+/**
+ * \brief Callback for external link traversal
+ */
typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char *parent_group_name,
const char *child_file_name, const char *child_object_name,
unsigned *acc_flags, hid_t fapl_id, void *op_data);
@@ -144,49 +187,1387 @@ typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char
/*********************/
/* Public Prototypes */
/*********************/
+/**
+ * \ingroup H5L
+ *
+ * \brief Moves a link within an HDF5 file
+ *
+ * \fgdta_loc_id{src_loc}
+ * \param[in] src_name Original link name
+ * \fgdta_loc_id{dst_loc}
+ * \param[in] dst_name New link name
+ * \lcpl_id
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lmove() moves a link within an HDF5 file. The original link,
+ * \p src_name, is removed from \p src_loc and the new link,
+ * \p dst_name, is inserted at dst_loc. This change is
+ * accomplished as an atomic operation.
+ *
+ * \p src_loc and \p src_name identify the original link.
+ * \p src_loc is the original location identifier; \p src_name is
+ * the path to the link and is interpreted relative to \p src_loc.
+ *
+ * \p dst_loc and \p dst_name identify the new link. \p dst_loc is
+ * either a file or group identifier; \p dst_name is the path to
+ * the link and is interpreted relative to \p dst_loc.
+ *
+ * \p lcpl_id and \p lapl_id are the link creation and link access
+ * property lists, respectively, associated with the new link,
+ * \p dst_name.
+ *
+ * Through these property lists, several properties are available to
+ * govern the behavior of H5Lmove(). The property controlling creation
+ * of missing intermediate groups is set in the link creation property
+ * list with H5Pset_create_intermediate_group(); H5Lmove() ignores any
+ * other properties in the link creation property list. Properties
+ * controlling character encoding, link traversals, and external link
+ * prefixes are set in the link access property list with
+ * H5Pset_char_encoding(), H5Pset_nlinks(), and H5Pset_elink_prefix(),
+ * respectively.
+ *
+ * \note Note that H5Lmove() does not modify the value of the link; the new
+ * link points to the same object as the original link pointed to.
+ * Furthermore, if the object pointed to by the original link was already
+ * open with a valid object identifier, that identifier will remain valid
+ * after the call to H5Lmove().
+ *
+ * \attention Exercise care in moving links as it is possible to render data in
+ * a file inaccessible with H5Lmove(). If the link being moved is on
+ * the only path leading to an HDF5 object, that object may become
+ * permanently inaccessible in the file.
+ *
+ * \since 1.8.0
+ *
+ *-------------------------------------------------------------------------
+ */
H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc, const char *dst_name, hid_t lcpl_id,
hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Creates an identical copy of a link with the same creation time and
+ * target. The new link can have a different name and be in a different
+ * location than the original.
+ *
+ * \fgdt_loc_id{src_loc}
+ * \param[in] src_name Name of the link to be copied
+ * \fgdt_loc_id{dst_loc}
+ * \param[in] dst_name Name to be assigned to the new copy
+ * \lcpl_id
+ * \lapl_id
+ * \return \herr_t
+ *
+ * \details H5Lcopy() copies the link specified by \p src_name from the location
+ * specified by \p src_loc_id to the location specified by
+ * \p dst_loc_id. The new copy of the link is created with the name
+ * \p dst_name.
+ *
+ * If \p dst_loc_id is a file identifier, \p dst_name will be
+ * interpreted relative to that file’s root group.
+ *
+ * The new link is created with the creation and access property lists
+ * specified by \p lcpl_id and \p lapl_id. The interpretation of
+ * \p lcpl_id is limited in the manner described in the next paragraph.
+ *
+ * H5Lcopy() retains the creation time and the target of the original
+ * link. However, since the link may be renamed, the character
+ * encoding is that specified in \p lcpl_id rather than that of the
+ * original link. Other link creation properties are ignored.
+ *
+ * If the link is a soft link, also known as a symbolic link, its
+ * target is interpreted relative to the location of the copy.
+ *
+ * Several properties are available to govern the behavior of
+ * H5Lcopy(). These properties are set in the link creation and access
+ * property lists, \p lcpl_id and \p lapl_id, respectively. The
+ * property controlling creation of missing intermediate groups is set
+ * in the link creation property list with
+ * H5Pset_create_intermediate_group(); this function ignores any
+ * other properties in the link creation property list. Properties
+ * controlling character encoding, link traversals, and external link
+ * prefixes are set in the link access property list with
+ * H5Pset_char_encoding(), H5Pset_nlinks(), and
+ * H5Pset_elink_prefix().
+ *
+ * \note H5Lcopy() does not affect the object that the link points to.
+ *
+ * \attention H5Lcopy() cannot copy hard links across files as a hard link is
+ * not valid without a target object; to copy objects from one file
+ * to another, see H5Ocopy().
+ *
+ * \see H5Ocopy()
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const char *dst_name, hid_t lcpl_id,
hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Creates a hard link to an object
+ *
+ * \fgdta_loc_id{cur_loc}
+ * \param[in] cur_name Name of the target object, which must already exist
+ * \fgdta_loc_id{dst_loc}
+ * \param[in] dst_name The name of the new link
+ * \lcpl_id
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lcreate_hard() creates a new hard link to a pre-existing object
+ * in an HDF5 file.
+ *
+ * \p cur_loc and \p cur_name specify the location
+ * and name, respectively, of the target object, i.e., the object that
+ * the new hard link points to. \p dst_loc and \p dst_name specify the
+ * location and name, respectively, of the new hard link.
+ *
+ * \p cur_name and \p dst_name are interpreted relative to \p cur_loc
+ * and \p dst_loc, respectively. If \p cur_loc and \p dst_loc are the
+ * same location, the HDF5 macro #H5L_SAME_LOC can be used for either
+ * parameter (but not both).
+ *
+ * \p lcpl_id and \p lapl_id are the link creation and access property
+ * lists associated with the new link.
+ *
+ * \note Hard and soft links are for use only if the target object is in the
+ * current file. If the desired target object is in a different file from
+ * the new link, an external link may be created with
+ * H5Lcreate_external().
+ *
+ * \note The HDF5 library keeps a count of all hard links pointing to an
+ * object; if the hard link count reaches zero (0), the object will be
+ * deleted from the file. Creating new hard links to an object will
+ * prevent it from being deleted if other links are removed. The
+ * library maintains no similar count for soft links and they can dangle.
+ *
+ * \note The new link may be one of many that point to that object.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, const char *dst_name,
hid_t lcpl_id, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Creates a soft link
+ *
+ * \param[in] link_target An HDF5 path name
+ * \fgdta_loc_id{link_loc_id}
+ * \param[in] link_name The name of the new link
+ * \lcpl_id
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lcreate_soft() creates a new soft link to an object in an HDF5
+ * file.
+ *
+ * \p link_target specifies the HDF5 path name the soft link contains.
+ * \p link_target can be an arbitrary HDF5 path name and is
+ * interpreted only at lookup time. This path may be absolute in the
+ * file or relative to \p link_loc_id.
+ *
+ * \p link_loc_id and \p link_name specify the location and name,
+ * respectively, of the new soft link. \p link_name is interpreted
+ * relative to \p link_loc_id and must contain only the name of the soft
+ * link; \p link_name may not contain any additional path elements.
+ *
+ * If \p link_loc_id is a group identifier, the object pointed to by
+ * \p link_name will be accessed as a member of that group. If
+ * \p link_loc_id is a file identifier, the object will be accessed as a
+ * member of the file's root group.
+ *
+ * \p lcpl_id and \p lapl_id are the link creation and access property
+ * lists associated with the new link.
+ *
+ * For instance, if target_path is \c ./foo, \p link_loc_id specifies
+ * \c ./x/y/bar, and the name of the new link is \c new_link, then a
+ * subsequent request for \c ./x/y/bar/new_link will return same the
+ * object as would be found at \c ./foo.
+ *
+ * \note H5Lcreate_soft() is for use only if the target object is in the
+ * current file. If the desired target object is in a different file from
+ * the new link, use H5Lcreate_external() to create an external link.
+ *
+ * \note Soft links and external links are also known as symbolic links as they
+ * use a name to point to an object; hard links employ an object’s
+ * address in the file.
+ *
+ * \note Unlike hard links, a soft link in an HDF5 file is allowed to dangle,
+ * meaning that the target object need not exist at the time that the
+ * link is created.
+ *
+ * \note The HDF5 library does not keep a count of soft links as it does of
+ * hard links.
+ *
+ * \note The new link may be one of many that point to that object.
+ *
+ * \see H5Lcreate_hard(), H5Lcreate_external()
+ *
+ * \since 1.8.0
+ *
+
+ */
H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id,
hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Removes a link from a group
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the link to delete
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Ldelete() removes the link specified by \p name from the location
+ * \p loc_id.
+ *
+ * If the link being removed is a hard link, H5Ldelete() also
+ * decrements the link count for the object to which name points.
+ * Unless there is a duplicate hard link in that group, this action
+ * removes the object to which name points from the group that
+ * previously contained it.
+ *
+ * Object headers keep track of how many hard links refer to an
+ * object; when the hard link count, also referred to as the reference
+ * count, reaches zero, the object can be removed from the file. The
+ * file space associated will then be released, i.e., identified in
+ * memory as freespace. Objects which are open are not removed until
+ * all identifiers to the object are closed.
+ *
+ * \attention Exercise caution in the use of H5Ldelete(); if the link being
+ * removed is on the only path leading to an HDF5 object, that
+ * object may become permanently inaccessible in the file.
+ *
+ * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_external()
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Removes the \Emph{n}-th link in a group
+ *
+ * \fgdta_loc_id
+ * \param[in] group_name Name of subject group
+ * \param[in] idx_type Index or field which determines the order
+ * \param[in] order Order within field or index
+ * \param[in] n Link for which to retrieve information
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group
+ * according to the specified order, \p order, in the specified index,
+ * \p index.
+ *
+ * If \p loc_id specifies the group in which the link resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * \see H5Ldelete()
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Returns the value of a link
+ *
+ * \fgdta_loc_id
+ * \param[in] name Link name
+ * \param[out] buf The buffer to hold the link value
+ * \param[in] size Maximum number of bytes of link value to be returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lget_val() returns tha value of link \p name. For smbolic links,
+ * this is the path to which the link points, including the null
+ * terminator. For external and user-defined links, it is the link
+ * buffer.
+ *
+ * \p size is the size of \p buf and should be the size of the link
+ * value being returned. This size value can be determined through a
+ * call to H5Lget_info(); it is returned in the \c val_size field of
+ * the \ref H5L_info_t \c struct.
+ *
+ * If \p size is smaller than the size of the returned value, then the
+ * string stored in \p buf will be truncated to \p size bytes. For
+ * soft links, this means that the value will not be null terminated.
+ *
+ * In the case of external links, the target file and object names are
+ * extracted from \p buf by calling H5Lunpack_elink_val().
+ *
+ * The link class of link \p name can be determined with a call to
+ * H5Lget_info().
+ *
+ * \p lapl_id specifies the link access property list associated with
+ * the link \p name. In the general case, when default link access
+ * properties are acceptable, this can be passed in as #H5P_DEFAULT. An
+ * example of a situation that requires a non-default link access
+ * property list is when the link is an external link; an external
+ * link may require that a link prefix be set in a link access
+ * property list (see H5Pset_elink_prefix()).
+ *
+ * This function should be used only after H5Lget_info() has been
+ * called to verify that \p name is a symbolic link. This can be
+ * deteremined from the \c link_type field of the \ref H5L_info_t
+ * \c struct.
+ *
+ * \note This function will fail if called on a hard link.
+ *
+ * \see H5Lget_val_by_idx()
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Retrieves value of the \Emph{n}-th link in a group, according to the order within an index
+ *
+ * \fgdta_loc_id
+ * \param[in] group_name Group name
+ * \param[in] idx_type Type of index
+ * \param[in] order Order within field or index
+ * \param[in] n Link position for which to retrieve information
+ * \param[out] buf The buffer to hold the link value
+ * \param[in] size Maximum number of bytes of link value to be returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in
+ * a group, according to the specified order, \p order, within an
+ * index, \p index.
+ *
+ * For soft links, the value is an HDF5 path name.
+ *
+ * For external links, this is a compound value containing file and
+ * path name information; to use this external link information, it
+ * must first be decoded with H5Lunpack_elink_val()
+ *
+ * For user-defined links, this value will be described in the
+ * definition of the user-defined link type.
+ *
+ * \p loc_id specifies the location identifier of the group specified
+ * by \p group_name.
+ *
+ * \p group_name specifies the group in which the link exists. If
+ * \p loc_id already specifies the group in which the link exists,
+ * \p group_name must be a dot (\c .).
+ *
+ * The size in bytes of link_val is specified in \p size. The size
+ * value can be determined through a call to H5Lget_info_by_idx(); it
+ * is returned in the \c val_size field of the \ref H5L_info_t
+ * \c struct. If
+ * size is smaller than the size of the returned value, then the
+ * string stored in link_val will be truncated to size bytes. For soft
+ * links, this means that the value will not be null terminated.
+ *
+ * If the type of the link is unknown or uncertain, H5Lget_val_by_idx()
+ * should be called only after the type has been determined via a call
+ * to H5Lget_info_by_idx().
+ *
+ * \note This function will fail if called on a hard link.
+ *
+ * \see H5Lget_val()
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size,
hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Determines whether a link with the specified name exists in a group
+ *
+ * \fgdta_loc_id
+ * \param[in] name Link name
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lexists() allows an application to determine whether the link \p
+ * name exists in the location specified by \p loc_id. The link may be
+ * of any type; only the presence of a link with that name is checked.
+ *
+ * Note that H5Lexists() verifies only that the target link exists. If
+ * name includes either a relative path or an absolute path to the
+ * target link, intermediate steps along the path must be verified
+ * before the existence of the target link can be safely checked. If
+ * the path is not verified and an intermediate element of the path
+ * does not exist, H5Lexists() will fail. The example in the next
+ * paragraph illustrates one step-by-step method for verifying the
+ * existence of a link with a relative or absolute path.
+ *
+ * \Bold{Example:} Use the following steps to verify the existence of
+ * the link \c datasetD in the \c group group1/group2/softlink_to_group3/,
+ * where \c group1 is a member of the group specified by \c loc_id:
+ *
+ * 1. First use H5Lexists() to verify that \c group1 exists.
+ * 2. If \c group1 exists, use H5Lexists() again, this time with name
+ * set to \c group1/group2, to verify that \c group2 exists.
+ * 3. If \c group2 exists, use H5Lexists() with name set to
+ * \c group1/group2/softlink_to_group3 to verify that
+ * \c softlink_to_group3 exists.
+ * 4. If \c softlink_to_group3 exists, you can now safely use
+ * H5Lexists() with \c name set to
+ * \c group1/group2/softlink_to_group3/datasetD to verify that the
+ * target link, \c datasetD, exists.
+ *
+ * If the link to be verified is specified with an absolute path, the
+ * same approach should be used, but starting with the first link in
+ * the file’s root group. For instance, if \c datasetD were in
+ * \c /group1/group2/softlink_to_group3, the first call to H5Lexists()
+ * would have name set to \c /group1.
+ *
+ * Note that this is an outline and does not include all necessary
+ * details. Depending on circumstances, for example, you may need to
+ * verify that an intermediate link points to a group and that a soft
+ * link points to an existing target.
+ *
+ * \note The behavior of H5Lexists() was changed in the 1.10 release in the
+ * case where the root group, \c "/", is the name of the link. This
+ * change is described below:
+ * <ol>
+ * <li>Let \c file denote a valid HDF5 file identifier, and let \c lapl
+ * denote a valid link access property list identifier. A call to
+ * H5Lexists() with arguments \c file, \c "/", and \c lapl
+ * returns a positive value; in other words,
+ * \Code{H5Lexists(file, "/", lapl)} returns a positive value.
+ * In HDF5 version 1.8.16, this function returns 0.</li>
+ * <li>Let \c root denote a valid HDF5 group identifier that refers to the
+ * root group of an HDF5 file, and let \c lapl denote a valid link
+ * access property list identifier. A call to H5Lexists() with
+ * arguments c root, \c "/", and \c lapl returns a positive value;
+ * in other words, \Code{H5Lexists(root, "/", lapl)} returns a postive
+ * value. In HDF5 version 1.8.16, this function returns 0.</li>
+ * </ol>
+ * Note that the function accepts link names and path names. This is
+ * potentially misleading to callers, and we plan to separate the
+ * functionality for link names and path names in a future release.
+ *
+ * \attention H5Lexists() checks the existence of only the final element in a
+ * relative or absolute path; it does not check any other path
+ * elements. The function will therefore fail when both of the
+ * following conditions exist:
+ * - \c name is not local to the group specified by \c loc_id or,
+ * if \c loc_id is something other than a group identifier, \c name
+ * is not local to the root group.
+ * - Any element of the relative path or absolute path in name,
+ * except the target link, does not exist.
+ *
+ * \version 1.10.0 Function behavior changed in this release. (See the note.)
+ * \since 1.8.0
+ *
+ */
H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Returns information about a link
+ *
+ * \fgdta_loc_id
+ * \param[in] name Link name
+ * \param[out] linfo Buffer in which link information is returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lget_info2() returns information about the specified link through
+ * the \p linfo argument.
+ *
+ * The location identifier, \p loc_id, specifies the location of the
+ * link. A link name, \p name, interpreted relative to \p loc_id,
+ * specifies the link being queried.
+ *
+ * \p lapl_id is the link access property list associated with the
+ * link name. In the general case, when default link access properties
+ * are acceptable, this can be passed in as #H5P_DEFAULT. An example
+ * of a situation that requires a non-default link access property
+ * list is when the link is an external link; an external link may
+ * require that a link prefix be set in a link access property list
+ * (see H5Pset_elink_prefix()).
+ *
+ * H5Lget_info2() returns information about name in the data structure
+ * H5L_info2_t, which is described below and defined in H5Lpublic.h.
+ * This structure is returned in the buffer \p linfo.
+ * \snippet this H5L_info2_t_snip
+ * In the above struct, \c type specifies the link class. Valid values
+ * include the following:
+ * \link_types
+ * There will be additional valid values if user-defined links have
+ * been registered.
+ *
+ * \p corder specifies the link’s creation order position while
+ * \p corder_valid indicates whether the value in corder is valid.
+ *
+ * If \p corder_valid is \c TRUE, the value in \p corder is known to
+ * be valid; if \p corder_valid is \c FALSE, the value in \p corder is
+ * presumed to be invalid; \p corder starts at zero (0) and is
+ * incremented by one (1) as new links are created. But
+ * higher-numbered entries are not adjusted when a lower-numbered link
+ * is deleted; the deleted link's creation order position is simply
+ * left vacant. In such situations, the value of \p corder for the
+ * last link created will be larger than the number of links remaining
+ * in the group.
+ *
+ * \p cset specifies the character set in which the link name is
+ * encoded. Valid values include the following:
+ * \csets
+ * This value is set with H5Pset_char_encoding().
+ *
+ * \c token is the location that a hard link points to, and
+ * \c val_size is the size of a soft link or user defined link value.
+ * H5O_token_t is used in the VOL layer. It is defined in H5public.h
+ * as:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * If the link is a symbolic link, \c val_size will be the length of
+ * the link value, e.g., the length of the HDF5 path name with a null
+ * terminator.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Retrieves metadata for a link in a group, according to the order
+ * within a field or index
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \param[in] n Link position for which to retrieve information
+ * \param[out] linfo Buffer in which link information is returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5get_info_by_idx2() returns the metadata for a link in a group
+ * according to a specified field or index and a specified order. The
+ * link for which information is to be returned is specified by \p
+ * idx_type, \p order, and \p n as follows:
+ *
+ * - \p idx_type specifies the field by which the links in \p
+ * group_name are ordered. The links may be indexed on this field,
+ * in which case operations seeking specific links are likely to
+ * complete more quickly.
+ * - \p order specifies the order in which
+ * the links are to be referenced for the purposes of this function.
+ * - \p n specifies the position of the subject link. Note that this
+ * count is zero-based; 0 (zero) indicates that the function will
+ * return the value of the first link; if \p n is 5, the function
+ * will return the value of the sixth link; etc.
+ *
+ * For example, assume that \p idx_type, \p order, and \p n are
+ * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME
+ * indicates that the links are accessed in lexicographic order by
+ * their names. #H5_ITER_DEC specifies that the list be traversed in
+ * reverse order, or in decremented order. And 5 specifies that this
+ * call to the function will return the metadata for the 6th link
+ * (\c n + 1) from the end.
+ *
+ * See H5Literate2() for a list of valid values and further discussion
+ * regarding \p idx_type and \p order.
+ *
+ * If \p loc_id specifies the group in which the link resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * \since 1.12.0
+ *
+ * \see H5Lget_info2()
+ *
+ */
H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/,
- hid_t lapl_id);
+ H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Retrieves name of the \Emph{n}-th link in a group, according to the
+ * order within a specified field or index
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \param[in] n Link position for which to retrieve information
+ * \param[out] name Buffer in which link name is returned
+ * \param[in] size Size in bytes of \p name
+ * \lapl_id
+ *
+ * \return Returns the size of the link name if successful; otherwise returns a
+ * negative value.
+ *
+ * \details H5get_name_by_idx() retrieves the name of the \Emph{n}-th link in a
+ * group, according to the specified order, \p order, within a specified
+ * field or index, \p idx_type.
+ *
+ * \p idx_type specifies the index that is used. Valid values include
+ * the following:
+ * \indexes
+ *
+ * \p order specifies the order in which objects are inspected along
+ * the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * If \p loc_id specifies the group in which the link resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * The size in bytes of name is specified in \p size. If \p size is
+ * unknown, it can be determined via an initial H5Lget_name_by_idx()
+ * call with name set to NULL; the function's return value will be the
+ * size of the name.
+ *
+ * \note Please note that in order for the specified index to correspond to the
+ * creation order index, \p order must be set to #H5_ITER_INC or
+ * #H5_ITER_DEC when calling H5Lget_name_by_idx(). \note The index \p n
+ * passed to H5Lget_name_by_idx() is the index of the link within the
+ * link table, sorted according to \p order and \p idx_type. If order is
+ * #H5_ITER_NATIVE, then the link table is not sorted, and it does not
+ * matter what \p idx_type is. Specifying #H5_ITER_NATIVE does not
+ * guarantee any particular order, only that it remains consistent.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
hid_t lapl_id);
-H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
- H5L_iterate2_t op, void *op_data);
-H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data,
- hid_t lapl_id);
-H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op,
- void *op_data);
-H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id);
-
+/**
+ * \ingroup TRAV
+ *
+ * \brief Iterates over links in a group, with user callback routine,
+ * according to the order within an index.
+ *
+ * \group_id{grp_id}
+ * \idx_type
+ * \order
+ * \param[in,out] idx Pointer to an iteration index to allow
+ * continuing a previous iteration
+ * \op
+ * \op_data
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \details H5Literate2() iterates through the links in a file or
+ * group, \p group_id, in the order of the specified
+ * index, \p idx_type, using a user-defined callback routine
+ * \p op. H5Literate2() does not recursively follow links into
+ * subgroups of the specified group.
+ *
+ * Three parameters are used to manage progress of the iteration:
+ * \p idx_type, \p order, and \p idx_p.
+ *
+ * \p idx_type specifies the index to be used. If the links have
+ * not been indexed by the index type, they will first be sorted by
+ * that index then the iteration will begin; if the links have been
+ * so indexed, the sorting step will be unnecessary, so the iteration
+ * may begin more quickly.
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index \p idx_type.
+ *
+ * \p idx_p tracks the iteration and allows an iteration to be
+ * resumed if it was stopped before all members were processed. It is
+ * passed in by the application with a starting point and returned by
+ * the library with the point at which the iteration stopped.
+ *
+ * \p op_data is a user-defined pointer to the data required to
+ * process links in the course of the iteration. This pointer is
+ * passed back to each step of the iteration in the \p op callback
+ * function's \p op_data parameter. \p op is invoked for each link
+ * encounter.
+ *
+ * \p op_data is passed to and from each iteration and can be used to
+ * supply or aggregate information across iterations.
+ *
+ * \remark Same pattern of behavior as H5Giterate().
+ *
+ * \note This function is also available through the H5Literate() macro.
+ *
+ * \warning The behavior of H5Literate2() is undefined if the link
+ * membership of \p group_id changes during the iteration.
+ * This does not limit the ability to change link destinations
+ * while iterating, but caution is advised.
+ *
+ *
+ * \since 1.12.0
+ *
+ * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()
+ *
+ */
+H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5L_iterate2_t op, void *op_data);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Iterates through links in a group
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \param[in,out] idx iteration position at which to start (\Emph{IN}) or
+ * position at which an interrupted iteration may be restarted
+ * (\Emph{OUT})
+ * \op
+ * \op_data
+ * \lapl_id
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \details H5Literate_by_name2() iterates through the links in a group
+ * specified by \p loc_id and \p group_name, in the order of the
+ * specified index, \p idx_type, using a user-defined callback routine
+ * \p op. H5Literate_by_name2() does not recursively follow links into
+ * subgroups of the specified group.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecessary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * \p idx_p allows an interrupted iteration to be resumed; it is
+ * passed in by the application with a starting point and returned by
+ * the library with the point at which the iteration stopped.
+ *
+ * \note H5Literate_by_name2() is not recursive. In particular, if a member of
+ * \p group_name is found to be a group, call it \c subgroup_a,
+ * H5Literate_by_name2() does not examine the members of \c subgroup_a.
+ * When recursive iteration is required, the application must handle the
+ * recursion, explicitly calling H5Literate_by_name2() on discovered
+ * subgroups.
+ *
+ * \note H5Literate_by_name2() assumes that the membership of the group being
+ * iterated over remains unchanged through the iteration; if any of the
+ * links in the group change during the iteration, the function’s
+ * behavior is undefined. Note, however, that objects pointed to by the
+ * links can be modified.
+ *
+ * \note H5Literate_by_name2() is the same as H5Literate2(), except that
+ * H5Literate2() always proceeds in alphanumeric order.
+ *
+ * \since 1.12.0
+ *
+ * \see H5Literate(), H5Lvisit()
+ *
+ */
+H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data,
+ hid_t lapl_id);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Recursively visits all links starting from a specified group
+ *
+ * \group_id{grp_id}
+ * \idx_type
+ * \order
+ * \op
+ * \op_data
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \details H5Lvisit2() is a recursive iteration function to visit all links in
+ * and below a group in an HDF5 file, thus providing a mechanism for
+ * an application to perform a common set of operations across all of
+ * those links or a dynamically selected subset. For non-recursive
+ * iteration across the members of a group, see H5Literate2().
+ *
+ * The group serving as the root of the iteration is specified by its
+ * group or file identifier, \p group_id.
+ *
+ * Two parameters are used to establish the iteration: \p idx_type and
+ * \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecessary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a best effort
+ * setting. If the application passes in a value indicating iteration
+ * in creation order and a group is encountered that was not tracked
+ * in creation order, that group will be iterated over in
+ * lexicographic order by name, or name order. (Name order is the
+ * native order used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * \p op is a callback function of type \ref H5L_iterate2_t that is invoked
+ * for each link encountered.
+ * \snippet this H5L_iterate2_t_snip
+ *
+ * The \ref H5L_info2_t struct is defined (in H5Lpublic.h) as follows:
+ * \snippet this H5L_info2_t_snip
+ *
+ * The possible return values from the callback function, and the
+ * effect of each, are as follows:
+ * \li Zero causes the visit iterator to continue, returning zero when
+ * all group members have been processed.
+ * \li A positive value causes the visit iterator to immediately
+ * return that positive value, indicating short-circuit success.
+ * \li A negative value causes the visit iterator to immediately
+ * return that value, indicating failure.
+ *
+ * The H5Lvisit2() \p op_data parameter is a user-defined pointer to
+ * the data required to process links in the course of the iteration.
+ * This pointer is passed back to each step of the iteration in the
+ * \p op callback function's \p op_data parameter.
+ *
+ * H5Lvisit2() and H5Ovisit2() are companion functions: one for
+ * examining and operating on links; the other for examining and
+ * operating on the objects that those links point to. Both functions
+ * ensure that by the time the function completes successfully, every
+ * link or object below the specified point in the file has been
+ * presented to the application for whatever processing the
+ * application requires.
+ *
+ * \since 1.12.0
+ *
+ * \see H5Literate()
+ *
+ */
+H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op,
+ void *op_data);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Recursively visits all links starting from a specified group
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \op
+ * \op_data
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lvisit_by_name2() is a recursive iteration function to visit all
+ * links in and below a group in an HDF5 file, thus providing a
+ * mechanism for an application to perform a common set of operations
+ * across all of those links or a dynamically selected subset. For
+ * non-recursive iteration across the members of a group, see
+ * H5Literate2().
+ *
+ * The group serving as the root of the iteration is specified by the
+ * \p loc_id / \p group_name parameter pair. \p loc_id specifies a
+ * file or group; group_name specifies either a group in the file
+ * (with an absolute name based in the file’s root group) or a group
+ * relative to \p loc_id. If \p loc_id fully specifies the group that
+ * is to serve as the root of the iteration, group_name should be '.'
+ * (a dot). (Note that when \p loc_id fully specifies the the group
+ * that is to serve as the root of the iteration, the user may wish to
+ * consider using H5Lvisit2() instead of H5Lvisit_by_name2().)
+ *
+ * Two parameters are used to establish the iteration: \p idx_type and
+ * \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecesary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a best effort
+ * setting. If the application passes in a value indicating iteration
+ * in creation order and a group is encountered that was not tracked
+ * in creation order, that group will be iterated over in
+ * lexicographic order by name, or name order. (Name order is the
+ * native order used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * The \p op callback function, the related \ref H5L_info2_t
+ * \c struct, and the effect that the callback function's return value
+ * has on the application are described in H5Lvisit2().
+ *
+ * The H5Lvisit_by_name2() \p op_data parameter is a user-defined
+ * pointer to the data required to process links in the course of the
+ * iteration. This pointer is passed back to each step of the
+ * iteration in the callback function's \p op_data parameter.
+ *
+ * \p lapl_id is a link access property list. In the general case,
+ * when default link access properties are acceptable, this can be
+ * passed in as #H5P_DEFAULT. An example of a situation that requires
+ * a non-default link access property list is when the link is an
+ * external link; an external link may require that a link prefix be
+ * set in a link access property list (see H5Pset_elink_prefix()).
+ *
+ * H5Lvisit_by_name2() and H5Ovisit_by_name2() are companion
+ * functions: one for examining and operating on links; the other for
+ * examining and operating on the objects that those links point to.
+ * Both functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point in the
+ * file has been presented to the application for whatever processing
+ * the application requires.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id);
/* UD link functions */
+/**
+ * \ingroup H5L
+ *
+ * \brief Creates a link of a user-defined type
+ *
+ * \loc_id{link_loc_id}
+ * \param[in] link_name Link name
+ * \param[in] link_type User-defined link class
+ * \param[in] udata User-supplied link information
+ * \param[in] udata_size Size of udata buffer
+ * \lcpl_id
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Lcreate_ud() creates a link of user-defined type \p link_type
+ * named \p link_name at the location specified in \p link_loc_id with
+ * user-specified data \p udata.
+ *
+ * \p link_name is interpreted relative to \p link_loc_id.
+ *
+ * Valid values for the link class of the new link, \p link_type,
+ * include #H5L_TYPE_EXTERNAL and any user-defined link classes that
+ * have been registered with the library. See H5Lregister() for
+ * further information.
+ *
+ * The format of the information pointed to by \p udata is defined by
+ * the user. \p udata_size specifies the size of the \p udata buffer.
+ * \p udata may be NULL if \p udata_size is zero (0).
+ *
+ * The property lists specified by \p lcpl_id and \p lapl_id specify
+ * properties used to create and access the link.
+ *
+ * \note The external link type, #H5L_TYPE_EXTERNAL, included in the HDF5
+ * library distribution, is implemented as a user-defined link type. This
+ * was done, in part, to provide a model for the implementation of other
+ * user-defined links.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata,
size_t udata_size, hid_t lcpl_id, hid_t lapl_id);
+/**
+ * \ingroup H5LA
+ *
+ * \brief Registers a user-defined link class or changes behavior of an
+ * existing class
+ *
+ * \param[in] cls Pointer to a buffer containing the struct describing the
+ * user-defined link class
+ *
+ * \return \herr_t
+ *
+ * \details H5Lregister() registers a class of user-defined links, or changes
+ * the behavior of an existing class.
+ *
+ * \p cls is a pointer to a buffer containing a copy of the
+ * H5L_class_t struct. This struct is defined in H5Lpublic.h as
+ * follows:
+ * \snippet this H5L_class_t_snip
+ *
+ * The class definition passed with \p cls must include at least the
+ * following:
+ * \li An H5L_class_t version (which should be #H5L_LINK_CLASS_T_VERS)
+ * \li A link class identifier, \c class_id
+ * \li A traversal function, \c trav_func
+ *
+ * Remaining \c struct members are optional and may be passed as NULL.
+ *
+ * The link class passed in \c class_id must be in the user-definable
+ * range between #H5L_TYPE_UD_MIN and #H5L_TYPE_UD_MAX
+ * (see the table below) and will override
+ * any existing link class with that identifier.
+ *
+ * As distributed, valid values of \c class_id used in HDF5 include
+ * the following (defined in H5Lpublic.h):
+ * \link_types
+ *
+ * The hard and soft link class identifiers cannot be modified or
+ * reassigned, but the external link class is implemented as an
+ * example in the user-definable link class identifier range.
+ * H5Lregister() is used to register additional link classes. It could
+ * also be used to modify the behavior of the external link class,
+ * though that is not recommended.
+ *
+ * The following table summarizes existing link types and values and
+ * the reserved and user-definable link class identifier value ranges.
+ * <table>
+ * <tr>
+ * <th>Link class identifier or Value range</th>
+ * <th>Description</th>
+ * <th>Link class or label</th>
+ * </tr>
+ * <tr>
+ * <td>0 to 63</td>
+ * <td>Reserved range</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>64 to 255</td>
+ * <td>User-definable range</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>64</td>
+ * <td>Minimum user-defined value</td>
+ * <td>#H5L_TYPE_UD_MIN</td>
+ * </tr>
+ * <tr>
+ * <td>64</td>
+ * <td>External link</td>
+ * <td>#H5L_TYPE_EXTERNAL</td>
+ * </tr>
+ * <tr>
+ * <td>255</td>
+ * <td>Maximum user-defined value</td>
+ * <td>#H5L_TYPE_UD_MAX</td>
+ * </tr>
+ * <tr>
+ * <td>255</td>
+ * <td>Maximum value</td>
+ * <td>#H5L_TYPE_MAX</td>
+ * </tr>
+ * <tr>
+ * <td>-1</td>
+ * <td>Error</td>
+ * <td>#H5L_TYPE_ERROR</td>
+ * </tr>
+ * </table>
+ *
+ * Note that HDF5 internally registers user-defined link classes only
+ * by the numeric value of the link class identifier. An application,
+ * on the other hand, will generally use a name for a user-defined
+ * class, if for no other purpose than as a variable name. Assume,
+ * for example, that a complex link type is registered with the link
+ * class identifier 73 and that the code includes the following
+ * assignment:
+ * \code
+ * H5L_TYPE_COMPLEX_A = 73
+ * \endcode
+ * The application can refer to the link class with a term,
+ * \c H5L_TYPE_COMPLEX_A, that conveys meaning to a human reviewing
+ * the code, while HDF5 recognizes it by the more cryptic numeric
+ * identifier, 73.
+ *
+ * \attention Important details and considerations include the following:
+ * \li If you plan to distribute files or software with a
+ * user-defined link class, please contact the Help Desk at
+ * The HDF Group to help prevent collisions between \c class_id
+ * values. See below.
+ * \li As distributed with HDF5, the external link class is
+ * implemented as an example of a user-defined link class with
+ * #H5L_TYPE_EXTERNAL equal to #H5L_TYPE_UD_MIN. \c class_id in
+ * the H5L_class_t \c struct must not equal #H5L_TYPE_UD_MIN
+ * unless you intend to overwrite or modify the behavior of
+ * external links.
+ * \li H5Lregister() can be used only with link class identifiers
+ * in the user-definable range (see table above).
+ * \li The hard and soft links defined by the HDF5 library,
+ * #H5L_TYPE_HARD and #H5L_TYPE_SOFT, reside in the reserved
+ * range below #H5L_TYPE_UD_MIN and cannot be redefined or
+ * modified.
+ * \li H5Lis_registered() can be used to determine whether a desired
+ * link class identifier is available. \Emph{Note that this
+ * function will tell you only whether the link class identifier
+ * has been registered with the installed copy of HDF5; it
+ * cannot tell you whether the link class has been registered
+ * with The HDF Group.}
+ * \li #H5L_TYPE_MAX is the maximum allowed value for a link type
+ * identifier.
+ * \li #H5L_TYPE_UD_MIN equals #H5L_TYPE_EXTERNAL.
+ * \li #H5L_TYPE_UD_MAX equals #H5L_TYPE_MAX.
+ * \li #H5L_TYPE_ERROR indicates that an error has occurred.
+ *
+ * \note \Bold{Registration with The HDF Group:}\n
+ * There are sometimes reasons to take a broader approach to registering
+ * a user-defined link class than just invoking H5Lregister(). For
+ * example:
+ * \li A user-defined link class is intended for use across an
+ * organization, among collaborators, or across a community of users.
+ * \li An application or library overlying HDF5 invokes a user-defined
+ * link class that must be shipped with the software.
+ * \li Files are distributed that make use of a user-defined link class.
+ * \li Or simply, a specific user-defined link class is thought to be
+ * widely useful.
+ *
+ * In such cases, you are encouraged to register that link class with
+ * The HDF Group's Helpdesk. The HDF Group maintains a registry of known
+ * user-defined link classes and tracks the selected link class
+ * identifiers. This registry is intended to reduce the risk of
+ * collisions between \c class_id values and to help coordinate the use
+ * of specialized link classes.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
+/**
+ * \ingroup H5LA
+ *
+ * \brief Unregisters a class of user-defined links
+ *
+ * \param[in] id User-defined link class identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Lunregister() unregisters a class of user-defined links,
+ * preventing them from being traversed, queried, moved, etc.
+ *
+ * \note A link class can be re-registered using H5Lregister().
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lunregister(H5L_type_t id);
+/**
+ * \ingroup H5LA
+ *
+ * \brief Determines whether a class of user-defined links is registered
+ *
+ * \param[in] id User-defined link class identifier
+ *
+ * \return \htri_t
+ *
+ * \details H5Lis_registered() tests whether a user-defined link class is
+ * currently registered, either by the HDF5 library or by the user
+ * through the use of H5Lregister().
+ *
+ * \note A link class must be registered to create new links of that type or to
+ * traverse existing links of that type.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL htri_t H5Lis_registered(H5L_type_t id);
/* External link functions */
+/**
+ * \ingroup H5L
+ *
+ * \brief Decodes external link information
+ *
+ * \param[in] ext_linkval Buffer containing external link information
+ * \param[in] link_size Size, in bytes, of the \p ext_linkval buffer
+ * \param[out] flags External link flags, packed as a bitmap (\Emph{Reserved as
+ * a bitmap for flags; no flags are currently defined, so the
+ * only valid value * is 0.})
+ * \param[out] filename Returned filename \param[out] obj_path Returned
+ * object path, relative to \p filename
+ *
+ * \return \herr_t
+ *
+ * \details H5Lunpack_elink_val() decodes the external link information
+ * returned by H5Lget_val() in the \p ext_linkval buffer.
+ *
+ * \p ext_linkval should be the buffer set by H5Lget_val() and will
+ * consist of two NULL-terminated strings, the filename and object
+ * path, one after the other.
+ *
+ * Given this buffer, H5Lunpack_elink_val() creates pointers to the
+ * filename and object path within the buffer and returns them in
+ * \p filename and \p obj_path, unless they are passed in as NULL.
+ *
+ * H5Lunpack_elink_val() requires that \p ext_linkval contain a
+ * concatenated pair of null-terminated strings, so use of this
+ * function on a string that is not an external link \p udata buffer
+ * may result in a segmentation fault. This failure can be avoided by
+ * adhering to the following procedure:
+ * <ol>
+ * <li>Call H5Lget_info() to get the link type and the size of the
+ * link value.<li>
+ * <li>Verify that the link is an external link, i.e., that its link
+ * type is #H5L_TYPE_EXTERNAL.</li>
+ * <li>Call H5Lget_val() to get the link value.</li>
+ * <li>Call H5Lunpack_elink_val() to unpack that value.</li>
+ * </ol>
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_size, unsigned *flags,
const char **filename /*out*/, const char **obj_path /*out*/);
+/**
+ * \ingroup H5L
+ *
+ * \brief Creates an external link, a soft link to an object in a different file.
+ *
+ * \param[in] file_name Name of the target file containing the target object.
+ * \param[in] obj_name Path within the target file to the target object
+ * \fgdt_loc_id{link_loc_id}
+ * \param[in] link_name Name of the new link, relative to \p link_loc_id
+ * \lcpl_id
+ * \lapl_id
+ * \return \herr_t
+ *
+ * \details H5Lcreate_external() creates a new external link. An external link
+ * is a soft link to an object in a different HDF5 file from the
+ * location of the link, i.e., to an external object.
+ *
+ * \p file_name identifies the target file containing the target
+ * object; \p obj_name specifies the path of the target object within
+ * that file. \p obj_name must be an absolute pathname in
+ * \p file_name, i.e., it must start at the target file’s root group,
+ * but it is not interpreted until an application attempts to traverse
+ * it.
+ *
+ * \p link_loc_id and \p link_name specify the location and name,
+ * respectively, of the new link. \p link_name is interpreted relative
+ * to \p link_loc_id.
+ *
+ * \p lcpl_id is the link creation property list used in creating the
+ * new link.
+ *
+ * \p lapl_id is the link access property list used in traversing the
+ * new link. Note that an external file opened by the traversal of an
+ * external link is always opened with the weak file close degree
+ * property setting, #H5F_CLOSE_WEAK (see H5Pset_fclose_degree());
+ * any file close degree property setting in \p lapl_id is ignored.
+ *
+ * An external link behaves similarly to a soft link, and like a soft
+ * link in an HDF5 file, it may dangle: the target file and object
+ * need not exist at the time that the external link is created.
+ *
+ * When the external link \p link_name is accessed, the library will
+ * search for the target file \p file_name as described below:
+ *
+ * - If \p file_name is a relative pathname, the following steps are
+ * performed:
+ * - The library will get the prefix(es) set in the environment
+ * variable \c HDF5_EXT_PREFIX and will try to prepend each prefix
+ * to \p file_name to form a new \p file_name.
+ * - If the new \p file_name does not exist or if \c HDF5_EXT_PREFIX
+ * is not set, the library will get the prefix set via
+ * H5Pset_elink_prefix() and prepend it to \p file_name to form a
+ * new \p file_name.
+ * - If the new \p file_name does not exist or no prefix is being
+ * set by H5Pset_elink_prefix(), then the path of the file
+ * associated with \p link_loc_id is obtained. This path can be
+ * the absolute path or the current working directory plus the
+ * relative path of that file when it is created/opened. The
+ * library will prepend this path to \p file_name to form a new
+ * \p file_name.
+ * - If the new \p file_name does not exist, then the library will
+ * look for \p file_name and will return failure/success
+ * accordingly.
+ * - If \p file_name is an absolute pathname, the library will first
+ * try to find \p file_name. If \p file_name does not exist,
+ * \p file_name is stripped of directory paths to form a new
+ * \p file_name. The search for the new \p file_name then follows
+ * the same steps as described above for a relative pathname. See
+ * examples below illustrating how target_file_name is stripped to
+ * form a new \p file_name.
+ *
+ * Note that \p file_name is considered to be an absolute pathname
+ * when the following condition is true:
+ *
+ * - For Unix, the first character of \p file_name is a slash (\c /).
+ * For example, consider a \p file_name of \c /tmp/A.h5.
+ * If that target file does not exist, the new \p file_name after
+ * stripping will be \c A.h5.
+ * - For Windows, there are 6 cases:
+ * -# \p file_name is an absolute drive with absolute pathname.
+ * For example, consider a \p file_name of \c /tmp/A.h5. If that
+ * target file does not exist, the new \p file_name after
+ * stripping will be \c A.h5.
+ * -# \p file_name is an absolute pathname without specifying drive
+ * name. For example, consider a \p file_name of \c /tmp/A.h5.
+ * If that target file does not exist, the new \p file_name after
+ * stripping will be \c A.h5.
+ * -# \p file_name is an absolute drive with relative pathname.
+ * For example, consider a \p file_name of \c /tmp/A.h5. If that
+ * target file does not exist, the new \p file_name after
+ * stripping will be \c tmp\A.h5.
+ * -# \p file_name is in UNC (Uniform Naming Convention) format with
+ * server name, share name, and pathname. For example, consider
+ * a \p file_name of \c /tmp/A.h5. If that target file does not
+ * exist, the new \p file_name after stripping will be \c A.h5.
+ * -# \p file_name is in Long UNC (Uniform Naming Convention) format
+ * with server name, share name, and pathname. For example,
+ * consider a \p file_name of \c /tmp/A.h5. If that target file
+ * does not exist, the new \p file_name after stripping will be
+ * \c A.h5.
+ * -# \p file_name is in Long UNC (Uniform Naming Convention) format
+ * with an absolute drive and an absolute pathname. For example,
+ * consider a \p file_name of \c /tmp/A.h5. If that target file
+ * does not exist, the new \p file_name after stripping will be
+ * \c A.h5.
+ *
+ * The library opens target file \p file_name with the file access
+ * property list that is set via H5Pset_elink_fapl() when the external
+ * link link_name is accessed. If no such property list is set, the
+ * library uses the file access property list associated with the file
+ * of \p link_loc_id to open the target file.
+ *
+ * If an application requires additional control over file access
+ * flags or the file access property list, see H5Pset_elink_cb(); this
+ * function enables the use of an external link callback function as
+ * described in H5L_elink_traverse_t().
+ *
+ * \attention A file close degree property setting (H5Pset_fclose_degree()) in
+ * the external link file access property list or in the external
+ * link callback function will be ignored. A file opened by means of
+ * traversing an external link is always opened with the weak file
+ * close degree property setting, #H5F_CLOSE_WEAK .
+ *
+ * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_ud()
+ *
+ * \since 1.8.0
+ */
H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id,
const char *link_name, hid_t lcpl_id, hid_t lapl_id);
@@ -203,50 +1584,508 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi
/* Typedefs */
-/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */
+//! <!-- [H5L_info1_t_snip] -->
+/**
+ * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1())
+ */
typedef struct {
- H5L_type_t type; /* Type of link */
- hbool_t corder_valid; /* Indicate if creation order is valid */
- int64_t corder; /* Creation order */
- H5T_cset_t cset; /* Character set of link name */
+ H5L_type_t type; /**< Type of link */
+ hbool_t corder_valid; /**< Indicate if creation order is valid */
+ int64_t corder; /**< Creation order */
+ H5T_cset_t cset; /**< Character set of link name */
union {
- haddr_t address; /* Address hard link points to */
- size_t val_size; /* Size of a soft link or UD link value */
+ haddr_t address; /**< Address hard link points to */
+ size_t val_size; /**< Size of a soft link or UD link value */
} u;
} H5L_info1_t;
+//! <!-- [H5L_info1_t_snip] -->
-/* Callback during link traversal */
+/** Callback during link traversal */
typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
size_t lnkdata_size, hid_t lapl_id);
-/* User-defined link types */
+/** User-defined link types */
typedef struct {
- int version; /* Version number of this struct */
- H5L_type_t id; /* Link type ID */
- const char * comment; /* Comment for debugging */
- H5L_create_func_t create_func; /* Callback during link creation */
- H5L_move_func_t move_func; /* Callback after moving link */
- H5L_copy_func_t copy_func; /* Callback after copying link */
- H5L_traverse_0_func_t trav_func; /* Callback during link traversal */
- H5L_delete_func_t del_func; /* Callback for link deletion */
- H5L_query_func_t query_func; /* Callback for queries */
+ int version; /**< Version number of this struct */
+ H5L_type_t id; /**< Link type ID */
+ const char * comment; /**< Comment for debugging */
+ H5L_create_func_t create_func; /**< Callback during link creation */
+ H5L_move_func_t move_func; /**< Callback after moving link */
+ H5L_copy_func_t copy_func; /**< Callback after copying link */
+ H5L_traverse_0_func_t trav_func; /**< Callback during link traversal */
+ H5L_delete_func_t del_func; /**< Callback for link deletion */
+ H5L_query_func_t query_func; /**< Callback for queries */
} H5L_class_0_t;
-/* Prototype for H5Literate1/H5Literate_by_name1() operator */
+/** Prototype for H5Literate1() / H5Literate_by_name1() operator */
+//! <!-- [H5L_iterate1_t_snip] -->
typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data);
+//! <!-- [H5L_iterate1_t_snip] -->
/* Function prototypes */
+/**
+ * \ingroup H5L
+ *
+ * \brief Returns information about a link
+ *
+ * \fgdta_loc_id
+ * \param[in] name Link name
+ * \param[out] linfo Buffer in which link information is returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Lget_info2() or the macro H5Lget_info().
+ *
+ * \details H5Lget_info1() returns information about the specified link through
+ * the \p linfo argument.
+ *
+ * The location identifier, \p loc_id, specifies the location of the
+ * link. A link name, \p name, interpreted relative to \p loc_id,
+ * specifies the link being queried.
+ *
+ * \p lapl_id is the link access property list associated with the
+ * link \p name. In the general case, when default link access
+ * properties are acceptable, this can be passed in as #H5P_DEFAULT.
+ * An example of a situation that requires a non-default link access
+ * property list is when the link is an external link; an external
+ * link may require that a link prefix be set in a link access
+ * property list (see H5Pset_elink_prefix()).
+ *
+ * H5Lget_info1() returns information about name in the data structure
+ * \ref H5L_info1_t, which is described below and defined in
+ * H5Lpublic.h. This structure is returned in the buffer \p linfo.
+ * \snippet this H5L_info1_t_snip
+ * In the above struct, type specifies the link class. Valid values
+ * include the following:
+ * \link_types
+ * There will be additional valid values if user-defined links have
+ * been registered.
+ *
+ * \c corder specifies the link’s creation order position while
+ * \c corder_valid indicates whether the value in \c corder is valid.
+ *
+ * If \c corder_valid is \c TRUE, the value in \c corder is known to
+ * be valid; if \c corder_valid is \c FALSE, the value in \c corder is
+ * presumed to be invalid;
+ *
+ * \c corder starts at zero (0) and is incremented by one (1) as new
+ * links are created. But higher-numbered entries are not adjusted
+ * when a lower-numbered link is deleted; the deleted link’s creation
+ * order position is simply left vacant. In such situations, the value
+ * of \c corder for the last link created will be larger than the
+ * number of links remaining in the group.
+ *
+ * \c cset specifies the character set in which the link name is
+ * encoded. Valid values include the following:
+ * \csets
+ * This value is set with H5Pset_char_encoding().
+ *
+ * \c address and \c val_size are returned for hard and symbolic
+ * links, respectively. Symbolic links include soft and external links
+ * and some user-defined links.
+ *
+ * If the link is a hard link, \c address specifies the file address
+ * that the link points to.
+ *
+ * If the link is a symbolic link, \c val_size will be the length of
+ * the link value, e.g., the length of the HDF5 path name with a null
+ * terminator.
+ *
+ * \version 1.12.0 Function was deprecated.
+ * \version 1.8.2 Fortran subroutine added in this release.
+ * \version 1.8.4 Fortran subroutine syntax changed in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t lapl_id);
+/**
+ * \ingroup H5L
+ *
+ * \brief Retrieves metadata for a link in a group, according to the order
+ * within a field or index
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \param[in] n Link position for which to retrieve information
+ * \param[out] linfo Buffer in which link information is returned
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Lget_info_by_idx2() and the macro
+ * H5Lget_info_by_idx().
+ *
+ * \details H5get_info_by_idx1() returns the metadata for a link in a group
+ * according to a specified field or index and a specified order.
+ *
+ * The link for which information is to be returned is specified by \p
+ * idx_type, \p order, and \p n as follows:
+ *
+ * - \p idx_type specifies the field by which the links in \p
+ * group_name are ordered. The links may be indexed on this field,
+ * in which case operations seeking specific links are likely to
+ * complete more quickly.
+ * - \p order specifies the order in which
+ * the links are to be referenced for the purposes of this function.
+ * - \p n specifies the position of the subject link. Note that this
+ * count is zero-based; 0 (zero) indicates that the function will
+ * return the value of the first link; if \p n is 5, the function
+ * will return the value of the sixth link; etc.
+ *
+ * For example, assume that \p idx_type, \p order, and \p n are
+ * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME
+ * indicates that the links are accessed in lexicographic order by
+ * their names. #H5_ITER_DEC specifies that the list be traversed in
+ * reverse order, or in decremented order. And 5 specifies that this
+ * call to the function will return the metadata for the 6th link
+ * (\c n + 1) from the end.
+ *
+ * See H5Literate1() for a list of valid values and further discussion
+ * regarding \p idx_type and \p order.
+ *
+ * If \p loc_id specifies the group in which the link resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * \version 1.12.0 Function was renamed to H5Lget_index_by_idx1() and deprecated.
+ * \version 1.8.4 Fortran subroutine syntax changed in this release.
+ * \version 1.8.2 Fortran subroutine added in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5L_info1_t *linfo /*out*/,
hid_t lapl_id);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Iterates over links in a group, with user callback routine,
+ * according to the order within an index.
+ *
+ * \group_id{grp_id}
+ * \idx_type
+ * \order
+ * \param[in,out] idx Pointer to an iteration index to allow
+ * continuing a previous iteration
+ * \op
+ * \op_data
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \deprecated Deprecated in favor of H5Literate2().
+ *
+ * \details H5Literate1() iterates through the links in a file or
+ * group, \p group_id, in the order of the specified
+ * index, \p idx_type, using a user-defined callback routine
+ * \p op. H5Literate1() does not recursively follow links into
+ * subgroups of the specified group.
+ *
+ * Three parameters are used to manage progress of the iteration:
+ * \p idx_type, \p order, and \p idx_p.
+ *
+ * \p idx_type specifies the index to be used. If the links have
+ * not been indexed by the index type, they will first be sorted by
+ * that index then the iteration will begin; if the links have been
+ * so indexed, the sorting step will be unnecessary, so the iteration
+ * may begin more quickly.
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index \p idx_type.
+ *
+ * \p idx_p tracks the iteration and allows an iteration to be
+ * resumed if it was stopped before all members were processed. It is
+ * passed in by the application with a starting point and returned by
+ * the library with the point at which the iteration stopped.
+ *
+ * \p op_data is a user-defined pointer to the data required to
+ * process links in the course of the iteration. This pointer is
+ * passed back to each step of the iteration in the \p op callback
+ * function's \p op_data parameter. \p op is invoked for each link
+ * encounter.
+ *
+ * \p op_data is passed to and from each iteration and can be used to
+ * supply or aggregate information across iterations.
+ *
+ * \remark Same pattern of behavior as H5Giterate().
+ *
+ * \note This function is also available through the H5Literate() macro.
+ *
+ * \warning The behavior of H5Literate1() is undefined if the link
+ * membership of \p group_id changes during the iteration.
+ * This does not limit the ability to change link destinations
+ * while iterating, but caution is advised.
+ *
+ *
+ * \version 1.12.0 Function was deprecated in this release.
+ * \since 1.8.0
+ *
+ * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()
+ *
+ */
H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
H5L_iterate1_t op, void *op_data);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Iterates through links in a group by its name
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \param[in,out] idx iteration position at which to start (\Emph{IN}) or
+ * position at which an interrupted iteration may be restarted
+ * (\Emph{OUT})
+ * \op
+ * \op_data
+ * \lapl_id
+ *
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Literate_by_name2() or the macro
+ * H5Literate_by_name().
+ *
+ * \details H5Literate_by_name1() iterates through the links in a group
+ * specified by \p loc_id and \p group_name, in the order of the
+ * specified index, \p idx_type, using a user-defined callback routine
+ * \p op. H5Literate_by_name1() does not recursively follow links into
+ * subgroups of the specified group.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecessary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * \p idx allows an interrupted iteration to be resumed; it is
+ * passed in by the application with a starting point and returned by
+ * the library with the point at which the iteration stopped.
+ *
+ * \note H5Literate_by_name1() is not recursive. In particular, if a member of
+ * \p group_name is found to be a group, call it \c subgroup_a,
+ * H5Literate_by_name1() does not examine the members of \c subgroup_a.
+ * When recursive iteration is required, the application must handle the
+ * recursion, explicitly calling H5Literate_by_name1() on discovered
+ * subgroups.
+ *
+ * \note H5Literate_by_name1() assumes that the membership of the group being
+ * iterated over remains unchanged through the iteration; if any of the
+ * links in the group change during the iteration, the function’s
+ * behavior is undefined. Note, however, that objects pointed to by the
+ * links can be modified.
+ *
+ * \note H5Literate_by_name1() is the same as H5Giterate(), except that
+ * H5Giterate() always proceeds in lexicographic order.
+ *
+ * \version 1.12.0 Function H5Literate_by_name() was renamed to
+ * H5Literate_by_name1() and deprecated.
+ * \version 1.8.8 Fortran subroutine added.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data,
hid_t lapl_id);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Recursively visits all links starting from a specified group
+ *
+ * \group_id{grp_id}
+ * \idx_type
+ * \order
+ * \op
+ * \op_data
+ *
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Lvisit2() or the macro H5Lvisit().
+ *
+ * \details H5Lvisit1() is a recursive iteration function to visit all links in
+ * and below a group in an HDF5 file, thus providing a mechanism for
+ * an application to perform a common set of operations across all of
+ * those links or a dynamically selected subset. For non-recursive
+ * iteration across the members of a group, see H5Literate1().
+ *
+ * The group serving as the root of the iteration is specified by its
+ * group or file identifier, \p group_id.
+ *
+ * Two parameters are used to establish the iteration: \p idx_type and
+ * \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecessary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a best effort
+ * setting. If the application passes in a value indicating iteration
+ * in creation order and a group is encountered that was not tracked
+ * in creation order, that group will be iterated over in
+ * lexicographic order by name, or name order. (Name order is the
+ * native order used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * \p op is a callback function of type \ref H5L_iterate1_t that is invoked
+ * for each link encountered.
+ * \snippet this H5L_iterate1_t_snip
+ *
+ * The \ref H5L_info1_t struct is defined (in H5Lpublic.h) as follows:
+ * \snippet this H5L_info1_t_snip
+ *
+ * The possible return values from the callback function, and the
+ * effect of each, are as follows:
+ * \li Zero causes the visit iterator to continue, returning zero when
+ * all group members have been processed.
+ * \li A positive value causes the visit iterator to immediately
+ * return that positive value, indicating short-circuit success.
+ * \li A negative value causes the visit iterator to immediately
+ * return that value, indicating failure.
+ *
+ * The H5Lvisit1() \p op_data parameter is a user-defined pointer to
+ * the data required to process links in the course of the iteration.
+ * This pointer is passed back to each step of the iteration in the
+ * \p op callback function's \p op_data parameter.
+ *
+ * H5Lvisit1() and H5Ovisit1() are companion functions: one for
+ * examining and operating on links; the other for examining and
+ * operating on the objects that those links point to. Both functions
+ * ensure that by the time the function completes successfully, every
+ * link or object below the specified point in the file has been
+ * presented to the application for whatever processing the
+ * application requires.
+ *
+ * \version 1.12.0 Function was renamed from H5Lvisit() to H5Lvisit1() and
+ * deprecated.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op,
void *op_data);
+/**
+ * \ingroup TRAV
+ *
+ * \brief Recursively visits all links starting from a specified group
+ *
+ * \loc_id
+ * \param[in] group_name Group name
+ * \idx_type
+ * \order
+ * \op
+ * \op_data
+ * \lapl_id
+ *
+ * \return \success{The return value of the first operator that returns
+ * non-zero, or zero if all members were processed with no
+ * operator returning non-zero.}
+ * \return \failure{Negative if an error occurs in the library, or the negative
+ * value returned by one of the operators.}
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Lvisit_by_name2() or the macro H5Lvisit_by_name().
+ *
+ * \details H5Lvisit_by_name1() is a recursive iteration function to visit all
+ * links in and below a group in an HDF5 file, thus providing a
+ * mechanism for an application to perform a common set of operations
+ * across all of those links or a dynamically selected subset. For
+ * non-recursive iteration across the members of a group, see
+ * H5Literate1().
+ *
+ * The group serving as the root of the iteration is specified by the
+ * \p loc_id / \p group_name parameter pair. \p loc_id specifies a
+ * file or group; group_name specifies either a group in the file
+ * (with an absolute name based in the file’s root group) or a group
+ * relative to \p loc_id. If \p loc_id fully specifies the group that
+ * is to serve as the root of the iteration, group_name should be '.'
+ * (a dot). (Note that when \p loc_id fully specifies the the group
+ * that is to serve as the root of the iteration, the user may wish to
+ * consider using H5Lvisit1() instead of H5Lvisit_by_name1().)
+ *
+ * Two parameters are used to establish the iteration: \p idx_type and
+ * \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links have not
+ * been indexed by the index type, they will first be sorted by that
+ * index then the iteration will begin; if the links have been so
+ * indexed, the sorting step will be unnecesary, so the iteration may
+ * begin more quickly. Valid values include the following:
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a best effort
+ * setting. If the application passes in a value indicating iteration
+ * in creation order and a group is encountered that was not tracked
+ * in creation order, that group will be iterated over in
+ * lexicographic order by name, or name order. (Name order is the
+ * native order used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include the
+ * following:
+ * \orders
+ *
+ * The \p op callback function, the related \ref H5L_info1_t
+ * \c struct, and the effect that the callback function's return value
+ * has on the application are described in H5Lvisit1().
+ *
+ * The H5Lvisit_by_name1() \p op_data parameter is a user-defined
+ * pointer to the data required to process links in the course of the
+ * iteration. This pointer is passed back to each step of the
+ * iteration in the callback function's \p op_data parameter.
+ *
+ * \p lapl_id is a link access property list. In the general case,
+ * when default link access properties are acceptable, this can be
+ * passed in as #H5P_DEFAULT. An example of a situation that requires
+ * a non-default link access property list is when the link is an
+ * external link; an external link may require that a link prefix be
+ * set in a link access property list (see H5Pset_elink_prefix()).
+ *
+ * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion
+ * functions: one for examining and operating on links; the other for
+ * examining and operating on the objects that those links point to.
+ * Both functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point in the
+ * file has been presented to the application for whatever processing
+ * the application requires.
+ *
+ * \version 1.12.0 Function renamed from H5Lvisit_by_name() to
+ * H5Lvisit_by_name1() and deprecated.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id);
@@ -255,4 +2094,4 @@ H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t
#ifdef __cplusplus
}
#endif
-#endif /* _H5Lpublic_H */
+#endif /* H5Lpublic_H */
diff --git a/src/H5M.c b/src/H5M.c
index 34d0105..e810e6d 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -38,7 +38,6 @@
/********************/
/* Local Prototypes */
/********************/
-
static herr_t H5M__close_cb(H5VL_object_t *map_vol_obj);
/*********************/
@@ -873,7 +872,7 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
/* Iterate over keys */
if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params,
H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
+ HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to iterate over keys")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5MF.c b/src/H5MF.c
index bcf3911..b7004c1 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5MF.c
* Jul 11 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: File memory management functions.
*
@@ -26,20 +26,20 @@
/* Module Setup */
/****************/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5FS_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5FS_FRIEND /*suppress error about including H5Fpkg */
#include "H5MFmodule.h" /* This source code file is part of the H5MF module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
#include "H5FSpkg.h" /* File free space */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFpkg.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFpkg.h" /* File memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
@@ -49,9 +49,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 */
@@ -130,7 +132,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* Purpose: Initialize the free space section+aggregator merge flags
* for the file.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, February 1, 2008
@@ -282,18 +284,17 @@ H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size,
} /* end H5MF__alloc_to_fs_type() */
/*-------------------------------------------------------------------------
- * Function: H5MF__open_fstype
+ * Function: H5MF__open_fstype
*
- * Purpose: Open an existing free space manager of TYPE for file by
+ * Purpose: Open an existing free space manager of TYPE for file by
* creating a free-space structure.
* Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jan 8 2008
+ * Programmer: Quincey Koziol
+ * Jan 8 2008
*
*-------------------------------------------------------------------------
*/
@@ -360,18 +361,17 @@ done:
} /* end H5MF__open_fstype() */
/*-------------------------------------------------------------------------
- * Function: H5MF__create_fstype
+ * Function: H5MF__create_fstype
*
- * Purpose: Create free space manager of TYPE for the file by creating
+ * Purpose: Create free space manager of TYPE for the file by creating
* a free-space structure
* Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jan 8 2008
+ * Programmer: Quincey Koziol
+ * Jan 8 2008
*
*-------------------------------------------------------------------------
*/
@@ -388,7 +388,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.
@@ -441,21 +441,20 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5MF__start_fstype
+ * Function: H5MF__start_fstype
*
- * Purpose: Open or create a free space manager of a given TYPE.
+ * Purpose: Open or create a free space manager of a given TYPE.
* Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jan 8 2008
+ * Programmer: Quincey Koziol
+ * Jan 8 2008
*
*-------------------------------------------------------------------------
*/
@@ -464,7 +463,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.
@@ -491,7 +490,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() */
/*-------------------------------------------------------------------------
@@ -503,7 +502,7 @@ done:
* Return: Success: non-negative
* Failure: negative
*
- * Programmer: Vailin Choi; April 2013
+ * Programmer: Vailin Choi; April 2013
*
*-------------------------------------------------------------------------
*/
@@ -515,7 +514,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);
@@ -562,7 +561,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() */
/*-------------------------------------------------------------------------
@@ -583,7 +582,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.
@@ -608,13 +607,13 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type)
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() */
/*-------------------------------------------------------------------------
* Function: H5MF__add_sect
*
- * Purpose: To add a section to the specified free-space manager.
+ * Purpose: To add a section to the specified free-space manager.
*
* Return: Success: non-negative
* Failure: negative
@@ -632,7 +631,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);
@@ -666,17 +665,17 @@ 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() */
/*-------------------------------------------------------------------------
* Function: H5MF__find_sect
*
- * Purpose: To find a section from the specified free-space manager to fulfill the request.
- * If found, re-add the left-over space back to the manager.
+ * Purpose: To find a section from the specified free-space manager to fulfill the request.
+ * If found, re-add the left-over space back to the manager.
*
- * Return: TRUE if a section is found to fulfill the request
- * FALSE if not
+ * Return: TRUE if a section is found to fulfill the request
+ * FALSE if not
*
* Programmer: Vailin Choi; April 2013
*
@@ -690,7 +689,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h
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);
@@ -749,22 +748,21 @@ 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() */
/*-------------------------------------------------------------------------
* Function: H5MF_alloc
*
* Purpose: Allocate SIZE bytes of file memory and return the relative
- * address where that contiguous chunk of file memory exists.
- * The TYPE argument describes the purpose for which the storage
- * is being requested.
+ * address where that contiguous chunk of file memory exists.
+ * The TYPE argument describes the purpose for which the storage
+ * is being requested.
*
* Return: Success: The file address of new chunk.
* Failure: HADDR_UNDEF
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 11 1997
*
*-------------------------------------------------------------------------
@@ -889,7 +887,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);
@@ -1000,7 +998,7 @@ done:
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() */
/*-------------------------------------------------------------------------
@@ -1008,15 +1006,15 @@ done:
*
* Purpose: Allocate temporary space in the file
*
- * Note: The address returned is non-overlapping with any other address
- * in the file and suitable for insertion into the metadata
- * cache.
+ * Note: The address returned is non-overlapping with any other address
+ * in the file and suitable for insertion into the metadata
+ * cache.
*
- * The address is _not_ suitable for actual file I/O and will
- * cause an error if it is so used.
+ * The address is _not_ suitable for actual file I/O and will
+ * cause an error if it is so used.
*
- * The space allocated with this routine should _not_ be freed,
- * it should just be abandoned. Calling H5MF_xfree() with space
+ * The space allocated with this routine should _not_ be freed,
+ * it should just be abandoned. Calling H5MF_xfree() with space
* from this routine will cause an error.
*
* Return: Success: Temporary file address
@@ -1071,7 +1069,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 17 1997
*
*-------------------------------------------------------------------------
@@ -1124,11 +1121,12 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
/* If it's metadata, check if the space to free intersects with the file's
* metadata accumulator
*/
- if (H5FD_MEM_DRAW != alloc_type)
+ if (H5FD_MEM_DRAW != alloc_type) {
/* Check if the space to free intersects with the file's metadata accumulator */
if (H5F__accum_free(f->shared, alloc_type, addr, size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL,
"can't check free space intersection w/metadata accumulator")
+ } /* end if */
/* Check if the free space manager for the file has been initialized */
if (!f->shared->fs_man[fs_type]) {
@@ -1244,9 +1242,9 @@ done:
} /* end H5MF_xfree() */
/*-------------------------------------------------------------------------
- * Function: H5MF_try_extend
+ * Function: H5MF_try_extend
*
- * Purpose: Extend a block in the file if possible.
+ * Purpose: Extend a block in the file if possible.
* For non-paged aggregation:
* --try to extend at EOA
* --try to extend into the aggregators
@@ -1256,11 +1254,11 @@ done:
* --try to extend into a free-space section if adjoined
* --try to extend into the page end threshold if a metadata block
*
- * Return: Success: TRUE(1) - Block was extended
+ * Return: Success: TRUE(1) - Block was extended
* FALSE(0) - Block could not be extended
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, June 11, 2004
*
*-------------------------------------------------------------------------
@@ -1437,7 +1435,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Feb 14 2008
*
*-------------------------------------------------------------------------
@@ -1445,13 +1442,13 @@ done:
htri_t
H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
{
- H5MF_free_section_t * node = NULL; /* Free space section pointer */
- H5MF_sect_ud_t udata; /* User data for callback */
- H5FS_section_class_t *sect_cls; /* Section class */
- H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
- H5F_mem_page_t fs_type; /* Free space type */
- htri_t ret_value = FALSE; /* Return value */
+ H5MF_free_section_t * node = NULL; /* Free space section pointer */
+ H5MF_sect_ud_t udata; /* User data for callback */
+ const H5FS_section_class_t *sect_cls; /* Section class */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
+ H5F_mem_page_t fs_type; /* Free space type */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
@@ -1523,7 +1520,7 @@ done:
* Purpose: Close the free space tracker(s) for a file:
* paged or non-paged aggregation
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; Dec 2012
*
@@ -1546,11 +1543,11 @@ H5MF_close(H5F_t *f)
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
@@ -1566,9 +1563,9 @@ done:
* of TYPE for file.
* Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Jan 2016
*
*-------------------------------------------------------------------------
@@ -1578,7 +1575,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 */
@@ -1615,7 +1612,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() */
/*-------------------------------------------------------------------------
@@ -1625,9 +1622,9 @@ done:
* free-space managers when downgrading persistent free-space
* to non-persistent.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
* Jan 2016
*
*-------------------------------------------------------------------------
@@ -1747,7 +1744,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 */
@@ -1889,7 +1886,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() */
/*-------------------------------------------------------------------------
@@ -1913,7 +1910,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 */
@@ -2064,7 +2061,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() */
/*-------------------------------------------------------------------------
@@ -2072,7 +2069,7 @@ done:
*
* Purpose: Shrink the EOA while closing
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Saturday, July 7, 2012
@@ -2092,7 +2089,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);
@@ -2161,7 +2158,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;
@@ -2173,7 +2170,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() */
/*-------------------------------------------------------------------------
@@ -2323,7 +2320,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF_get_free_sections()
*
- * Purpose: To retrieve free-space section information for
+ * Purpose: To retrieve free-space section information for
* paged or non-paged aggregation
*
* Return: Success: Number of free sections
@@ -2443,10 +2440,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF__sects_cb()
*
- * Purpose: Iterator callback for each free-space section
+ * Purpose: Iterator callback for each free-space section
* Retrieve address and size into user data
*
- * Return: Always succeed
+ * Return: Always succeed
*
* Programmer: Vailin Choi
* July 1st, 2009
@@ -2473,7 +2470,7 @@ H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata)
/*-------------------------------------------------------------------------
* Function: H5MF__get_free_sects
*
- * Purpose: Retrieve section information for the specified free-space manager.
+ * Purpose: Retrieve section information for the specified free-space manager.
*
* Return: Success: non-negative
* Failure: negative
@@ -2488,7 +2485,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);
@@ -2514,10 +2511,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF_settle_raw_data_fsm()
*
- * Purpose: Handle any tasks required before the metadata cache
- * can serialize or flush the raw data free space manager
- * and any metadata free space managers that reside in the
- * raw data free space manager ring.
+ * Purpose: Handle any tasks required before the metadata cache
+ * can serialize or flush the raw data free space manager
+ * and any metadata free space managers that reside in the
+ * raw data free space manager ring.
*
* Specifically, this means any metadata managers that DON'T
* handle space allocation for free space manager header or
@@ -2525,25 +2522,25 @@ done:
* ring.
*
* In the absence of page allocation, there is at most one
- * free space manager per memory type defined in H5F_mem_t.
- * Of these, the one that allocates H5FD_MEM_DRAW will
- * always reside in the raw data free space manager ring.
- * If there is more than one metadata free space manager,
- * all that don't handle H5FD_MEM_FSPACE_HDR or
+ * free space manager per memory type defined in H5F_mem_t.
+ * Of these, the one that allocates H5FD_MEM_DRAW will
+ * always reside in the raw data free space manager ring.
+ * If there is more than one metadata free space manager,
+ * all that don't handle H5FD_MEM_FSPACE_HDR or
* H5FD_MEM_FSPACE_SINFO (which map to H5FD_MEM_OHDR and
* H5FD_MEM_LHEAP respectively) will reside in the raw
- * data free space manager ring as well
+ * data free space manager ring as well
*
- * With page allocation, the situation is conceptually
- * identical, but more complex in practice.
+ * With page allocation, the situation is conceptually
+ * identical, but more complex in practice.
*
* In the worst case (multi file driver) page allocation
- * can result in two free space managers for each memory
- * type -- one for small (less than on equal to one page)
+ * can result in two free space managers for each memory
+ * type -- one for small (less than on equal to one page)
* allocations, and one for large (greater than one page)
* allocations.
*
- * In the more common one file case, page allocation will
+ * In the more common one file case, page allocation will
* result in a total of three free space managers -- one for
* small (<= one page) raw data allocations, one for small
* metadata allocations (i.e, all memory types other than
@@ -2551,64 +2548,64 @@ done:
* allocations.
*
* Despite these complications, the solution is the same in
- * the page allocation case -- free space managers (be they
+ * the page allocation case -- free space managers (be they
* small data or large) are assigned to the raw data free
* space manager ring if they don't allocate file space for
* free space managers. Note that in the one file case, the
- * large free space manager must be assigned to the metadata
- * free space manager ring, as it both allocates pages for
- * the metadata free space manager, and allocates space for
- * large (> 1 page) metadata cache entries.
+ * large free space manager must be assigned to the metadata
+ * free space manager ring, as it both allocates pages for
+ * the metadata free space manager, and allocates space for
+ * large (> 1 page) metadata cache entries.
*
* At present, the task list for this routine is:
*
- * 1) Reduce the EOA to the extent possible. To do this:
+ * 1) Reduce the EOA to the extent possible. To do this:
*
- * a) Free both aggregators. Space not at EOA will be
- * added to the appropriate free space manager.
+ * a) Free both aggregators. Space not at EOA will be
+ * added to the appropriate free space manager.
*
- * The raw data aggregator should not be restarted
- * after this point. It is possible that the metadata
- * aggregator will be.
+ * The raw data aggregator should not be restarted
+ * after this point. It is possible that the metadata
+ * aggregator will be.
*
- * b) Free all file space currently allocated to free
- * space managers.
+ * b) Free all file space currently allocated to free
+ * space managers.
*
- * c) Delete the free space manager superblock
- * extension message if allocated.
+ * c) Delete the free space manager superblock
+ * extension message if allocated.
*
- * This done, reduce the EOA by moving it to just before
- * the last piece of free memory in the file.
+ * This done, reduce the EOA by moving it to just before
+ * the last piece of free memory in the file.
*
- * 2) Ensure that space is allocated for the free space
+ * 2) Ensure that space is allocated for the free space
* manager superblock extension message. Must do this
* now, before reallocating file space for free space
- * managers, as it is possible that this allocation may
- * grab the last section in a FSM -- making it unnecessary
- * to re-allocate file space for it.
- *
- * 3) Scan all free space managers not involved in allocating
- * space for free space managers. For each such free space
- * manager, test to see if it contains free space. If
- * it does, allocate file space for its header and section
- * data. If it contains no free space, leave it without
- * allocated file space as there is no need to save it to
- * file.
- *
- * Note that all free space managers in this class should
- * see no further space allocations / deallocations as
- * at this point, all raw data allocations should be
- * finalized, as should all metadata allocations not
- * involving free space managers.
- *
- * We will allocate space for free space managers involved
- * in the allocation of file space for free space managers
- * in H5MF_settle_meta_data_fsm()
- *
- * Return: SUCCEED/FAIL
+ * managers, as it is possible that this allocation may
+ * grab the last section in a FSM -- making it unnecessary
+ * to re-allocate file space for it.
+ *
+ * 3) Scan all free space managers not involved in allocating
+ * space for free space managers. For each such free space
+ * manager, test to see if it contains free space. If
+ * it does, allocate file space for its header and section
+ * data. If it contains no free space, leave it without
+ * allocated file space as there is no need to save it to
+ * file.
+ *
+ * Note that all free space managers in this class should
+ * see no further space allocations / deallocations as
+ * at this point, all raw data allocations should be
+ * finalized, as should all metadata allocations not
+ * involving free space managers.
+ *
+ * We will allocate space for free space managers involved
+ * in the allocation of file space for free space managers
+ * in H5MF_settle_meta_data_fsm()
+ *
+ * Return: SUCCEED/FAIL
*
* Programmer: John Mainzer
- * 5/25/16
+ * 5/25/16
*
*-------------------------------------------------------------------------
*/
@@ -2633,6 +2630,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.
@@ -2984,85 +2985,85 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF_settle_meta_data_fsm()
*
- * Purpose: If the free space manager is persistent, handle any tasks
- * required before the metadata cache can serialize or flush
- * the metadata free space manager(s) that handle file space
- * allocation for free space managers.
+ * Purpose: If the free space manager is persistent, handle any tasks
+ * required before the metadata cache can serialize or flush
+ * the metadata free space manager(s) that handle file space
+ * allocation for free space managers.
*
- * In most cases, there will be only one manager assigned
- * to this role. However, since for reasons unknown,
- * free space manager headers and section info blocks are
- * different classes of memory, it is possible that two free
- * space managers will be involved.
+ * In most cases, there will be only one manager assigned
+ * to this role. However, since for reasons unknown,
+ * free space manager headers and section info blocks are
+ * different classes of memory, it is possible that two free
+ * space managers will be involved.
*
- * On entry to this function, the raw data settle routine
- * (H5MF_settle_raw_data_fsm()) should have:
+ * On entry to this function, the raw data settle routine
+ * (H5MF_settle_raw_data_fsm()) should have:
*
* 1) Freed the aggregators.
*
- * 2) Freed all file space allocated to the free space managers.
+ * 2) Freed all file space allocated to the free space managers.
*
- * 3) Deleted the free space manager superblock extension message
+ * 3) Deleted the free space manager superblock extension message
*
- * 4) Reduced the EOA to the extent possible.
+ * 4) Reduced the EOA to the extent possible.
*
- * 5) Re-created the free space manager superblock extension
- * message.
+ * 5) Re-created the free space manager superblock extension
+ * message.
*
- * 6) Reallocated file space for all non-empty free space
- * managers NOT involved in allocation of space for free
- * space managers.
+ * 6) Reallocated file space for all non-empty free space
+ * managers NOT involved in allocation of space for free
+ * space managers.
*
- * Note that these free space managers (if not empty) should
- * have been written to file by this point, and that no
- * further space allocations involving them should take
- * place during file close.
+ * Note that these free space managers (if not empty) should
+ * have been written to file by this point, and that no
+ * further space allocations involving them should take
+ * place during file close.
*
- * On entry to this routine, the free space manager(s) involved
- * in allocation of file space for free space managers should
- * still be floating. (i.e. should not have any file space
- * allocated to them.)
+ * On entry to this routine, the free space manager(s) involved
+ * in allocation of file space for free space managers should
+ * still be floating. (i.e. should not have any file space
+ * allocated to them.)
*
- * Similarly, the raw data aggregator should not have been
- * restarted. Note that it is probable that reallocation of
- * space in 5) and 6) above will have re-started the metadata
- * aggregator.
+ * Similarly, the raw data aggregator should not have been
+ * restarted. Note that it is probable that reallocation of
+ * space in 5) and 6) above will have re-started the metadata
+ * aggregator.
*
*
- * In this routine, we proceed as follows:
+ * In this routine, we proceed as follows:
*
- * 1) Verify that the free space manager(s) involved in file
- * space allocation for free space managers are still floating.
+ * 1) Verify that the free space manager(s) involved in file
+ * space allocation for free space managers are still floating.
*
* 2) Free the aggregators.
*
* 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.
+ * of the resulting value. This value will be stored
+ * in the fsinfo superblock extension message and be used
+ * in the subsequent file open.
*
- * 4) Re-allocate space for any free space manager(s) that:
+ * 4) Re-allocate space for any free space manager(s) that:
*
- * a) are involved in allocation of space for free space
- * managers, and
+ * a) are involved in allocation of space for free space
+ * managers, and
*
- * b) contain free space.
+ * b) contain free space.
*
- * It is possible that we could allocate space for one
- * of these free space manager(s) only to have the allocation
- * result in the free space manager being empty and thus
- * obliging us to free the space again. Thus there is the
- * potential for an infinite loop if we want to avoid saving
- * empty free space managers.
+ * It is possible that we could allocate space for one
+ * of these free space manager(s) only to have the allocation
+ * result in the free space manager being empty and thus
+ * obliging us to free the space again. Thus there is the
+ * potential for an infinite loop if we want to avoid saving
+ * empty free space managers.
*
- * Similarly, it is possible that we could allocate space
- * for a section info block, only to discover that this
- * allocation has changed the size of the section info --
- * forcing us to deallocate and start the loop over again.
+ * Similarly, it is possible that we could allocate space
+ * for a section info block, only to discover that this
+ * allocation has changed the size of the section info --
+ * forcing us to deallocate and start the loop over again.
*
- * The solution is to modify the FSM code to
- * save empty FSMs to file, and to allow section info blocks
- * to be oversized. That is, only allow section info to increase
+ * The solution is to modify the FSM code to
+ * save empty FSMs to file, and to allow section info blocks
+ * to be oversized. That is, only allow section info to increase
* in size, not shrink. The solution is now implemented.
*
* 5) Make note of the EOA -- used for sanity checking on
@@ -3070,26 +3071,26 @@ done:
* the free-space info message for backward compatibility
* with the 1.10 library that has the hack.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: John Mainzer
- * 5/25/16
+ * 5/25/16
*
*-------------------------------------------------------------------------
*/
herr_t
H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled)
{
- H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */
- H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */
- H5F_mem_page_t lg_fshdr_fs_type; /* large fs hdr fsm */
- H5F_mem_page_t lg_fssinfo_fs_type; /* large fs sinfo fsm */
- H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */
- H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */
- H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */
- H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */
- haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */
- /* for self referential FSMs */
+ H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */
+ H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */
+ H5F_mem_page_t lg_fshdr_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs hdr fsm */
+ H5F_mem_page_t lg_fssinfo_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs sinfo fsm */
+ H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */
+ H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */
+ H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */
+ H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */
+ haddr_t eoa_fsm_fsalloc; /* eoa after file space allocation */
+ /* for self referential FSMs */
hbool_t continue_alloc_fsm = FALSE; /* Continue allocating addr and sect_addr for FSMs */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3315,11 +3316,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5MF__continue_alloc_fsm
*
- * Purpose: To determine whether any of the input FSMs has allocated
+ * Purpose: To determine whether any of the input FSMs has allocated
* its "addr" and "sect_addr".
* Return TRUE or FALSE in *continue_alloc_fsm.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* 6/24/2019
@@ -3329,36 +3330,32 @@ 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->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 */
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5MF__continue_alloc_fsm() */
@@ -3367,7 +3364,7 @@ H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_s
* Function: H5MF__fsm_type_is_self_referential()
*
* Purpose: Return TRUE if the indicated free space manager allocates
- * file space for free space managers. Return FALSE otherwise.
+ * file space for free space managers. Return FALSE otherwise.
*
* Return: TRUE/FALSE
*
@@ -3422,7 +3419,7 @@ H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type)
* Function: H5MF__fsm_is_self_referential()
*
* Purpose: Return TRUE if the indicated free space manager allocates
- * file space for free space managers. Return FALSE otherwise.
+ * file space for free space managers. Return FALSE otherwise.
*
* Return: TRUE/FALSE
*
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index fdf11f3..68cd263 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
* Purpose: Routines for aggregating free space allocations
@@ -889,7 +889,7 @@ done:
} /* H5MF__aggr_free() */
/*-------------------------------------------------------------------------
- * 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
@@ -901,13 +901,13 @@ done:
*
*-------------------------------------------------------------------------
*/
- htri_t H5MF_aggrs_try_shrink_eoa(H5F_t * f)
+ htri_t 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);
@@ -929,4 +929,4 @@ done:
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 8530e6e..7b89fd8 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5MFdbg.c
* Jan 31 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File memory management debugging functions.
*
@@ -84,7 +84,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
*
*-------------------------------------------------------------------------
@@ -111,11 +110,11 @@ H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata)
: (sect->sect_info.type == H5MF_FSPACE_SECT_SMALL
? "small"
: (sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown"))));
- HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth,
+ HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth,
"Section address:", sect->sect_info.addr);
- HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth,
+ HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth,
"Section size:", sect->sect_info.size);
- HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth,
+ HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth,
"End of section:", (haddr_t)((sect->sect_info.addr + sect->sect_info.size) - 1));
HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth,
"Section state:", (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized"));
@@ -137,7 +136,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* January 31 2008
*
*-------------------------------------------------------------------------
@@ -198,7 +196,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 31 2008
*
*-------------------------------------------------------------------------
@@ -226,7 +223,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
+ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", FUNC, eoa);
#endif /* H5MF_ALLOC_DEBUG */
if (H5F_PAGED_AGGR(f)) { /* File space paging */
@@ -268,15 +265,17 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
/* Retrieve metadata aggregator info, if available */
H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size,
- (haddr_t)((ma_addr + ma_size) - 1));
+ HDfprintf(stderr,
+ "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n",
+ FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve 'small data' aggregator info, if available */
H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size,
- (haddr_t)((sda_addr + sda_size) - 1));
+ HDfprintf(stderr,
+ "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n",
+ FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Iterate over all the free space types that have managers and dump each free list's space */
@@ -289,7 +288,8 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
/* Retrieve the 'eoa' for this file memory type */
if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, atype)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3),
+ "eoa:", eoa);
/* Print header for sections */
HDfprintf(stream, "%*sSections:\n", indent + 3, "");
diff --git a/src/H5MFmodule.h b/src/H5MFmodule.h
index d4dd52b..9726cec 100644
--- a/src/H5MFmodule.h
+++ b/src/H5MFmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5MF package. Including this header means that the source file
* is part of the H5MF package.
*/
-#ifndef _H5MFmodule_H
-#define _H5MFmodule_H
+#ifndef H5MFmodule_H
+#define H5MFmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_RESOURCE
#define H5_MY_PKG_INIT NO
-#endif /* _H5MFmodule_H */
+#endif /* H5MFmodule_H */
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h
index 4f39a8b..f34c73e 100644
--- a/src/H5MFpkg.h
+++ b/src/H5MFpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5MF package!"
#endif
-#ifndef _H5MFpkg_H
-#define _H5MFpkg_H
+#ifndef H5MFpkg_H
+#define H5MFpkg_H
/* Get package's private header */
#include "H5MFprivate.h"
@@ -50,11 +50,12 @@
/* Free-space section types for file */
/* (values stored in free space data structures in file) */
-#define H5MF_FSPACE_SECT_SIMPLE 0 /* For non-paged aggregation: section is a range of actual bytes in file \
- */
-#define H5MF_FSPACE_SECT_SMALL \
- 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */
-#define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */
+/* For non-paged aggregation: section is a range of actual bytes in file */
+#define H5MF_FSPACE_SECT_SIMPLE 0
+/* For paged aggregation: "small" meta/raw data section which is < fsp_size) */
+#define H5MF_FSPACE_SECT_SMALL 1
+/* For paged aggregation: "large" Section which is >= fsp_size) */
+#define H5MF_FSPACE_SECT_LARGE 2
/* Get section class type based on size */
#define H5MF_SECT_CLASS_TYPE(F, S) \
@@ -167,9 +168,9 @@ typedef struct H5MF_fs_t {
/*****************************/
/* H5MF single section inherits serializable properties from H5FS_section_class_t */
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1];
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1];
/******************************/
/* Package Private Prototypes */
@@ -190,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, H5MF_free_section_t *sect,
@@ -205,4 +207,4 @@ H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream);
#ifdef H5MF_TESTING
#endif /* H5MF_TESTING */
-#endif /* _H5MFpkg_H */
+#endif /* H5MFpkg_H */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 6c3f760..292e85c 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,14 +15,14 @@
*
* Created: H5MFprivate.h
* Jul 11 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Private header file for file memory management.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5MFprivate_H
-#define _H5MFprivate_H
+#ifndef H5MFprivate_H
+#define H5MFprivate_H
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
@@ -63,7 +63,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);
@@ -82,4 +81,4 @@ H5_DLL herr_t H5MF_tidy_self_referential_fsm_hack(H5F_t *f);
H5_DLL herr_t H5MF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth);
#endif /* H5MF_DEBUGGING */
-#endif /* end _H5MFprivate_H */
+#endif /* end H5MFprivate_H */
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 443945d..bf5b888 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
* Purpose: Free space section callbacks for file.
@@ -81,7 +81,7 @@ static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *udata);
/*********************/
/* Class info for "simple" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_SIMPLE, /* Section type */
0, /* Extra serialized size */
@@ -107,7 +107,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
}};
/* Class info for "small" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_SMALL, /* Section type */
0, /* Extra serialized size */
@@ -133,7 +133,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
}};
/* Class info for "large" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_LARGE, /* Section type */
0, /* Extra serialized size */
@@ -181,7 +181,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 62fc3f3..b4447f6 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5MM.c
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Memory management functions
*
@@ -102,8 +102,8 @@ static H5MM_block_t H5MM_block_head_s;
/* Statistics about block allocations */
static unsigned long long H5MM_total_alloc_bytes_s = 0;
-static unsigned long long H5MM_curr_alloc_bytes_s = 0;
-static unsigned long long H5MM_peak_alloc_bytes_s = 0;
+static size_t H5MM_curr_alloc_bytes_s = 0;
+static size_t H5MM_peak_alloc_bytes_s = 0;
static size_t H5MM_max_block_size_s = 0;
static size_t H5MM_total_alloc_blocks_count_s = 0;
static size_t H5MM_curr_alloc_blocks_count_s = 0;
@@ -225,7 +225,7 @@ H5MM_final_sanity_check(void)
HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s);
#ifdef H5MM_PRINT_MEMORY_STATS
HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s);
- HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s);
+ HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %zu\n", __func__, H5MM_peak_alloc_bytes_s);
HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s);
HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__,
H5MM_total_alloc_blocks_count_s);
@@ -449,11 +449,17 @@ H5MM_xstrdup(const char *s)
FUNC_ENTER_NOAPI(NULL)
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
if (s) {
if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDstrcpy(ret_value, s);
- } /* end if */
+ }
+#else
+ if (s)
+ if (NULL == (ret_value = HDstrdup(s)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed")
+#endif
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -483,10 +489,15 @@ H5MM_strdup(const char *s)
FUNC_ENTER_NOAPI(NULL)
if (!s)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "null string")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed")
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDstrcpy(ret_value, s);
+#else
+ if (NULL == (ret_value = HDstrdup(s)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed")
+#endif
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -551,6 +562,30 @@ H5MM_xfree(void *mem)
} /* end H5MM_xfree() */
/*-------------------------------------------------------------------------
+ * Function: H5MM_xfree_const
+ *
+ * Purpose: H5MM_xfree() wrapper that handles const pointers without
+ * warnings. Used for freeing buffers that should be regarded
+ * as const in use but need to be freed when no longer needed.
+ *
+ * Return: Success: NULL
+ * Failure: never fails
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_xfree_const(const void *mem)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Cast through uintptr_t to de-const memory */
+ H5MM_xfree((void *)(uintptr_t)mem);
+
+ FUNC_LEAVE_NOAPI(NULL)
+} /* end H5MM_xfree_const() */
+
+/*-------------------------------------------------------------------------
* Function: H5MM_memcpy
*
* Purpose: Like memcpy(3) but with sanity checks on the parameters,
@@ -584,3 +619,45 @@ H5MM_memcpy(void *dest, const void *src, size_t n)
FUNC_LEAVE_NOAPI(ret)
} /* end H5MM_memcpy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_get_alloc_stats
+ *
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. If the macro is not
+ * defined, zeros are returned. These statistics are global for the
+ * entire library.
+ *
+ * Parameters:
+ * H5_alloc_stats_t *stats; OUT: Memory allocation statistics
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, March 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5MM_get_alloc_stats(H5_alloc_stats_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+ if (stats) {
+ stats->total_alloc_bytes = H5MM_total_alloc_bytes_s;
+ stats->curr_alloc_bytes = H5MM_curr_alloc_bytes_s;
+ stats->peak_alloc_bytes = H5MM_peak_alloc_bytes_s;
+ stats->max_block_size = H5MM_max_block_size_s;
+ stats->total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s;
+ stats->curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s;
+ stats->peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s;
+ } /* end if */
+#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
+ if (stats)
+ HDmemset(stats, 0, sizeof(H5_alloc_stats_t));
+#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5MM_get_alloc_stats() */
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index ef36a17..bb846f4 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,14 +15,14 @@
*
* Created: H5MMprivate.h
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Private header for memory management.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5MMprivate_H
-#define _H5MMprivate_H
+#ifndef H5MMprivate_H
+#define H5MMprivate_H
#include "H5MMpublic.h"
@@ -39,16 +39,18 @@
/*
* Library prototypes...
*/
-H5_DLL void *H5MM_malloc(size_t size);
-H5_DLL void *H5MM_calloc(size_t size);
-H5_DLL void *H5MM_realloc(void *mem, size_t size);
-H5_DLL char *H5MM_xstrdup(const char *s);
-H5_DLL char *H5MM_strdup(const char *s);
-H5_DLL void *H5MM_xfree(void *mem);
-H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
-#if defined H5_MEMORY_ALLOC_SANITY_CHECK
-H5_DLL void H5MM_sanity_check_all(void);
-H5_DLL void H5MM_final_sanity_check(void);
+H5_DLL void * H5MM_malloc(size_t size);
+H5_DLL void * H5MM_calloc(size_t size);
+H5_DLL void * H5MM_realloc(void *mem, size_t size);
+H5_DLL char * H5MM_xstrdup(const char *s);
+H5_DLL char * H5MM_strdup(const char *s);
+H5_DLL void * H5MM_xfree(void *mem);
+H5_DLL void * H5MM_xfree_const(const void *mem);
+H5_DLL void * H5MM_memcpy(void *dest, const void *src, size_t n);
+H5_DLL herr_t H5MM_get_alloc_stats(H5_alloc_stats_t *stats);
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
+H5_DLL void H5MM_sanity_check_all(void);
+H5_DLL void H5MM_final_sanity_check(void);
#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
-#endif /* _H5MMprivate_H */
+#endif /* H5MMprivate_H */
diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h
index f66fafb..70ac644 100644
--- a/src/H5MMpublic.h
+++ b/src/H5MMpublic.h
@@ -6,33 +6,36 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5MMproto.h
+ * Created: H5MMpublic.h
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Public declarations for the H5MM (memory management)
* package.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifndef _H5MMpublic_H
-#define _H5MMpublic_H
+#ifndef H5MMpublic_H
+#define H5MMpublic_H
/* Public headers needed by this file */
#include "H5public.h"
/* These typedefs are currently used for VL datatype allocation/freeing */
+//! <!-- [H5MM_allocate_t_snip] -->
typedef void *(*H5MM_allocate_t)(size_t size, void *alloc_info);
+//! <!-- [H5MM_allocate_t_snip] -->
+
+//! <!-- [H5MM_free_t_snip] -->
typedef void (*H5MM_free_t)(void *mem, void *free_info);
+//! <!-- [H5MM_free_t_snip] -->
#ifdef __cplusplus
extern "C" {
@@ -41,4 +44,4 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-#endif /* _H5MMpublic_H */
+#endif /* H5MMpublic_H */
diff --git a/src/H5MP.c b/src/H5MP.c
index f52bb6b..474a995 100644
--- a/src/H5MP.c
+++ b/src/H5MP.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5MP.c
* May 2 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Implements memory pools. (Similar to Apache's APR
* memory pools)
@@ -76,7 +76,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
*
*-------------------------------------------------------------------------
@@ -118,26 +117,25 @@ done:
} /* end H5MP_create() */
/*-------------------------------------------------------------------------
- * 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);
@@ -156,9 +154,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);
@@ -184,7 +179,7 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5MP_new_page() */
+} /* end H5MP__new_page() */
/*-------------------------------------------------------------------------
* Function: H5MP_malloc
@@ -194,7 +189,6 @@ done:
* Return: Pointer to the space allocated on success/NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2005
*
*-------------------------------------------------------------------------
@@ -215,10 +209,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) {
@@ -267,7 +257,7 @@ H5MP_malloc(H5MP_pool_t *mp, size_t request)
(needed > mp->max_size) ? (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 */
@@ -315,9 +305,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)
@@ -331,7 +318,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?
@@ -361,9 +347,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;
@@ -420,7 +403,6 @@ H5MP_free(H5MP_pool_t *mp, void *spc)
* 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 70e457a..8e34598 100644
--- a/src/H5MPmodule.h
+++ b/src/H5MPmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5MP package. Including this header means that the source file
* is part of the H5MP package.
*/
-#ifndef _H5MPmodule_H
-#define _H5MPmodule_H
+#ifndef H5MPmodule_H
+#define H5MPmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_RESOURCE
#define H5_MY_PKG_INIT NO
-#endif /* _H5MPmodule_H */
+#endif /* H5MPmodule_H */
diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h
index 4011f46..64c5293 100644
--- a/src/H5MPpkg.h
+++ b/src/H5MPpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Monday, May 2, 2005
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5MP package!"
#endif
-#ifndef _H5MPpkg_H
-#define _H5MPpkg_H
+#ifndef H5MPpkg_H
+#define H5MPpkg_H
/* Get package's private header */
#include "H5MPprivate.h" /* Memory Pools */
@@ -96,4 +96,4 @@ H5_DLL herr_t H5MP_get_page_free_size(const H5MP_page_t *mp, size_t *page);
H5_DLL herr_t H5MP_get_page_next_page(const H5MP_page_t *page, H5MP_page_t **next_page);
#endif /* H5MP_TESTING */
-#endif /* _H5MPpkg_H */
+#endif /* H5MPpkg_H */
diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h
index 22e36cc..2b06650 100644
--- a/src/H5MPprivate.h
+++ b/src/H5MPprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
*
* Created: H5MPprivate.h
* May 2 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Private header for memory pool routines.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5MPprivate_H
-#define _H5MPprivate_H
+#ifndef H5MPprivate_H
+#define H5MPprivate_H
/* Include package's public header (not yet) */
/* #include "H5MPpublic.h" */
@@ -54,4 +54,4 @@ H5_DLL void * H5MP_malloc(H5MP_pool_t *mp, size_t request);
H5_DLL void * H5MP_free(H5MP_pool_t *mp, void *spc);
H5_DLL herr_t H5MP_close(H5MP_pool_t *mp);
-#endif /* _H5MPprivate_H */
+#endif /* H5MPprivate_H */
diff --git a/src/H5MPtest.c b/src/H5MPtest.c
index 9fb7c5f..27e7bbe 100644
--- a/src/H5MPtest.c
+++ b/src/H5MPtest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Tuesday, May 3, 2005
*
* Purpose: Memory pool testing functions.
@@ -41,8 +41,6 @@
* Programmer: Quincey Koziol
* Tuesday, May 3, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -72,8 +70,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
@@ -106,8 +102,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
@@ -141,10 +135,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)
@@ -157,10 +147,6 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp)
/* 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)
@@ -180,8 +166,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, May 3, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -211,8 +195,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/H5Mmodule.h b/src/H5Mmodule.h
index ab84a9a..3dae3e2 100644
--- a/src/H5Mmodule.h
+++ b/src/H5Mmodule.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
* H5M package. Including this header means that the source file
* is part of the H5M package.
*/
-#ifndef _H5Mmodule_H
-#define _H5Mmodule_H
+#ifndef H5Mmodule_H
+#define H5Mmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -26,4 +26,49 @@
#define H5_MY_PKG_ERR H5E_MAP
#define H5_MY_PKG_INIT YES
-#endif /* _H5Dmodule_H */
+/**
+ * \defgroup H5M H5M
+ * \brief Map Interface
+ *
+ * \details \Bold{The interface can only be used with the HDF5 VOL connectors that
+ * implement map objects.} The native HDF5 library does not support this
+ * feature.
+ *
+ * While the HDF5 data model is a flexible way to store data, some
+ * applications require a more general way to index information. HDF5
+ * effectively uses key-value stores internally for a variety of
+ * purposes, but it does not expose a generic key-value store to the
+ * API. The Map APIs provide this capability to the HDF5 applications
+ * in the form of HDF5 map objects. These Map objects contain
+ * application-defined key-value stores, to which key-value pairs can
+ * be added, and from which values can be retrieved by key.
+ *
+ * HDF5 VOL connectors with support for map objects:
+ * - DAOS
+ *
+ * \par Example:
+ * \code
+ * hid_t file_id, fapl_id, map_id, vls_type_id;
+ * const char *names[2] = ["Alice", "Bob"];
+ * uint64_t IDs[2] = [25385486, 34873275];
+ * uint64_t val_out;
+ *
+ * <HDF5 VOL setup code ....>
+ *
+ * vls_type_id = H5Tcopy(H5T_C_S1);
+ * H5Tset_size(vls_type_id, H5T_VARIABLE);
+ * file_id = H5Fcreate("file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ * map_id = H5Mcreate(file_id, "map", vls_type_id, H5T_NATIVE_UINT64, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ * H5Mput(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &IDs[0], H5P_DEFAULT);
+ * H5Mput(map_id, vls_type_id, &names[1], H5T_NATIVE_UINT64, &IDs[1], H5P_DEFAULT);
+ * H5Mget(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &val_out, H5P_DEFAULT);
+ * if(val_out != IDs[0])
+ * ERROR;
+ * H5Mclose(map_id);
+ * H5Tclose(vls_type_id);
+ * H5Fclose(file_id);
+ * \endcode
+ *
+ */
+
+#endif /* H5Dmodule_H */
diff --git a/src/H5Mpkg.h b/src/H5Mpkg.h
index 56d1943..be6749b 100644
--- a/src/H5Mpkg.h
+++ b/src/H5Mpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,8 +20,8 @@
#error "Do not include this file outside the H5M package!"
#endif
-#ifndef _H5Mpkg_H
-#define _H5Mpkg_H
+#ifndef H5Mpkg_H
+#define H5Mpkg_H
/* Get package's private header */
#include "H5Mprivate.h"
@@ -44,4 +44,4 @@
/* Package Private Prototypes */
/******************************/
-#endif /*_H5Dpkg_H*/
+#endif /*H5Dpkg_H*/
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index 7adc97e..1a2524e 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5M module
*/
-#ifndef _H5Mprivate_H
-#define _H5Mprivate_H
+#ifndef H5Mprivate_H
+#define H5Mprivate_H
/* Include package's public header */
#include "H5Mpublic.h"
@@ -75,4 +75,4 @@ H5_DLL herr_t H5M_init(void);
/* Library Private Prototypes */
/******************************/
-#endif /* _H5Mprivate_H */
+#endif /* H5Mprivate_H */
diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h
index 643a1e6..f645bc9 100644
--- a/src/H5Mpublic.h
+++ b/src/H5Mpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,8 +17,8 @@
* NOTE: This is an experimental API. Everything in the H5M package
* is subject to revision in a future release.
*/
-#ifndef _H5Mpublic_H
-#define _H5Mpublic_H
+#ifndef H5Mpublic_H
+#define H5Mpublic_H
/* System headers needed by this file */
@@ -61,8 +61,12 @@ typedef enum H5VL_map_specific_t {
H5VL_MAP_DELETE /* H5Mdelete */
} H5VL_map_specific_t;
-/* Callback for H5Miterate() */
+//! <!-- [H5M_iterate_t_snip] -->
+/**
+ * Callback for H5Miterate()
+ */
typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data);
+//! <!-- [H5M_iterate_t_snip] -->
/********************/
/* Public Variables */
@@ -81,25 +85,359 @@ extern "C" {
*/
#ifdef H5_HAVE_MAP_API
+/**
+ * \ingroup H5M
+ *
+ * \brief Creates a map object
+ *
+ * \fgdta_loc_id
+ * \param[in] name Map object name
+ * \type_id{key_type_id}
+ * \type_id{val_type_id}
+ * \lcpl_id
+ * \mcpl_id
+ * \mapl_id
+ * \returns \hid_t{map object}
+ *
+ * \details H5Mcreate() creates a new map object for storing key-value
+ * pairs. The in-file datatype for keys is defined by \p key_type_id
+ * and the in-file datatype for values is defined by \p val_type_id. \p
+ * loc_id specifies the location to create the the map object and \p
+ * name specifies the name of the link to the map object relative to
+ * \p loc_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id,
hid_t mcpl_id, hid_t mapl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief
+ *
+ * \details
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Opens a map object
+ *
+ * \fgdta_loc_id{loc_id}
+ * \param[in] name Map object name relative to \p loc_id
+ * \mapl_id
+ * \returns \hid_t{map object}
+ *
+ * \details H5Mopen() finds a map object specified by \p name under the location
+ * specified by \p loc_id. The map object should be close with
+ * H5Mclose() when the application is not longer interested in
+ * accessing it.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Terminates access to a map object
+ *
+ * \map_id
+ * \returns \herr_t
+ *
+ * \details H5Mclose() closes access to a map object specified by \p map_id and
+ * releases resources used by it.
+ *
+ * It is illegal to subsequently use that same map identifier in calls
+ * to other map functions.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mclose(hid_t map_id);
-H5_DLL hid_t H5Mget_key_type(hid_t map_id);
-H5_DLL hid_t H5Mget_val_type(hid_t map_id);
-H5_DLL hid_t H5Mget_create_plist(hid_t map_id);
-H5_DLL hid_t H5Mget_access_plist(hid_t map_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Gets key datatype for a map object
+ *
+ * \map_id
+ * \returns \hid_t{datatype}
+ *
+ * \details H5Mget_key_type() retrieves key datatype as stored in the file for a
+ * map object specified by \p map_id and returns identifier for the
+ * datatype.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5Mget_key_type(hid_t map_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Gets value datatype for a map object
+ *
+ * \map_id
+ * \returns \hid_t{datatype}
+ *
+ * \details H5Mget_val_type() retrieves value datatype as stored in the file for
+ * a map object specified by \p map_id and returns identifier for the
+ * datatype .
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5Mget_val_type(hid_t map_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Gets creation property list for a map object
+ *
+ * \map_id
+ * \returns \hid_t{map creation property list}
+ *
+ * \details H5Mget_create_plist() returns an identifier for a copy of the
+ * creation property list for a map object specified by \p map_id.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL hid_t H5Mget_create_plist(hid_t map_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Gets access property list for a map object
+ *
+ * \map_id
+ * \returns \hid_t{map access property list}
+ *
+ * \details H5Mget_access_plist() returns an identifier for a copy of the access
+ * property list for a map object specified by \p map_id.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5Mget_access_plist(hid_t map_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Retrieves the number of key-value pairs in a map object
+ *
+ * \map_id
+ * \param[out] count The number of key-value pairs stored in the map object
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Mget_count() retrieves the number of key-value pairs stored in a
+ * map specified by map_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Adds a key-value pair to a map object
+ *
+ * \map_id
+ * \type_id{key_mem_type_id}
+ * \param[in] key Pointer to key buffer
+ * \type_id{val_mem_type_id}
+ * \param[in] value Pointer to value buffer
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Mput() adds a key-value pair to a map object specified by \p
+ * map_id, or updates the value for the specified key if one was set
+ * previously.
+ *
+ * \p key_mem_type_id and \p val_mem_type_id specify the datatypes for
+ * the provided key and value buffers, and if different from those used
+ * to create the map object, the key and value will be internally
+ * converted to the datatypes for the map object.
+ *
+ * Any further options can be specified through the property list
+ * \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id,
const void *value, hid_t dxpl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Retrieves a key-value pair from a map object
+ *
+ * \map_id
+ * \type_id{key_mem_type_id}
+ * \param[in] key Pointer to key buffer
+ * \type_id{val_mem_type_id}
+ * \param[out] value Pointer to value buffer
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Mget() retrieves from a map object specified by \p map_id, the
+ * value associated with the provided key \p key. \p key_mem_type_id
+ * and \p val_mem_type_id specify the datatypes for the provided key
+ * and value buffers. If if the datatype specified by \p
+ * key_mem_type_id is different from that used to create the map object
+ * the key will be internally converted to the datatype for the map
+ * object for the query, and if the datatype specified by \p
+ * val_mem_type_id is different from that used to create the map object
+ * the returned value will be converted to have a datatype as specified
+ * by \p val_mem_type_id before the function returns.
+ *
+ * Any further options can be specified through the property list
+ * \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value,
hid_t dxpl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Checks if provided key exists in a map object
+ *
+ * \map_id
+ * \type_id{key_mem_type_id}
+ * \param[in] key Pointer to key buffer
+ * \param[out] exists Pointer to a buffer to return the existence status
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Mexists() checks if the provided key is stored in the map object
+ * specified by \p map_id. If \p key_mem_type_id is different from that
+ * used to create the map object the key will be internally converted
+ * to the datatype for the map object for the query.
+ *
+ * Any further options can be specified through the property list
+ * \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Iterates over all key-value pairs in a map object
+ *
+ * \map_id
+ * \param[in,out] idx iteration index
+ * \type_id{key_mem_type_id}
+ * \param[in] op User-defined iterator function
+ * \op_data
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Miterate() iterates over all key-value pairs stored in the map
+ * object specified by \p map_id, making the callback specified by \p
+ * op for each. The \p idx parameter is an in/out parameter that may be
+ * used to restart a previously interrupted iteration. At the start of
+ * iteration \p idx should be set to 0, and to restart iteration at the
+ * same location on a subsequent call to H5Miterate(), \p idx should be
+ * the same value as returned by the previous call. Iterate callback is
+ * defined as:
+ * \snippet this H5M_iterate_t_snip
+ * The \p key parameter is the buffer for the key for this iteration,
+ * converted to the datatype specified by \p key_mem_type_id. The \p
+ * op_data parameter is a simple pass through of the value passed to
+ * H5Miterate(), which can be used to store application-defined data for
+ * iteration. A negative return value from this function will cause
+ * H5Miterate() to issue an error, while a positive return value will
+ * cause H5Miterate() to stop iterating and return this value without
+ * issuing an error. A return value of zero allows iteration to continue.
+ *
+ * Any further options can be specified through the property list \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data,
hid_t dxpl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Iterates over all key-value pairs in a map object
+ *
+ * \loc_id
+ * \param[in] map_name Map object name relative to the location specified by \p loc_id
+ * \param[in,out] idx Iteration index
+ * \type_id{key_mem_type_id}
+ * \param[in] op User-defined iterator function
+ * \op_data
+ * \dxpl_id
+ * \lapl_id
+ * \returns \herr_t
+ *
+ * \details H5Miterate_by_name() iterates over all key-value pairs stored in the
+ * map object specified by \p map_id, making the callback specified by
+ * \p op for each. The \p idx parameter is an in/out parameter that may
+ * be used to restart a previously interrupted iteration. At the start
+ * of iteration \p idx should be set to 0, and to restart iteration at
+ * the same location on a subsequent call to H5Miterate(), \p idx
+ * should be the same value as returned by the previous call. Iterate
+ * callback is defined as:
+ * \snippet this H5M_iterate_t_snip
+ * The\p key parameter is the buffer for the key for this iteration,
+ * converted to the datatype specified by \p key_mem_type_id. The \p
+ * op_data parameter is a simple pass through of the value passed to
+ * H5Miterate(), which can be used to store application-defined data
+ * for iteration. A negative return value from this function will cause
+ * H5Miterate() to issue an error, while a positive return value will cause
+ * H5Miterate() to stop iterating and return this value without issuing an
+ * error. A return value of zero allows iteration to continue.
+ *
+ * Any further options can be specified through the property list \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id,
H5M_iterate_t op, void *op_data, hid_t dxpl_id, hid_t lapl_id);
+
+/**
+ * \ingroup H5M
+ *
+ * \brief Deletes a key-value pair from a map object
+ *
+ * \map_id
+ * \type_id{key_mem_type_id}
+ * \param[in] key Pointer to key buffer
+ * \dxpl_id
+ * \returns \herr_t
+ *
+ * \details H5Mdelete() deletes a key-value pair from the map object specified
+ * by \p map_id. \p key_mem_type_id specifies the datatype for the
+ * provided key buffer key, and if different from that used to create
+ * the map object, the key will be internally converted to the datatype
+ * for the map object.
+ *
+ * Any further options can be specified through the property list \p dxpl_id.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
@@ -115,4 +453,4 @@ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hi
}
#endif
-#endif /* _H5Mpublic_H */
+#endif /* H5Mpublic_H */
diff --git a/src/H5O.c b/src/H5O.c
index e5d794c..72f9d42 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index 24acc29..10c9ede 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Oainfo.c
* Mar 6 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Attribute Information messages.
*
@@ -34,13 +34,13 @@
/* 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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *udata);
+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, H5O_copy_t *cpy_info, void *udata);
static herr_t H5O__ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
@@ -54,16 +54,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 */
@@ -91,7 +91,6 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 6 2007
*
*-------------------------------------------------------------------------
@@ -157,25 +156,24 @@ done:
} /* end H5O__ainfo_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -207,10 +205,10 @@ 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.
@@ -219,19 +217,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);
@@ -246,10 +243,10 @@ 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.
@@ -259,18 +256,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 =
@@ -284,7 +280,7 @@ H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void
: 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() */
/*-------------------------------------------------------------------------
* Function: H5O__ainfo_free
@@ -348,7 +344,7 @@ done:
} /* end H5O__ainfo_delete() */
/*-------------------------------------------------------------------------
- * Function: H5O_ainfo_pre_copy_file
+ * Function: H5O__ainfo_pre_copy_file
*
* Purpose: Perform any necessary actions before copying message between
* files.
@@ -362,10 +358,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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)
+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);
@@ -378,7 +374,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() */
/*-------------------------------------------------------------------------
* Function: H5O__ainfo_copy_file
@@ -486,7 +482,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 6 2007
*
*-------------------------------------------------------------------------
@@ -505,18 +500,18 @@ H5O__ainfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "Track creation order of attributes:", ainfo->track_corder);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "Index creation order of attributes:", ainfo->index_corder);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Track creation order of attributes:", ainfo->track_corder ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index creation order of attributes:", ainfo->index_corder ? "TRUE" : "FALSE");
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. creation index value:", (unsigned)ainfo->max_crt_idx);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' attribute storage fractal heap address:", ainfo->fheap_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' attribute storage name index v2 B-tree address:", ainfo->name_bt2_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' attribute storage creation order index v2 B-tree address:", ainfo->corder_bt2_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index e411854..bad89ae 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Oalloc.c
* Nov 17 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object header allocation routines.
*
@@ -94,7 +94,6 @@ H5FL_EXTERN(H5O_cont_t);
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 17 2006
*
*-------------------------------------------------------------------------
@@ -220,7 +219,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 17 2006
*
*-------------------------------------------------------------------------
@@ -318,7 +316,6 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *g
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 22 2006
*
*-------------------------------------------------------------------------
@@ -428,7 +425,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Nov 21 2005
*
*-------------------------------------------------------------------------
@@ -715,7 +711,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Oct 21 2016
*
*-------------------------------------------------------------------------
@@ -865,7 +860,6 @@ H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size_t *size, H5O_
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Oct 21 2016
*
*-------------------------------------------------------------------------
@@ -1147,7 +1141,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 7 1997
*
*-------------------------------------------------------------------------
@@ -1197,7 +1190,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@lbl.gov
* Oct 21 2016
*
*-------------------------------------------------------------------------
@@ -1242,10 +1234,10 @@ H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx)
/* Keep first one found */
if (found_null < 0)
found_null = (ssize_t)idx;
- else
- /* Check for better fit */
- if (oh->mesg[idx].raw_size < oh->mesg[found_null].raw_size)
+ /* Check for better fit */
+ else if (oh->mesg[idx].raw_size < oh->mesg[found_null].raw_size) {
found_null = (ssize_t)idx;
+ }
else {
/* If they are the same size, choose the one in the earliest chunk */
if (oh->mesg[idx].raw_size == oh->mesg[found_null].raw_size) {
@@ -1271,7 +1263,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
*
*-------------------------------------------------------------------------
@@ -1355,7 +1346,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 22 2006
*
*-------------------------------------------------------------------------
@@ -1597,7 +1587,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Oct 17 2005
*
*-------------------------------------------------------------------------
@@ -1976,7 +1965,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Oct 10 2005
*
*-------------------------------------------------------------------------
@@ -2017,8 +2005,8 @@ H5O__merge_null(H5F_t *f, H5O_t *oh)
for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) {
if (u != v && H5O_NULL_ID == curr_msg2->type->id &&
curr_msg->chunkno == curr_msg2->chunkno) {
- ssize_t adj_raw; /* Amount to adjust raw message pointer */
- size_t adj_raw_size; /* Amount to adjust raw message size */
+ ssize_t adj_raw = 0; /* Amount to adjust raw message pointer */
+ size_t adj_raw_size = 0; /* Amount to adjust raw message size */
/* Check for second message after first message */
if ((curr_msg->raw + curr_msg->raw_size) ==
@@ -2125,7 +2113,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Oct 17 2005
*
*-------------------------------------------------------------------------
@@ -2314,7 +2301,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Oct 4 2005
*
*-------------------------------------------------------------------------
@@ -2374,7 +2360,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 c3fda12..db53eaf 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,65 +23,65 @@
#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, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
+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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *udata);
+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, H5O_copy_t *cpy_info, void *udata);
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 */
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
- H5O_ATTR_ID, /* message id number */
- "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_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_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_ID, /* message id number */
+ "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_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_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 */
}};
/* Flags for attribute flag encoding */
@@ -97,14 +97,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
@@ -114,8 +117,8 @@ 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 */
@@ -126,7 +129,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, un
unsigned flags = 0; /* Attribute flags */
H5A_t * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -235,6 +238,11 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, un
/* 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);
@@ -259,15 +267,15 @@ 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
@@ -278,7 +286,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 */
@@ -287,7 +295,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);
@@ -367,15 +375,15 @@ 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
@@ -385,11 +393,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);
@@ -400,15 +408,15 @@ 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
@@ -419,13 +427,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);
@@ -460,7 +468,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() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_reset
@@ -589,7 +597,7 @@ done:
} /* end H5O__attr_link() */
/*-------------------------------------------------------------------------
- * 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.
@@ -602,13 +610,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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)
+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);
@@ -629,7 +637,7 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, h
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_pre_copy_file() */
+} /* end H5O__attr_pre_copy_file() */
/*-------------------------------------------------------------------------
* Function: H5O__attr_copy_file
@@ -705,7 +713,7 @@ done:
} /* H5O__attr_post_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_get_crt_index
+ * Function: H5O__attr_get_crt_index
*
* Purpose: Get creation index from the message
*
@@ -717,11 +725,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);
@@ -730,10 +738,10 @@ 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
*
@@ -745,11 +753,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);
@@ -757,7 +765,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() */
/*--------------------------------------------------------------------------
NAME
@@ -828,8 +836,9 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt
break;
} /* end switch */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Object opened:", mesg->obj_opened);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object:", mesg->oloc.addr);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Object opened:", mesg->obj_opened ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr);
/* Check for attribute creation order index on the attribute */
if (mesg->shared->crt_idx != H5O_MAX_CRT_ORDER_IDX)
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 0406bbc..b21a654 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -6,14 +6,14 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5Oattribute.c
+ * Created: H5Oattribute.c
*
* Purpose: Object header attribute routines.
*
@@ -141,7 +141,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
*
*-------------------------------------------------------------------------
@@ -383,7 +382,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 11 2006
*
*-------------------------------------------------------------------------
@@ -528,7 +526,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2006
*
*-------------------------------------------------------------------------
@@ -711,7 +708,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jan 2 2007
*
*-------------------------------------------------------------------------
@@ -785,7 +781,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 4 2006
*
*-------------------------------------------------------------------------
@@ -943,7 +938,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 5 2006
*
*-------------------------------------------------------------------------
@@ -989,7 +983,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
*
*-------------------------------------------------------------------------
@@ -1451,7 +1444,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 11 2006
*
*-------------------------------------------------------------------------
@@ -1678,7 +1670,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);
@@ -1711,7 +1703,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 */
/*-------------------------------------------------------------------------
@@ -1723,7 +1715,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 11 2006
*
*-------------------------------------------------------------------------
@@ -1904,48 +1895,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 400f8f4..c7fcdb9 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Obogus.c
* Jan 21 2003
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: "bogus" message. This message is guaranteed to never
* be found in a valid HDF5 file and is only used to
@@ -38,8 +38,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);
/* This message derives from H5O message class */
@@ -49,9 +49,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 */
@@ -73,9 +73,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 */
@@ -101,7 +101,6 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jan 21 2003
*
*-------------------------------------------------------------------------
@@ -141,23 +140,22 @@ done:
} /* end H5O__bogus_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -168,10 +166,10 @@ 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
@@ -183,19 +181,18 @@ 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() */
/*-------------------------------------------------------------------------
* Function: H5O__bogus_debug
@@ -205,11 +202,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 b63f338..a783366 100644
--- a/src/H5Obtreek.c
+++ b/src/H5Obtreek.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Thursday, March 1, 2007
*
* Purpose: A message holding non-default v1 B-tree 'K' value
@@ -25,11 +25,11 @@
#include "H5Opkg.h" /* Object headers */
#include "H5MMprivate.h" /* Memory management */
-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 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_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
/* This message derives from H5O message class */
@@ -37,11 +37,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 */
@@ -60,7 +60,7 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{
#define H5O_BTREEK_VERSION 0
/*-------------------------------------------------------------------------
- * 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.
@@ -74,13 +74,13 @@ 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, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+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);
@@ -104,10 +104,10 @@ H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign
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.
*
@@ -119,12 +119,12 @@ 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);
@@ -138,10 +138,10 @@ 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.
@@ -155,13 +155,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);
@@ -178,10 +178,10 @@ 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.
@@ -195,12 +195,12 @@ 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;
+ size_t ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(f);
@@ -211,7 +211,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() */
/*-------------------------------------------------------------------------
* Function: H5O__btreek_debug
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index e47babe..62dc2f2 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ocache.c
* Sep 28 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Object header metadata cache virtual functions.
*
@@ -275,7 +275,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
@@ -1053,7 +1053,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 12, 2008
*
*-------------------------------------------------------------------------
@@ -1271,7 +1270,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 12, 2008
*
*-------------------------------------------------------------------------
@@ -1337,7 +1335,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Check for magic # on chunks > 0 in later versions of the format */
else if (chunkno > 0 && oh->version > H5O_VERSION_1) {
/* Magic number */
- if (HDmemcmp(chunk_image, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(chunk_image, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "wrong object header chunk signature")
chunk_image += H5_SIZEOF_MAGIC;
} /* end if */
@@ -1617,7 +1615,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 1fb497a..2603f71 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -281,37 +281,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")
@@ -321,11 +292,8 @@ 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 {
- 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")
- }
-
+ 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:
@@ -358,9 +326,10 @@ H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Metadata Cache Image Block address:", mdci->addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Metadata Cache Image Block address:", mdci->addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
"Metadata Cache Image Block size in bytes:", mdci->size);
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 490e241..66e11c8 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ochunk.c
* Jul 13 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object header chunk routines.
*
@@ -74,7 +74,6 @@ H5FL_DEFINE(H5O_chunk_proxy_t);
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -136,14 +135,13 @@ done:
} /* end H5O__chunk_add() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -217,7 +215,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 17 2008
*
*-------------------------------------------------------------------------
@@ -268,7 +265,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 6 2010
*
*-------------------------------------------------------------------------
@@ -308,7 +304,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -348,7 +343,7 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__chunk_update_idx() */
/*-------------------------------------------------------------------------
@@ -359,7 +354,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -403,7 +397,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 6c9762a..080225a 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ocont.c
* Aug 6 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: The object header continuation message. This
* message is only generated and read from within
@@ -79,7 +79,6 @@ H5FL_DEFINE(H5O_cont_t);
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -121,7 +120,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 7 1997
*
*-------------------------------------------------------------------------
@@ -159,7 +157,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
*
*-------------------------------------------------------------------------
@@ -243,7 +240,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -262,7 +258,7 @@ H5O__cont_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Continuation address:", cont->addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Continuation address:", cont->addr);
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Continuation size in bytes:", (unsigned long)(cont->size));
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index a47fc24..6cf402b 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -244,7 +244,7 @@ done:
} /* end H5Ocopy() */
/*-------------------------------------------------------------------------
- * Function: H5O_copy
+ * Function: H5O__copy
*
* Purpose: Private version of H5Ocopy
*
@@ -256,8 +256,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-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)
+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 */
H5G_name_t src_path; /* Opened source object hier. path */
@@ -267,7 +267,7 @@ H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const c
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);
@@ -307,7 +307,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() */
/*-------------------------------------------------------------------------
* Function: H5O__copy_header_real
@@ -1283,10 +1283,10 @@ done:
} /* end H5O__copy_comm_dt_cmp */
/*-------------------------------------------------------------------------
- * 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.
@@ -1299,7 +1299,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 */
@@ -1308,7 +1308,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);
@@ -1361,10 +1361,10 @@ 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
@@ -1379,7 +1379,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t *udata)
+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 */
haddr_t * addr = NULL; /* Destination address */
@@ -1388,7 +1388,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t
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);
@@ -1457,7 +1457,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t
/* 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,
@@ -1479,14 +1479,14 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_copy_search_comm_dt_check */
+} /* end H5O__copy_search_comm_dt_check */
/*-------------------------------------------------------------------------
* Function: H5O__copy_search_comm_dt_cb
*
* 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
*
@@ -1529,7 +1529,7 @@ H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, const
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 */
@@ -1627,7 +1627,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i
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 a6d22de..f2372c1 100644
--- a/src/H5Ocopy_ref.c
+++ b/src/H5Ocopy_ref.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -170,31 +170,32 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, H5O_loc_t
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")
- } /* end for */
+ 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:
FUNC_LEAVE_NOAPI(ret_value)
@@ -232,43 +233,42 @@ H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc, const void *buf_src, H5O_loc_t
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 for */
+ } /* end else */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 6ee6cc0..2826bcd 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Odbg.c
* Nov 17 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object header debugging routines.
*
@@ -76,7 +76,6 @@
* Return: SUCCEED (Doesn't fail, just crashes)
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 17 2006
*
*-------------------------------------------------------------------------
@@ -146,8 +145,8 @@ H5O__assert(const H5O_t *oh)
/* Loop over all messages in object header */
for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- uint8_t *curr_hdr; /* Start of current message header */
- size_t curr_tot_size; /* Total size of current message (including header) */
+ uint8_t H5_ATTR_NDEBUG_UNUSED *curr_hdr; /* Start of current message header */
+ size_t curr_tot_size; /* Total size of current message (including header) */
curr_hdr = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh);
curr_tot_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
@@ -156,8 +155,8 @@ H5O__assert(const H5O_t *oh)
if (H5O_NULL_ID == curr_msg->type->id)
free_space += curr_tot_size;
else if (H5O_CONT_ID == curr_msg->type->id) {
- H5O_cont_t *cont = (H5O_cont_t *)curr_msg->native;
- hbool_t found_chunk = FALSE; /* Found a chunk that matches */
+ H5O_cont_t * cont = (H5O_cont_t *)curr_msg->native;
+ hbool_t H5_ATTR_NDEBUG_UNUSED found_chunk = FALSE; /* Found a chunk that matches */
HDassert(cont);
@@ -232,7 +231,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
*
*-------------------------------------------------------------------------
@@ -272,7 +270,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -298,7 +295,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
/* debug */
HDfprintf(stream, "%*sObject Header...\n", indent, "");
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Dirty:", oh->cache_info.is_dirty);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Dirty:", oh->cache_info.is_dirty ? "TRUE" : "FALSE");
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", oh->version);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Header size (in bytes):", (unsigned)H5O_SIZEOF_HDR(oh));
@@ -347,9 +345,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
} /* end if */
} /* end if */
- HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth,
"Number of messages (allocated):", oh->nmesgs, oh->alloc_nmesgs);
- HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks,
+ HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks,
oh->alloc_nchunks);
/* debug each chunk */
@@ -358,7 +356,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Address:", oh->chunk[i].addr);
/* Decrement chunk 0's size by the object header prefix size */
if (0 == i) {
@@ -373,9 +372,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
chunk_total += chunk_size;
gap_total += oh->chunk[i].gap;
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap);
} /* end for */
/* debug each message */
@@ -404,7 +403,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3),
"Message ID (sequence number):", (unsigned)(oh->mesg[i].type->id), oh->mesg[i].type->name,
sequence[oh->mesg[i].type->id]++);
- HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX(0, fwidth - 3), "Dirty:", oh->mesg[i].dirty);
+ HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3),
+ "Dirty:", oh->mesg[i].dirty ? "TRUE" : "FALSE");
HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3), "Message flags:");
if (oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
@@ -464,7 +464,7 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
chunkno = oh->mesg[i].chunkno;
if (chunkno >= oh->nchunks)
HDfprintf(stream, "*** BAD CHUNK NUMBER\n");
- HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s (%zu, %zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3),
"Raw message data (offset, size) in chunk:",
(size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size);
@@ -505,7 +505,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 460feae..2a0a321 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -6,14 +6,14 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * 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.
@@ -182,10 +182,10 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
/* Set the native fields */
if (shim_data->fields & H5O_INFO_HDR)
- HDmemcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
+ H5MM_memcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
if (shim_data->fields & H5O_INFO_META_SIZE) {
- HDmemcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
- HDmemcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
+ H5MM_memcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
+ H5MM_memcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
}
}
@@ -274,10 +274,10 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
/* Set the native fields */
if (fields & H5O_INFO_HDR)
- HDmemcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
+ H5MM_memcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
if (fields & H5O_INFO_META_SIZE) {
- HDmemcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
- HDmemcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
+ H5MM_memcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
+ H5MM_memcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
} /* end if */
} /* end if */
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index ac72b5f..8bebc6d 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Thursday, March 1, 2007
*
* Purpose: A message holding driver info settings
@@ -25,11 +25,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, 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 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_reset(void *_mesg);
static herr_t H5O__drvinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -38,16 +38,16 @@ 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 */
@@ -61,7 +61,7 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{
#define H5O_DRVINFO_VERSION 0
/*-------------------------------------------------------------------------
- * 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.
@@ -75,13 +75,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, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+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);
@@ -118,10 +119,10 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsig
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.
*
@@ -133,12 +134,12 @@ 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);
@@ -154,10 +155,10 @@ 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.
@@ -171,13 +172,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);
@@ -202,10 +203,10 @@ 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.
@@ -219,12 +220,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);
@@ -236,7 +237,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() */
/*-------------------------------------------------------------------------
* Function: H5O__drvinfo_reset
@@ -247,7 +248,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
*
*-------------------------------------------------------------------------
@@ -295,7 +295,7 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Buffer size:", mesg->len);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__drvinfo_debug() */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a3c3a29..1be9522 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -26,17 +26,17 @@
#include "H5VMprivate.h" /* Vectors and arrays */
/* 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, 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 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 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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *_udata);
+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, H5O_copy_t *cpy_info,
void *udata);
@@ -46,22 +46,22 @@ static herr_t H5O__dtype_debug(H5F_t *f, const void *_mesg, FILE *stream, int in
/* 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 */
@@ -90,26 +90,26 @@ 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
*
@@ -124,14 +124,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);
@@ -327,7 +327,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);
@@ -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
@@ -512,7 +512,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
@@ -577,19 +577,20 @@ 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)
+ if (dt->shared != NULL) {
+ HDassert(!dt->shared->owned_vol_obj);
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ } /* end if */
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.
*
@@ -605,7 +606,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;
@@ -613,7 +614,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);
@@ -978,7 +979,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 */
} break;
@@ -999,7 +1000,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 */
@@ -1036,7 +1037,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;
@@ -1074,7 +1075,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;
@@ -1093,19 +1094,22 @@ 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
@@ -1114,13 +1118,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,
- unsigned *ioflags /*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+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);
@@ -1130,7 +1134,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 */
@@ -1138,15 +1142,15 @@ 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
@@ -1158,12 +1162,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);
@@ -1171,20 +1175,20 @@ 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
@@ -1196,13 +1200,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);
@@ -1223,15 +1227,15 @@ 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
@@ -1242,13 +1246,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);
@@ -1311,12 +1315,12 @@ 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 */
@@ -1333,7 +1337,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:
@@ -1343,7 +1347,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:
@@ -1356,7 +1360,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg)
} /* end switch */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_dtype_size() */
+} /* H5O__dtype_size() */
/*-------------------------------------------------------------------------
* Function: H5O__dtype_reset
@@ -1415,7 +1419,7 @@ done:
} /* end H5O__dtype_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_dtype_set_share
+ * Function: H5O__dtype_set_share
*
* Purpose: Copies sharing information from SH into the message.
*
@@ -1427,12 +1431,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);
@@ -1463,10 +1467,10 @@ 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 +1486,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,10 +1510,10 @@ 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
@@ -1524,14 +1528,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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)
+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)
{
const H5T_t * dt_src = (const H5T_t *)mesg_src; /* Source datatype */
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);
@@ -1563,7 +1567,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_U
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_dtype_pre_copy_file() */
+} /* end H5O__dtype_pre_copy_file() */
/*-------------------------------------------------------------------------
* Function: H5O__dtype_copy_file
@@ -1589,7 +1593,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. */
@@ -1635,9 +1639,8 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, const
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 f95324d..d950249 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, November 25, 1997
*/
@@ -26,11 +26,11 @@
#include "H5Opkg.h" /* Object headers */
/* PRIVATE PROTOTYPES */
-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 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_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, H5O_copy_t *cpy_info, void *udata);
@@ -42,10 +42,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 */
@@ -63,7 +63,7 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
#define H5O_EFL_VERSION 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).
@@ -83,8 +83,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
*-------------------------------------------------------------------------
*/
static void *
-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)
+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)
{
H5O_efl_t * mesg = NULL;
int version;
@@ -93,7 +93,7 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED
size_t u; /* Local index variable */
void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(f);
@@ -172,10 +172,10 @@ 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.
*
@@ -187,12 +187,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);
@@ -230,10 +230,10 @@ 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.
@@ -248,7 +248,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;
@@ -256,7 +256,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);
@@ -296,10 +296,10 @@ 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
@@ -316,12 +316,12 @@ 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);
@@ -336,7 +336,7 @@ H5O_efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *
(size_t)H5F_SIZEOF_SIZE(f)); /*file size */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_efl_size() */
+} /* end H5O__efl_size() */
/*-------------------------------------------------------------------------
* Function: H5O__efl_reset
@@ -396,7 +396,7 @@ 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;
@@ -466,7 +466,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == (name_offset = H5HL_insert(file_dst, heap, (size_t)1, "")))
+ if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
HDassert(0 == name_offset);
@@ -483,10 +483,10 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
/* copy the name from the source */
for (idx = 0; idx < efl_src->nused; idx++) {
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
- if (UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert(
- file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name)))
+ if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
+ &(efl_dst->slot[idx].name_offset)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
- } /* end for */
+ }
/* Set return value */
ret_value = efl_dst;
@@ -529,28 +529,28 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int ind
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Heap address:", mesg->heap_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Heap address:", mesg->heap_addr);
- HDfprintf(stream, "%*s%-*s %u/%u\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused,
+ HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused,
mesg->nalloc);
for (u = 0; u < mesg->nused; u++) {
char buf[64];
- HDsnprintf(buf, sizeof(buf), "File %u", (unsigned)u);
+ HDsnprintf(buf, sizeof(buf), "File %zu", u);
HDfprintf(stream, "%*s%s:\n", indent, "", buf);
HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0),
"Name:", mesg->slot[u].name);
- HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0),
- "Name offset:", (unsigned long)(mesg->slot[u].name_offset));
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(fwidth - 3, 0),
+ "Name offset:", mesg->slot[u].name_offset);
- HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0),
- "Offset of data in file:", (unsigned long)(mesg->slot[u].offset));
+ HDfprintf(stream, "%*s%-*s %" PRIdMAX "\n", indent + 3, "", MAX(fwidth - 3, 0),
+ "Offset of data in file:", (intmax_t)(mesg->slot[u].offset));
- HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0),
- "Bytes reserved for data:", (unsigned long)(mesg->slot[u].size));
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", MAX(fwidth - 3, 0),
+ "Bytes reserved for data:", (mesg->slot[u].size));
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 15e6a80..2314a84 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Wednesday, September 30, 1998
*
* Purpose: The fill message indicates a bit pattern to use for
@@ -30,15 +30,15 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5Sprivate.h" /* Dataspaces */
-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, 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 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, 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_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, hbool_t *deleted,
@@ -47,22 +47,22 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind
/* 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_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
#undef H5O_SHARED_LINK_REAL
#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 H5O__fill_shared_debug
#define H5O_SHARED_DEBUG_REAL H5O__fill_debug
#include "H5Oshared.h" /* Shared Object Header Message Callbacks */
@@ -71,17 +71,17 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind
#undef H5O_SHARED_TYPE
#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
#undef H5O_SHARED_DELETE_REAL
@@ -92,11 +92,11 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind
#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
#undef H5Oshared_H
@@ -108,10 +108,10 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{
"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__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 */
@@ -120,10 +120,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 */
@@ -132,10 +132,10 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
"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__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 */
@@ -144,10 +144,10 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
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_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 */
@@ -176,7 +176,7 @@ H5FL_DEFINE(H5O_fill_t);
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
@@ -191,14 +191,15 @@ H5FL_BLK_EXTERN(type_conv);
*-------------------------------------------------------------------------
*/
static void *
-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_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 */
+ H5O_fill_t * fill = NULL;
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(f);
HDassert(p);
@@ -227,8 +228,11 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh,
INT32DECODE(p, fill->size);
if (fill->size > 0) {
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- if ((size_t)fill->size > p_size)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small")
+
+ /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */
+ if (p + fill->size - 1 > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size")
+
if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
H5MM_memcpy(fill->buf, p, (size_t)fill->size);
@@ -275,11 +279,10 @@ 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 */
+ } /* end else */
/* Set return value */
ret_value = (void *)fill;
@@ -292,10 +295,10 @@ 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.
*
@@ -308,15 +311,16 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-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)
+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)
{
- H5O_fill_t *fill = NULL; /* Decoded fill value message */
- htri_t exists = FALSE;
- H5T_t * dt = NULL;
- void * ret_value = NULL; /* Return value */
+ H5O_fill_t * fill = NULL; /* Decoded fill value message */
+ htri_t exists = FALSE;
+ H5T_t * dt = NULL;
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(f);
HDassert(p);
@@ -335,8 +339,10 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags
/* Only decode the fill value itself if there is one */
if (fill->size > 0) {
H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
- if ((size_t)fill->size > p_size)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small")
+
+ /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */
+ if (p + fill->size - 1 > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size")
/* Get the datatype message */
if ((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0)
@@ -371,10 +377,10 @@ 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
@@ -388,11 +394,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);
@@ -469,10 +475,10 @@ 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.
*
@@ -484,11 +490,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);
@@ -499,10 +505,10 @@ 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
@@ -518,13 +524,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);
@@ -617,10 +623,10 @@ 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
@@ -637,12 +643,12 @@ 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);
@@ -654,22 +660,22 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill)
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 */
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
@@ -684,16 +690,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() */
/*-------------------------------------------------------------------------
* Function: H5O_fill_reset_dyn
@@ -938,7 +944,7 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, int in
break;
} /* end switch */
- HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth, "Size:", fill->size);
+ HDfprintf(stream, "%*s%-*s %zd\n", indent, "", fwidth, "Size:", fill->size);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if (fill->type) {
H5T_debug(fill->type, stream);
@@ -973,7 +979,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 0d57768..eeba525 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Oflush.c
* Aug 19, 2010
- * Mike McGreevy <mamcgree@hdfgroup.org>
+ * Mike McGreevy
*
* Purpose: Object flush/refresh routines.
*
@@ -58,7 +58,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *
*
* 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
@@ -81,7 +81,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;
@@ -164,7 +164,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)
@@ -219,7 +219,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
@@ -387,32 +387,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 67702ce..b9dc4fe 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ofsinfo.c
* Feb 2009
- * Vailin Choi
+ * Vailin Choi
*
* Purpose: File space info message.
*
@@ -25,17 +25,17 @@
#include "H5Omodule.h" /* This source code file is part of the H5O module */
#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
+#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, 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 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_free(void *mesg);
static herr_t H5O__fsinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -45,22 +45,22 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
"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 */
+ 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, /* 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 */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O__fsinfo_debug /* debug the message */
}};
/* Format version bounds for fsinfo message */
@@ -77,7 +77,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = {
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.
*
@@ -89,15 +89,15 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*-------------------------------------------------------------------------
*/
static void *
-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)
+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)
{
H5O_fsinfo_t * fsinfo = NULL; /* File space info message */
H5F_mem_page_t ptype; /* Memory type for iteration */
unsigned vers; /* message version */
void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -129,7 +129,6 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS
/* 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;
@@ -176,10 +175,9 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS
&(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;
}
@@ -192,10 +190,10 @@ 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.
*
@@ -206,12 +204,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);
@@ -228,17 +226,16 @@ 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.
@@ -251,13 +248,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);
@@ -272,10 +269,10 @@ 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.
@@ -289,12 +286,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 */
@@ -307,7 +304,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() */
/*-------------------------------------------------------------------------
* Function: H5O__fsinfo_free
@@ -333,6 +330,79 @@ H5O__fsinfo_free(void *mesg)
} /* end H5O__fsinfo_free() */
/*-------------------------------------------------------------------------
+ * Function: H5O__fsinfo_debug
+ *
+ * Purpose: Prints debugging info for a message.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__fsinfo_debug(H5F_t 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 %s\n", indent, "", fwidth,
+ "Free-space persist:", fsinfo->persist ? "TRUE" : "FALSE");
+
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Free-space section threshold:", fsinfo->threshold);
+
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "File space page size:", fsinfo->page_size);
+
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "Page end metadata threshold:", fsinfo->pgend_meta_thres);
+
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\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 %" PRIuHADDR "\n", indent, "", fwidth,
+ "Free space manager address:", fsinfo->fs_addr[ptype - 1]);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O__fsinfo_debug() */
+
+/*-------------------------------------------------------------------------
* Function: H5O_fsinfo_set_version
*
* Purpose: Set the version to encode the fsinfo message with.
@@ -402,74 +472,3 @@ H5O_fsinfo_check_version(H5F_libver_t high, H5O_fsinfo_t *fsinfo)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* 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 499c245..8540cc4 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Oginfo.c
* Aug 23 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Group Information messages.
*
@@ -30,11 +30,11 @@
#include "H5Opkg.h" /* Object headers */
/* PRIVATE PROTOTYPES */
-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 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_free(void *_mesg);
static herr_t H5O__ginfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth);
@@ -44,10 +44,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 */
@@ -74,7 +74,7 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
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.
@@ -84,20 +84,19 @@ 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, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+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)
{
H5O_ginfo_t * ginfo = NULL; /* Pointer to group information message */
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);
@@ -146,29 +145,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);
@@ -195,10 +193,10 @@ 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.
@@ -208,19 +206,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);
@@ -235,10 +232,10 @@ 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.
@@ -249,18 +246,17 @@ 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 */
@@ -275,7 +271,7 @@ H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha
: 0);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_ginfo_size() */
+} /* end H5O__ginfo_size() */
/*-------------------------------------------------------------------------
* Function: H5O__ginfo_free
@@ -292,7 +288,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);
@@ -309,7 +305,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 e41fbc0..18b2db0 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -91,35 +91,35 @@ 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_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_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_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_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_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_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 */
};
@@ -203,7 +203,7 @@ H5O__init_package(void)
} /* end H5O__init_package() */
/*-------------------------------------------------------------------------
- * 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
@@ -217,12 +217,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);
@@ -246,7 +246,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() */
/*-------------------------------------------------------------------------
* Function: H5O_create
@@ -263,17 +263,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
@@ -291,13 +282,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:
@@ -308,7 +299,7 @@ done:
} /* end H5O_create() */
/*-----------------------------------------------------------------------------
- * Function: H5O__create_ohdr
+ * Function: H5O_create_ohdr
*
* Purpose: Create the object header, set version and flags.
*
@@ -321,7 +312,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 */
@@ -357,7 +348,7 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
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;
@@ -369,10 +360,10 @@ 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`.
@@ -386,7 +377,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;
@@ -457,12 +448,16 @@ H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t ini
#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
if (size_hint > 4294967295UL)
oh->flags |= H5O_HDR_CHUNK0_8;
- else
-#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
- if (size_hint > 65535)
+ else if (size_hint > 65535)
oh->flags |= H5O_HDR_CHUNK0_4;
else if (size_hint > 255)
oh->flags |= H5O_HDR_CHUNK0_2;
+#else
+ if (size_hint > 65535)
+ oh->flags |= H5O_HDR_CHUNK0_4;
+ else if (size_hint > 255)
+ oh->flags |= H5O_HDR_CHUNK0_2;
+#endif
}
else {
/* Reset unused time fields */
@@ -546,7 +541,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() */
/*-------------------------------------------------------------------------
* Function: H5O_open
@@ -579,7 +574,7 @@ H5O_open(H5O_loc_t *loc)
#ifdef H5O_DEBUG
if (H5DEBUG(O))
- HDfprintf(H5DEBUG(O), "> %a\n", loc->addr);
+ HDfprintf(H5DEBUG(O), "> %" PRIuHADDR "\n", loc->addr);
#endif
/* Turn off the variable for holding file or increment open-lock counters */
@@ -643,7 +638,7 @@ done:
} /* end H5O_open_name() */
/*-------------------------------------------------------------------------
- * Function: H5O_open_by_idx
+ * Function: H5O__open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
@@ -656,8 +651,8 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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 */
H5G_name_t obj_path; /* Opened object group hier. path */
@@ -665,7 +660,7 @@ H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_
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);
@@ -691,10 +686,10 @@ 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
*
@@ -707,14 +702,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);
@@ -733,7 +728,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() */
/*-------------------------------------------------------------------------
* Function: H5O_open_by_loc
@@ -810,10 +805,10 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
#ifdef H5O_DEBUG
if (H5DEBUG(O)) {
if (FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file))
- HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr,
+ HDfprintf(H5DEBUG(O), "< %" PRIuHADDR " auto %lu remaining\n", loc->addr,
(unsigned long)H5F_NOPEN_OBJS(loc->file));
else
- HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
+ HDfprintf(H5DEBUG(O), "< %" PRIuHADDR "\n", loc->addr);
}
#endif
@@ -845,7 +840,6 @@ done:
* Failure: -1
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 5 1997
*
*-------------------------------------------------------------------------
@@ -961,7 +955,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 5 1997
*
*-------------------------------------------------------------------------
@@ -1009,7 +1002,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Dec 31 2002
*
*-------------------------------------------------------------------------
@@ -1197,7 +1189,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -1243,7 +1234,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -1278,7 +1268,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Dec 31 2002
*
*-------------------------------------------------------------------------
@@ -1474,7 +1463,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * <koziol@ncsa.uiuc.edu>
* Tuesday, January 21, 2003
*
*-------------------------------------------------------------------------
@@ -1545,7 +1533,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 19 2003
*
*-------------------------------------------------------------------------
@@ -1607,7 +1594,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 19 2003
*
*-------------------------------------------------------------------------
@@ -1707,10 +1693,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() */
@@ -1891,7 +1876,6 @@ H5O_loc_reset(H5O_loc_t *loc)
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Monday, September 19, 2005
*
*-------------------------------------------------------------------------
@@ -2231,7 +2215,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) {
@@ -2525,8 +2509,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
*
*-------------------------------------------------------------------------
*/
@@ -2541,12 +2525,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
*
*-------------------------------------------------------------------------
*/
@@ -2562,8 +2546,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
*
*-------------------------------------------------------------------------
*/
@@ -2895,7 +2879,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -2930,7 +2913,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -2966,7 +2948,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 08 2010
*
*-------------------------------------------------------------------------
@@ -3030,7 +3011,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 b99e7a9..651e317 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Wednesday, October 8, 1997
*
* Purpose: Messages related to data layout.
*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
#include "H5private.h" /* Generic Functions */
@@ -90,12 +90,13 @@ H5FL_DEFINE(H5O_layout_t);
*/
static void *
H5O__layout_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)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p)
{
- H5O_layout_t *mesg = NULL;
- uint8_t * heap_block = NULL;
- unsigned u;
- void * ret_value = NULL; /* Return value */
+ H5O_layout_t * mesg = NULL;
+ uint8_t * heap_block = NULL;
+ unsigned u;
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -179,6 +180,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
if (mesg->type == H5D_COMPACT) {
UINT32DECODE(p, mesg->storage.u.compact.size);
if (mesg->storage.u.compact.size > 0) {
+ /* Ensure that size doesn't exceed buffer size, due to possible data corruption */
+ if (p + mesg->storage.u.compact.size - 1 > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size")
+
if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed for compact data buffer")
@@ -198,6 +203,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
UINT16DECODE(p, mesg->storage.u.compact.size);
if (mesg->storage.u.compact.size > 0) {
+ /* Ensure that size doesn't exceed buffer size, due to possible data corruption */
+ if (p + mesg->storage.u.compact.size - 1 > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size")
+
/* Allocate space for compact data */
if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL,
@@ -433,8 +442,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
(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 */
@@ -443,8 +451,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
(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 */
@@ -889,13 +896,13 @@ done:
} /* end H5O__layout_reset() */
/*-------------------------------------------------------------------------
- * Function: H5O__layout_free
+ * Function: H5O__layout_free
*
- * Purpose: Free's the message
+ * Purpose: Free's the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, March 11, 2000
*
*-------------------------------------------------------------------------
@@ -997,7 +1004,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);
@@ -1196,31 +1203,32 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int
(unsigned)mesg->u.chunk.idx_type);
break;
} /* end switch */
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Index address:", mesg->storage.u.chunk.idx_addr);
break;
case H5D_CONTIGUOUS:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous");
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Data address:", mesg->storage.u.contig.addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Data Size:", mesg->storage.u.contig.size);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Data Size:", mesg->storage.u.contig.size);
break;
case H5D_COMPACT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact");
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Data Size:", mesg->storage.u.compact.size);
break;
case H5D_VIRTUAL:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Virtual");
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Global heap address:", mesg->storage.u.virt.serial_list_hobjid.addr);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"Global heap index:", mesg->storage.u.virt.serial_list_hobjid.idx);
for (u = 0; u < mesg->storage.u.virt.list_nused; u++) {
- HDfprintf(stream, "%*sMapping %u:\n", indent, "", u);
+ HDfprintf(stream, "%*sMapping %zu:\n", indent, "", u);
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3,
"Virtual selection:", "<Not yet implemented>");
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3,
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index ae3d4a1..711f199 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Olinfo.c
* Aug 23 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Link Information messages.
*
@@ -36,9 +36,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, H5F_t *file_dst, hbool_t *recompute_size,
@@ -55,9 +55,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 */
@@ -100,7 +100,6 @@ H5FL_DEFINE_STATIC(H5O_linfo_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 23 2005
*
*-------------------------------------------------------------------------
@@ -167,25 +166,24 @@ done:
} /* end H5O__linfo_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -217,10 +215,10 @@ 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.
@@ -229,19 +227,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);
@@ -256,10 +253,10 @@ 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.
@@ -269,18 +266,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 =
@@ -293,7 +289,7 @@ H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void
: 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() */
/*-------------------------------------------------------------------------
* Function: H5O__linfo_free
@@ -383,7 +379,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
@@ -430,7 +426,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Sept 26 2006
*
*-------------------------------------------------------------------------
@@ -535,7 +530,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 23 2005
*
*-------------------------------------------------------------------------
@@ -554,17 +548,18 @@ H5O__linfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "Track creation order of links:", linfo->track_corder);
- HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
- "Index creation order of links:", linfo->index_corder);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of links:", linfo->nlinks);
- HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth, "Max. creation order value:", linfo->max_corder);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Track creation order of links:", linfo->track_corder ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Index creation order of links:", linfo->index_corder ? "TRUE" : "FALSE");
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of links:", linfo->nlinks);
+ HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth,
+ "Max. creation order value:", linfo->max_corder);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' link storage fractal heap address:", linfo->fheap_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 8fd3b84..75456f4 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Olink.c
* Aug 29 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Link messages.
*
@@ -38,13 +38,13 @@
/* 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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *udata);
+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, H5O_copy_t *cpy_info, void *udata);
static herr_t H5O__link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
@@ -58,16 +58,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 */
@@ -106,19 +106,19 @@ H5FL_DEFINE_STATIC(H5O_link_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 29 2005
*
*-------------------------------------------------------------------------
*/
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)
+ unsigned H5_ATTR_UNUSED *ioflags, 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 */
- void * ret_value = NULL; /* Return value */
+ 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
@@ -193,6 +193,11 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
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")
@@ -212,6 +217,12 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
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);
@@ -231,6 +242,11 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
UINT16DECODE(p, len)
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);
@@ -259,26 +275,25 @@ done:
} /* end H5O__link_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -378,10 +393,10 @@ 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.
@@ -391,19 +406,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);
@@ -444,10 +458,10 @@ 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.
@@ -458,20 +472,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));
@@ -520,7 +533,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() */
/*-------------------------------------------------------------------------
* Function: H5O__link_reset
@@ -651,7 +664,7 @@ done:
} /* end H5O_link_delete() */
/*-------------------------------------------------------------------------
- * 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.
@@ -666,10 +679,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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)
+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);
@@ -684,7 +697,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() */
/*-------------------------------------------------------------------------
* Function: H5O__link_copy_file
@@ -775,7 +788,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 29 2005
*
*-------------------------------------------------------------------------
@@ -786,7 +798,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
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);
@@ -805,7 +817,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
: (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown")))));
if (lnk->corder_valid)
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Creation Order:", lnk->corder);
+ HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, "Creation Order:", lnk->corder);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Link Name Character Set:",
(lnk->cset == H5T_CSET_ASCII ? "ASCII" : (lnk->cset == H5T_CSET_UTF8 ? "UTF-8" : "Unknown")));
@@ -814,7 +826,8 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
/* Display link-specific information */
switch (lnk->type) {
case H5L_TYPE_HARD:
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object address:", lnk->u.hard.addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Object address:", lnk->u.hard.addr);
break;
case H5L_TYPE_SOFT:
@@ -831,11 +844,11 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
(const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "External File Name:", lnk->u.ud.udata);
+ "External File Name:", (const char *)lnk->u.ud.udata);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External Object Name:", objname);
} /* end if */
else {
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
"User-Defined Link Size:", lnk->u.ud.size);
} /* end else */
} /* end if */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 5100e72..15edf1e 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Omessage.c
* Dec 3 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object header message routines.
*
@@ -94,7 +94,6 @@ static herr_t H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_clas
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 1 2006
*
*-------------------------------------------------------------------------
@@ -140,7 +139,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Dec 31 2002
*
*-------------------------------------------------------------------------
@@ -182,7 +180,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 8 2006
*
*-------------------------------------------------------------------------
@@ -233,7 +230,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -287,7 +283,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 6 2007
*
*-------------------------------------------------------------------------
@@ -334,7 +329,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -435,7 +429,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -487,7 +480,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -543,7 +535,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 12 1997
*
*-------------------------------------------------------------------------
@@ -579,7 +570,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 12 1997
*
*-------------------------------------------------------------------------
@@ -921,7 +911,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 28 1997
*
*-------------------------------------------------------------------------
@@ -971,7 +960,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
*-------------------------------------------------------------------------
@@ -1020,7 +1008,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
*-------------------------------------------------------------------------
@@ -1086,7 +1073,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 28 1997
*
*-------------------------------------------------------------------------
@@ -1142,7 +1128,6 @@ done:
* object headers were processed.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Nov 19 2004
*
* Description:
@@ -1206,7 +1191,6 @@ done:
* object headers were processed.
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
* Description:
@@ -1304,7 +1288,6 @@ done:
* Return: Size of message on success, 0 on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 13 2003
*
*-------------------------------------------------------------------------
@@ -1345,7 +1328,6 @@ done:
* Return: Size of message on success, 0 on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 6 2005
*
*-------------------------------------------------------------------------
@@ -1406,7 +1388,6 @@ done:
* Return: Size of message on success, 0 on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 7 2007
*
*-------------------------------------------------------------------------
@@ -1539,7 +1520,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
*
*-------------------------------------------------------------------------
@@ -1583,7 +1563,6 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg)
* Failure: Negative
*
* Programmer: James Laird
- * jlaird@hdfgroup.org
* November 1 2006
*
*-------------------------------------------------------------------------
@@ -1633,7 +1612,6 @@ done:
* Failure: Negative
*
* Programmer: James Laird
- * jlaird@hdfgroup.org
* Oct 17 2006
*
*-------------------------------------------------------------------------
@@ -1707,7 +1685,6 @@ done:
* Failure: Negative
*
* Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
* July 13, 2004
*
*-------------------------------------------------------------------------
@@ -1745,14 +1722,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 *
@@ -2010,7 +1981,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* September 26 2003
*
*-------------------------------------------------------------------------
@@ -2050,7 +2020,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 14 2007
*
*-------------------------------------------------------------------------
@@ -2150,7 +2119,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 1d355f7..134aa92 100644
--- a/src/H5Omodule.h
+++ b/src/H5Omodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5O package. Including this header means that the source file
* is part of the H5O package.
*/
-#ifndef _H5Omodule_H
-#define _H5Omodule_H
+#ifndef H5Omodule_H
+#define H5Omodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,10 @@
#define H5_MY_PKG_ERR H5E_OHDR
#define H5_MY_PKG_INIT YES
-#endif /* _H5Omodule_H */
+/**\defgroup H5O H5O
+ * \brief Object Interface
+ *
+ * \todo Describe concisely what the functions in this module are about.
+ *
+ */
+#endif /* H5Omodule_H */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 4d25325..d48d226 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -6,15 +6,15 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
- * 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 */
@@ -27,14 +27,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);
@@ -44,16 +44,16 @@ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{
"mtime", /*message name for debugging */
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 */
- NULL, /* reset method */
- H5O__mtime_free, /* free method */
- NULL, /* file delete method */
- NULL, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
+ H5O__mtime_decode, /*decode message */
+ 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 */
+ 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 */
@@ -69,16 +69,16 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
"mtime_new", /*message name for debugging */
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 */
- NULL, /* reset method */
- H5O__mtime_free, /* free method */
- NULL, /* file delete method */
- NULL, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
+ 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 */
+ NULL, /* reset method */
+ H5O__mtime_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 */
@@ -107,7 +107,6 @@ H5FL_DEFINE(time_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Jan 3 2002
*
*-------------------------------------------------------------------------
@@ -163,7 +162,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 24 1998
*
*-------------------------------------------------------------------------
@@ -213,25 +211,24 @@ done:
} /* end H5O__mtime_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -250,31 +247,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);
@@ -287,10 +281,10 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared,
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.
@@ -300,21 +294,18 @@ 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);
@@ -329,10 +320,10 @@ 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
@@ -344,28 +335,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
@@ -377,28 +365,25 @@ H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable
* 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() */
/*-------------------------------------------------------------------------
- * Function: H5O__mtime_free
+ * Function: H5O__mtime_free
*
* Purpose: Frees the message
*
@@ -422,14 +407,13 @@ H5O__mtime_free(void *mesg)
} /* end H5O__mtime_free() */
/*-------------------------------------------------------------------------
- * Function: H5O__mtime_debug
+ * Function: H5O__mtime_debug
*
* Purpose: Prints debugging info for the message.
*
* 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 d8e848e..979b240 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Oname.c
* Aug 12 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Object name message.
*
@@ -32,9 +32,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);
@@ -45,9 +45,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 */
@@ -73,7 +73,6 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 12 1997
*
*-------------------------------------------------------------------------
@@ -109,26 +108,24 @@ done:
} /* end H5O__name_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -139,10 +136,10 @@ 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.
@@ -152,21 +149,18 @@ 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);
@@ -188,10 +182,10 @@ 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
@@ -203,20 +197,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);
@@ -225,7 +216,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() */
/*-------------------------------------------------------------------------
* Function: H5O__name_reset
@@ -236,7 +227,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
*
*-------------------------------------------------------------------------
@@ -265,11 +255,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
@@ -277,7 +264,7 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
{
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 78f5a69..9b377fb 100644
--- a/src/H5Onull.c
+++ b/src/H5Onull.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,6 @@
*
* Created: H5Onull.c
* Aug 6 1997
- * Robb Matzke <matzke@llnl.gov>
*
* Purpose: The null message.
*
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index e63e622..6e203bb 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
#error "Do not include this file outside the H5O package!"
#endif
-#ifndef _H5Opkg_H
-#define _H5Opkg_H
+#ifndef H5Opkg_H
+#define H5Opkg_H
/* Get package's private header */
#include "H5Oprivate.h" /* Object headers */
@@ -540,7 +540,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);
@@ -639,4 +644,4 @@ H5_DLL herr_t H5O__assert(const H5O_t *oh);
#endif /* H5O_DEBUG */
H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth);
-#endif /* _H5Opkg_H */
+#endif /* H5Opkg_H */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 8b72c74..4b76da9 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -6,84 +6,84 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * 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 */
#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
+#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 "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, const void *mesg_src, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *_udata);
+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 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_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
#undef H5O_SHARED_LINK_REAL
#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 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_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_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_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 */
@@ -100,12 +100,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
*
*-------------------------------------------------------------------------
@@ -218,8 +218,8 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign
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)
+ "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)
@@ -241,7 +241,7 @@ done:
} /* end H5O__pline_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_pline_encode
+ * Function: H5O__pline_encode
*
* Purpose: Encodes message MESG into buffer P.
*
@@ -253,13 +253,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);
@@ -335,10 +335,10 @@ 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
@@ -354,14 +354,14 @@ 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)))
@@ -429,10 +429,10 @@ done:
} /* 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.
*
@@ -446,13 +446,13 @@ 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 */
@@ -470,7 +470,7 @@ 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;
@@ -493,7 +493,7 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg)
} /* end for */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_pline_size() */
+} /* end H5O__pline_size() */
/*-------------------------------------------------------------------------
* Function: H5O__pline_reset
@@ -524,7 +524,6 @@ H5O__pline_reset(void *mesg)
/* Free the filter information and array */
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)
@@ -575,7 +574,7 @@ H5O__pline_free(void *mesg)
} /* end H5O__pline_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_pline_pre_copy_file
+ * Function: H5O__pline_pre_copy_file
*
* Purpose: Perform any necessary actions before copying message between
* files
@@ -590,14 +589,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, hbool_t H5_ATTR_UNUSED *deleted,
- const H5O_copy_t *cpy_info, void *_udata)
+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);
@@ -614,12 +613,12 @@ H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hb
* 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() */
/*-------------------------------------------------------------------------
* Function: H5O__pline_debug
@@ -650,14 +649,14 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %Zu/%Zu\n", indent, "", fwidth, "Number of filters:", pline->nused,
+ HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Number of filters:", pline->nused,
pline->nalloc);
/* 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);
+ HDsnprintf(name, sizeof(name), "Filter at position %zu", 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));
@@ -668,7 +667,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
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),
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3),
"Num CD values:", pline->filter[i].cd_nelmts);
/* Filter parameters */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 2c4ec6b..6d901b3 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,36 +15,36 @@
*
* Created: H5Oprivate.h
* Aug 5 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Object header private include file.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Oprivate_H
-#define _H5Oprivate_H
+#ifndef H5Oprivate_H
+#define H5Oprivate_H
/* Early typedefs to avoid circular dependencies */
typedef struct H5O_t H5O_t;
typedef struct H5O_fill_t H5O_fill_t;
/* Include the public header file for this API */
-#include "H5Opublic.h" /* Object header functions */
+#include "H5Opublic.h" /* Object header functions */
/* Public headers needed by this file */
-#include "H5Dpublic.h" /* Dataset functions */
-#include "H5Lpublic.h" /* Link functions */
+#include "H5Dpublic.h" /* Dataset functions */
+#include "H5Lpublic.h" /* Link functions */
#include "H5Spublic.h" /* Dataspace functions */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Fprivate.h" /* File access */
-#include "H5HGprivate.h" /* Global Heaps */
+#include "H5HGprivate.h" /* Global Heaps */
#include "H5SLprivate.h" /* Skip lists */
#include "H5Tprivate.h" /* Datatype functions */
-#include "H5VLprivate.h"
-#include "H5Zprivate.h" /* I/O pipeline filters */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5Zprivate.h" /* I/O pipeline filters */
/* Forward references of package typedefs */
typedef struct H5O_msg_class_t H5O_msg_class_t;
@@ -232,7 +232,7 @@ typedef struct H5O_copy_t {
#define H5O_FSINFO_ID 0x0017 /* File space info message. */
#define H5O_MDCI_MSG_ID 0x0018 /* Metadata Cache Image Message */
#define H5O_UNKNOWN_ID 0x0019 /* Placeholder message ID for unknown message. */
- /* (this should never exist in a file) */
+/* (this should never exist in a file) */
/*
* Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g
* in H5O.c when creating a new message type. Also bump the value of
@@ -903,13 +903,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, size_t size_hint, size_t initial_rc,
- 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, 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);
@@ -999,8 +996,6 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst
void **udata);
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,
@@ -1037,4 +1032,4 @@ H5_DLL herr_t H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline);
/* Shared message operators */
H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
-#endif /* _H5Oprivate_H */
+#endif /* H5Oprivate_H */
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 411c786..3c44421 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,20 +15,20 @@
*
* Created: H5Opublic.h
* Aug 5 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Public declarations for the H5O (object header)
* package.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5Opublic_H
-#define _H5Opublic_H
+#ifndef H5Opublic_H
+#define H5Opublic_H
/* Public headers needed by this file */
-#include "H5public.h" /* Generic Functions */
-#include "H5Ipublic.h" /* IDs */
-#include "H5Lpublic.h" /* Links */
+#include "H5public.h" /* Generic Functions */
+#include "H5Ipublic.h" /* IDs */
+#include "H5Lpublic.h" /* Links */
/*****************/
/* Public Macros */
@@ -86,13 +86,15 @@
#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */
#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS)
-/* Flags for H5Oget_native_info.
- * Theses flags determine which fields will be filled in in the H5O_native_info_t
- * struct.
+//! <!-- [H5O_native_info_fields_snip] -->
+/**
+ * Flags for H5Oget_native_info(). Theses flags determine which fields will be
+ * filled in in the \ref H5O_native_info_t struct.
*/
#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */
#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE)
+//! <!-- [H5O_native_info_fields_snip] -->
/* Convenience macro to check if the token is the 'undefined' token value */
#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t)))
@@ -101,36 +103,48 @@
/* Public Typedefs */
/*******************/
-/* Types of objects in file */
+//! <!-- [H5O_type_t_snip] -->
+/**
+ * Types of objects in file
+ */
typedef enum H5O_type_t {
- H5O_TYPE_UNKNOWN = -1, /* Unknown object type */
- H5O_TYPE_GROUP, /* Object is a group */
- H5O_TYPE_DATASET, /* Object is a dataset */
- H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */
- H5O_TYPE_MAP, /* Object is a map */
- H5O_TYPE_NTYPES /* Number of different object types (must be last!) */
+ H5O_TYPE_UNKNOWN = -1, /**< Unknown object type */
+ H5O_TYPE_GROUP, /**< Object is a group */
+ H5O_TYPE_DATASET, /**< Object is a dataset */
+ H5O_TYPE_NAMED_DATATYPE, /**< Object is a named data type */
+ H5O_TYPE_MAP, /**< Object is a map */
+ H5O_TYPE_NTYPES /**< Number of different object types (must be last!) */
} H5O_type_t;
+//! <!-- [H5O_type_t_snip] -->
-/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
+//! <!-- [H5O_hdr_info_t_snip] -->
+/**
+ * Information struct for object header metadata (for
+ * H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx())
+ */
typedef struct H5O_hdr_info_t {
- unsigned version; /* Version number of header format in file */
- unsigned nmesgs; /* Number of object header messages */
- unsigned nchunks; /* Number of object header chunks */
- unsigned flags; /* Object header status flags */
+ unsigned version; /**< Version number of header format in file */
+ unsigned nmesgs; /**< Number of object header messages */
+ unsigned nchunks; /**< Number of object header chunks */
+ unsigned flags; /**< Object header status flags */
struct {
- hsize_t total; /* Total space for storing object header in file */
- hsize_t meta; /* Space within header for object header metadata information */
- hsize_t mesg; /* Space within header for actual message information */
- hsize_t free; /* Free space within object header */
+ hsize_t total; /**< Total space for storing object header in file */
+ hsize_t meta; /**< Space within header for object header metadata information */
+ hsize_t mesg; /**< Space within header for actual message information */
+ hsize_t free; /**< Free space within object header */
} space;
struct {
- uint64_t present; /* Flags to indicate presence of message type in header */
- uint64_t shared; /* Flags to indicate message type is shared in header */
+ uint64_t present; /**< Flags to indicate presence of message type in header */
+ uint64_t shared; /**< Flags to indicate message type is shared in header */
} mesg;
} H5O_hdr_info_t;
+//! <!-- [H5O_hdr_info_t_snip] -->
-/* Data model information struct for objects */
-/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */
+//! <!-- [H5O_info2_t_snip] -->
+/**
+ * Data model information struct for objects
+ * (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3)
+ */
typedef struct H5O_info2_t {
unsigned long fileno; /* File number that object is located in */
H5O_token_t token; /* Token representing the object */
@@ -142,34 +156,52 @@ typedef struct H5O_info2_t {
time_t btime; /* Birth time */
hsize_t num_attrs; /* # of attributes attached to object */
} H5O_info2_t;
+//! <!-- [H5O_info2_t_snip] -->
-/* Native file format information struct for objects */
-/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */
+//! <!-- [H5O_native_info_t_snip] -->
+/**
+ * Native file format information struct for objects.
+ * (For H5Oget_native_info(), H5Oget_native_info_by_name(), H5Oget_native_info_by_idx())
+ */
typedef struct H5O_native_info_t {
- H5O_hdr_info_t hdr; /* Object header information */
+ H5O_hdr_info_t hdr; /**< Object header information */
/* Extra metadata storage for obj & attributes */
struct {
- H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
+ H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */
} meta_size;
} H5O_native_info_t;
+//! <!-- [H5O_native_info_t_snip] -->
-/* Typedef for message creation indexes */
+/**
+ * Typedef for message creation indexes
+ */
typedef uint32_t H5O_msg_crt_idx_t;
-/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */
+//! <!-- [H5O_iterate2_t_snip] -->
+/**
+ * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3)
+ */
typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data);
+//! <!-- [H5O_iterate2_t_snip] -->
+//! <!-- [H5O_mcdt_search_ret_t_snip] -->
typedef enum H5O_mcdt_search_ret_t {
- H5O_MCDT_SEARCH_ERROR = -1, /* Abort H5Ocopy */
- H5O_MCDT_SEARCH_CONT, /* Continue the global search of all committed datatypes in the destination file */
- H5O_MCDT_SEARCH_STOP /* Stop the search, but continue copying. The committed datatype will be copied but
- not merged. */
+ H5O_MCDT_SEARCH_ERROR = -1, /**< Abort H5Ocopy */
+ H5O_MCDT_SEARCH_CONT, /**< Continue the global search of all committed datatypes in the destination file
+ */
+ H5O_MCDT_SEARCH_STOP /**< Stop the search, but continue copying. The committed datatype will be copied
+ but not merged. */
} H5O_mcdt_search_ret_t;
+//! <!-- [H5O_mcdt_search_ret_t_snip] -->
-/* Callback to invoke when completing the search for a matching committed datatype from the committed dtype
- * list */
+//! <!-- [H5O_mcdt_search_cb_t_snip] -->
+/**
+ * Callback to invoke when completing the search for a matching committed
+ * datatype from the committed dtype list
+ */
typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data);
+//! <!-- [H5O_mcdt_search_cb_t_snip] -->
/********************/
/* Public Variables */
@@ -182,48 +214,1611 @@ typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data);
extern "C" {
#endif
-H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
-H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token);
-H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, hid_t lapl_id);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Opens an object in an HDF5 file by location identifier and path name.
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Path to the object; relative to \p loc_id
+ * \lapl_id
+ *
+ * \return \hid_tv{object}
+ *
+ * \details H5Oopen() opens a group, dataset, or committed (named) datatype
+ * specified by a location, \p loc_id, and a path name, \p name, in an HDF5 file.
+ *
+ * This function opens the object in the same manner as H5Gopen(), H5Topen(), and H5Dopen().
+ * However, H5Oopen() does not require the type of object to be known beforehand.
+ * This can be useful with user-defined links, for instance, when only a path may be known.
+ *
+ * H5Oopen() cannot be used to open a dataspace, attribute, property list, or file.
+ *
+ * Once an object of unknown type has been opened with H5Oopen(),
+ * the type of that object can be determined by means of an H5Iget_type() call.
+ *
+ * \p loc_id may be a file, group, dataset, named datatype, or attribute.
+ * If an attribute is specified for \p loc_id then the object where the
+ * attribute is attached will be accessed.
+ *
+ * \p name must be the path to that object relative to \p loc_id.
+ *
+ * \p lapl_id is the link access property list associated with the link pointing to
+ * the object. If default link access properties are appropriate, this can be
+ * passed in as #H5P_DEFAULT.
+ *
+ * When it is no longer needed, the opened object should be closed with
+ * H5Oclose(), H5Gclose(), H5Tclose(), or H5Dclose().
+ *
+ * \version 1.8.1 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Opens an object in an HDF5 file using its VOL independent token
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] token Object token
+ *
+ * \return \hid_ti{object}
+ *
+ * \details H5Oopen_by_token() opens an object specified by the object
+ * identifier, \p loc_id and object token, \p token.
+ *
+ * \par Example
+ * An example snippet from examples/h5_extlink.c:
+ * \snippet h5_extlink.c H5Open_by_token_snip
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Opens the nth object in a group
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] group_name Name of group, relative to \p loc_id, in which object is located
+ * \idx_type
+ * \order
+ * \param[in] n Object to open
+ * \lapl_id
+ *
+ * \return \hid_tv{object}
+ *
+ * \details H5Open_by_idx() opens the nth object in the group specified by \p loc_id
+ * and \p group_name.
+ *
+ * \p loc_id specifies a location identifier.
+ * \p group_name specifies the group relative to \p loc_id in which the object can be found.
+ * If \p loc_id fully specifies the group in which the object resides,
+ * \p group_name can be a dot (.).
+ *
+ * The specific object to be opened within the group is specified by the three parameters:
+ * \p idx_type, \p order and \p n.
+ *
+ * \p idx_type specifies the type of index by which objects are ordered.
+ * Valid index types include the following:
+ *
+ * \indexes
+ *
+ * \p order specifies the order in which the objects are to be referenced for the purposes
+ * of this function. Valid orders include the following:
+ *
+ * \orders
+ *
+ * Note that for #H5_ITER_NATIVE, rather than implying a particular order,
+ * it instructs the HDF5 library to iterate through the objects in the fastest
+ * available order, i.e., in a natural order.
+ *
+ * \p n specifies the position of the object within the index. Note that this count is
+ * zero-based; 0 (zero) indicates that the function will return the value of the first object;
+ * if \p n is 5, the function will return the value of the sixth object; etc.
+ *
+ * \p lapl_id specifies the link access property list to be used in accessing the object.
+ *
+ * An object opened with this function should be closed when it is no longer needed so that
+ * resource leaks will not develop. H5Oclose() can be used to close groups, datasets,
+ * or committed datatypes.
+ *
+ * \version 1.8.1 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Determines whether a link resolves to an actual object.
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name The name of the link to check
+ * \lapl_id
+ *
+ * \return Returns a positive value if the object pointed to by
+ * the \p loc_id and \p name combination exists.
+ * \return Returns 0 if the object pointed to by
+ * the \p loc_id and \p name combination does not exist.
+ * \return Returns a negatvie value when the function fails.
+ *
+ * \details H5Oexists_by_name() allows an application to determine whether
+ * the link \p name in the group or file specified with \p loc_id
+ * resolves to an HDF5 object to open or if the link dangles. The
+ * link may be of any type, but hard links will always resolve
+ * to objects and do not need to be verified.
+ *
+ * Note that H5Oexists_by_name() verifies only that the target
+ * object exists. If \p name includes either a relative path or
+ * an absolute path to the target link, intermediate steps
+ * along the path must be verified before the existence of
+ * the target link can be safely checked. If the path is not
+ * verified and an intermediate element of the path does not
+ * exist, H5Oexists_by_name() will fail. The example in the next
+ * paragraph illustrates one step-by-step method for verifying
+ * the existence of a link with a relative or absolute path.
+ *
+ * \par Example
+ * Use the following steps to verify the existence of
+ * the link \c datasetD in the \c group group1/group2/softlink_to_group3/,
+ * where \c group1 is a member of the group specified by \c loc_id:
+ *
+ * \par
+ * - First use H5Lexists() to verify that a link named \c group1 exists.
+ * - If \c group1 exists, use H5Oexists_by_name() to verify that the
+ * link \c group1 resolves to an object.
+ * - If \c group1 exists, use H5Lexists() again, this time with name
+ * set to \c group1/group2, to verify that the link \c group2 exists
+ * in \c group1.
+ * - If the \c group2 link exists, use H5Oexists_by_name() to verify
+ * that \c group1/group2 resolves to an object.
+ * - If \c group2 exists, use H5Lexists() again, this time with name
+ * set to \c group1/group2/softlink_to_group3, to verify that the
+ * link \c softlink_to_group3 exists in \c group2.
+ * - If the \c softlink_to_group3 link exists, use H5Oexists_by_name()
+ * to verify that \c group1/group2/softlink_to_group3 resolves to
+ * an object.
+ * - If \c softlink_to_group3 exists, you can now safely use H5Lexists
+ * with name set to \c group1/group2/softlink_to_group3/datasetD to
+ * verify that the target link, \c datasetD, exists.
+ * - And finally, if the link \c datasetD exists, use H5Oexists_by_name
+ * to verify that \c group1/group2/softlink_to_group3/datasetD
+ * resolves to an object.
+ *
+ * \par
+ * If the link to be verified is specified with an absolute path,
+ * the same approach should be used, but starting with the first
+ * link in the file’s root group. For instance, if \c datasetD
+ * were in \c /group1/group2/softlink_to_group3, the first call to
+ * H5Lexists() would have name set to \c /group1.
+ *
+ * \par
+ * Note that this is an outline and does not include all necessary
+ * details. Depending on circumstances, for example, an application
+ * may need to verify the type of an object also.
+ *
+ * \warning \Bold{Failure Modes:}
+ * \warning If \p loc_id and \p name both exist but the combination does not
+ * resolve to an object, the function will return 0 (zero);
+ * the function does not fail in this case.
+ * \warning If either the location or the link specified by the \p loc_id
+ * and \p name combination does not exist, the function will fail,
+ * returning a negative value.
+ * \warning Note that verifying the existence of an object within an HDF5
+ * file is a multistep process. An application can be certain the
+ * object does not exist only if H5Lexists() and H5Oexists_by_name()
+ * have been used to verify the existence of the links and groups
+ * in the hierarchy above that object. The example above, in the
+ * function description, provides a step-by-step description of
+ * that verification process.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.5
+ *
+ */
H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object specified by an identifier
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_info3() specifies an object by its identifier, \p loc_id , and
+ * retrieves the metadata describing that object in \p oinfo , an H5O_info2_t \c struct.
+ *
+ * The H5O_info2_t \c struct is defined in H5Opublic.h as follows :
+ * \snippet this H5O_info2_t_snip
+ *
+ * Note the following about H5O_info2_t :
+ * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
+ * only \c ctime has been implemented.
+ * - The \c atime value is the last time the object was read or written.
+ * - The \c mtime value is the last time the raw data in the object was changed.
+ * - The \c ctime value is the last time the metadata for the object was changed.
+ * - The \c btime value is the time the object was created.
+ *
+ * The H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * The H5O_type_t \c enum indicates the object type and
+ * is defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * Note that the object retrieved as indicated by \p loc_id
+ * refers only to the types specified by H5O_type_t.
+ *
+ * The \p fields parameter contains flags to determine which fields will be filled in
+ * the H5O_info2_t \c struct returned in \p oinfo.
+ * These flags are defined in the H5Opublic.h file:
+ *
+ * \obj_info_fields
+ *
+ * \par Example
+ * An example snippet from examples/h5_attribute.c:
+ * \par
+ * \snippet h5_attribute.c H5Oget_info3_snip
+ *
+ * \note If you are iterating through a lot of different objects to
+ * retrieve information via the H5Oget_info() family of routines,
+ * you may see memory building up. This can be due to memory
+ * allocation for metadata such as object headers and messages
+ * when the iterated objects are put into the metadata cache.
+ * \note
+ * If the memory buildup is not desirable, you can configure a
+ * smaller cache via H5Fset_mdc_config() or set the file access
+ * property list via H5Pset_mdc_config(). A smaller sized cache
+ * will force metadata entries to be evicted from the cache,
+ * thus freeing the memory associated with the entries.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object by
+ * location and relative name
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of group, relative to \p loc_id
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_info_by_name3() specifies an object’s location and name,
+ * \p loc_id and \p name, respectively, and retrieves the metadata
+ * describing that object in \p oinfo, an H5O_info2_t struct.
+ *
+ * \p oinfo, in which the object information is returned, is a \c struct of
+ * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
+ *
+ * \snippet this H5O_info2_t_snip
+ *
+ * Note the following about H5O_info2_t :
+ * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
+ * only \c ctime has been implemented.
+ * - The \c atime value is the last time the object was read or written.
+ * - The \c mtime value is the last time the raw data in the object was changed.
+ * - The \c ctime value is the last time the metadata for the object was changed.
+ * - The \c btime value is the time the object was created.
+ *
+ * The H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * The H5O_type_t \c enum indicates the object type and
+ * is defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * Note that the object retrieved as indicated by \p loc_id
+ * refers only to the types specified by H5O_type_t.
+ *
+ * The \p fields parameter contains flags to determine which fields will be filled in
+ * the H5O_info2_t \c struct returned in \p oinfo.
+ * These flags are defined in the H5Opublic.h file:
+ *
+ * \obj_info_fields
+ *
+ * The link access property list, \c lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \par Example
+ * An example snippet from test/vol.c:
+ * \snippet vol.c H5Oget_info_by_name3_snip
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields,
hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object
+ * by an index position
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] group_name Name of group in which object is located
+ * \idx_type
+ * \order
+ * \param[in] n Position within the index
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_info_by_idx3() retrieves the metadata describing an
+ * object in the \c struct \p oinfo, as specified by the location,
+ * \p loc_id, group name, \p group_name, the index by which objects
+ * in that group are tracked, \p idx_type, the order by which the
+ * index is to be traversed, \p order, and an object’s position
+ * \p n within that index.
+ *
+ * If \p loc_id fully specifies the group in which the object resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * \p idx_type is of type #H5_index_t, defined in H5public.h as:
+ * \snippet H5public.h H5_index_t_snip
+ *
+ * \p order is of type #H5_iter_order_t defined in H5public.h as:
+ * \snippet H5public.h H5_iter_order_t_snip
+ *
+ * \p oinfo, in which the object information is returned, is a \c struct of
+ * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
+ * \snippet this H5O_info2_t_snip
+ *
+ * Note the following about H5O_info2_t :
+ * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
+ * only \c ctime has been implemented.
+ * - The \c atime value is the last time the object was read or written.
+ * - The \c mtime value is the last time the raw data in the object was changed.
+ * - The \c ctime value is the last time the metadata for the object was changed.
+ * - The \c btime value is the time the object was created.
+ *
+ * H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * The #H5O_type_t \c enum indicates the object type and
+ * is defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * Note that the object retrieved as indicated by \p loc_id
+ * refers only to the types specified by #H5O_type_t.
+ *
+ * The \p fields parameter contains flags to determine which fields will be filled in
+ * the H5O_info2_t \c struct returned in \p oinfo.
+ * These flags are defined in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * The link access property list, \c lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \par Example
+ * An example snippet from test/titerate.c:
+ * \snippet titerate.c H5Oget_info_by_idx3_snip
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields,
hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieve native file format information about an object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[out] oinfo Buffer in which to return native object information
+ * \param[in] fields Flags to determine which fields in \p oinfo are filled in
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_native_info() retrieves the native file format information for an object
+ * specified by \p loc_id. The information is retrieved into the
+ * buffer specified by \p oinfo, which is defined as a \c struct of
+ * type H5O_native_info_t in H5Opublic.h:
+ *
+ * \snippet this H5O_native_info_t_snip
+ *
+ * The \p fields parameter indicates which fields to fill in
+ * H5O_native_info_t. Possible values defined in H5Opublic.h are:
+ *
+ * \snippet this H5O_native_info_fields_snip
+ *
+ * \par Example
+ * An example snippet from test/tfile.c:
+ * \par
+ * \snippet tfile.c H5Oget_native_info_snip
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieve native file format information about an object given its name
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of object
+ * \param[out] oinfo Buffer in which to return native object information
+ * \param[in] fields Flags to determine which fields in \p oinfo are filled in
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_native_info_by_name() retrieves the native file format information for an object
+ * specified by \p loc_id and the name \p name. The information is
+ * retrieved into the buffer specified by \p oinfo, which is defined
+ * as a \c struct of type H5O_native_info_t in H5Opublic.h:
+ *
+ * \snippet this H5O_native_info_t_snip
+ *
+ * The \p fields parameter which fields to fill in H5O_native_info_t.
+ * Possible values defined in H5Opublic.h are:
+ *
+ * \snippet this H5O_native_info_fields_snip
+ *
+ * \par Example
+ * An example snippet from test/tfile.c:
+ * \snippet tfile.c H5Oget_native_info_by_name_snip
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo,
unsigned fields, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieve native file format information about an object
+ * according to the order of an index
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] group_name Name of group in which object is located
+ * \idx_type
+ * \order
+ * \param[in] n Position within the index
+ * \param[out] oinfo Buffer in which to return native object information
+ * \param[in] fields Flags to determine which fields in \p oinfo are filled in
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Oget_native_info_by_idx() retrieves the native file format information for an object
+ * specified by \p loc_id, group name, \p group_name, the index by which
+ * objects in the group are tracked, \p idx_type, the order by which
+ * the index is to be traversed, \p order , and an object's position
+ * \p n within that index. The information is retrieved into the
+ * buffer specified by \p oinfo, which is defined as a \c struct of
+ * type H5O_native_info_t in H5Opublic.h:
+ * \snippet this H5O_native_info_t_snip
+ *
+ * \p idx_type is of type #H5_index_t, defined in H5public.h as:
+ * \snippet H5public.h H5_index_t_snip
+ *
+ * \p order is of type #H5_iter_order_t defined in H5public.h as:
+ * \snippet H5public.h H5_iter_order_t_snip
+ *
+ * The \p fields parameter indicates which fields to fill in H5O_native_info_t.
+ * Possible values defined in H5Opublic.h are:
+ * \snippet this H5O_native_info_fields_snip
+ *
+ * The link access property list, \c lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo,
unsigned fields, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Creates a hard link to an object in an HDF5 file
+ *
+ * \param[in] obj_id Object to be linked
+ * \param[in] new_loc_id Location identifier at which object is to be linked;
+ * may be a file, group, dataset, named datatype or attribute identifier.
+ * \param[in] new_name Name of link to be created, relative to \p new_loc_id.
+ * \lcpl_id
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Olink() creates a new hard link to an object in an HDF5 file.
+ * \p new_loc_id and \p \p new_link_name specify the location and name of the
+ * new link while \p object_id identifies the object that the link
+ * points to.
+ *
+ * H5Olink() is designed for two purposes:
+ * - To create the first hard link to an object that has just
+ * been created with H5Dcreate_anon(), H5Gcreate_anon(), or
+ * H5Tcommit_anon().
+ * - To add additional structure to an existing
+ * file so that, for example, an object can be shared among
+ * multiple groups.
+ *
+ * \p lcpl and \p lapl are the link creation and access property lists
+ * associated with the new link.
+ *
+ * \par Example:
+ * To create a new link to an object while simultaneously creating
+ * missing intermediate groups: Suppose that an application must
+ * create the group C with the path /A/B01/C but may not know
+ * at run time whether the groups A and B01 exist. The following
+ * code ensures that those groups are created if they are missing:
+ * \par
+ * \code
+ *
+ * // Creates a link creation property list (LCPL).
+ * hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE);
+ *
+ * // Sets "create missing intermediate groups" property in that LCPL.
+ * int status = H5Pset_create_intermediate_group(lcpl_id, TRUE);
+ *
+ * // Creates a group without linking it into the file structure.
+ * hid_t gid = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT);
+ *
+ * // Links group into file structure.
+ * status = H5Olink(gid, file_id, "/A/B01/C", lcpl_id, H5P_DEFAULT);
+ *
+ * \endcode
+ *
+ * \par
+ * Note that unless the object is intended to be temporary,
+ * the H5O_LINK call is mandatory if an object created with one
+ * of the H5*_CREATE_ANON functions (or with H5T_COMMIT_ANON)
+ * is to be retained in the file; without an H5O_LINK call,
+ * the object will not be linked into the HDF5 file structure
+ * and will be deleted when the file is closed.
+ *
+ * \version 1.8.1 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Increments an object reference count
+ *
+ * \fgdta_loc_obj_id{object_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Oincr_refcount() increments the hard link reference count for an object.
+ * It should be used any time a user-defined link that references
+ * an object by address is added. When the link is deleted,
+ * H5Odecr_refcount() should be used.
+ *
+ * An object’s reference count is the number of hard links in the
+ * file that point to that object. See the “Programming Model”
+ * section of the HDF5 Groups chapter in the -- <em>HDF5 User’s Guide</em>
+ * for a more complete discussion of reference counts.
+ *
+ * If a user application needs to determine an object’s reference
+ * count, an H5Oget_info() call is required; the reference count
+ * is returned in the \c rc field of the #H5O_info_t \c struct.
+ *
+ * \warning This function must be used with care!
+ * \warning Improper use can lead to inaccessible data, wasted space in the file,
+ * or <b><em>file corruption</em></b>.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oincr_refcount(hid_t object_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Decrements an object reference count
+ *
+ * \fgdta_loc_obj_id{object_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Odecr_refcount() decrements the hard link reference count for an object.
+ * It should be used any time a user-defined link that references
+ * an object by address is deleted. In general, H5Oincr_refcount() will have
+ * been used previously, when the link was created.
+ *
+ * An object’s reference count is the number of hard links in the
+ * file that point to that object. See the “Programming Model”
+ * section of the HDF5 Groups chapter in the <em>HDF5 User’s Guide</em>
+ * for a more complete discussion of reference counts.
+ *
+ * If a user application needs to determine an object’s reference
+ * count, an H5Oget_info() call is required; the reference count
+ * is returned in the \c rc field of the #H5O_info_t \c struct.
+ *
+ * \warning This function must be used with care!
+ * \warning Improper use can lead to inaccessible data, wasted space in the file,
+ * or <b><em>file corruption</em></b>.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Odecr_refcount(hid_t object_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Copies an object in an HDF5 file
+ *
+ * \param[in] src_loc_id Object identifier indicating the location of the
+ * source object to be copied
+ * \param[in] src_name Name of the source object to be copied
+ * \param[in] dst_loc_id Location identifier specifying the destination
+ * \param[in] dst_name Name to be assigned to the new copy
+ * \param[in] ocpypl_id Object copy property list
+ * \lcpl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Ocopy() copies the group, dataset or committed datatype
+ * specified by \p src_name from the file or group specified by
+ * \p src_loc_id to the destination location \p dst_loc_id.
+ *
+ * The destination location, as specified in dst_loc_id, may
+ * be a group in the current file or a location in a different
+ * file. If dst_loc_id is a file identifier, the copy will be
+ * placed in that file’s root group.
+ *
+ * The copy will be created with the path specified in \p dst_name,
+ * which must not pre-exist in the destination location. If
+ * \p dst_name already exists at the location \p dst_loc_id,
+ * H5Ocopy() will fail. If \p dst_name is an absolute path,
+ * the copy will be created relative to the file’s root group.
+ *
+ * The copy of the object is created with the property lists
+ * specified by \p ocpypl_id and \p lcpl_id. #H5P_DEFAULT can be passed
+ * in for these property lists. The default behavior:
+ *
+ * - of the link creation property list is to NOT create
+ * intermediate groups.
+ * - of the flags specified by the object creation property list
+ * is described in H5Pset_copy_object().
+ *
+ * These property lists or flags can be modified to govern the
+ * behavior of H5Ocopy() as follows:
+ *
+ * - A flag controlling the creation of intermediate groups that
+ * may not yet exist is set in the link creation property list
+ * \p lcpl_id with H5Pset_create_intermediate_group().
+ *
+ * - Copying of committed datatypes can be tuned through the use
+ * of H5Pset_copy_object(), H5Padd_merge_committed_dtype_path(),
+ * H5Pset_mcdt_search_cb(), and related functions.
+ *
+ * - Flags controlling other aspects of object copying are set in the
+ * object copy property list \p ocpypl_id with H5Pset_copy_object().
+ *
+ * H5Ocopy() will always try to make a copy of the object specified
+ * in \p src_name.
+ *
+ * - If the object specified by \p src_name is a group containing a
+ * soft or external link, the default is that the new copy will
+ * contain a soft or external link with the same value as the
+ * original. See H5Pset_copy_object() for optional settings.
+ *
+ * - If the path specified in \p src_name is or contains a soft link
+ * or an external link, H5Ocopy() will copy the target object.
+ * Use H5Lcopy() if the intent is to create a new soft or external
+ * link with the same value as the original link.
+ *
+ * H5Ocopy() can be used to copy an object in an HDF5 file. If
+ * an object has been changed since it was opened, it should be
+ * written back to the file before using H5Ocopy(). The object
+ * can be written back either by closing the object (H5Gclose(),
+ * H5Oclose(), H5Dclose(), or H5Tclose()) or by flushing
+ * the HDF5 file (H5Fflush()).
+ *
+ * \par See Also:
+ * - Functions to modify the behavior of H5Ocopy():
+ * - H5Padd_merge_committed_dtype_path()
+ * - H5Pset_copy_object()
+ * - H5Pset_create_intermediate_group()
+ * - H5Pset_mcdt_search_cb()
+ * - Copying Committed Datatypes with #H5Ocopy - A comprehensive
+ * discussion of copying committed datatypes (PDF) in
+ * Advanced Topics in HDF5
+ *
+ * \version 1.8.9 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Sets comment for specified object
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ * \param[in] comment The new comment
+ *
+ * \return \herr_t
+ *
+ * \details H5Oset_comment() sets the comment for the specified object
+ * to the contents of \p comment. Any previously existing comment
+ * is overwritten.
+ *
+ * The target object is specified by an identifier, \p obj_id.
+ * If \p comment is the empty string or a null pointer, any existing
+ * comment message is removed from the object.
+ *
+ * Comments should be relatively short, null-terminated, ASCII strings.
+ *
+ * Comments can be attached to any object that has an object
+ * header. Datasets, groups, and committed (named) datatypes have
+ * object headers. Symbolic links do not have object headers.
+ *
+ * If a comment is being added to an object attribute, this comment
+ * will be attached to the object to which the attribute belongs
+ * and not to the attribute itself.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oset_comment(hid_t obj_id, const char *comment);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Sets comment for specified object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of the object whose comment is to be set or reset
+ * \param[in] comment The new comment
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Oset_comment_by_name() sets the comment for the specified object
+ * to the contents of \p comment. Any previously existing comment
+ * is overwritten.
+ *
+ * The target object is specified by \p loc_id and \p name.
+ * \p loc_id can specify any object in the file.
+ * \p name can be one of the following:
+ *
+ * - The name of the object specified as a path relative to \p loc_id
+ * - An absolute name of the object, starting from \c /, the file’s root group
+ * - A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * If \p comment is the empty string or a null pointer, any existing
+ * comment message is removed from the object.
+ *
+ * Comments should be relatively short, null-terminated, ASCII strings.
+ *
+ * Comments can be attached to any object that has an object
+ * header. Datasets, groups, and committed (named) datatypes have
+ * object headers. Symbolic links do not have object headers.
+ *
+ * If a comment is being added to an object attribute, this comment
+ * will be attached to the object to which the attribute belongs
+ * and not to the attribute itself.
+ *
+ * \p lapl_id contains a link access property list identifier. A
+ * link access property list can come into play when traversing
+ * links to access an object.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves comment for specified object
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ * \param[out] comment The comment
+ * \param[in] bufsize Anticipated required size of the comment buffer
+ *
+ * \return Upon success, returns the number of characters in the
+ * comment, not including the \c NULL terminator, or zero (\c 0) if
+ * the object has no comment. The value returned may be larger
+ * than \p bufsize. Otherwise returns a negative value.
+ *
+ * \details H5Oget_comment() retrieves the comment for the specified object in
+ * the buffer \p comment.
+ *
+ * The target object is specified by an identifier, \p object_id.
+ *
+ * The size in bytes of the buffer \p comment, including the \c NULL
+ * terminator, is specified in \p bufsize. If \p bufsize is unknown,
+ * a preliminary H5Oget_comment() call with the pointer \p comment
+ * set to \c NULL will return the size of the comment <em>without</em>
+ * the \c NULL terminator.
+ *
+ * If \p bufsize is set to a smaller value than described above,
+ * only \p bufsize bytes of the comment, without a \c NULL terminator,
+ * are returned in \p comment.
+ *
+ * If an object does not have a comment, the empty string is
+ * returned in \p comment.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves comment for specified object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of the object whose comment is to be retrieved
+ * \param[out] comment The comment
+ * \param[in] bufsize Anticipated required size of the \p comment buffer
+ * \lapl_id
+ *
+ * \return Upon success, returns the number of characters in the comment,
+ * not including the \c NULL terminator, or zero (\c 0) if the object
+ * has no comment. The value returned may be larger than \c bufsize.
+ * Otherwise returns a negative value.
+ *
+ * \details H5Oget_comment_by_name() retrieves the comment for an object
+ * in the buffer \p comment.
+ *
+ * The target object is specified by \p loc_id and \p name.
+ * \p loc_id can specify any object in the file.
+ * \p name can be one of the following:
+ *
+ * - The name of the object relative to \p loc_id
+ * - An absolute name of the object, starting from \c /, the file’s root group
+ * - A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * The size in bytes of the comment, including the \c NULL terminator,
+ * is specified in \p bufsize. If \p bufsize is unknown, a preliminary
+ * H5Oget_comment_by_name() call with the pointer \p comment set
+ * to \c NULL will return the size of the comment <em>without</em>
+ * the \c NULL terminator.
+ *
+ * If \p bufsize is set to a smaller value than described above,
+ * only \p bufsize bytes of the comment, without a \c NULL terminator,
+ * are returned in \p comment.
+ *
+ * If an object does not have a comment, the empty string is
+ * returned in \p comment.
+ *
+ * \p lapl_id contains a link access property list identifier. A
+ * link access property list can come into play when traversing
+ * links to access an object.
+ *
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize,
hid_t lapl_id);
-H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op,
- void *op_data, unsigned fields);
-H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields,
- hid_t lapl_id);
-H5_DLL herr_t H5Oclose(hid_t object_id);
-H5_DLL herr_t H5Oflush(hid_t obj_id);
-H5_DLL herr_t H5Orefresh(hid_t oid);
-H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
-H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
-H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
-H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2,
- int *cmp_value);
-H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str);
-H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects accessible from a specified object
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ * \param[in] fields Flags specifying the fields to be retrieved to the
+ * callback \p op
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \details H5Ovisit3() is a recursive iteration function to visit the
+ * object \p obj_id and, if \p obj_id is a group, all objects in
+ * and below it in an HDF5 file, thus providing a mechanism for
+ * an application to perform a common set of operations across
+ * all of those objects or a dynamically selected subset.
+ * For non-recursive iteration across the members of a group,
+ * see H5Literate2().
+ *
+ * If \p obj_id is a group identifier, that group serves as the
+ * root of a recursive iteration. If \p obj_id is a file identifier,
+ * that file’s root group serves as the root of the recursive
+ * iteration. If \p obj_id is an attribute identifier,
+ * then the object where the attribute is attached will be iterated.
+ * If \p obj_id is any other type of object, such as a dataset or
+ * named datatype, there is no iteration.
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in
+ * a value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The prototype of the callback function op is as follows (as
+ * defined in the source code file H5Opublic.h):
+ *
+ * \snippet this H5O_iterate2_t_snip
+ *
+ * The parameters of this callback function have the following values
+ * or meanings:
+ * <table>
+ * <tr>
+ * <td>\c obj</td>
+ * <td>Object that serves as root of the iteration;
+ * same value as the H5Ovisit() \p obj_id parameter</td>
+ * </tr>
+ * <tr>
+ * <td>\c name</td>
+ * <td>Name of object, relative to \c obj, being examined at
+ * current step of the iteration</td>
+ * </tr>
+ * <tr>
+ * <td>\c info</td>
+ * <td>H5O_info2_t \c struct containing information
+ * regarding that object</td>
+ * </tr>
+ * <tr>
+ * <td>\c op_data</td>
+ * <td>User-defined pointer to data required by the application in
+ * processing the object; a pass-through of the \c op_data pointer
+ * provided with the H5Ovisit() function call</td>
+ * </tr>
+ * </table>
+ *
+ * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
+ * \snippet this H5O_info2_t_snip
+ *
+ * H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * The #H5O_type_t enum indicates the object type and is
+ * defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * Note that the object retrieved as indicated by \p obj_id
+ * refers only to the types specified by #H5O_type_t.
+ *
+ * The return values from an operator are:
+ * - Zero causes the visit iterator to continue, returning zero when all
+ * group members have been processed.
+ * - A positive value causes the visit iterator to immediately return that
+ * positive value, indicating short-circuit success.
+ * - A negative value causes the visit iterator to immediately return that
+ * value, indicating failure.
+ *
+ * The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data
+ * required to process objects in the course of the iteration. This pointer
+ * is passed back to each step of the iteration in the callback
+ * function’s \p op_data parameter.
+ *
+ * The \p fields parameter contains flags to determine which fields will
+ * be retrieved by the \p op callback function. These flags are defined
+ * in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * H5Lvisit2() and H5Ovisit3() are companion functions: one for
+ * examining and operating on links; the other for examining
+ * and operating on the objects that those links point to. Both
+ * functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires. These functions assume
+ * that the membership of the group being iterated over remains
+ * unchanged through the iteration; if any of the links in the
+ * group change during the iteration, the resulting behavior
+ * is undefined.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \par Example
+ * An example snippet from test/links.c:
+ * \snippet links.c H5Ovisit3_snip
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op,
+ void *op_data, unsigned fields);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects accessible from a specified object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] obj_name Name of the object, generally relative to
+ * \p loc_id, that will serve as root of the iteration
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ * \param[in] fields Flags specifying the fields to be retrieved to the
+ * callback function \p op
+ * \lapl_id
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \details H5Ovisit_by_name3() is a recursive iteration function to visit
+ * the object specified by the \p loc_id / \p obj_name parameter
+ * pair and, if that object is a group, all objects in and below it
+ * in an HDF5 file, thus providing a mechanism for an application to
+ * perform a common set of operations across all of those objects or
+ * a dynamically selected subset. For non-recursive iteration across
+ * the members of a group, see H5Literate2().
+ *
+ * The object serving as the root of the iteration is specified
+ * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies
+ * a file or an object in a file; if \p loc_id is an attribute identifier,
+ * the object where the attribute is attached will be used.
+ * \p obj_name specifies either an object in the file (with an absolute
+ * name based in the file’s root group) or an object name relative
+ * to \p loc_id. If \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, \p obj_name should be '\c .' (a dot).
+ * (Note that when \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, the user may wish to consider
+ * using H5Ovisit3() instead of H5Ovisit_by_name3().)
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in a
+ * value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The prototype of the callback function op is as follows (as
+ * defined in the source code file H5Opublic.h):
+ *
+ * \snippet this H5O_iterate2_t_snip
+ *
+ * The parameters of this callback function have the following
+ * values or meanings:
+ * <table>
+ * <tr>
+ * <td>\c obj</td>
+ * <td>Object that serves as root of the iteration</td>
+ * </tr>
+ * <tr>
+ * <td>\c name</td>
+ * <td>Name of object, relative to \c obj, being examined at
+ * current step of the iteration</td>
+ * </tr>
+ * <tr>
+ * <td>\c info</td>
+ * <td>H5O_info2_t \c struct containing information
+ * regarding that object</td>
+ * </tr>
+ * <tr>
+ * <td>\c op_data</td>
+ * <td>User-defined pointer to data required by the application in
+ * processing the object</td>
+ * </tr>
+ * </table>
+ *
+ * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
+ * \snippet this H5O_info2_t_snip
+ *
+ * H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * The #H5O_type_t enum indicates the object type and is
+ * defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * The H5Ovisit_by_name3() \p op_data parameter is a user-defined
+ * pointer to the data required to process objects in the course
+ * of the iteration. This pointer is passed back to each step of
+ * the iteration in the callback function’s \p op_data parameter.
+ *
+ * \p lapl_id is a link access property list. In the general case,
+ * when default link access properties are acceptable, this can
+ * be passed in as #H5P_DEFAULT. An example of a situation that
+ * requires a non-default link access property list is when
+ * the link is an external link; an external link may require
+ * that a link prefix be set in a link access property list
+ * (see H5Pset_elink_prefix()).
+ *
+ * The \p fields parameter contains flags to determine which fields will
+ * be retrieved by the \p op callback function. These flags are defined
+ * in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * H5Lvisit_by_name2() and H5Ovisit_by_name3() are companion
+ * functions: one for examining and operating on links; the other
+ * for examining and operating on the objects that those links point to.
+ * Both functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \par Example
+ * An example snippet from test/links.c:
+ * \snippet links.c H5Ovisit_by_name3_snip
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields,
+ hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Closes an object in an HDF5 file
+ *
+ * \obj_id{object_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Oclose() closes the group, dataset, or named datatype specified by
+ * object_id.
+ *
+ * This function is the companion to H5Oopen(), and has the same
+ * effect as calling H5Gclose(), H5Dclose(), or H5Tclose().
+ *
+ * H5Oclose() is not used to close a dataspace, attribute, property
+ * list, or file.
+ *
+ * \version 1.8.8 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Oclose(hid_t object_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Flushes all buffers associated with an HDF5 object to disk
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Oflush() causes all buffers associated with an object to be immediately
+ * flushed to disk without removing the data from the cache.
+ *
+ * The object associated with \p object_id can be any named object in an
+ * HDF5 file including a dataset, a group, or a committed datatype.
+ *
+ * \note HDF5 does not possess full control over buffering. H5Oflush()
+ * flushes the internal HDF5 buffers and then asks the operating
+ * system (the OS) to flush the system buffers for the open
+ * files. After that, the OS is responsible for ensuring that
+ * the data is actually flushed to disk.
+ *
+ * \par See Also:
+ * - H5Dflush()
+ * - H5Drefresh()
+ * - H5Oflush()
+ * - H5Grefresh()
+ * - H5Oflush()
+ * - H5Orefresh()
+ * - H5Tflush()
+ * - H5Trefresh()
+ * \par
+ * - \c H5DOappend()
+ * - H5Fstart_swmr_write()
+ * - H5Pget_append_flush()
+ * - H5Pget_object_flush_cb()
+ * - H5Pset_append_flush()
+ * - H5Pset_object_flush_cb()
+ * \par
+ * - H5Oare_mdc_flushes_disabled()
+ * - H5Odisable_mdc_flushes()
+ * - H5Oenable_mdc_flushes()
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Oflush(hid_t obj_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Refreshes all buffers associated with an HDF5 object
+ *
+ * \fgdta_loc_obj_id{oid}
+ *
+ * \return \herr_t
+ *
+ * \details H5Orefresh() causes all buffers associated with an object to be cleared
+ * and immediately re-loaded with updated contents from disk.
+ *
+ * This function essentially closes the object, evicts all
+ * metadata associated with it from the cache, and then re-opens
+ * the object. The reopened object is automatically re-registered
+ * with the same identifier.
+ *
+ * The object associated with \p oid can be any named object in an
+ * HDF5 file including a dataset, a group, or a committed datatype.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Orefresh(hid_t oid);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Prevents metadata entries for an HDF5 object from being flushed
+ * from the metadata cache to storage
+ *
+ * \param[in] object_id Identifier of the object that will have flushes disabled;
+ * may be a group, named datatype, or dataset identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes() and associated flush
+ * functions can be used to control the flushing of entries from
+ * a file’s metadata cache.
+ *
+ * This function prevents an object’s or cache’s dirty metadata
+ * entries from being flushed from the cache by the usual cache
+ * eviction/flush policy. Instead, users must manually flush the
+ * cache or entries for individual objects via the appropriate
+ * H5Fflush(), H5Dflush(), H5Gflush(), H5Tflush(), and H5Oflush() calls.
+ *
+ * Metadata cache entries can be controlled at both the individual
+ * HDF5 object level (datasets, groups, committed datatypes)
+ * and the entire metadata cache level.
+ *
+ * \note HDF5 objects include datasets, groups, and committed datatypes.
+ * Only #hid_t identifiers that represent these objects can be passed to the function.
+ * \note Passing in a #hid_t identifier that represents any other HDF5 entity is
+ * considered an error.
+ * \note It is an error to pass an HDF5 file identifier
+ * (obtained from H5Fopen() or H5Fcreate())
+ * to this function.
+ * \note Misuse of this function can cause the cache to exhaust
+ * available memory.
+ * \note Objects can be returned to the default automatic flush behavior
+ * with H5Oenable_mdc_flushes().
+ * \note Flush prevention only pertains to new or dirty metadata entries.
+ * Clean entries can be evicted from the cache.
+ * \note Calling this function on an object that has already had flushes
+ * disabled will return an error.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Enables flushing of dirty metadata entries from a file’s metadata cache
+ *
+ * \param[in] object_id Identifier of the object that will have flushes re-enabled;
+ * may be a group, named datatype, or dataset identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes()
+ * and associated flush functions can be used to control the flushing
+ * of entries from a file’s metadata cache.
+ *
+ * This function allows an object or cache’s dirty metadata entries to be
+ * flushed from the cache by the usual cache eviction/flush policy.
+ *
+ * Metadata cache entries can be controlled at both the individual HDF5
+ * object level (datasets, groups, committed datatypes) and the entire
+ * metadata cache level.
+ *
+ *
+ * \note HDF5 objects include datasets, groups, and committed datatypes.
+ * Only #hid_t identifiers that represent these objects can be
+ * passed to the function.
+ *
+ * \note Passing in a #hid_t identifier that represents any other HDF5 entity
+ * is considered an error.
+ *
+ * \note It is an error to pass an HDF5 file identifier
+ * (obtained from H5Fopen() or H5Fcreate())
+ * to this function.
+ *
+ * \note Using this function on an object that has not had flushes disabled
+ * is considered an error. The state of an object can be determined
+ * with H5Oare_mdc_flushes_disabled().
+ *
+ * \note An object will be returned to the default flush algorithm when it is closed.
+ *
+ * \note All objects will be returned to the default flush algorithm when
+ * the file is closed.
+ *
+ * \note An object’s entries will not necessarily be flushed as a result of
+ * calling this function.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves comment for specified object
+ *
+ * \param[in] object_id Identifier of an object in the cache;
+ * may be a group, named datatype, or dataset identifier
+ * \param[out] are_disabled Flushes enabled/disabled
+ *
+ * \return \p are_disabled will be set to \c 1 if an object has had flushes disabled
+ * and \c 0 if it has not had flushes disabled.
+ * \return \herr_t
+ *
+ * \details H5Oare_mdc_flushes_disabled() determines if an HDF5 object (dataset, group, committed
+ * datatype) has had flushes of metadata entries disabled.
+ *
+ * The H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() and
+ * associated flush functions can be used to control the flushing of
+ * entries from a file’s metadata cache. Metadata cache entries can be controlled
+ * at both the individual HDF5 object level (datasets, groups,
+ * committed datatypes) and the entire metadata cache level.
+ *
+ * \note HDF5 objects include datasets, groups, and committed datatypes.
+ * Only #hid_t identifiers that represent these objects can be passed to the function.
+ * \note Passing in a #hid_t identifier that represents any other HDF5 entity is
+ * considered an error.
+ * \note It is an error to pass an HDF5 file identifier
+ * (obtained from H5Fopen() or H5Fcreate()) to this function.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Compares two VOL connector object tokens
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] token1 First object token
+ * \param[in] token2 Second object token
+ * \param[out] cmp_value Comparison value
+ *
+ * \return \herr_t
+ *
+ * \details H5Otoken_cmp() compares two VOL connector object tokens, \p token1
+ * and \p token2 for the file or group identifier specified by \p loc_id.
+ * Both object tokens must be from the same VOL connector class.
+ *
+ * H5O_token_t is defined in H5public.h as follows:
+ * \snippet H5public.h H5O_token_t_snip
+ *
+ * A comparison value, \p cmp_value, is returned, which indicates the
+ * result of the comparison:
+ *
+ * <table>
+ * <tr>
+ * <th>cmp_value</th>
+ * <th>Result</th>
+ * </tr>
+ * <tr>
+ * <td> > 0</td>
+ * <td> \p token1 > \p token2</td>
+ * </tr>
+ * <tr>
+ * <td> < 0</td>
+ * <td>\p token1 < \p token2</td>
+ * </tr>
+ * <tr>
+ * <td>0</td>
+ * <td>\p token1 = \p token2</td>
+ * </tr>
+ * </table>
+ *
+ * \par Example
+ * An example snippet from test/links.c:
+ * \snippet links.c H5Otoken_cmp_snip
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2,
+ int *cmp_value);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Serializes a connector's object token into a string
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] token Connector object token
+ * \param[out] token_str String for connector object token \p token
+ *
+ * \return \herr_t
+ *
+ * \details H5Otoken_to_str() serializes a connector's object token specified by
+ * \p token and the location identifier for the object, \p loc_id,
+ * into a string, \p token_str.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Deserializes a string into a connector object token
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] token_str Object token string
+ * \param[out] token Connector object token
+ *
+ * \return \herr_t
+ *
+ * \details H5Otoken_from_str() deserializes a string, \p token_str, into a
+ * connector object token, \p token, for the object specified by the
+ * location identifier, \p loc_id.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
/* The canonical 'undefined' token value */
#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g)
@@ -245,55 +1840,978 @@ H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g;
/* Typedefs */
-/* A struct that's part of the H5G_stat_t structure (deprecated) */
+//! <!-- [H5O_stat_t_snip] -->
+/**
+ * A struct that's part of the \ref H5G_stat_t structure
+ * \deprecated
+ */
typedef struct H5O_stat_t {
- hsize_t size; /* Total size of object header in file */
- hsize_t free; /* Free space within object header */
- unsigned nmesgs; /* Number of object header messages */
- unsigned nchunks; /* Number of object header chunks */
+ hsize_t size; /**< Total size of object header in file */
+ hsize_t free; /**< Free space within object header */
+ unsigned nmesgs; /**< Number of object header messages */
+ unsigned nchunks; /**< Number of object header chunks */
} H5O_stat_t;
+//! <!-- [H5O_stat_t_snip] -->
-/* Information struct for object */
-/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */
+//! <!-- [H5O_info1_t_snip] -->
+/**
+ * Information struct for object (For H5Oget_info(), H5Oget_info_by_name(),
+ * H5Oget_info_by_idx() versions 1 & 2.)
+ */
typedef struct H5O_info1_t {
- unsigned long fileno; /* File number that object is located in */
- haddr_t addr; /* Object address in file */
- H5O_type_t type; /* Basic object type (group, dataset, etc.) */
- unsigned rc; /* Reference count of object */
- time_t atime; /* Access time */
- time_t mtime; /* Modification time */
- time_t ctime; /* Change time */
- time_t btime; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
- H5O_hdr_info_t hdr; /* Object header information */
+ unsigned long fileno; /**< File number that object is located in */
+ haddr_t addr; /**< Object address in file */
+ H5O_type_t type; /**< Basic object type (group, dataset, etc.) */
+ unsigned rc; /**< Reference count of object */
+ time_t atime; /**< Access time */
+ time_t mtime; /**< Modification time */
+ time_t ctime; /**< Change time */
+ time_t btime; /**< Birth time */
+ hsize_t num_attrs; /**< # of attributes attached to object */
+ H5O_hdr_info_t hdr; /**< Object header information */
/* Extra metadata storage for obj & attributes */
struct {
- H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
+ H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */
} meta_size;
} H5O_info1_t;
+//! <!-- [H5O_info1_t_snip] -->
-/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */
+//! <!-- [H5O_iterate1_t_snip] -->
+/**
+ * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2)
+ */
typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data);
+//! <!-- [H5O_iterate1_t_snip] -->
/* Function prototypes */
-H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Opens an object using its address within an HDF5 file.
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] addr Object's address in the file
+ *
+ * \return \hid_tv{object}
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oopen_by_token().
+ *
+ * \details H5Oopen_by_addr() opens a group, dataset, or committed (named) datatype using its
+ * address within an HDF5 file, \p addr. The resulting opened object is identical to
+ * an object opened with H5Oopen() and should be closed with H5Oclose() or an
+ * object-type-specific closing function (such as H5Gclose()) when no longer needed.
+ *
+ * \p loc_id is a location identifier in the file.
+ *
+ * The object’s address within the file, \p addr, is the byte offset of the first byte
+ * of the object header from the beginning of the HDF5 file space, i.e., from the
+ * beginning of the super block (see the “HDF5 Storage Model” section of the The
+ * HDF5 Data Model and File Structure chapter of the <em>HDF5 User's Guide</em>.)
+ *
+ * \p addr can be obtained via either of two function calls. H5Gget_objinfo() returns
+ * the object’s address in the \c objno field of the H5G_stat_t \c struct;
+ * H5Lget_info() returns the address in the \c address field of the #H5L_info_t \c struct.
+ *
+ * The address of the HDF5 file on a physical device has no effect on H5Oopen_by_addr(),
+ * nor does the use of any file driver. As stated above, the object address is its
+ * offset within the HDF5 file; HDF5’s file drivers will transparently map this to an
+ * address on a storage device.
+ *
+ * \warning This function must be used with care!
+ * \warning Improper use can lead to inaccessible data, wasted space in the file,
+ * or <b><em>file corruption</em></b>.
+ * \warning This function is dangerous if called on an invalid address. The risk can be safely
+ * overcome by retrieving the object address with H5Gget_objinfo() or H5Lget_info()
+ * immediately before calling H5Oopen_by_addr(). The immediacy of the operation can be
+ * important; if time has elapsed and the object has been deleted from the file,
+ * the address will be invalid and file corruption can result.
+ *
+ * \version 1.8.4 Fortran subroutine added in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object specified by an identifier
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[out] oinfo Buffer in which to return object information
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oget_info3() or the macro #H5Oget_info.
+ *
+ * \details H5Oget_info1() specifies an object by its identifier, \p loc_id , and
+ * retrieves the metadata describing that object in \p oinfo ,
+ * defined as a \c struct of type H5O_info1_t :
+ *
+ * \snippet this H5O_info1_t_snip
+ *
+ * Note the following about H5O_info1_t :
+ * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
+ * only \c ctime has been implemented.
+ * - The \c atime value is the last time the object was read or written.
+ * - The \c mtime value is the last time the raw data in the object was changed.
+ * - The \c ctime value is the last time the metadata for the object was changed.
+ * - The \c btime value is the time the object was created.
+ * - The fields nested in the \c meta_size field are for internal library use only.
+ *
+ * The #H5O_type_t \c enum indicates the object type and
+ * is defined in H5Opublic.h as follows:
+ * \snippet this H5O_type_t_snip
+ *
+ * Note that the object retrieved as indicated by \p loc_id
+ * refers only to the types specified by #H5O_type_t.
+ *
+ * An H5O_hdr_info_t \c struct holds object header metadata and is
+ * defined in H5Opublic.h as follows:
+ * \snippet this H5O_hdr_info_t_snip
+ *
+ * Valid values for the \c version field are \c H5O_VERSION_1 and \c H5O_VERSION_2.
+ * Version 2 of the object header is smaller and more efficient than version 1.
+ *
+ * Please be aware that the information held by H5O_hdr_info_t may only be useful to
+ * developers with extensive HDF5 experience.
+ *
+ * \note If you are iterating through a lot of different objects to
+ * retrieve information via the H5Oget_info() family of routines,
+ * you may see memory building up. This can be due to memory
+ * allocation for metadata such as object headers and messages
+ * when the iterated objects are put into the metadata cache.
+ * \note
+ * If the memory buildup is not desirable, you can configure a
+ * smaller cache via H5Fset_mdc_config() or set the file access
+ * property list via H5Pset_mdc_config(). A smaller sized cache
+ * will force metadata entries to be evicted from the cache,
+ * thus freeing the memory associated with the entries.
+ *
+ * \version 1.10.5 The macro #H5Oget_info was removed and the function
+ * H5Oget_info1() was copied to H5Oget_info().
+ * \version 1.10.3 Function H5Oget_info() was copied to H5Oget_info1(),
+ * and the macro #H5Oget_info was created.
+ * \version 1.8.15 Added a note about the valid values for the \c version
+ * field in the H5O_hdr_info_t structure.
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ * \version 1.8.10 Added #H5O_type_t structure to the Description section. \n
+ * Separated H5O_hdr_info_t structure from #H5O_info_t in the
+ * Description section. \n
+ * Clarified the definition and implementation of the time fields.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object
+ * by location and relative name
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of group, relative to \p loc_id
+ * \param[out] oinfo Buffer in which to return object information
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oget_info_by_name2() or the macro #H5Oget_info_by_name.
+ *
+ * \details H5Oget_info_by_name1() specifies an object’s location and name, \p loc_id
+ * and \p name, respectively, and retrieves the metadata describing that object
+ * in \p oinfo, an H5O_info1_t \c struct.
+ *
+ * The \c struct H5O_info1_t is defined in H5Opublic.h and described
+ * in the H5Oget_info1() function entry.
+ *
+ * The link access property list, \p lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \version 1.10.5 The macro #H5Oget_info_by_name was removed and the function
+ * H5Oget_info_by_name1() was copied to H5Oget_info_by_name().
+ * \version 1.10.3 Function H5Oget_info_by_name() was copied to H5Oget_info_by_name1()
+ * and the macro #H5Oget_info_by_name was created.
+ * \version 1.8.8 Fortran 2003 subroutine and \c h5o_info_t derived type introduced
+ * in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object
+ * by an index position
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] group_name Name of group in which object is located
+ * \idx_type
+ * \order
+ * \param[in] n Position within the index
+ * \param[out] oinfo Buffer in which to return object information
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oget_info_by_idx3() or the macro H5Oget_info_by_idx().
+ *
+ * \details H5Oget_info_by_idx1() retrieves the metadata describing an
+ * object in the \c struct \p oinfo, as specified by the location,
+ * \p loc_id, group name, \p group_name, the index by which objects
+ * in that group are tracked, \p idx_type, the order by which the
+ * index is to be traversed, \p order, and an object’s position
+ * \p n within that index.
+ *
+ * If \p loc_id fully specifies the group in which the object resides,
+ * \p group_name can be a dot (\c .).
+ *
+ * \p idx_type is of type #H5_index_t, defined in H5public.h as:
+ * \snippet H5public.h H5_index_t_snip
+ *
+ * \p order is of type #H5_iter_order_t defined in H5public.h as:
+ * \snippet H5public.h H5_iter_order_t_snip
+ *
+ * \p oinfo, in which the object information is returned, is a \c struct of
+ * type H5O_info1_t .
+ * \snippet this H5O_info1_t_snip
+ *
+ * The link access property list, \c lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \version 1.10.5 The macro #H5Oget_info_by_idx was removed and the function
+ * H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1().
+ * \version 1.10.3 Function H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1()
+ * and the macro #H5Oget_info_by_idx was created.
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object specified by an identifier
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oget_info3() or the macro H5Oget_info().
+ *
+ * \details H5Oget_info2() specifies an object by its identifier, \p loc_id , and
+ * retrieves the metadata describing that object in \p oinfo , an H5O_info1_t \c struct.
+ * This \c struct type is described in H5Oget_info1().
+ *
+ * The \p fields parameter contains flags to determine which fields will be filled in
+ * the H5O_info1_t \c struct returned in \p oinfo.
+ * These flags are defined in the H5Opublic.h file:
+ *
+ * \obj_info_fields
+ *
+ * \note If you are iterating through a lot of different objects to
+ * retrieve information via the H5Oget_info() family of routines,
+ * you may see memory building up. This can be due to memory
+ * allocation for metadata such as object headers and messages
+ * when the iterated objects are put into the metadata cache.
+ * \note
+ * If the memory buildup is not desirable, you can configure a
+ * smaller cache via H5Fset_mdc_config() or set the file access
+ * property list via H5Pset_mdc_config(). A smaller sized cache
+ * will force metadata entries to be evicted from the cache,
+ * thus freeing the memory associated with the entries.
+ *
+ * \since 1.10.3
+ *
+ */
H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object
+ * by location and relative name
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] name Name of group, relative to \p loc_id
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Oget_info_by_name3() or the macro H5Oget_info_by_name().
+ *
+ * \details H5Oget_info_by_name2() specifies an object’s location and name, \p loc_id and
+ * \p name, respectively, and retrieves the metadata describing
+ * that object in \p oinfo, an H5O_info1_t \c struct.
+ *
+ * The \c struct H5O_info1_t is defined in H5Opublic.h and described
+ * in the H5Oget_info1() function entry.
+ *
+ * The \p fields parameter contains flags to determine which fields
+ * will be filled in in the H5O_info1_t \c struct returned in
+ * \p oinfo. These flags are defined in the H5Opublic.h file:
+ *
+ * \obj_info_fields
+ *
+ * The link access property list, \p lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \since 1.10.3
+ *
+ */
H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, unsigned fields,
hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Retrieves the metadata for an object, identifying the object
+ * by an index position
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] group_name Name of group in which object is located
+ * \idx_type
+ * \order
+ * \param[in] n Position within the index
+ * \param[out] oinfo Buffer in which to return object information
+ * \param[in] fields Flags specifying the fields to include in \p oinfo
+ * \lapl_id
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function is deprecated in favor of
+ * the function H5Oget_info_by_idx3() or the macro #H5Oget_info_by_idx.
+ *
+ * \details H5Oget_info_by_idx2() retrieves the metadata describing an
+ * object in the \c struct \p oinfo, as specified by the location,
+ * \p loc_id, group name, \p group_name, the index by which objects
+ * in that group are tracked, \p idx_type, the order by which the
+ * index is to be traversed, \p order, and an object’s position
+ * \p n within that index.
+ *
+ * \p oinfo, in which the object information is returned, is a \c struct of
+ * type H5O_info1_t. This and other \c struct types used
+ * by H5Oget_info_by_idx2() are described in H5Oget_info_by_idx1().
+ *
+ * If \p loc_id fully specifies the group in which the object resides,
+ * i\p group_name can be a dot (\c .).
+ *
+ * The \p fields parameter contains flags to determine which fields will be
+ * filled in the H5O_info1_t \c struct returned in \p oinfo.
+ * These flags are defined in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * The link access property list, \c lapl_id, is not currently used;
+ * it should be passed in as #H5P_DEFAULT.
+ *
+ * \since 1.10.3
+ *
+ */
H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, unsigned fields,
hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects accessible from a specified object
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Ovisit3() or the macro #H5Ovisit.
+ *
+ * \details H5Ovisit1() is a recursive iteration function to visit the
+ * object \p obj_id and, if \p obj_id is a group, all objects in
+ * and below it in an HDF5 file, thus providing a mechanism for
+ * an application to perform a common set of operations across all
+ * of those objects or a dynamically selected subset. For
+ * non-recursive iteration across the members of a group,
+ * see H5Literate1().
+ *
+ * If \p obj_id is a group identifier, that group serves as the
+ * root of a recursive iteration. If \p obj_id is a file identifier,
+ * that file’s root group serves as the root of the recursive
+ * iteration. If \p obj_id is an attribute identifier,
+ * then the object where the attribute is attached will be iterated.
+ * If \p obj_id is any other type of object, such as a dataset or
+ * named datatype, there is no iteration.
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in
+ * a value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The prototype of the callback function op is as follows (as
+ * defined in the source code file H5Opublic.h):
+ *
+ * \snippet this H5O_iterate1_t_snip
+ *
+ * The parameters of this callback function have the following values
+ * or meanings:
+ * <table>
+ * <tr>
+ * <td>\c obj</td>
+ * <td>Object that serves as root of the iteration;
+ * same value as the H5Ovisit1() \p obj_id parameter</td>
+ * </tr>
+ * <tr>
+ * <td>\c name</td>
+ * <td>Name of object, relative to \c obj, being examined at
+ * current step of the iteration</td>
+ * </tr>
+ * <tr>
+ * <td>\c info</td>
+ * <td>H5O_info1_t \c struct containing information
+ * regarding that object</td>
+ * </tr>
+ * <tr>
+ * <td>\c op_data</td>
+ * <td>User-defined pointer to data required by the application in
+ * processing the object</td>
+ * </tr>
+ * </table>
+ *
+ * The H5O_info1_t \c struct is defined in H5Opublic.h:
+ * \snippet this H5O_info1_t_snip
+ *
+ * The return values from an operator are:
+ * - Zero causes the visit iterator to continue, returning zero when all
+ * group members have been processed.
+ * - A positive value causes the visit iterator to immediately return that
+ * positive value, indicating short-circuit success.
+ * - A negative value causes the visit iterator to immediately return that
+ * value, indicating failure.
+ *
+ * The H5Ovisit1() \p op_data parameter is a user-defined pointer to the data
+ * required to process objects in the course of the iteration. This pointer
+ * is passed back to each step of the iteration in the callback
+ * function’s \p op_data parameter.
+ *
+ * H5Lvisit1() and H5Ovisit1() are companion functions: one for
+ * examining and operating on links; the other for examining
+ * and operating on the objects that those links point to. Both
+ * functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires. These functions assume
+ * that the membership of the group being iterated over remains
+ * unchanged through the iteration; if any of the links in the
+ * group change during the iteration, the resulting behavior
+ * is undefined.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \version 1.10.5 The macro #H5Ovisit was removed and the function
+ * H5Ovisit1() was copied to H5Ovisit().
+ * \version 1.10.3 Function H5Ovisit() was copied to H5Ovisit1(),
+ * and the macro #H5Ovisit was created.
+ * \version 1.8.8 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op,
void *op_data);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects starting from a specified object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] obj_name Name of the object, generally relative to
+ * \p loc_id, that will serve as root of the iteration
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ * \lapl_id
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name.
+ *
+ * \details H5Ovisit_by_name1() is a recursive iteration function to visit
+ * the object specified by the \p loc_id / \p obj_name parameter
+ * pair and, if that object is a group, all objects in and below it
+ * in an HDF5 file, thus providing a mechanism for an application to
+ * perform a common set of operations across all of those objects or
+ * a dynamically selected subset. For non-recursive iteration across
+ * the members of a group, see H5Literate1().
+ *
+ * The object serving as the root of the iteration is specified
+ * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies
+ * a file or an object in a file; if \p loc_id is an attribute identifier,
+ * the object where the attribute is attached will be used.
+ * \p obj_name specifies either an object in the file (with an absolute
+ * name based in the file’s root group) or an object name relative
+ * to \p loc_id. If \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, \p obj_name should be '\c .' (a dot).
+ * (Note that when \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, the user may wish to consider
+ * using H5Ovisit1() instead of H5Ovisit_by_name1().)
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in a
+ * value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The \p op callback function and the effect of the callback
+ * function’s return value on the application are described
+ * in H5Ovisit1().
+ *
+ * The H5O_info1_t \c struct is defined in H5Opublic.h
+ * and described in the H5Oget_info1() function entry.
+ *
+ * The H5Ovisit_by_name1() \p op_data parameter is a user-defined
+ * pointer to the data required to process objects in the course
+ * of the iteration. This pointer is passed back to each step of
+ * the iteration in the callback function’s \p op_data parameter.
+ *
+ * \p lapl_id is a link access property list. In the general case,
+ * when default link access properties are acceptable, this can
+ * be passed in as #H5P_DEFAULT. An example of a situation that
+ * requires a non-default link access property list is when
+ * the link is an external link; an external link may require
+ * that a link prefix be set in a link access property list
+ * (see H5Pset_elink_prefix()).
+ *
+ * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion
+ * functions: one for examining and operating on links; the other
+ * for examining and operating on the objects that those links point to.
+ * Both functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \version 1.10.5 The macro #H5Ovisit_by_name was removed and the function
+ * H5Ovisit_by_name1() was copied to #H5Ovisit_by_name.
+ * \version 1.10.3 The H5Ovisit_by_name() function was renamed to H5Ovisit_by_name1(),
+ * and the macro #H5Ovisit_by_name was created.
+ * \version 1.8.11 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects accessible from a specified object
+ *
+ * \fgdta_loc_obj_id{obj_id}
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ * \param[in] fields Flags specifying the fields to be retrieved to the
+ * callback \p op
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Ovisit3() or the macro #H5Ovisit.
+ *
+ * \details H5Ovisit2() is a recursive iteration function to visit the
+ * object \p obj_id and, if \p obj_id is a group, all objects in
+ * and below it in an HDF5 file, thus providing a mechanism for
+ * an application to perform a common set of operations across all
+ * of those objects or a dynamically selected subset. For
+ * non-recursive iteration across the members of a group,
+ * see H5Literate1().
+ *
+ * If \p obj_id is a group identifier, that group serves as the
+ * root of a recursive iteration. If \p obj_id is a file identifier,
+ * that file’s root group serves as the root of the recursive
+ * iteration. If \p obj_id is an attribute identifier,
+ * then the object where the attribute is attached will be iterated.
+ * If \p obj_id is any other type of object, such as a dataset or
+ * named datatype, there is no iteration.
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in
+ * a value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The prototype of the callback function op is as follows (as
+ * defined in the source code file H5Opublic.h):
+ *
+ * \snippet this H5O_iterate1_t_snip
+ *
+ * The parameters of this callback function have the following values
+ * or meanings:
+ * <table>
+ * <tr>
+ * <td>\c obj</td>
+ * <td>Object that serves as root of the iteration;
+ * same value as the H5Ovisit1() \p obj_id parameter</td>
+ * </tr>
+ * <tr>
+ * <td>\c name</td>
+ * <td>Name of object, relative to \c obj, being examined at
+ * current step of the iteration</td>
+ * </tr>
+ * <tr>
+ * <td>\c info</td>
+ * <td>H5O_info1_t \c struct containing information
+ * regarding that object</td>
+ * </tr>
+ * <tr>
+ * <td>\c op_data</td>
+ * <td>User-defined pointer to data required by the application in
+ * processing the object; a pass-through of the \c op_data pointer
+ * provided with the H5Ovisit() function call</td>
+ * </tr>
+ * </table>
+ *
+ * The H5O_info1_t \c struct is defined in H5Opublic.h and
+ * described in the H5Oget_info1() function entry.
+ *
+ * The return values from an operator are:
+ * - Zero causes the visit iterator to continue, returning zero when all
+ * group members have been processed.
+ * - A positive value causes the visit iterator to immediately return that
+ * positive value, indicating short-circuit success.
+ * - A negative value causes the visit iterator to immediately return that
+ * value, indicating failure.
+ *
+ * The H5Ovisit2() \p op_data parameter is a user-defined pointer to the data
+ * required to process objects in the course of the iteration. This pointer
+ * is passed back to each step of the iteration in the callback
+ * function’s \p op_data parameter.
+ *
+ * The \p fields parameter contains flags to determine which fields will
+ * be retrieved by the \p op callback function. These flags are defined
+ * in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * H5Lvisit() and H5Ovisit() are companion functions: one for
+ * examining and operating on links; the other for examining
+ * and operating on the objects that those links point to. Both
+ * functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires. These functions assume
+ * that the membership of the group being iterated over remains
+ * unchanged through the iteration; if any of the links in the
+ * group change during the iteration, the resulting behavior
+ * is undefined.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \since 1.10.3
+ *
+ */
H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op,
void *op_data, unsigned fields);
+
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5O
+ *
+ * \brief Recursively visits all objects starting from a specified object
+ *
+ * \fgdta_loc_obj_id{loc_id}
+ * \param[in] obj_name Name of the object, generally relative to
+ * \p loc_id, that will serve as root of the iteration
+ * \idx_type
+ * \order
+ * \param[in] op Callback function passing data regarding the object
+ * to the calling application
+ * \param[in] op_data User-defined pointer to data required by the application
+ * for its processing of the object
+ * \param[in] fields Flags specifying the fields to be retrieved to the
+ * callback function \p op
+ * \lapl_id
+ *
+ * \return On success, returns the return value of the first operator
+ * that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * \return On failure, returns a negative value if something goes wrong
+ * within the library, or the first negative value returned by
+ * an operator.
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name.
+ *
+ * \details H5Ovisit_by_name2() is a recursive iteration function to visit
+ * the object specified by the \p loc_id / \p obj_name parameter
+ * pair and, if that object is a group, all objects in and below it
+ * in an HDF5 file, thus providing a mechanism for an application to
+ * perform a common set of operations across all of those objects or
+ * a dynamically selected subset. For non-recursive iteration across
+ * the members of a group, see #H5Literate.
+ *
+ * The object serving as the root of the iteration is specified
+ * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies
+ * a file or an object in a file; if \p loc_id is an attribute identifier,
+ * the object where the attribute is attached will be used.
+ * \p obj_name specifies either an object in the file (with an absolute
+ * name based in the file’s root group) or an object name relative
+ * to \p loc_id. If \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, \p obj_name should be '\c .' (a dot).
+ * (Note that when \p loc_id fully specifies the object that is to serve
+ * as the root of the iteration, the user may wish to consider
+ * using H5Ovisit2() instead of #H5Ovisit_by_name.)
+ *
+ * Two parameters are used to establish the iteration: \p idx_type
+ * and \p order.
+ *
+ * \p idx_type specifies the index to be used. If the links in
+ * a group have not been indexed by the index type, they will
+ * first be sorted by that index then the iteration will begin;
+ * if the links have been so indexed, the sorting step will be
+ * unnecessary, so the iteration may begin more quickly. Valid
+ * values include the following:
+ *
+ * \indexes
+ *
+ * Note that the index type passed in \p idx_type is a
+ * <em>best effort</em> setting. If the application passes in a
+ * value indicating iteration in creation order and a group is
+ * encountered that was not tracked in creation order, that group
+ * will be iterated over in alpha-numeric order by name, or
+ * <em>name order</em>. (<em>Name order</em> is the native order
+ * used by the HDF5 library and is always available.)
+ *
+ * \p order specifies the order in which objects are to be inspected
+ * along the index specified in \p idx_type. Valid values include
+ * the following:
+ *
+ * \orders
+ *
+ * The \p op callback function and the effect of the callback
+ * function’s return value on the application are described
+ * in H5Ovisit2().
+ *
+ * The H5O_info1_t \c struct is defined in H5Opublic.h
+ * and described in the H5Oget_info1() function entry.
+ *
+ * The H5Ovisit_by_name2() \p op_data parameter is a user-defined
+ * pointer to the data required to process objects in the course
+ * of the iteration. This pointer is passed back to each step of
+ * the iteration in the callback function’s \p op_data parameter.
+ *
+ * \p lapl_id is a link access property list. In the general case,
+ * when default link access properties are acceptable, this can
+ * be passed in as #H5P_DEFAULT. An example of a situation that
+ * requires a non-default link access property list is when
+ * the link is an external link; an external link may require
+ * that a link prefix be set in a link access property list
+ * (see H5Pset_elink_prefix()).
+ *
+ * The \p fields parameter contains flags to determine which fields will
+ * be retrieved by the \p op callback function. These flags are defined
+ * in the H5Opublic.h file:
+ * \obj_info_fields
+ *
+ * #H5Lvisit_by_name and #H5Ovisit_by_name are companion
+ * functions: one for examining and operating on links; the other
+ * for examining and operating on the objects that those links point to.
+ * Both functions ensure that by the time the function completes
+ * successfully, every link or object below the specified point
+ * in the file has been presented to the application for whatever
+ * processing the application requires.
+ *
+ * \note \Bold{Programming Note for C++ Developers Using C Functions:}
+ * \note If a C routine that takes a function pointer as an argument is
+ * called from within C++ code, the C routine should be returned
+ * from normally.
+ *
+ * \note Examples of this kind of routine include callbacks such as
+ * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
+ * functions such as H5Tconvert() and H5Ewalk2().
+ *
+ * \note Exiting the routine in its normal fashion allows the HDF5
+ * C library to clean up its work properly. In other words, if
+ * the C++ application jumps out of the routine back to the C++
+ * “catch” statement, the library is not given the opportunity
+ * to close any temporary data structures that were set up when
+ * the routine was called. The C++ application should save some
+ * state as the routine is started so that any problem that occurs
+ * might be diagnosed.
+ *
+ * \since 1.10.3
+ *
+ */
H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields,
hid_t lapl_id);
@@ -303,4 +2821,4 @@ H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t i
#ifdef __cplusplus
}
#endif
-#endif /* _H5Opublic_H */
+#endif /* H5Opublic_H */
diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c
index 1526ac0..52eee14 100644
--- a/src/H5Orefcount.c
+++ b/src/H5Orefcount.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Orefcount.c
* Mar 10 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object ref. count messages.
*
@@ -32,36 +32,36 @@
/* 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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *udata);
+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);
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_REFCOUNT[1] = {{
- H5O_REFCOUNT_ID, /*message id number */
- "refcount", /*message name for debugging */
- 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 */
- 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 */
- NULL, /* copy native value to file */
- NULL, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O__refcount_debug /*debug the message */
+ H5O_REFCOUNT_ID, /*message id number */
+ "refcount", /*message name for debugging */
+ 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 */
+ 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 */
+ NULL, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O__refcount_debug /*debug the message */
}};
/* Current version of ref. count information */
@@ -79,7 +79,6 @@ H5FL_DEFINE_STATIC(H5O_refcount_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 10 2007
*
*-------------------------------------------------------------------------
@@ -120,25 +119,24 @@ done:
} /* end H5O__refcount_decode() */
/*-------------------------------------------------------------------------
- * 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);
@@ -152,10 +150,10 @@ 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.
@@ -164,19 +162,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);
@@ -191,10 +188,10 @@ 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.
@@ -204,25 +201,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,
- const void H5_ATTR_UNUSED *_mesg)
+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() */
/*-------------------------------------------------------------------------
* Function: H5O__refcount_free
@@ -249,7 +245,7 @@ H5O__refcount_free(void *mesg)
} /* end H5O__refcount_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_refcount_pre_copy_file
+ * Function: H5O__refcount_pre_copy_file
*
* Purpose: Perform any necessary actions before copying message between
* files.
@@ -263,11 +259,11 @@ 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,
- hbool_t *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info,
- void H5_ATTR_UNUSED *udata)
+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);
@@ -279,7 +275,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() */
/*-------------------------------------------------------------------------
* Function: H5O__refcount_debug
@@ -289,7 +285,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 aad150f..dab989f 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -26,33 +26,33 @@
/* 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, hbool_t *deleted,
- const H5O_copy_t *cpy_info, void *_udata);
+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 */
@@ -61,23 +61,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 */
@@ -106,12 +106,13 @@ H5FL_ARR_EXTERN(hsize_t);
--------------------------------------------------------------------------*/
static void *
H5O__sdspace_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)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p)
{
- H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */
- unsigned flags, version;
- unsigned i; /* Local counting variable */
- void * ret_value = NULL; /* Return value */
+ H5S_extent_t * sdim = NULL; /* New extent dimensionality structure */
+ unsigned flags, version;
+ unsigned i; /* Local counting variable */
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -138,8 +139,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
flags = *p++;
/* Get or determine the type of the extent */
- if (version >= H5O_SDSPACE_VERSION_2)
+ if (version >= H5O_SDSPACE_VERSION_2) {
sdim->type = (H5S_class_t)*p++;
+ if (sdim->type != H5S_SIMPLE && sdim->rank > 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid rank for scalar or NULL dataspace")
+ } /* end if */
else {
/* Set the dataspace type to be simple or scalar as appropriate */
if (sdim->rank > 0)
@@ -158,6 +162,13 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
/* Decode dimension sizes */
if (sdim->rank > 0) {
+ /* Ensure that rank doesn't cause reading passed buffer's end,
+ due to possible data corruption */
+ uint8_t sizeof_size = H5F_SIZEOF_SIZE(f);
+ if (p + (sizeof_size * sdim->rank - 1) > p_end) {
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+ }
+
if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -167,6 +178,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
if (flags & H5S_VALID_MAX) {
if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Ensure that rank doesn't cause reading passed buffer's end */
+ if (p + (sizeof_size * sdim->rank - 1) > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+
for (i = 0; i < sdim->rank; i++)
H5F_DECODE_LENGTH(f, p, sdim->max[i]);
} /* end if */
@@ -194,11 +210,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
@@ -209,28 +225,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);
@@ -261,26 +264,28 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*p++ = 0; /*reserved*/
} /* end else */
- /* Current & maximum dimensions */
- if (sdim->rank > 0) {
- for (u = 0; u < sdim->rank; u++)
- H5F_ENCODE_LENGTH(f, p, sdim->size[u]);
- if (flags & H5S_VALID_MAX) {
+ /* Encode dataspace dimensions for simple dataspaces */
+ if (H5S_SIMPLE == sdim->type) {
+ /* Encode current & maximum dimensions */
+ if (sdim->rank > 0) {
for (u = 0; u < sdim->rank; u++)
- H5F_ENCODE_LENGTH(f, p, sdim->max[u]);
+ H5F_ENCODE_LENGTH(f, p, sdim->size[u]);
+ if (flags & H5S_VALID_MAX)
+ for (u = 0; u < sdim->rank; u++)
+ H5F_ENCODE_LENGTH(f, p, sdim->max[u]);
} /* end if */
} /* 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
@@ -290,13 +295,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);
@@ -316,15 +321,15 @@ 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
@@ -334,18 +339,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 */
@@ -361,7 +362,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() */
/*-------------------------------------------------------------------------
* Function: H5O__sdspace_reset
@@ -413,7 +414,7 @@ H5O__sdspace_free(void *mesg)
} /* end H5O__sdspace_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_sdspace_pre_copy_file
+ * Function: H5O__sdspace_pre_copy_file
*
* Purpose: Perform any necessary actions before copying message between
* files
@@ -428,14 +429,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,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
+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);
@@ -507,7 +508,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
for (u = 0; u < sdim->rank; u++)
- HDfprintf(stream, "%s%Hu", u ? ", " : "", sdim->size[u]);
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->size[u]);
HDfprintf(stream, "}\n");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
@@ -517,7 +518,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int
if (H5S_UNLIMITED == sdim->max[u])
HDfprintf(stream, "%sUNLIM", u ? ", " : "");
else
- HDfprintf(stream, "%s%Hu", u ? ", " : "", sdim->max[u]);
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->max[u]);
} /* end for */
HDfprintf(stream, "}\n");
} /* end if */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index d3d4983..51ea145 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Wednesday, April 1, 1998
*
* Purpose: Functions that operate on a shared message. The shared
@@ -95,7 +95,6 @@ static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 24 2003
*
*-------------------------------------------------------------------------
@@ -209,7 +208,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 26 2003
*
*-------------------------------------------------------------------------
@@ -432,7 +430,6 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 26 2003
*
*-------------------------------------------------------------------------
@@ -638,7 +635,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
- * xcao@hdfgroup.org
* May 24 2007
*
*-------------------------------------------------------------------------
@@ -711,7 +707,8 @@ H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth
case H5O_SHARE_TYPE_COMMITTED:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr");
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object address:", mesg->u.loc.oh_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
+ "Object address:", mesg->u.loc.oh_addr);
break;
case H5O_SHARE_TYPE_SOHM:
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 189c6be..f164db3 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Friday, January 19, 2007
*
* Purpose: This file contains inline definitions for "generic" routines
@@ -44,7 +44,7 @@
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void *
+static inline void *
H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p)
{
@@ -103,7 +103,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_shared_t *sh_mesg =
@@ -158,7 +158,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE size_t
+static inline size_t
H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
{
const H5O_shared_t *sh_mesg =
@@ -211,7 +211,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
{
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
@@ -262,7 +262,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
{
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
@@ -312,7 +312,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void *
+static inline void *
H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, hbool_t *recompute_size,
unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata)
{
@@ -375,7 +375,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src,
H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info)
{
@@ -445,7 +445,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
{
const H5O_shared_t *sh_mesg =
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index 50f7c75..1c894a5 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: James Laird <jlaird@hdfgroup.org>
+/* Programmer: James Laird
* Monday, January 29, 2007
*
* Purpose: A message holding "implicitly shared object header message"
@@ -27,9 +27,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);
/* This message derives from H5O message class */
@@ -39,9 +39,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 */
@@ -100,7 +100,7 @@ done:
} /* end H5O__shmesg_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_shmesg_encode
+ * Function: H5O__shmesg_encode
*
* Purpose: Encode a shared message table message.
*
@@ -112,11 +112,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);
@@ -129,10 +129,10 @@ 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.
@@ -146,13 +146,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);
@@ -169,10 +169,10 @@ 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.
@@ -186,11 +186,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);
@@ -200,7 +200,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() */
/*-------------------------------------------------------------------------
* Function: H5O__shmesg_debug
@@ -229,7 +229,8 @@ H5O__shmesg_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version);
- HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, "Shared message table address:", mesg->addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth,
+ "Shared message table address:", mesg->addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of indexes:", mesg->nindexes);
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index a1aad7d..fa030bd 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ostab.c
* Aug 6 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Symbol table messages.
*
@@ -84,7 +84,6 @@ H5FL_DEFINE_STATIC(H5O_stab_t);
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -96,7 +95,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
H5O_stab_t *stab = NULL;
void * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -112,10 +111,9 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE
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() */
@@ -128,7 +126,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -163,7 +160,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
*
*-------------------------------------------------------------------------
@@ -204,7 +200,6 @@ done:
* Failure: zero
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
*-------------------------------------------------------------------------
@@ -399,11 +394,8 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 6 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -420,9 +412,9 @@ H5O__stab_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "B-tree address:", stab->btree_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "B-tree address:", stab->btree_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Name heap address:", stab->heap_addr);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Name heap address:", stab->heap_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__stab_debug() */
diff --git a/src/H5Otest.c b/src/H5Otest.c
index c191125..cdbc5ee 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Monday, December 4, 2006
*
* Purpose: Object header testing functions.
@@ -782,4 +782,4 @@ 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 57d1be6..2b8a7bb 100644
--- a/src/H5Ounknown.c
+++ b/src/H5Ounknown.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Ounknown.c
* Apr 19 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Handle unknown message classes in a minimal way.
*
diff --git a/src/H5P.c b/src/H5P.c
index e85b645..45a9267 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
*
* Purpose: Generic Property Functions
*/
diff --git a/src/H5PB.c b/src/H5PB.c
index d0a2444..efaf1f9 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,20 +24,20 @@
/* Module Setup */
/****************/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#include "H5PBmodule.h" /* This source code file is part of the H5PB module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5PBpkg.h" /* File access */
-#include "H5SLprivate.h" /* Skip List */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5PBpkg.h" /* File access */
+#include "H5SLprivate.h" /* Skip List */
/****************/
/* Local Macros */
@@ -148,7 +148,7 @@ H5FL_DEFINE_STATIC(H5PB_t);
H5FL_DEFINE_STATIC(H5PB_entry_t);
/*-------------------------------------------------------------------------
- * Function: H5PB_reset_stats
+ * Function: H5PB_reset_stats
*
* Purpose: This function was created without documentation.
* What follows is my best understanding of Mohamad's intent.
@@ -157,7 +157,7 @@ H5FL_DEFINE_STATIC(H5PB_entry_t);
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -184,7 +184,7 @@ H5PB_reset_stats(H5PB_t *page_buf)
} /* H5PB_reset_stats() */
/*-------------------------------------------------------------------------
- * Function: H5PB_get_stats
+ * Function: H5PB_get_stats
*
* Purpose: This function was created without documentation.
* What follows is my best understanding of Mohamad's intent.
@@ -196,9 +196,9 @@ H5PB_reset_stats(H5PB_t *page_buf)
* --evictions: the number of metadata and raw data evictions from the page buffer layer
* --bypasses: the number of metadata and raw data accesses that bypass the page buffer layer
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -226,16 +226,16 @@ H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsigned hits[2], u
} /* H5PB_get_stats */
/*-------------------------------------------------------------------------
- * Function: H5PB_print_stats()
+ * Function: H5PB_print_stats()
*
* Purpose: This function was created without documentation.
* What follows is my best understanding of Mohamad's intent.
*
* Print out statistics collected for the page buffer layer.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -272,13 +272,13 @@ H5PB_print_stats(const H5PB_t *page_buf)
} /* H5PB_print_stats */
/*-------------------------------------------------------------------------
- * Function: H5PB_create
+ * Function: H5PB_create
*
- * Purpose: Create and setup the PB on the file.
+ * Purpose: Create and setup the PB on the file.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -348,13 +348,13 @@ done:
} /* H5PB_create */
/*-------------------------------------------------------------------------
- * Function: H5PB__flush_cb
+ * Function: H5PB__flush_cb
*
- * Purpose: Callback to flush PB skiplist entries.
+ * Purpose: Callback to flush PB skiplist entries.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -381,13 +381,13 @@ done:
} /* H5PB__flush_cb() */
/*-------------------------------------------------------------------------
- * Function: H5PB_flush
+ * Function: H5PB_flush
*
- * Purpose: Flush/Free all the PB entries to the file.
+ * Purpose: Flush/Free all the PB entries to the file.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -415,13 +415,13 @@ done:
} /* H5PB_flush */
/*-------------------------------------------------------------------------
- * Function: H5PB__dest_cb
+ * Function: H5PB__dest_cb
*
- * Purpose: Callback to free PB skiplist entries.
+ * Purpose: Callback to free PB skiplist entries.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -451,13 +451,13 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
} /* H5PB__dest_cb() */
/*-------------------------------------------------------------------------
- * Function: H5PB_dest
+ * Function: H5PB_dest
*
- * Purpose: Flush and destroy the PB on the file if it exists.
+ * Purpose: Flush and destroy the PB on the file if it exists.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -504,16 +504,16 @@ done:
} /* H5PB_dest */
/*-------------------------------------------------------------------------
- * Function: H5PB_add_new_page
+ * Function: H5PB_add_new_page
*
- * Purpose: Add a new page to the new page skip list. This is called
+ * Purpose: Add a new page to the new page skip list. This is called
* from the MF layer when a new page is allocated to
* indicate to the page buffer layer that a read of the page
* from the file is not necessary since it's an empty page.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -563,16 +563,16 @@ done:
} /* H5PB_add_new_page */
/*-------------------------------------------------------------------------
- * Function: H5PB_update_entry
+ * Function: H5PB_update_entry
*
- * Purpose: In PHDF5, entries that are written by other processes and just
+ * Purpose: In PHDF5, entries that are written by other processes and just
* marked clean by this process have to have their corresponding
* pages updated if they exist in the page buffer.
* This routine checks and update the pages.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -661,14 +661,14 @@ done:
} /* H5PB_remove_entry */
/*-------------------------------------------------------------------------
- * Function: H5PB_read
+ * Function: H5PB_read
*
- * Purpose: Reads in the data from the page containing it if it exists
+ * Purpose: Reads in the data from the page containing it if it exists
* in the PB cache; otherwise reads in the page through the VFD.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -682,8 +682,8 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
haddr_t offset;
haddr_t search_addr; /* Address of current page */
hsize_t num_touched_pages; /* Number of pages accessed */
- size_t access_size;
- hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
+ size_t access_size = 0;
+ hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
hsize_t i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -961,15 +961,15 @@ done:
} /* end H5PB_read() */
/*-------------------------------------------------------------------------
- * Function: H5PB_write
+ * Function: H5PB_write
*
- * Purpose: Write data into the Page Buffer. If the page exists in the
- * cache, update it; otherwise read it from disk, update it, and
- * insert into cache.
+ * Purpose: Write data into the Page Buffer. If the page exists in the
+ * cache, update it; otherwise read it from disk, update it, and
+ * insert into cache.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -983,8 +983,8 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
haddr_t offset;
haddr_t search_addr; /* Address of current page */
hsize_t num_touched_pages; /* Number of pages accessed */
- size_t access_size;
- hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
+ size_t access_size = 0;
+ hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */
hsize_t i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1306,26 +1306,24 @@ done:
} /* end H5PB_write() */
/*-------------------------------------------------------------------------
- * Function: H5PB__insert_entry()
- *
- * Purpose: ???
+ * Function: H5PB__insert_entry()
*
- * This function was created without documentation.
- * What follows is my best understanding of Mohamad's intent.
+ * Purpose: This function was created without documentation.
+ * What follows is my best understanding of Mohamad's intent.
*
- * Insert the supplied page into the page buffer, both the
- * skip list and the LRU.
+ * Insert the supplied page into the page buffer, both the
+ * skip list and the LRU.
*
- * As best I can tell, this function imposes no limit on the
- * number of entries in the page buffer beyond an assertion
- * failure it the page count exceeds the limit.
+ * As best I can tell, this function imposes no limit on the
+ * number of entries in the page buffer beyond an assertion
+ * failure it the page count exceeds the limit.
*
* JRM -- 12/22/16
*
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -1355,16 +1353,21 @@ done:
} /* end H5PB__insert_entry() */
/*-------------------------------------------------------------------------
- * Function: H5PB__make_space()
+ * Function: H5PB__make_space()
*
- * Purpose: If necessary and if possible, evict a page from the page
- * buffer to make space for the supplied page. Depending on
- * the page buffer configuration and contents, and the page
- * supplied this may or may not be possible.
+ * Purpose: This function was created without documentation.
+ * What follows is my best understanding of Mohamad's intent.
*
- * Return: Non-negative on success/Negative on failure
+ * If necessary and if possible, evict a page from the page
+ * buffer to make space for the supplied page. Depending on
+ * the page buffer configuration and contents, and the page
+ * supplied this may or may not be possible.
*
- * Programmer: Mohamad Chaarawi
+ * JRM -- 12/22/16
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
@@ -1453,17 +1456,16 @@ done:
} /* end H5PB__make_space() */
/*-------------------------------------------------------------------------
- * Function: H5PB__write_entry()
- *
- * Purpose: ???
+ * Function: H5PB__write_entry()
*
- * This function was created without documentation.
- * What follows is my best understanding of Mohamad's intent.
+ * Purpose: ???
*
+ * This function was created without documentation.
+ * What follows is my best understanding of Mohamad's intent.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Mohamad Chaarawi
+ * Programmer: Mohamad Chaarawi
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5PBmodule.h b/src/H5PBmodule.h
index 09bee16..21294c8 100644
--- a/src/H5PBmodule.h
+++ b/src/H5PBmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5PB package. Including this header means that the source file
* is part of the H5PB package.
*/
-#ifndef _H5PBmodule_H
-#define _H5PBmodule_H
+#ifndef H5PBmodule_H
+#define H5PBmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_RESOURCE
#define H5_MY_PKG_INIT NO
-#endif /* _H5PBmodule_H */
+#endif /* H5PBmodule_H */
diff --git a/src/H5PBpkg.h b/src/H5PBpkg.h
index f159b6c..2656588 100644
--- a/src/H5PBpkg.h
+++ b/src/H5PBpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
#error "Do not include this file outside the H5PB package!"
#endif
-#ifndef _H5PBpkg_H
-#define _H5PBpkg_H
+#ifndef H5PBpkg_H
+#define H5PBpkg_H
/* Get package's private header */
#include "H5PBprivate.h"
@@ -50,4 +50,4 @@ typedef struct H5PB_entry_t {
/* Package Private Prototypes */
/******************************/
-#endif /* _H5PBpkg_H */
+#endif /* H5PBpkg_H */
diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h
index de27b20..e0197bf 100644
--- a/src/H5PBprivate.h
+++ b/src/H5PBprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,8 +20,8 @@
*-------------------------------------------------------------------------
*/
-#ifndef _H5PBprivate_H
-#define _H5PBprivate_H
+#ifndef H5PBprivate_H
+#define H5PBprivate_H
/* Include package's public header */
#ifdef NOT_YET
@@ -98,4 +98,4 @@ H5_DLL herr_t H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsig
unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
H5_DLL herr_t H5PB_print_stats(const H5PB_t *page_buf);
-#endif /* !_H5PBprivate_H */
+#endif /* H5PBprivate_H */
diff --git a/src/H5PL.c b/src/H5PL.c
index 57c9a12..4556885 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5PLextern.h b/src/H5PLextern.h
index 2385d54..7f3df5e 100644
--- a/src/H5PLextern.h
+++ b/src/H5PLextern.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* Purpose: Header file for writing external HDF5 plugins.
*/
-#ifndef _H5PLextern_H
-#define _H5PLextern_H
+#ifndef H5PLextern_H
+#define H5PLextern_H
/* Include HDF5 header */
#include "hdf5.h"
@@ -40,4 +40,4 @@ H5PLUGIN_DLL const void *H5PLget_plugin_info(void);
}
#endif
-#endif /* _H5PLextern_H */
+#endif /* H5PLextern_H */
diff --git a/src/H5PLint.c b/src/H5PLint.c
index ca29932..cf6135d 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -253,7 +253,7 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
/* Search in the table of already loaded plugin libraries */
if (H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in plugin cache failed")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in plugin cache failed")
/* If not found, try iterating through the path table to find an appropriate plugin */
if (!found)
@@ -290,15 +290,17 @@ done:
* get_plugin_info function pointer, but early (4.4.7, at least) gcc
* only allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(pedantic)
+H5_GCC_DIAG_OFF("pedantic")
herr_t
H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *success,
- const void **plugin_info)
+ H5PL_type_t *plugin_type, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
H5PL_get_plugin_type_t get_plugin_type = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
- herr_t ret_value = SUCCEED;
+ H5PL_type_t loaded_plugin_type;
+ H5PL_key_t tmp_key;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -310,6 +312,8 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
/* Initialize out parameters */
*success = FALSE;
*plugin_info = NULL;
+ if (plugin_type)
+ *plugin_type = H5PL_TYPE_ERROR;
/* There are different reasons why a library can't be open, e.g. wrong architecture.
* If we can't open the library, just return.
@@ -332,11 +336,12 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
HGOTO_DONE(SUCCEED)
/* Check the plugin type and return if it doesn't match the one passed in */
- if (type != (H5PL_type_t)(*get_plugin_type)())
+ loaded_plugin_type = (H5PL_type_t)(*get_plugin_type)();
+ if ((type != H5PL_TYPE_NONE) && (type != loaded_plugin_type))
HGOTO_DONE(SUCCEED)
/* Get the plugin information */
- switch (type) {
+ switch (loaded_plugin_type) {
case H5PL_TYPE_FILTER: {
const H5Z_class2_t *filter_info;
@@ -344,8 +349,16 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info)()))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
+ /* Setup temporary plugin key if one wasn't supplied */
+ if (!key) {
+ tmp_key.id = filter_info->id;
+ key = &tmp_key;
+ }
+
/* If the filter IDs match, we're done. Set the output parameters. */
if (filter_info->id == key->id) {
+ if (plugin_type)
+ *plugin_type = H5PL_TYPE_FILTER;
*plugin_info = (const void *)filter_info;
*success = TRUE;
}
@@ -354,30 +367,29 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
}
case H5PL_TYPE_VOL: {
- const H5VL_class_t *cls;
+ const void *cls;
/* Get the plugin info */
- if (NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)()))
+ if (NULL == (cls = (const void *)(*get_plugin_info)()))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL connector info from plugin")
- /* Which kind of key are we looking for? */
- if (key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
- /* If the plugin names match, we're done. Set the output parameters. */
- if (cls->name && !HDstrcmp(cls->name, key->vol.u.name)) {
- *plugin_info = (const void *)cls;
- *success = TRUE;
- } /* end if */
- } /* end if */
- else {
- /* Sanity check */
- HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
-
- /* If the plugin values match, we're done. Set the output parameters. */
- if (cls->value == key->vol.u.value) {
- *plugin_info = (const void *)cls;
- *success = TRUE;
- } /* end if */
- } /* end else */
+ /* Setup temporary plugin key if one wasn't supplied */
+ if (!key) {
+ tmp_key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ tmp_key.vol.u.name = ((const H5VL_class_t *)cls)->name;
+ key = &tmp_key;
+ }
+
+ /* Ask VOL interface if this class is the one we are looking for and is compatible, etc */
+ if (H5VL_check_plugin_load(cls, key, success) < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VOL connector compatibility check failed")
+
+ /* Check for finding the correct plugin */
+ if (*success) {
+ if (plugin_type)
+ *plugin_type = H5PL_TYPE_VOL;
+ *plugin_info = cls;
+ }
break;
}
@@ -390,7 +402,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
/* If we found the correct plugin, store it in the cache */
if (*success)
- if (H5PL__add_plugin(type, key, handle))
+ if (H5PL__add_plugin(loaded_plugin_type, key, handle))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache")
done:
@@ -400,7 +412,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__open() */
-H5_GCC_DIAG_ON(pedantic)
+H5_GCC_DIAG_ON("pedantic")
/*-------------------------------------------------------------------------
* Function: H5PL__close
@@ -420,3 +432,29 @@ H5PL__close(H5PL_HANDLE handle)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5PL__close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5PL_iterate
+ *
+ * Purpose: Iterates over all the available plugins and calls the
+ * specified callback function on each plugin.
+ *
+ * Return: H5_ITER_CONT if all plugins are processed successfully
+ * H5_ITER_STOP if short-circuit success occurs while
+ * processing plugins
+ * H5_ITER_ERROR if an error occurs while processing plugins
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5PL_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, void *op_data)
+{
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_NOAPI(H5_ITER_ERROR)
+
+ ret_value = H5PL__path_table_iterate(iter_type, iter_op, op_data);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5PL_iterate() */
diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h
index 8bf11ce..ab9f1d5 100644
--- a/src/H5PLmodule.h
+++ b/src/H5PLmodule.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,8 +16,8 @@
* is part of the H5PL package.
*/
-#ifndef _H5PLmodule_H
-#define _H5PLmodule_H
+#ifndef H5PLmodule_H
+#define H5PLmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -27,4 +27,9 @@
#define H5_MY_PKG_ERR H5E_PLUGIN
#define H5_MY_PKG_INIT YES
-#endif /* _H5PLmodule_H */
+/**\defgroup H5PL H5PL
+ * \brief Plugins
+ * \todo Describe what programmatically controlling dynamically loaded plugins (H5PL) is all about
+ */
+
+#endif /* H5PLmodule_H */
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 1858cf8..39a7d0d 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -62,6 +62,8 @@ static herr_t H5PL__insert_at(const char *path, unsigned int idx);
static herr_t H5PL__make_space_at(unsigned int idx);
static herr_t H5PL__replace_at(const char *path, unsigned int idx);
static herr_t H5PL__expand_path_table(void);
+static herr_t H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type_t iter_type,
+ H5PL_iterate_t iter_op, void *op_data);
static herr_t H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *found,
const char *dir, const void **plugin_info);
@@ -546,7 +548,220 @@ H5PL__get_path(unsigned int idx)
return H5PL_paths_g[idx];
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5PL__replace_path() */
+} /* end H5PL__get_path() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5PL__path_table_iterate
+ *
+ * Purpose: Iterates over all the plugins in the plugin path table and
+ * calls the specified callback function on each plugin found.
+ *
+ * Return: H5_ITER_CONT if all plugins are processed successfully
+ * H5_ITER_STOP if short-circuit success occurs while
+ * processing plugins
+ * H5_ITER_ERROR if an error occurs while processing plugins
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5PL__path_table_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, void *op_data)
+{
+ unsigned int u;
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_PACKAGE
+
+ for (u = 0; (u < H5PL_num_paths_g) && (ret_value == H5_ITER_CONT); u++)
+ ret_value = H5PL__path_table_iterate_process_path(H5PL_paths_g[u], iter_type, iter_op, op_data);
+
+ if (ret_value < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_BADITER, H5_ITER_ERROR, "can't iterate over plugins in plugin path '%s'",
+ H5PL_paths_g[u]);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5PL__path_table_iterate() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5PL__path_table_iterate_process_path
+ *
+ * Purpose: Iterates over all the plugins within a single plugin path
+ * entry in the plugin path table and calls the specified
+ * callback function on each plugin found. Two function
+ * definitions are for Unix and Windows.
+ *
+ * Return: H5_ITER_CONT if all plugins are processed successfully
+ * H5_ITER_STOP if short-circuit success occurs while
+ * processing plugins
+ * H5_ITER_ERROR if an error occurs while processing plugins
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef H5_HAVE_WIN32_API
+static herr_t
+H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type_t iter_type,
+ H5PL_iterate_t iter_op, void *op_data)
+{
+ H5PL_type_t plugin_type;
+ const void * plugin_info = NULL;
+ hbool_t plugin_loaded;
+ char * path = NULL;
+ DIR * dirp = NULL; /* Directory stream */
+ struct dirent *dp = NULL; /* Directory entry */
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(plugin_path);
+ HDassert(iter_op);
+
+ /* Open the directory */
+ if (!(dirp = HDopendir(plugin_path)))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory: %s", plugin_path)
+
+ /* Iterate through all entries in the directory */
+ while (NULL != (dp = HDreaddir(dirp))) {
+ /* The library we are looking for should be called libxxx.so... on Unix
+ * or libxxx.xxx.dylib on Mac.
+ */
+#ifndef __CYGWIN__
+ if (!HDstrncmp(dp->d_name, "lib", (size_t)3) &&
+ (HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) {
+#else
+ if (!HDstrncmp(dp->d_name, "cyg", (size_t)3) && HDstrstr(dp->d_name, ".dll")) {
+#endif
+
+ hbool_t plugin_matches;
+ h5_stat_t my_stat;
+ size_t len;
+
+ /* Allocate & initialize the path name */
+ len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ +
+ 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */
+
+ if (NULL == (path = (char *)H5MM_calloc(len)))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path")
+
+ HDsnprintf(path, len, "%s/%s", plugin_path, dp->d_name);
+
+ /* Get info for directory entry */
+ if (HDstat(path, &my_stat) == -1)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "can't stat file %s -- error was: %s", path,
+ HDstrerror(errno))
+
+ /* If it is a directory, skip it */
+ if (S_ISDIR(my_stat.st_mode))
+ continue;
+
+ /* Attempt to open the dynamic library */
+ plugin_type = H5PL_TYPE_ERROR;
+ plugin_info = NULL;
+ plugin_loaded = FALSE;
+ if (H5PL__open(path, H5PL_TYPE_NONE, NULL, &plugin_loaded, &plugin_type, &plugin_info) < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, H5_ITER_ERROR, "failed to open plugin '%s'", path);
+
+ /* Determine if we should process this plugin */
+ plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) ||
+ ((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) ||
+ ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL));
+
+ /* If the plugin was successfully loaded, call supplied callback function on plugin */
+ if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data)))
+ break;
+
+ path = (char *)H5MM_xfree(path);
+ } /* end if */
+ } /* end while */
+
+ if (ret_value < 0)
+ HERROR(H5E_PLUGIN, H5E_CALLBACK, "callback operator function returned failure");
+
+done:
+ if (dirp)
+ if (HDclosedir(dirp) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close directory: %s",
+ HDstrerror(errno))
+
+ path = (char *)H5MM_xfree(path);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5PL__path_table_iterate_process_path() */
+#else /* H5_HAVE_WIN32_API */
+static herr_t
+H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type_t iter_type,
+ H5PL_iterate_t iter_op, void *op_data)
+{
+ WIN32_FIND_DATAA fdFile;
+ HANDLE hFind = INVALID_HANDLE_VALUE;
+ H5PL_type_t plugin_type;
+ const void * plugin_info = NULL;
+ hbool_t plugin_loaded;
+ char * path = NULL;
+ char service[2048];
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_STATIC
+
+ /* Check args - Just assert on package functions */
+ HDassert(plugin_path);
+ HDassert(iter_op);
+
+ /* Specify a file mask. *.* = We want everything! */
+ HDsprintf(service, "%s\\*.dll", plugin_path);
+ if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory")
+
+ /* Loop over all the files */
+ do {
+ /* Ignore '.' and '..' */
+ if (HDstrcmp(fdFile.cFileName, ".") != 0 && HDstrcmp(fdFile.cFileName, "..") != 0) {
+ hbool_t plugin_matches;
+ size_t len;
+
+ /* Allocate & initialize the path name */
+ len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1;
+
+ if (NULL == (path = (char *)H5MM_calloc(len)))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path")
+
+ HDsnprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName);
+
+ /* Ignore directories */
+ if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ /* Attempt to open the dynamic library */
+ plugin_type = H5PL_TYPE_ERROR;
+ plugin_info = NULL;
+ plugin_loaded = FALSE;
+ if (H5PL__open(path, H5PL_TYPE_NONE, NULL, &plugin_loaded, &plugin_type, &plugin_info) < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, H5_ITER_ERROR, "failed to open plugin '%s'", path);
+
+ /* Determine if we should process this plugin */
+ plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) ||
+ ((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) ||
+ ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL));
+
+ /* If the plugin was successfully loaded, call supplied callback function on plugin */
+ if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data)))
+ break;
+
+ path = (char *)H5MM_xfree(path);
+ }
+ } while (FindNextFileA(hFind, &fdFile));
+
+ if (ret_value < 0)
+ HERROR(H5E_PLUGIN, H5E_CALLBACK, "callback operator function returned failure");
+
+done:
+ if (hFind != INVALID_HANDLE_VALUE)
+ FindClose(hFind);
+
+ path = (char *)H5MM_xfree(path);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5PL__path_table_iterate_process_path() */
+#endif /* H5_HAVE_WIN32_API */
/*-------------------------------------------------------------------------
* Function: H5PL__find_plugin_in_path_table
@@ -669,11 +884,13 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
HDstrerror(errno))
/* If it is a directory, skip it */
- if (S_ISDIR(my_stat.st_mode))
+ if (S_ISDIR(my_stat.st_mode)) {
+ path = (char *)H5MM_xfree(path);
continue;
+ }
- /* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
+ /* attempt to open the dynamic library */
+ if (H5PL__open(path, search_params->type, search_params->key, found, NULL, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
@@ -739,8 +956,8 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
- /* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
+ /* attempt to open the dynamic library */
+ if (H5PL__open(path, search_params->type, search_params->key, found, NULL, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index 65c56a5..cffc358 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,8 +21,8 @@
#error "Do not include this file outside the H5PL package!"
#endif
-#ifndef _H5PLpkg_H
-#define _H5PLpkg_H
+#ifndef H5PLpkg_H
+#define H5PLpkg_H
/* Include private header file */
#include "H5PLprivate.h" /* Filter functions */
@@ -94,7 +94,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void);
#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)
@@ -133,7 +133,8 @@ H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
/* Plugin search and manipulation */
H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key,
- hbool_t *success /*out*/, const void **plugin_info /*out*/);
+ hbool_t *success /*out*/, H5PL_type_t *plugin_type /*out*/,
+ const void **plugin_info /*out*/);
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle);
/* Plugin cache calls */
@@ -153,7 +154,8 @@ H5_DLL herr_t H5PL__replace_path(const char *path, unsigned int index);
H5_DLL herr_t H5PL__insert_path(const char *path, unsigned int index);
H5_DLL herr_t H5PL__remove_path(unsigned int index);
H5_DLL const char *H5PL__get_path(unsigned int index);
-H5_DLL herr_t H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params,
- hbool_t *found /*out*/, const void **plugin_info /*out*/);
+H5_DLL herr_t H5PL__path_table_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, void *op_data);
+H5_DLL herr_t H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params,
+ hbool_t *found /*out*/, const void **plugin_info /*out*/);
-#endif /* _H5PLpkg_H */
+#endif /* H5PLpkg_H */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index 3892dbe..2ec0845 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -242,7 +242,7 @@ done:
/* See the other use of H5PL_GET_LIB_FUNC() for an explanation
* for why we disable -Wpedantic here.
*/
-H5_GCC_DIAG_OFF(pedantic)
+H5_GCC_DIAG_OFF("pedantic")
herr_t
H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found,
const void **plugin_info)
@@ -264,12 +264,12 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* Loop over all the plugins, looking for one that matches */
for (u = 0; u < H5PL_num_plugins_g; u++) {
- /* If the plugin type (filter, etc.) and ID match, query the plugin for its info */
+ /* If the plugin type (filter, VOL connector, etc.) and ID match, query the plugin for its info */
if ((search_params->type == (H5PL_cache_g[u]).type) &&
(search_params->key->id == (H5PL_cache_g[u]).key.id)) {
H5PL_get_plugin_info_t get_plugin_info_function;
- const H5Z_class2_t * filter_info;
+ const void * info;
/* Get the "get plugin info" function from the plugin. */
if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(
@@ -277,12 +277,12 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
/* Call the "get plugin info" function */
- if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info_function)()))
+ if (NULL == (info = (*get_plugin_info_function)()))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
/* Set output parameters */
*found = TRUE;
- *plugin_info = filter_info;
+ *plugin_info = info;
/* No need to continue processing */
break;
@@ -294,4 +294,4 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__find_plugin_in_cache() */
-H5_GCC_DIAG_ON(pedantic)
+H5_GCC_DIAG_ON("pedantic")
diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h
index 43930ad..7eae513 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,15 +14,15 @@
* This file contains private information about the H5PL module
*/
-#ifndef _H5PLprivate_H
-#define _H5PLprivate_H
+#ifndef H5PLprivate_H
+#define H5PLprivate_H
/* Include package's public header */
#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 */
/**************************/
/* Library Private Macros */
@@ -44,6 +44,18 @@ typedef union H5PL_key_t {
} vol;
} H5PL_key_t;
+/* Enum dictating the type of plugins to process
+ * when iterating through available plugins
+ */
+typedef enum {
+ H5PL_ITER_TYPE_FILTER,
+ H5PL_ITER_TYPE_VOL,
+ H5PL_ITER_TYPE_ALL,
+} H5PL_iterate_type_t;
+
+/* Callback function for iterating through the available plugins */
+typedef herr_t (*H5PL_iterate_t)(H5PL_type_t plugin_type, const void *plugin_info, void *op_data);
+
/*****************************/
/* Library-private Variables */
/*****************************/
@@ -54,5 +66,6 @@ typedef union H5PL_key_t {
/* Internal API routines */
H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key);
+H5_DLL herr_t H5PL_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, void *op_data);
-#endif /* _H5PLprivate_H */
+#endif /* H5PLprivate_H */
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
index a54cce0..55ff594 100644
--- a/src/H5PLpublic.h
+++ b/src/H5PLpublic.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* This file contains public declarations for the H5PL module.
*/
-#ifndef _H5PLpublic_H
-#define _H5PLpublic_H
+#ifndef H5PLpublic_H
+#define H5PLpublic_H
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
@@ -28,13 +28,17 @@
*/
#define H5PL_NO_PLUGIN "::"
-/* Plugin type used by the plugin library */
+//! <!-- [H5PL_type_t_snip] -->
+/**
+ * Plugin type (bit-position) used by the plugin library
+ */
typedef enum H5PL_type_t {
- H5PL_TYPE_ERROR = -1, /* Error */
- H5PL_TYPE_FILTER = 0, /* Filter */
- H5PL_TYPE_VOL = 1, /* VOL driver */
- H5PL_TYPE_NONE = 2 /* This must be last! */
+ H5PL_TYPE_ERROR = -1, /**< Error */
+ H5PL_TYPE_FILTER = 0, /**< Filter */
+ H5PL_TYPE_VOL = 1, /**< VOL driver */
+ H5PL_TYPE_NONE = 2 /**< Sentinel: This must be last! */
} H5PL_type_t;
+//! <!-- [H5PL_type_t_snip] -->
/* Common dynamic plugin type flags used by the set/get_loading_state functions */
#define H5PL_FILTER_PLUGIN 0x0001
@@ -46,18 +50,178 @@ extern "C" {
#endif
/* plugin state */
-H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
-H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_control_mask /*out*/);
-H5_DLL herr_t H5PLappend(const char *search_path);
-H5_DLL herr_t H5PLprepend(const char *search_path);
-H5_DLL herr_t H5PLreplace(const char *search_path, unsigned int index);
-H5_DLL herr_t H5PLinsert(const char *search_path, unsigned int index);
-H5_DLL herr_t H5PLremove(unsigned int index);
+/**
+ * \ingroup H5PL
+ * \brief Controls the loadability of dynamic plugin types
+ *
+ * \param[in] plugin_control_mask The list of dynamic plugin types to enable or disable.\n
+ * A plugin bit set to 0 (zero) prevents use of that dynamic plugin.\n
+ * A plugin bit set to 1 (one) enables use of that dynamic plugin.\n
+ * Setting \p plugin_control_mask to a negative value enables all dynamic
+ * plugin types.\n
+ * Setting \p plugin_control_mask to 0 (zero) disables all dynamic plugin\n
+ * types.
+ * \return \herr_t
+ *
+ * \details H5PLset_loading_state() uses one argument to enable or disable individual plugin types.
+ *
+ * \details The \p plugin_control_mask parameter is an encoded integer in which each bit controls a specific
+ * plugin type. Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
+ * \snippet this H5PL_type_t_snip
+ *
+ * A plugin bit set to 0 (zero) prevents the use of the dynamic plugin type corresponding to that bit
+ * position. A plugin bit set to 1 (one) allows the use of that dynamic plugin type.
+ *
+ * All dynamic plugin types can be enabled by setting \p plugin_control_mask to a negative value. A
+ * value of 0 (zero) will disable all dynamic plugin types.
+ *
+ * The loading of external dynamic plugins can be controlled during runtime with an environment
+ * variable, \c HDF5_PLUGIN_PRELOAD. H5PLset_loading_state() inspects the \c HDF5_PLUGIN_PRELOAD
+ * environment variable every time it is called. If the environment variable is set to the special
+ * \c :: string, all dynamic plugins are disabled.
+ *
+ * \warning The environment variable \c HDF5_PLUGIN_PRELOAD controls the loading of dynamic plugin types at
+ * runtime. If it is set to disable all plugin types, then it will disable them for \Emph{all}
+ * running programs that access the same variable instance.
+ *
+ * \since 1.8.15
+ *
+ */
+H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
+/**
+ * \ingroup H5PL
+ * \brief Queries the loadability of dynamic plugin types
+ *
+ * \param[out] plugin_control_mask List of dynamic plugin types that are enabled or disabled.\n
+ * A plugin bit set to 0 (zero) indicates that that the dynamic plugin type is
+ * disabled.\n
+ * A plugin bit set to 1 (one) indicates that that the dynamic plugin type is
+ * enabled.\n
+ * If the value of \p plugin_control_mask is negative, all dynamic plugin
+ * types are enabled.\n
+ * If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins
+ * are disabled.
+ * \return \herr_t
+ *
+ * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins
+ * (e.g.: filters, VOL drivers) will be loaded by the HDF5 library.
+ *
+ * Bit positions allocated to date are specified in \ref H5PL_type_t as follows:
+ * \snippet this H5PL_type_t_snip
+ *
+ * \since 1.8.15
+ *
+ */
+H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_control_mask /*out*/);
+/**
+ * \ingroup H5PL
+ * \brief Inserts a plugin path at the end of the plugin search path list
+ *
+ * \param[in] search_path A plugin path
+ * \return \herr_t
+ *
+ * \details H5PLappend() inserts a plugin path at the end of the plugin search path list.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLappend(const char *search_path);
+/**
+ * \ingroup H5PL
+ * \brief Inserts a plugin path at the beginning of the plugin search path list
+ *
+ * \param[in] search_path A plugin path
+ * \return \herr_t
+ *
+ * \details H5PLprepend() inserts a plugin path at the end of the plugin search path list.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLprepend(const char *search_path);
+/**
+ * \ingroup H5PL
+ * \brief Replaces the path at the specified index in the plugin search path list
+ *
+ * \param[in] search_path A plugin path
+ * \param[in] index Index
+ * \return \herr_t
+ *
+ * \details H5PLreplace() replaces a plugin path at the specified index in the plugin search path list.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLreplace(const char *search_path, unsigned int index);
+/**
+ * \ingroup H5PL
+ * \brief Inserts a path at the specified index in the plugin search path list
+ *
+ * \param[in] search_path A plugin path
+ * \param[in] index Index
+ * \return \herr_t
+ *
+ * \details H5PLinsert() inserts a plugin path at the specified index in the plugin search path list,
+ * moving other paths after \p index.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLinsert(const char *search_path, unsigned int index);
+/**
+ * \ingroup H5PL
+ * \brief Removes a plugin path at a specified index from the plugin search path list
+ *
+ * \param[in] index Index
+ * \return \herr_t
+ *
+ * \details H5PLremove() removes a plugin path at the specified \p index and compacts the plugin search path
+ * list.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLremove(unsigned int index);
+/**
+ * \ingroup H5PL
+ * \brief Queries the plugin search path list at the specified index
+ *
+ * \param[in] index Index
+ * \param[out] path_buf Pathname
+ * \param[in] buf_size Size of \p path_buf
+ * \return Returns the length of the path, a non-negative value, if successful; otherwise returns a negative
+ * value.
+ *
+ * \details H5PLget() queries the plugin path at a specified index. If \p path_buf is non-NULL then it writes
+ * up to \p buf_size bytes into that buffer and always returns the length of the path name.
+ *
+ * If \p path_buf is NULL, this function will simply return the number of characters required to
+ * store the path name, ignoring \p path_buf and \p buf_size.
+ *
+ * If an error occurs then the buffer pointed to by \p path_buf (NULL or non-NULL) is unchanged and
+ * the function returns a negative value. If a zero is returned for the name's length, then there is
+ * no path name associated with the index. and the \p path_buf buffer will be unchanged.
+ *
+ * \since 1.10.1
+ *
+ */
H5_DLL ssize_t H5PLget(unsigned int index, char *path_buf /*out*/, size_t buf_size);
-H5_DLL herr_t H5PLsize(unsigned int *num_paths /*out*/);
+/**
+ * \ingroup H5PL
+ * \brief Retrieves the number of stored plugin paths
+ *
+ * \param[out] num_paths Current length of the plugin search path list
+ * \return \herr_t
+ *
+ * \details H5PLsize() retrieves the number of paths stored in the plugin search path list.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5PLsize(unsigned int *num_paths /*out*/);
#ifdef __cplusplus
}
#endif
-#endif /* _H5PLpublic_H */
+#endif /* H5PLpublic_H */
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index 3c4222f..65fd54a 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -29,10 +29,9 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Ppkg.h" /* Property lists */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Ppkg.h" /* Property lists */
/****************/
/* Local Macros */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 737140a..3b14959 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pdapl.c
* October 27, 2008
- * Neil Fortner <nfortne2@hdfgroup.org>
+ * Neil Fortner
*
* Purpose: Dataset access property list class routines
*
@@ -36,7 +36,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 */
/****************/
@@ -320,7 +320,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));
@@ -371,7 +371,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);
@@ -414,7 +414,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);
@@ -434,7 +434,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);
@@ -460,7 +460,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);
@@ -484,7 +484,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);
@@ -560,7 +560,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));
@@ -611,7 +611,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);
@@ -654,7 +654,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);
@@ -674,7 +674,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);
@@ -700,7 +700,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);
@@ -724,7 +724,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);
@@ -768,7 +768,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
- if (rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 > 1.0)
HGOTO_ERROR(
H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
@@ -865,11 +865,11 @@ done:
static herr_t
H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size)
{
- uint64_t enc_value; /* Property value to encode */
- uint8_t **pp = (uint8_t **)_pp;
+ uint64_t enc_value = 0; /* Property value to encode */
+ 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));
@@ -924,7 +924,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));
@@ -965,11 +965,11 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value)
static herr_t
H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size)
{
- uint64_t enc_value; /* Property value to encode */
- uint8_t **pp = (uint8_t **)_pp;
+ uint64_t enc_value = 0; /* Property value to encode */
+ 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));
@@ -1024,7 +1024,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 3ec8f82..59a41ed 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -523,13 +523,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;
@@ -699,7 +699,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
(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 */
@@ -708,7 +708,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
(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 */
@@ -1977,13 +1977,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
@@ -2057,13 +2050,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
@@ -2106,13 +2092,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
@@ -2187,13 +2166,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
@@ -2255,7 +2227,7 @@ herr_t
H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name,
hid_t src_space_id)
{
- H5P_genplist_t * plist; /* Property list pointer */
+ H5P_genplist_t * plist = NULL; /* Property list pointer */
H5O_layout_t virtual_layout; /* Layout information for setting virtual info */
H5S_t * vspace; /* Virtual dataset space selection */
H5S_t * src_space; /* Source dataset space selection */
@@ -2502,7 +2474,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")
@@ -2557,9 +2529,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
@@ -2662,7 +2634,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si
/* 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))
@@ -2723,7 +2695,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si
/* 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))
@@ -2947,13 +2919,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
@@ -3003,13 +2968,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
@@ -3129,8 +3087,6 @@ done:
* Programmer: Kent Yang
* Wednesday, November 13, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3173,9 +3129,6 @@ done:
* Programmer: Xiaowen Wu
* Wednesday, December 22, 2004
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3234,9 +3187,6 @@ done:
* Programmer: Xiaowen Wu
* Thursday, April 14, 2005
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3635,9 +3585,6 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3815,9 +3762,6 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3865,8 +3809,6 @@ done:
* Programmer: Jacob Smith
* 2018 August 14
*
- * Modifications: None.
- *
*-----------------------------------------------------------------------------
*/
herr_t
@@ -3911,8 +3853,6 @@ done:
* Programmer: Jacob Smith
* 2018 August 14
*
- * Modifications: None.
- *
*-----------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 25578b3..bb705e2 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pdeprec.c
* October 11 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * 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 09a7722..2d6b313 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pdxpl.c
* March 16 1998
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Data transfer property list class routines
*
@@ -782,7 +782,7 @@ done:
*
* Return: Success: SUCCEED, Failure: FAIL
*
- * Programmer: Leon Arber larber@uiuc.edu
+ * Programmer: Leon Arber
*
* Date: April 9, 2004
*
@@ -813,7 +813,7 @@ done:
*
* Return: Success: SUCCEED, Failure: FAIL
*
- * Programmer: Leon Arber larber@uiuc.edu
+ * Programmer: Leon Arber
*
* Date: April 9, 2004
*
@@ -903,7 +903,7 @@ done:
*
* Return: Success: SUCCEED, Failure: FAIL
*
- * Programmer: Leon Arber larber@uiuc.edu
+ * Programmer: Leon Arber
*
* Date: April 9, 2004
*
@@ -1304,8 +1304,6 @@ done:
* Programmer: Raymond Lu
* Jan 14, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1345,8 +1343,6 @@ done:
* Programmer: Raymond Lu
* April 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1386,8 +1382,6 @@ done:
* Programmer: Raymond Lu
* April 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1492,9 +1486,8 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right)
H5TRACE4("e", "iddd", plist_id, left, middle, right);
/* Check arguments */
- if (left < (double)0.0f || left > (double)1.0f || middle < (double)0.0f || middle > (double)1.0f ||
- right < (double)0.0f || right > (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
+ if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0")
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index a33239f..5b0ecb6 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
*
* Purpose: Generic Property Functions
*/
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 228057f..a7f84fb 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -208,12 +208,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
@@ -288,6 +288,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
/******************/
/* Local Typedefs */
@@ -335,12 +358,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,
@@ -478,6 +501,10 @@ 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 */
/*-------------------------------------------------------------------------
* Function: H5P__facc_reg_prop
@@ -764,6 +791,19 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
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() */
@@ -790,12 +830,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
@@ -1206,27 +1240,17 @@ H5P__file_driver_free(void *value)
/* Copy the driver & info, if there is one */
if (info->driver_id > 0) {
- if (info->driver_info) {
- H5FD_class_t *driver; /* Pointer to driver */
- /* Retrieve the driver for the ID */
- if (NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Allow driver to free info or do it ourselves */
- if (driver->fapl_free) {
- if ((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
- } /* end if */
- else
- H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */
- } /* end if */
+ /* Free the driver info, if it exists */
+ if (info->driver_info)
+ if (H5FD_free_driver_info(info->driver_id, info->driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
/* Decrement reference count for driver */
if (H5I_dec_ref(info->driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID")
- } /* end if */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1662,7 +1686,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots,
H5TRACE5("e", "iIszzd", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0);
/* Check arguments */
- if (rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive")
@@ -1792,23 +1816,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr)
+H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", plist_id, config_ptr);
+ H5TRACE2("e", "i*x", plist_id, config);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* validate the config_ptr */
- if (config_ptr == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.")
-
- if (config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION)
+ /* validate the config ptr */
+ if (config == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.")
+ if (config->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version.")
/* If we ever support multiple versions of H5AC_cache_config_t, we
@@ -1817,7 +1840,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr)
*/
/* Get the current initial metadata cache resize configuration */
- if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config_ptr) < 0)
+ if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial image config")
done:
@@ -1873,7 +1896,7 @@ done:
* Purpose: Retrieve the metadata cache initial resize configuration
* from the target FAPL.
*
- * Observe that the function will fail if config_ptr is
+ * Observe that the function will fail if config is
* NULL, or if config_ptr->version specifies an unknown
* version of H5AC_cache_config_t.
*
@@ -1885,23 +1908,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr)
+H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", plist_id, config_ptr);
+ H5TRACE2("e", "i*x", plist_id, config);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* validate the config_ptr */
- if (config_ptr == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.")
-
- if (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)
+ /* validate the config ptr */
+ if (config == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.")
+ if (config->version != H5AC__CURR_CACHE_CONFIG_VERSION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.")
/* If we ever support multiple versions of H5AC_cache_config_t, we
@@ -1910,7 +1932,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr)
*/
/* Get the current initial metadata cache resize configuration */
- if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0)
+ if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial resize config")
done:
@@ -1939,13 +1961,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
@@ -1980,13 +1995,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
@@ -2021,8 +2029,6 @@ done:
* Programmer: Raymond Lu
* November, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2056,8 +2062,6 @@ done:
* Programmer: Raymond Lu
* November, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2100,13 +2104,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
@@ -2141,13 +2138,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
@@ -2193,13 +2183,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
@@ -2234,13 +2217,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
@@ -2285,8 +2261,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 5, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2321,8 +2295,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 5, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2464,7 +2436,6 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
/* Check args */
if (low < 0 || low > H5F_LIBVER_LATEST)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid")
-
if (high < 0 || high > H5F_LIBVER_LATEST)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid")
@@ -2516,15 +2487,13 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
- if (low) {
+ if (low)
if (H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions")
- }
- if (high) {
+ if (high)
if (H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions")
- }
done:
FUNC_LEAVE_API(ret_value)
@@ -2689,22 +2658,22 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image
*
- * Purpose: If the file image exists and buf_ptr_ptr is not NULL,
+ * Purpose: If the file image exists and buf is not NULL,
* allocate a buffer of the correct size, copy the image into
* the new buffer, and return the buffer to the caller in
- * *buf_ptr_ptr. Do this using the file image callbacks
+ * *buf. Do this using the file image callbacks
* if defined.
*
* NB: It is the responsibility of the caller to free the
- * buffer whose address is returned in *buf_ptr_ptr. Do
+ * buffer whose address is returned in *buf. Do
* this using free if the file image callbacks are not
* defined, or with whatever method is appropriate if
* the callbacks are defined.
*
- * If buf_ptr_ptr is not NULL, and no image exists, set
- * *buf_ptr_ptr to NULL.
+ * If buf is not NULL, and no image exists, set
+ * *buf to NULL.
*
- * If buf_len_ptr is not NULL, set *buf_len_ptr equal
+ * If buf_len is not NULL, set *buf_len equal
* to the length of the file image if it exists, and
* to 0 if it does not.
*
@@ -2716,14 +2685,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr)
+H5Pget_file_image(hid_t fapl_id, void **buf, size_t *buf_len)
{
H5P_genplist_t * fapl; /* Property list pointer */
H5FD_file_image_info_t image_info; /* File image info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i**x*z", fapl_id, buf_ptr_ptr, buf_len_ptr);
+ H5TRACE3("e", "i**x*z", fapl_id, buf, buf_len);
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
@@ -2738,11 +2707,11 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr)
((image_info.buffer == NULL) && (image_info.size == 0)));
/* Set output size */
- if (buf_len_ptr != NULL)
- *buf_len_ptr = image_info.size;
+ if (buf_len != NULL)
+ *buf_len = image_info.size;
/* Duplicate the image if desired, using callbacks if available */
- if (buf_ptr_ptr != NULL) {
+ if (buf != NULL) {
void *copy_ptr = NULL; /* Copy of memory image */
if (image_info.buffer != NULL) {
@@ -2767,7 +2736,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr)
H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size);
} /* end if */
- *buf_ptr_ptr = copy_ptr;
+ *buf = copy_ptr;
} /* end if */
done:
@@ -2852,7 +2821,7 @@ done:
} /* end H5Pset_file_image_callbacks() */
/*-------------------------------------------------------------------------
- * Function: H5Pget_file_image_callbacks
+ * Function: H5Pget_file_image_callbacks
*
* Purpose: Sets the callbacks for file images. Some file drivers allow
* the use of user-defined callbacks for allocating, freeing and
@@ -2867,14 +2836,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr)
+H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks)
{
H5P_genplist_t * fapl; /* Property list pointer */
H5FD_file_image_info_t info; /* File image info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*x", fapl_id, callbacks_ptr);
+ H5TRACE2("e", "i*x", fapl_id, callbacks);
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
@@ -2887,17 +2856,17 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback
/* verify file image field consistency */
HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0)));
- /* verify that callbacks_ptr is not NULL */
- if (NULL == callbacks_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr")
+ /* verify that callbacks is not NULL */
+ if (NULL == callbacks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks ptr")
/* Transfer values to parameters */
- *callbacks_ptr = info.callbacks;
+ *callbacks = info.callbacks;
/* Copy udata if it exists */
if (info.callbacks.udata != NULL) {
HDassert(info.callbacks.udata_copy);
- if ((callbacks_ptr->udata = info.callbacks.udata_copy(info.callbacks.udata)) == 0)
+ if ((callbacks->udata = info.callbacks.udata_copy(info.callbacks.udata)) == 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy udata")
} /* end if */
@@ -4251,7 +4220,7 @@ herr_t
H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access)
{
H5P_genplist_t *plist; /* Property list pointer */
- char * tmp_location; /* Working location pointer */
+ char * new_location; /* Working location pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -4267,19 +4236,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list")
- /* Get the current location string and free it */
- if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location")
- H5MM_xfree(tmp_location);
-
/* Make a copy of the passed-in location */
- if (NULL == (tmp_location = H5MM_xstrdup(location)))
+ if (NULL == (new_location = H5MM_xstrdup(location)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location")
/* Set values */
if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag")
- if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
+ if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location")
if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag")
@@ -4301,9 +4265,9 @@ 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)
{
- H5P_genplist_t *plist; /* Property list pointer */
- char * location_ptr; /* Pointer to location string */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ char * location_ptr = NULL; /* Pointer to location string */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*b*s*z*b", plist_id, is_enabled, location, location_size, start_on_access);
@@ -4335,14 +4299,14 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size
*location_size = HDstrlen(location_ptr) + 1;
else
*location_size = 0;
- }
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mdc_log_options() */
/*-------------------------------------------------------------------------
- * 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
@@ -4354,7 +4318,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;
@@ -4362,7 +4326,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));
@@ -4391,10 +4355,10 @@ 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
@@ -4406,7 +4370,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;
@@ -4415,7 +4379,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);
@@ -4444,10 +4408,10 @@ 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.
*
@@ -4456,20 +4420,20 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-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)
+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.
*
@@ -4478,19 +4442,19 @@ 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
@@ -4500,14 +4464,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);
@@ -4518,10 +4482,10 @@ 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
@@ -4531,16 +4495,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_evict_on_close
@@ -4561,7 +4525,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
+H5Pset_evict_on_close(hid_t fapl_id, hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_close)
{
H5P_genplist_t *plist; /* property list pointer */
herr_t ret_value = SUCCEED; /* return value */
@@ -4632,6 +4596,96 @@ 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
/*-------------------------------------------------------------------------
@@ -5461,7 +5515,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info)
/* Prepare the VOL connector property */
vol_prop.connector_id = vol_id;
- vol_prop.connector_info = (void *)vol_info;
+ vol_prop.connector_info = vol_info;
/* Set the connector ID & info property */
if (H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0)
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 16329f9..5006b9a 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pfcpl.c
* January 6 1998
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: File creation property list class routines
*
@@ -132,7 +132,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);
@@ -157,7 +157,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 */
@@ -197,7 +197,7 @@ static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE
static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SIZE_DEF;
/*-------------------------------------------------------------------------
- * Function: H5P_fcrt_reg_prop
+ * Function: H5P__fcrt_reg_prop
*
* Purpose: Register the file creation property list class's properties
*
@@ -208,11 +208,11 @@ static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE
*-------------------------------------------------------------------------
*/
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,
@@ -303,7 +303,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_userblock
@@ -363,11 +363,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -518,11 +513,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,15 +561,10 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */, unsigned *lk /*out */)
+H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/)
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
@@ -618,11 +603,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -671,15 +651,10 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */)
+H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/)
{
unsigned btree_k[H5B_NUM_BTREE_ID];
H5P_genplist_t *plist; /* Property list pointer */
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index de908e4..b8dab90 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pmtpl.c
* November 1 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File mount property list class routines
*
@@ -59,7 +59,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);
/*********************/
/* Package Variables */
@@ -74,7 +74,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 */
@@ -96,7 +96,7 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{
static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */
/*-------------------------------------------------------------------------
- * Function: H5P_fmnt_reg_prop
+ * Function: H5P__fmnt_reg_prop
*
* Purpose: Register the file mount property list class's properties
*
@@ -107,11 +107,11 @@ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlink
*-------------------------------------------------------------------------
*/
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, NULL,
@@ -120,4 +120,4 @@ 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 811a569..5df73a1 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pgcpl.c
* August 29 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Group creation property list class routines
*
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 43950a7..f66e2b9 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
*
* Purpose: Generic Property Functions
*/
@@ -1436,7 +1436,7 @@ H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED
NAME
H5P__access_class
PURPOSE
- Internal routine to increment or decrement list & class dependancies on a
+ Internal routine to increment or decrement list & class dependencies on a
property list class
USAGE
herr_t H5P__access_class(pclass,mod)
@@ -5559,7 +5559,7 @@ done:
* Return: Success: Non-negative ID of property list.
* Failure: H5I_INVALID_HID
*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* April 22, 2014
*
*-------------------------------------------------------------------------
@@ -5586,7 +5586,7 @@ H5P_get_plist_id(const H5P_genplist_t *plist)
* Return: Success: Non-NULL class of property list.
* Failure: NULL
*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* April 22, 2014
*
*-------------------------------------------------------------------------
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index b9a6b60..75fea42 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Plapl.c
* July 14 2006
- * James Laird <jlaird@ncsa.uiuc.edu>
+ * James Laird
*
* Purpose: Link access property list class routines
*
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 6d43830..2d7d5f5 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -59,7 +59,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);
/*********************/
/* Package Variables */
@@ -74,7 +74,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 */
@@ -97,7 +97,7 @@ static const unsigned H5L_def_intmd_group_g =
H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */
/*-------------------------------------------------------------------------
- * Function: H5P_lcrt_reg_prop
+ * Function: H5P__lcrt_reg_prop
*
* Purpose: Register the dataset creation property list class's properties
*
@@ -107,12 +107,12 @@ static const unsigned H5L_def_intmd_group_g =
* 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,
@@ -122,7 +122,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() */
/*-------------------------------------------------------------------------
* Function: H5Pset_create_intermediate_group
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
index a1f0fae..8fdf610 100644
--- a/src/H5Pmapl.c
+++ b/src/H5Pmapl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Pmcpl.c b/src/H5Pmcpl.c
index ecdf1f0..c88d0bb 100644
--- a/src/H5Pmcpl.c
+++ b/src/H5Pmcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h
index d6e67d4..18f30c6 100644
--- a/src/H5Pmodule.h
+++ b/src/H5Pmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5P package. Including this header means that the source file
* is part of the H5P package.
*/
-#ifndef _H5Pmodule_H
-#define _H5Pmodule_H
+#ifndef H5Pmodule_H
+#define H5Pmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,50 @@
#define H5_MY_PKG_ERR H5E_PLIST
#define H5_MY_PKG_INIT YES
-#endif /* _H5Pmodule_H */
+/**\defgroup H5P H5P
+ * \brief Property List Interface
+ *
+ * \details The HDF5 Property List Interface provides a mechanism to take
+ * advantage of more powerful or unusual features in HDF5.
+ *
+ * HDF5 objects have properties or characteristics associated with
+ * them, and there are default properties that handle the most
+ * common needs. These default properties can be modified using the
+ * HDF5 Property List Interface. For example, the data storage
+ * layout property of a dataset is contiguous by default. For better
+ * performance, the layout can be modified to be chunked or chunked
+ * and compressed.
+ *
+ * \todo Describe concisely what the functions in this module are about.
+ *
+ * \defgroup GPLO General Property List Operations
+ * \ingroup H5P
+ * \defgroup GPLOA General Property List Operations (Advanced)
+ * \ingroup H5P
+ * \defgroup FCPL File Creation Properties
+ * \ingroup H5P
+ * \defgroup FAPL File Access Properties
+ * \ingroup H5P
+ * \defgroup GCPL Group Creation Properties
+ * \ingroup H5P
+ * \defgroup ALCAPL Attribute and Link Creation Properties
+ * \ingroup H5P
+ * \defgroup LAPL Link Access Properties
+ * \ingroup H5P
+ * \defgroup DCPL Dataset Creation Properties
+ * \ingroup H5P
+ * \defgroup DAPL Dataset Access Properties
+ * \ingroup H5P
+ * \defgroup DXPL Dataset Transfer Properties
+ * \ingroup H5P
+ * \defgroup OCPL Object Creation Properties
+ * \ingroup H5P
+ * \defgroup OCPPL Object Copy Properties
+ * \ingroup H5P
+ * \defgroup GACPL General Access Properties
+ * \ingroup H5P
+ * \defgroup MAPL Map Access Properties
+ * \ingroup H5P
+ */
+
+#endif /* H5Pmodule_H */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 0fcc07d..cc32582 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pocpl.c
* Nov 28 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object creation property list class routines
*
@@ -568,13 +568,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
@@ -637,18 +630,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
@@ -764,13 +745,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
@@ -820,13 +794,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
@@ -959,13 +926,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
@@ -1025,13 +985,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
@@ -1106,13 +1059,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
@@ -1164,18 +1110,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
@@ -1223,13 +1157,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 145ba72..ff959d2 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pocpypl.c
* Mar 13 2006
- * Peter Cao <xcao@ncsa.uiuc.edu>
+ * Peter Cao
*
* Purpose: Object copying property list class routines
*
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 04051c8..699d5f3 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, November 16, 2001
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5P package!"
#endif
-#ifndef _H5Ppkg_H
-#define _H5Ppkg_H
+#ifndef H5Ppkg_H
+#define H5Ppkg_H
/* Get package's private header */
#include "H5Pprivate.h"
@@ -198,4 +198,4 @@ H5_DLL char *H5P__get_class_path_test(hid_t pclass_id);
H5_DLL hid_t H5P__open_class_path_test(const char *path);
#endif /* H5P_TESTING */
-#endif /* _H5Ppkg_H */
+#endif /* H5Ppkg_H */
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 926b5ca..862c74f 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5P module
*/
-#ifndef _H5Pprivate_H
-#define _H5Pprivate_H
+#ifndef H5Pprivate_H
+#define H5Pprivate_H
/* Early typedefs to avoid circular dependencies */
typedef struct H5P_genplist_t H5P_genplist_t;
@@ -209,4 +209,4 @@ H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type
H5_DLL int H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2,
size_t H5_ATTR_UNUSED size);
-#endif /* _H5Pprivate_H */
+#endif /* H5Pprivate_H */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 68519f8..5adb05e 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
* This file contains function prototypes for each exported function in the
* H5P module.
*/
-#ifndef _H5Ppublic_H
-#define _H5Ppublic_H
+#ifndef H5Ppublic_H
+#define H5Ppublic_H
/* System headers needed by this file */
@@ -39,11 +39,11 @@
/* When this header is included from a private HDF5 header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5private_H
+#ifndef H5private_H
#define H5OPEN H5open(),
-#else /* _H5private_H */
+#else /* H5private_H */
#define H5OPEN
-#endif /* _H5private_H */
+#endif /* H5private_H */
/*
* The library's property list classes
@@ -111,13 +111,50 @@ extern "C" {
/*******************/
/* Define property list class callback function pointer types */
+//! <!-- [H5P_cls_create_func_t_snip] -->
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
+//! <!-- [H5P_cls_create_func_t_snip] -->
+
+//! <!-- [H5P_cls_copy_func_t_snip] -->
typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
+//! <!-- [H5P_cls_copy_func_t_snip] -->
+
+//! <!-- [H5P_cls_close_func_t_snip] -->
typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
+//! <!-- [H5P_cls_close_func_t_snip] -->
/* Define property list callback function pointer types */
+//! <!-- [H5P_prp_cb1_t_snip] -->
+/**
+ * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1()
+ *
+ * \param[in] name The name of the property
+ * \param[in] size The size of the property in bytes
+ * \param[in,out] value The value for the property
+ * \return \herr_t
+ *
+ * \details The H5P_prp_cb1_t() describes the parameters used by the
+ * property create,copy and close callback functions.
+ */
typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value);
+//! <!-- [H5P_prp_cb1_t_snip] -->
+
+//! <!-- [H5P_prp_cb2_t_snip] -->
+/**
+ * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1()
+ *
+ * \plist_id{prop_id}
+ * \param[in] name The name of the property
+ * \param[in] size The size of the property in bytes
+ * \param[in] value The value for the property
+ * \return \herr_t
+ *
+ * \details The H5P_prp_cb2_t() describes the parameters used by the
+ * property set ,copy and delete callback functions.
+ */
typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value);
+//! <!-- [H5P_prp_cb2_t_snip] -->
+
typedef H5P_prp_cb1_t H5P_prp_create_func_t;
typedef H5P_prp_cb2_t H5P_prp_set_func_t;
typedef H5P_prp_cb2_t H5P_prp_get_func_t;
@@ -125,56 +162,93 @@ typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *s
typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
+
+//! <!-- [H5P_prp_compare_func_t_snip] -->
typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
+//! <!-- [H5P_prp_compare_func_t_snip] -->
+
typedef H5P_prp_cb1_t H5P_prp_close_func_t;
/* Define property list iteration function type */
+//! <!-- [H5P_iterate_t_snip] -->
typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
+//! <!-- [H5P_iterate_t_snip] -->
-/* Actual IO mode property */
+//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] -->
+/**
+ * Actual IO mode property
+ *
+ * \details The default value, #H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all
+ * I/O operations that do not use chunk optimizations, including
+ * non-collective I/O and contiguous collective I/O.
+ */
typedef enum H5D_mpio_actual_chunk_opt_mode_t {
- /* The default value, H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all I/O
- * operations that do not use chunk optimizations, including non-collective
- * I/O and contiguous collective I/O.
- */
H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0,
+ /**< No chunk optimization was performed. Either no collective I/O was
+ attempted or the dataset wasn't chunked. */
H5D_MPIO_LINK_CHUNK,
+ /**< Collective I/O is performed on all chunks simultaneously. */
H5D_MPIO_MULTI_CHUNK
+ /**< Each chunk was individually assigned collective or independent I/O based
+ on what fraction of processes access the chunk. If the fraction is greater
+ than the multi chunk ratio threshold, collective I/O is performed on that
+ chunk. The multi chunk ratio threshold can be set using
+ H5Pset_dxpl_mpio_chunk_opt_ratio(). The default value is 60%. */
} H5D_mpio_actual_chunk_opt_mode_t;
+//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] -->
+//! <!-- [H5D_mpio_actual_io_mode_t_snip] -->
+/**
+ * The following values are conveniently defined as a bit field so that
+ * we can switch from the default to independent or collective and then to
+ * mixed without having to check the original value.
+ */
typedef enum H5D_mpio_actual_io_mode_t {
- /* The following four values are conveniently defined as a bit field so that
- * we can switch from the default to independent or collective and then to
- * mixed without having to check the original value.
- *
- * NO_COLLECTIVE means that either collective I/O wasn't requested or that
- * no I/O took place.
- *
- * CHUNK_INDEPENDENT means that collective I/O was requested, but the
- * chunk optimization scheme chose independent I/O for each chunk.
- */
- H5D_MPIO_NO_COLLECTIVE = 0x0,
+ H5D_MPIO_NO_COLLECTIVE = 0x0,
+ /**< No collective I/O was performed. Collective I/O was not requested or
+ collective I/O isn't possible on this dataset */
H5D_MPIO_CHUNK_INDEPENDENT = 0x1,
- H5D_MPIO_CHUNK_COLLECTIVE = 0x2,
- H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2,
-
- /* The contiguous case is separate from the bit field. */
+ /**< HDF5 performed one the chunk collective optimization schemes and each
+ chunk was accessed independently */
+ H5D_MPIO_CHUNK_COLLECTIVE = 0x2,
+ /**< HDF5 performed one the chunk collective optimization schemes and each
+ chunk was accessed collectively */
+ H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2,
+ /**< HDF5 performed one the chunk collective optimization schemes and some
+ chunks were accessed independently, some collectively. */
+ /** \internal The contiguous case is separate from the bit field. */
H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4
+ /**< Collective I/O was performed on a contiguous dataset */
} H5D_mpio_actual_io_mode_t;
+//! <!-- [H5D_mpio_actual_io_mode_t_snip] -->
-/* Broken collective IO property */
+//! <!-- [H5D_mpio_no_collective_cause_t_snip] -->
+/**
+ * Broken collective IO property
+ */
typedef enum H5D_mpio_no_collective_cause_t {
- H5D_MPIO_COLLECTIVE = 0x00,
- H5D_MPIO_SET_INDEPENDENT = 0x01,
- H5D_MPIO_DATATYPE_CONVERSION = 0x02,
- H5D_MPIO_DATA_TRANSFORMS = 0x04,
- H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08,
- H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
- H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
- H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
+ H5D_MPIO_COLLECTIVE = 0x00,
+ /**< Collective I/O was performed successfully */
+ H5D_MPIO_SET_INDEPENDENT = 0x01,
+ /**< Collective I/O was not performed because independent I/O was requested */
+ H5D_MPIO_DATATYPE_CONVERSION = 0x02,
+ /**< Collective I/O was not performed because datatype conversions were required */
+ H5D_MPIO_DATA_TRANSFORMS = 0x04,
+ /**< Collective I/O was not performed because data transforms needed to be applied */
+ H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08,
+ /**< \todo FIXME! */
+ H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
+ /**< Collective I/O was not performed because one of the dataspaces was neither simple nor scalar */
+ H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
+ /**< Collective I/O was not performed because the dataset was neither contiguous nor chunked */
+ H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
+ /**< \todo FIXME! */
H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80,
- H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
+ /**< \todo FIXME! */
+ H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
+ /**< Sentinel */
} H5D_mpio_no_collective_cause_t;
+//! <!-- [H5D_mpio_no_collective_cause_t_snip] -->
/********************/
/* Public Variables */
@@ -232,274 +306,8952 @@ H5_DLLVAR hid_t H5P_LST_REFERENCE_ACCESS_ID_g;
/*********************/
/* Generic property list routines */
-H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create,
- void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data,
- H5P_cls_close_func_t cls_close, void *close_data);
-H5_DLL char * H5Pget_class_name(hid_t pclass_id);
-H5_DLL hid_t H5Pcreate(hid_t cls_id);
-H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value,
- H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del,
- H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
- H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value,
- H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
- H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
- H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value);
-H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name);
+
+/**
+ * \ingroup GPLO
+ *
+ * \brief Terminates access to a property list
+ *
+ * \plist_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Pclose() terminates access to a property list. All property
+ * lists should be closed when the application is finished
+ * accessing them. This frees resources used by the property
+ * list.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pclose(hid_t plist_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Closes an existing property list class
+ *
+ * \plistcls_id{plist_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pclose_class() removes a property list class from the library.
+ * Existing property lists of this class will continue to exist,
+ * but new ones are not able to be created.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL herr_t H5Pclose_class(hid_t plist_id);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Copies an existing property list to create a new property list
+ *
+ * \plist_id
+ *
+ * \return \hid_t{property list}
+ *
+ * \details H5Pcopy() copies an existing property list to create a new
+ * property list. The new property list has the same properties
+ * and values as the original property list.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Pcopy(hid_t plist_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Copies a property from one list or class to another
+ *
+ * \param[in] dst_id Identifier of the destination property list or class
+ * \param[in] src_id Identifier of the source property list or class
+ * \param[in] name Name of the property to copy
+ *
+ * \return \herr_t
+ *
+ * \details H5Pcopy_prop() copies a property from one property list or
+ * class to another.
+ *
+ * If a property is copied from one class to another, all the
+ * property information will be first deleted from the destination
+ * class and then the property information will be copied from the
+ * source class into the destination class.
+ *
+ * If a property is copied from one list to another, the property
+ * will be first deleted from the destination list (generating a
+ * call to the close callback for the property, if one exists)
+ * and then the property is copied from the source list to the
+ * destination list (generating a call to the copy callback for
+ * the property, if one exists).
+ *
+ * If the property does not exist in the class or list, this
+ * call is equivalent to calling H5Pregister() or H5Pinsert() (for
+ * a class or list, as appropriate) and the create callback will
+ * be called in the case of the property being copied into a list
+ * (if such a callback exists for the property).
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Creates a new property list as an instance of a property list class
+ *
+ * \plistcls_id{cls_id}
+ *
+ * \return \hid_t{property list}
+ *
+ * \details H5Pcreate() creates a new property list as an instance of
+ * some property list class. The new property list is initialized
+ * with default values for the specified class. The classes are as
+ * follows:
+ *
+ * <table>
+ * <tr>
+ * <th>Class Identifier</th>
+ * <th>Class Name</th>
+ * <th>Comments</th>
+ * </tr>
+ * <tr>
+ * <td>#H5P_ATTRIBUTE_CREATE</td>
+ * <td>attribute create</td>
+ * <td>Properties for attribute creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_DATASET_ACCESS</td>
+ * <td>dataset access</td>
+ * <td>Properties for dataset access</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_DATASET_CREATE</td>
+ * <td>dataset create</td>
+ * <td>Properties for dataset creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_DATASET_XFER</td>
+ * <td>data transfer</td>
+ * <td>Properties for raw data transfer</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_DATATYPE_ACCESS</td>
+ * <td>datatype access</td>
+ * <td>Properties for datatype access</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_DATATYPE_CREATE</td>
+ * <td>datatype create</td>
+ * <td>Properties for datatype creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_FILE_ACCESS</td>
+ * <td>file access</td>
+ * <td>Properties for file access</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_FILE_CREATE</td>
+ * <td>file create</td>
+ * <td>Properties for file creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_FILE_MOUNT</td>
+ * <td>file mount</td>
+ * <td>Properties for file mounting</td>
+ * </tr>
+ * <tr valign="top">
+ * <td>#H5P_GROUP_ACCESS</td>
+ * <td>group access</td>
+ * <td>Properties for group access</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_GROUP_CREATE</td>
+ * <td>group create</td>
+ * <td>Properties for group creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_LINK_ACCESS</td>
+ * <td>link access</td>
+ * <td>Properties governing link traversal when accessing objects</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_LINK_CREATE</td>
+ * <td>link create</td>
+ * <td>Properties governing link creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_OBJECT_COPY</td>
+ * <td>object copy</td>
+ * <td>Properties governing the object copying process</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_OBJECT_CREATE</td>
+ * <td>object create</td>
+ * <td>Properties for object creation</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_STRING_CREATE</td>
+ * <td>string create</td>
+ * <td>Properties for character encoding when encoding strings or
+ * object names</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_VOL_INITIALIZE</td>
+ * <td>vol initialize</td>
+ * <td>Properties for VOL initialization</td>
+ * </tr>
+ * </table>
+ *
+ * This property list must eventually be closed with H5Pclose();
+ * otherwise, errors are likely to occur.
+ *
+ * \version 1.12.0 The #H5P_VOL_INITIALIZE property list class was added
+ * \version 1.8.15 For each class, the class name returned by
+ * H5Pget_class_name() was added.
+ * The list of possible Fortran values was updated.
+ * \version 1.8.0 The following property list classes were added at this
+ * release: #H5P_DATASET_ACCESS, #H5P_GROUP_CREATE,
+ * #H5P_GROUP_ACCESS, #H5P_DATATYPE_CREATE,
+ * #H5P_DATATYPE_ACCESS, #H5P_ATTRIBUTE_CREATE
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Pcreate(hid_t cls_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Creates a new property list class
+ *
+ * \plistcls_id{parent}
+ * \param[in] name Name of property list class to register
+ * \param[in] create Callback routine called when a property list is
+ * created
+ * \param[in] create_data Pointer to user-defined class create data, to be
+ * passed along to class create callback
+ * \param[in] copy Callback routine called when a property list is
+ * copied
+ * \param[in] copy_data Pointer to user-defined class copy data, to be
+ * passed along to class copy callback
+ * \param[in] close Callback routine called when a property list is
+ * being closed
+ * \param[in] close_data Pointer to user-defined class close data, to be
+ * passed along to class close callback
+ *
+ * \return \hid_t{property list class}
+ *
+ * \details H5Pcreate_class() registers a new property list class with the
+ * library. The new property list class can inherit from an
+ * existing property list class, \p parent, or may be derived
+ * from the default “empty” class, NULL. New classes with
+ * inherited properties from existing classes may not remove
+ * those existing properties, only add or remove their own class
+ * properties. Property list classes defined and supported in the
+ * HDF5 library distribution are listed and briefly described in
+ * H5Pcreate(). The \p create routine is called when a new property
+ * list of this class is being created. The #H5P_cls_create_func_t
+ * callback function is defined as follows:
+ *
+ * \snippet this H5P_cls_create_func_t_snip
+ *
+ * The parameters to this callback function are defined as follows:
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being created</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * create_data}</td>
+ * <td>IN: User pointer to any class creation data required</td>
+ * </tr>
+ * </table>
+ *
+ * The \p create routine is called after any registered
+ * \p create function is called for each property value. If the
+ * \p create routine returns a negative value, the new list is not
+ * returned to the user and the property list creation routine returns
+ * an error value.
+ *
+ * The \p copy routine is called when an existing property
+ * list of this class is copied. The #H5P_cls_copy_func_t callback
+ * function is defined as follows:
+ * \snippet this H5P_cls_copy_func_t_snip
+ *
+ * The parameters to this callback function are defined as follows:
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list created by copying</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * copy_data}</td>
+ * <td>IN: User pointer to any class copy data required</td>
+ * </tr>
+ * </table>
+ *
+ * The \p copy routine is called after any registered \p copy function
+ * is called for each property value. If the \p copy routine returns a
+ * negative value, the new list is not returned to the user and the
+ * property list \p copy routine returns an error value.
+ *
+ * The \p close routine is called when a property list of this class
+ * is being closed. The #H5P_cls_close_func_t callback function is
+ * defined as follows:
+ * \snippet this H5P_cls_close_func_t_snip
+ *
+ * The parameters to this callback function are defined as follows:
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being closed</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * close_data}</td>
+ * <td>IN: User pointer to any class close data required</td>
+ * </tr>
+ * </table>
+ *
+ * The \p close routine is called before any registered \p close
+ * function is called for each property value. If the \p close routine
+ * returns a negative value, the property list close routine returns
+ * an error value but the property list is still closed.
+ *
+ * H5Pclose_class() can be used to release the property list class
+ * identifier returned by this function so that resources leaks will
+ * not develop.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t create, void *create_data,
+ H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close,
+ void *close_data);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Decodes property list received in a binary object buffer and
+ * returns a new property list identifier
+ *
+ * \param[in] buf Buffer holding the encoded property list
+ *
+ * \return \hid_tv{object}
+ *
+ * \details Given a binary property list description in a buffer, H5Pdecode()
+ * reconstructs the HDF5 property list and returns an identifier
+ * for the new property list. The binary description of the property
+ * list is encoded by H5Pencode().
+ *
+ * The user is responsible for passing in the correct buffer.
+ *
+ * The property list identifier returned by this function should be
+ * released with H5Pclose() when the identifier is no longer needed
+ * so that resource leaks will not develop.
+ *
+ * \note Some properties cannot be encoded and therefore will not be available
+ * in the decoded property list. These properties are discussed in
+ * H5Pencode().
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL hid_t H5Pdecode(const void *buf);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Encodes the property values in a property list into a binary
+ * buffer
+ *
+ * \plist_id
+ * \param[out] buf Buffer into which the property list will be encoded.
+ * If the provided buffer is NULL, the size of the
+ * buffer required is returned through \p nalloc; the
+ * function does nothing more.
+ * \param[out] nalloc The size of the required buffer
+ * \fapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Pencode2() encodes the property list \p plist_id into the
+ * binary buffer \p buf, according to the file format setting
+ * specified by the file access property list \p fapl_id.
+ *
+ * If the required buffer size is unknown, \p buf can be passed
+ * in as NULL and the function will set the required buffer size
+ * in \p nalloc. The buffer can then be created and the property
+ * list encoded with a subsequent H5Pencode2() call.
+ *
+ * If the buffer passed in is not big enough to hold the encoded
+ * properties, the H5Pencode2() call can be expected to fail with
+ * a segmentation fault.
+ *
+ * The file access property list \p fapl_id is used to
+ * control the encoding via the \a libver_bounds property
+ * (see H5Pset_libver_bounds()). If the \a libver_bounds
+ * property is missing, H5Pencode2() proceeds as if the \a
+ * libver_bounds property were set to (#H5F_LIBVER_EARLIEST,
+ * #H5F_LIBVER_LATEST). (Functionally, H5Pencode1() is identical to
+ * H5Pencode2() with \a libver_bounds set to (#H5F_LIBVER_EARLIEST,
+ * #H5F_LIBVER_LATEST).)
+ * Properties that do not have encode callbacks will be skipped.
+ * There is currently no mechanism to register an encode callback for
+ * a user-defined property, so user-defined properties cannot currently
+ * be encoded.
+ *
+ * Some properties cannot be encoded, particularly properties that are
+ * reliant on local context.
+ *
+ * \b Motivation:
+ * This function was introduced in HDF5-1.12 as part of the \a H5Sencode
+ * format change to enable 64-bit selection encodings and a dataspace
+ * selection that is tied to a file.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id);
-H5_DLL hid_t H5Pdecode(const void *buf);
-H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
-H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops);
-H5_DLL hid_t H5Pget_class(hid_t plist_id);
-H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id);
-H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Compares two property lists or classes for equality
+ *
+ * \param[in] id1 First property object to be compared
+ * \param[in] id2 Second property object to be compared
+ *
+ * \return \htri_t
+ *
+ * \details H5Pequal() compares two property lists or classes to determine
+ * whether they are equal to one another.
+ *
+ * Either both \p id1 and \p id2 must be property lists or both
+ * must be classes; comparing a list to a class is an error.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL htri_t H5Pequal(hid_t id1, hid_t id2);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Queries whether a property name exists in a property list or
+ * class
+ *
+ * \param[in] plist_id Identifier for the property list or class to query
+ * \param[in] name Name of property to check for
+ *
+ * \return \htri_t
+ *
+ * \details H5Pexist() determines whether a property exists within a
+ * property list or class.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Queries the value of a property
+ *
+ * \plist_id
+ * \param[in] name Name of property to query
+ * \param[out] value Pointer to a location to which to copy the value of
+ * the property
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget() retrieves a copy of the value for a property in a
+ * property list. If there is a \p get callback routine registered
+ * for this property, the copy of the value of the property will
+ * first be passed to that routine and any changes to the copy of
+ * the value will be used when returning the property value from
+ * this routine.
+ *
+ * This routine may be called for zero-sized properties with the
+ * \p value set to NULL. The \p get routine will be called with
+ * a NULL value if the callback exists.
+ *
+ * The property name must exist or this routine will fail.
+ *
+ * If the \p get callback routine returns an error, \ value will
+ * not be modified.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value);
+/**
+ *\ingroup GPLO
+ *
+ * \brief Returns the property list class identifier for a property list
+ *
+ * \plist_id
+ *
+ * \return \hid_t{property list class}
+ *
+ * \details H5Pget_class() returns the property list class identifier for
+ * the property list identified by the \p plist_id parameter.
+ *
+ * Note that H5Pget_class() returns a value of #hid_t type, an
+ * internal HDF5 identifier, rather than directly returning a
+ * property list class. That identifier can then be used with
+ * either H5Pequal() or H5Pget_class_name() to determine which
+ * predefined HDF5 property list class H5Pget_class() has returned.
+ *
+ * A full list of valid predefined property list classes appears
+ * in the description of H5Pcreate().
+ *
+ * Determining the HDF5 property list class name with H5Pequal()
+ * requires a series of H5Pequal() calls in an if-else sequence.
+ * An iterative sequence of H5Pequal() calls can compare the
+ * identifier returned by H5Pget_class() to members of the list of
+ * valid property list class names. A pseudo-code snippet might
+ * read as follows:
+ *
+ * \code
+ * plist_class_id = H5Pget_class (dsetA_plist);
+ *
+ * if H5Pequal (plist_class_id, H5P_OBJECT_CREATE) = TRUE;
+ * [ H5P_OBJECT_CREATE is the property list class ]
+ * [ returned by H5Pget_class. ]
+ *
+ * else if H5Pequal (plist_class_id, H5P_DATASET_CREATE) = TRUE;
+ * [ H5P_DATASET_CREATE is the property list class. ]
+ *
+ * else if H5Pequal (plist_class_id, H5P_DATASET_XFER) = TRUE;
+ * [ H5P_DATASET_XFER is the property list class. ]
+ *
+ * .
+ * . [ Continuing the iteration until a match is found. ]
+ * .
+ * \endcode
+ *
+ * H5Pget_class_name() returns the property list class name directly
+ * as a string:
+ *
+ * \code
+ * plist_class_id = H5Pget_class (dsetA_plist);
+ * plist_class_name = H5Pget_class_name (plist_class_id)
+ * \endcode
+ *
+ * Note that frequent use of H5Pget_class_name() can become a
+ * performance problem in a high-performance environment. The
+ * H5Pequal() approach is generally much faster.
+ *
+ * \version 1.6.0 Return type changed in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Pget_class(hid_t plist_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Retrieves the name of a class
+ *
+ * \plistcls_id{pclass_id}
+ *
+ * \return Returns a pointer to an allocated string containing the class
+ * name if successful, and NULL if not successful.
+ *
+ * \details H5Pget_class_name() retrieves the name of a generic property
+ * list class. The pointer to the name must be freed by the user
+ * with a call to H5free_memory() after each successful call.
+ *
+ * <table>
+ * <tr>
+ * <th>Class Name (class identifier) Returned</th>
+ * <th>Property List Class</th>
+ * <th>Expanded Name of the Property List Class</th>
+ * <th>The Class Identifier Used with H5Pcreate</th>
+ * <th>Comments</th>
+ * </tr>
+ * <tr>
+ * <td>attribute create</td>
+ * <td>acpl</td>
+ * <td>Attribute Creation Property List</td>
+ * <td>H5P_ATTRIBUTE_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>dataset access</td>
+ * <td>dapl</td>
+ * <td>Dataset Access Property List</td>
+ * <td>H5P_DATASET_ACCESS</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>dataset create</td>
+ * <td>dcpl</td>
+ * <td>Dataset Creation Property List</td>
+ * <td>H5P_DATASET_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>data transfer</td>
+ * <td>dxpl</td>
+ * <td>Data Transfer Property List</td>
+ * <td>H5P_DATASET_XFER</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>datatype access</td>
+ * <td> </td>
+ * <td> </td>
+ * <td>H5P_DATATYPE_ACCESS</td>
+ * <td>This class can be created, but there are no properties
+ * in the class currently.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>datatype create</td>
+ * <td> </td>
+ * <td> </td>
+ * <td>H5P_DATATYPE_CREATE</td>
+ * <td>This class can be created, but there
+ * are no properties in the class currently.</td>
+ * </tr>
+ * <tr>
+ * <td>file access</td>
+ * <td>fapl</td>
+ * <td>File Access Property List</td>
+ * <td>H5P_FILE_ACCESS</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>file create</td>
+ * <td>fcpl</td>
+ * <td>File Creation Property List</td>
+ * <td>H5P_FILE_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>file mount</td>
+ * <td>fmpl</td>
+ * <td>File Mount Property List</td>
+ * <td>H5P_FILE_MOUNT</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>group access</td>
+ * <td> </td>
+ * <td> </td>
+ * <td>H5P_GROUP_ACCESS</td>
+ * <td>This class can be created, but there
+ * are no properties in the class currently.</td>
+ * </tr>
+ * <tr>
+ * <td>group create</td>
+ * <td>gcpl</td>
+ * <td>Group Creation Property List</td>
+ * <td>H5P_GROUP_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>link access</td>
+ * <td>lapl</td>
+ * <td>Link Access Property List</td>
+ * <td>H5P_LINK_ACCESS</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>link create</td>
+ * <td>lcpl</td>
+ * <td>Link Creation Property List</td>
+ * <td>H5P_LINK_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>object copy</td>
+ * <td>ocpypl</td>
+ * <td>Object Copy Property List</td>
+ * <td>H5P_OBJECT_COPY</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>object create</td>
+ * <td>ocpl</td>
+ * <td>Object Creation Property List</td>
+ * <td>H5P_OBJECT_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * <tr>
+ * <td>string create</td>
+ * <td>strcpl</td>
+ * <td>String Creation Property List</td>
+ * <td>H5P_STRING_CREATE</td>
+ * <td> </td>
+ * </tr>
+ * </table>
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL char *H5Pget_class_name(hid_t pclass_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Retrieves the parent class of a property class
+ *
+ * \plistcls_id{pclass_id}
+ *
+ * \return \hid_t{parent class object}
+ *
+ * \details H5Pget_class_parent() retrieves an identifier for the parent
+ * class of a property class.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Queries the number of properties in a property list or class
+ *
+ * \param[in] id Identifier for property object to query
+ * \param[out] nprops Number of properties in object
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_nprops() retrieves the number of properties in a
+ * property list or property list class.
+ *
+ * If \p id is a property list identifier, the current number of
+ * properties in the list is returned in \p nprops.
+ *
+ * If \p id is a property list class identifier, the number of
+ * registered properties in the class is returned in \p nprops.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Queries the size of a property value in bytes
+ *
+ * \param[in] id Identifier of property object to query
+ * \param[in] name Name of property to query
+ * \param[out] size Size of property in bytes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_size() retrieves the size of a property's value in
+ * bytes. This function operates on both property lists and
+ * property classes.
+ *
+ * Zero-sized properties are allowed and return 0.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a temporary property with a property list
+ *
+ * \plist_id
+ * \param[in] name Name of property to create
+ * \param[in] size Size of property in bytes
+ * \param[in] value Initial value for the property
+ * \param[in] set Callback routine called before a new value is copied
+ * into the property's value
+ * \param[in] get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_del Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] copy Callback routine called when a property is copied
+ * from an existing property list
+ * \param[in] compare Callback routine called when a property is compared
+ * with another property list
+ * \param[in] close Callback routine called when a property list is
+ * being closed and the property value will be disposed
+ * of
+ *
+ * \return \herr_t
+ *
+ * \details H5Pinsert2() creates a new property in a property
+ * list. The property will exist only in this property list and
+ * copies made from it.
+ *
+ * The initial property value must be provided in \p value and
+ * the property value will be set accordingly.
+ *
+ * The name of the property must not already exist in this list,
+ * or this routine will fail.
+ *
+ * The \p set and \p get callback routines may be set to NULL
+ * if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data
+ * in the property list. The default value of a zero-size
+ * property may be set to NULL. They may be used to indicate the
+ * presence or absence of a particular piece of information.
+ *
+ * The \p set routine is called before a new value is copied
+ * into the property. The #H5P_prp_set_func_t callback function
+ * is defined as follows:
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being
+ * modified</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being modified</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: Pointer to new value pointer for the property
+ * being modified</td>
+ * </tr>
+ * </table>
+ *
+ * The \p set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p set routine returns a negative value, the new property
+ * value is not copied into the property and the \p set routine
+ * returns an error value. The \p set routine will be called for
+ * the initial value.
+ *
+ * \b Note: The \p set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p get
+ * callback would then reverse the transformation or translation.
+ * A single \p get or \p set callback could handle multiple
+ * properties by performing different actions based on the
+ * property name or other properties in the property list.
+ *
+ * The \p get routine is called when a value is retrieved from
+ * a property value. The #H5P_prp_get_func_t callback function
+ * is defined as follows:
+ *
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to the above callback function are:
+ *
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being queried</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being queried</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: The value of the property being returned</td>
+ * </tr>
+ * </table>
+ *
+ * The \p get routine may modify the value to be returned from
+ * the query and those changes will be preserved. If the \p get
+ * routine returns a negative value, the query routine returns
+ * an error value.
+ *
+ * The \p prp_del routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to the above callback function are:
+ *
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list the property is
+ * being deleted from</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property in the list</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: The value for the property being deleted</td>
+ * </tr>
+ * </table>
+ *
+ * The \p prp_del routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_del routine
+ * returns. If the \p prp_del routine returns a negative value,
+ * the property list \p prp_del routine returns an error value but
+ * the property is still deleted.
+ *
+ * The \p copy routine is called when a new property list with
+ * this property is being created through a \p copy operation.
+ *
+ * The #H5P_prp_copy_func_t callback function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The parameters to the above callback function are:
+ * <table>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being copied</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN/OUT: The value for the property being copied</td>
+ * </tr>
+ * </table>
+ *
+ * The \p copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If the
+ * \p copy routine returns a negative value, the new property value
+ * is not copied into the property and the copy routine returns an
+ * error value.
+ *
+ * The \p compare routine is called when a property list with this
+ * property is compared to another property list with the same
+ * property.
+ *
+ * The #H5P_prp_compare_func_t callback function is defined as
+ * follows:
+ *
+ * \snippet this H5P_prp_compare_func_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const void * value1}</td>
+ * <td>IN: The value of the first property to compare</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const void * value2}</td>
+ * <td>IN: The value of the second property to compare</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * </table>
+ *
+ * The \p compare routine may not modify the values. The \p compare
+ * routine should return a positive value if \p value1 is greater
+ * than \p value2, a negative value if \p value2 is greater than
+ * \p value1 and zero if \p value1 and \p value2 are equal.
+ *
+ * The \p close routine is called when a property list with this
+ * property is being closed.
+ *
+ * The #H5P_prp_close_func_t callback function is defined as follows:
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property in the list</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: The value for the property being closed</td>
+ * </tr>
+ * </table>
+ *
+ * The \p close routine may modify the value passed in, the
+ * value is not used by the library when the close routine
+ * returns. If the \p close routine returns a negative value,
+ * the property list \p close routine returns an error value
+ * but the property list is still closed.
+ *
+ * \b Note: There is no \p create callback routine for temporary
+ * property list objects; the initial value is assumed to
+ * have any necessary setup already performed on it.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t set,
+ H5P_prp_get_func_t get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy,
+ H5P_prp_compare_func_t compare, H5P_prp_close_func_t close);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Determines whether a property list is a member of a class
+ *
+ * \plist_id
+ * \plistcls_id{pclass_id}
+ *
+ * \return \htri_t
+ *
+ * \details H5Pisa_class() checks to determine whether the property list
+ * \p plist_id is a member of the property list class
+ * \p pclass_id.
+ *
+ * \see H5Pcreate()
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id);
-H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data);
-H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Iterates over properties in a property class or list
+ *
+ * \param[in] id Identifier of property object to iterate over
+ * \param[in,out] idx Index of the property to begin with
+ * \param[in] iter_func Function pointer to function to be called
+ * with each property iterated over
+ * \param[in,out] iter_data Pointer to iteration data from user
+ *
+ * \return On success: the return value of the last call to \p iter_func if
+ * it was non-zero; zero if all properties have been processed.
+ * On Failure, a negative value
+ *
+ * \details H5Piterate() iterates over the properties in the property
+ * object specified in \p id, which may be either a property
+ * list or a property class, performing a specified operation
+ * on each property in turn.
+ *
+ * For each property in the object, \p iter_func and the
+ * additional information specified below are passed to the
+ * #H5P_iterate_t operator function.
+ *
+ * The iteration begins with the \p idx-th property in the
+ * object; the next element to be processed by the operator
+ * is returned in \p idx. If \p idx is NULL, the iterator
+ * starts at the first property; since no stopping point is
+ * returned in this case, the iterator cannot be restarted if
+ * one of the calls to its operator returns non-zero.
+ *
+ * The prototype for the #H5P_iterate_t operator is as follows:
+ * \snippet this H5P_iterate_t_snip
+ *
+ * The operation receives the property list or class
+ * identifier for the object being iterated over, \p id, the
+ * name of the current property within the object, \p name,
+ * and the pointer to the operator data passed in to H5Piterate(),
+ * \p iter_data. The valid return values from an operator are
+ * as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>Zero</td>
+ * <td>Causes the iterator to continue, returning zero when all
+ * properties have been processed</td>
+ * </tr>
+ * <tr>
+ * <td>Positive</td>
+ * <td>Causes the iterator to immediately return that positive
+ * value, indicating short-circuit success. The iterator
+ * can be restarted at the index of the next property</td>
+ * </tr>
+ * <tr>
+ * <td>Negative</td>
+ * <td>Causes the iterator to immediately return that value,
+ * indicating failure. The iterator can be restarted at the
+ * index of the next property</td>
+ * </tr>
+ * </table>
+ * H5Piterate() assumes that the properties in the object
+ * identified by \p id remain unchanged through the iteration.
+ * If the membership changes during the iteration, the function's
+ * behavior is undefined.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a permanent property with a property list class
+ *
+ * \plistcls_id{cls_id}
+ * \param[in] name Name of property to register
+ * \param[in] size Size of property in bytes
+ * \param[in] def_value Default value for property in newly created
+ * property lists
+ * \param[in] create Callback routine called when a property list is
+ * being created and the property value will be
+ * initialized
+ * \param[in] set Callback routine called before a new value is
+ * copied into the property's value
+ * \param[in] get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_del Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] copy Callback routine called when a property is copied
+ * from a property list
+ * \param[in] compare Callback routine called when a property is compared
+ * with another property list
+ * \param[in] close Callback routine called when a property list is
+ * being closed and the property value will be
+ * disposed of
+ *
+ * \return \herr_t
+ *
+ * \details H5Pregister2() registers a new property with a property list
+ * class. The \p cls_id identifier can be obtained by calling
+ * H5Pcreate_class(). The property will exist in all property
+ * list objects of \p cl_id created after this routine finishes. The
+ * name of the property must not already exist, or this routine
+ * will fail. The default property value must be provided and all
+ * new property lists created with this property will have the
+ * property value set to the default value. Any of the callback
+ * routines may be set to NULL if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data in
+ * the property list. These may be used as flags to indicate the
+ * presence or absence of a particular piece of information. The
+ * default pointer for a zero-sized property may be set to NULL.
+ * The property \p create and \p close callbacks are called for
+ * zero-sized properties, but the \p set and \p get callbacks are
+ * never called.
+ *
+ * The \p create routine is called when a new property list with
+ * this property is being created. The #H5P_prp_create_func_t
+ * callback function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The parameters to this callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being modified</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN/OUT: The default value for the property being created,
+ * which will be passed to H5Pregister2()</td>
+ * </tr>
+ * </table>
+ *
+ * The \p create routine may modify the value to be set and those
+ * changes will be stored as the initial value of the property.
+ * If the \p create routine returns a negative value, the new
+ * property value is not copied into the property and the
+ * \p create routine returns an error value.
+ *
+ * The \p set routine is called before a new value is copied into
+ * the property. The #H5P_prp_set_func_t callback function is defined
+ * as follows:
+ *
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to this callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being modified</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being modified</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void *value}</td>
+ * <td>IN/OUT: Pointer to new value pointer for the property
+ * being modified</td>
+ * </tr>
+ * </table>
+ *
+ * The \p set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p set routine returns a negative value, the new property
+ * value is not copied into the property and the \p set routine
+ * returns an error value. The \p set routine will not be called
+ * for the initial value; only the \p create routine will be called.
+ *
+ * \b Note: The \p set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p get
+ * callback would then reverse the transformation or translation.
+ * A single \p get or \p set callback could handle multiple
+ * properties by performing different actions based on the property
+ * name or other properties in the property list.
+ *
+ * The \p get routine is called when a value is retrieved from a
+ * property value. The #H5P_prp_get_func_t callback function is
+ * defined as follows:
+ *
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list being
+ * queried</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being queried</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN/OUT: The value of the property being returned</td>
+ * </tr>
+ * </table>
+ *
+ * The \p get routine may modify the value to be returned from the
+ * query and those changes will be returned to the calling routine.
+ * If the \p set routine returns a negative value, the query
+ * routine returns an error value.
+ *
+ * The \p prp_del routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\ref hid_t \c prop_id</td>
+ * <td>IN: The identifier of the property list the property is
+ * being deleted from</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property in the list</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: The value for the property being deleted</td>
+ * </tr>
+ * </table>
+ *
+ * The \p prp_del routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_del routine
+ * returns. If the \p prp_del routine returns a negative value,
+ * the property list delete routine returns an error value but
+ * the property is still deleted.
+ *
+ * The \p copy routine is called when a new property list with
+ * this property is being created through a \p copy operation.
+ * The #H5P_prp_copy_func_t callback function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property being copied</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN/OUT: The value for the property being copied</td>
+ * </tr>
+ * </table>
+ *
+ * The \p copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If
+ * the \p copy routine returns a negative value, the new
+ * property value is not copied into the property and the \p copy
+ * routine returns an error value.
+ *
+ * The \p compare routine is called when a property list with this
+ * property is compared to another property list with the same
+ * property. The #H5P_prp_compare_func_t callback function is
+ * defined as follows:
+ *
+ * \snippet this H5P_prp_compare_func_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const void * value1}</td>
+ * <td>IN: The value of the first property to compare</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{const void * value2}</td>
+ * <td>IN: The value of the second property to compare</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * </table>
+ *
+ * The \p compare routine may not modify the values. The \p compare
+ * routine should return a positive value if \p value1 is greater
+ * than \p value2, a negative value if \p value2 is greater than
+ * \p value1 and zero if \p value1 and \p value2 are equal.
+ *
+ * The \p close routine is called when a property list with this
+ * property is being closed. The #H5P_prp_close_func_t callback
+ * function is defined as follows:
+ *
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The parameters to the callback function are defined as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>\Code{const char * name}</td>
+ * <td>IN: The name of the property in the list</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{size_t size}</td>
+ * <td>IN: The size of the property in bytes</td>
+ * </tr>
+ * <tr>
+ * <td>\Code{void * value}</td>
+ * <td>IN: The value for the property being closed</td>
+ * </tr>
+ * </table>
+ *
+ * The \p close routine may modify the value passed in, but the
+ * value is not used by the library when the \p close routine returns.
+ * If the \p close routine returns a negative value, the property
+ * list close routine returns an error value but the property list is
+ * still closed.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value,
+ H5P_prp_create_func_t create, H5P_prp_set_func_t set, H5P_prp_get_func_t get,
+ H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy,
+ H5P_prp_compare_func_t compare, H5P_prp_close_func_t close);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Removes a property from a property list
+ *
+ * \plist_id
+ * \param[in] name Name of property to remove
+ *
+ * \return \herr_t
+ *
+ * \details H5Premove() removes a property from a property list. Both
+ * properties which were in existence when the property list was
+ * created (i.e. properties registered with H5Pregister()) and
+ * properties added to the list after it was created (i.e. added
+ * with H5Pinsert1() may be removed from a property list.
+ * Properties do not need to be removed from a property list
+ * before the list itself is closed; they will be released
+ * automatically when H5Pclose() is called.
+ *
+ * If a \p close callback exists for the removed property, it
+ * will be called before the property is released.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Premove(hid_t plist_id, const char *name);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Sets a property list value
+ *
+ * \plist_id
+ * \param[in] name Name of property to modify
+ * \param[in] value Pointer to value to set the property to
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset() sets a new value for a property in a property list.
+ * If there is a \p set callback routine registered for this
+ * property, the \p value will be passed to that routine and any
+ * changes to the \p value will be used when setting the property
+ * value. The information pointed to by the \p value pointer
+ * (possibly modified by the \p set callback) is copied into the
+ * property list value and may be changed by the application
+ * making the H5Pset() call without affecting the property value.
+ *
+ * The property name must exist or this routine will fail.
+ *
+ * If the \p set callback routine returns an error, the property
+ * value will not be modified.
+ *
+ * This routine may not be called for zero-sized properties and
+ * will return an error in that case.
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Removes a property from a property list class
+ *
+ * \plistcls_id{pclass_id}
+ * \param[in] name Name of property to remove
+ *
+ * \return \herr_t
+ *
+ * \details H5Punregister() removes a property from a property list class.
+ * Future property lists created of that class will not contain
+ * this property; existing property lists containing this property
+ * are not affected.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name);
-H5_DLL herr_t H5Pclose_class(hid_t plist_id);
-H5_DLL herr_t H5Pclose(hid_t plist_id);
-H5_DLL hid_t H5Pcopy(hid_t plist_id);
/* Object creation property list (OCPL) routines */
-H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
-H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense);
-H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags);
+
+/**
+ * \ingroup DCPL
+ *
+ * \brief Verifies that all required filters are available
+ *
+ * \plist_id
+ *
+ * \return \htri_t
+ *
+ * \details H5Pall_filters_avail() verifies that all of the filters set in
+ * the dataset or group creation property list \p plist_id are
+ * currently available.
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \since 1.6.0
+ *
+ */
+H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Retrieves tracking and indexing settings for attribute creation
+ * order
+ *
+ * \plist_id
+ * \param[out] crt_order_flags Flags specifying whether to track and
+ * index attribute creation order
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_attr_creation_order() retrieves the settings for
+ * tracking and indexing attribute creation order on an object.
+ *
+ * \p plist_id is an object creation property list (\p ocpl),
+ * as it can be a dataset or group creation property list
+ * identifier. The term \p ocpl is used when different types
+ * of objects may be involved.
+ *
+ * \p crt_order_flags returns flags with the following meanings:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_TRACKED</td>
+ * <td>Attribute creation order is tracked but not necessarily
+ * indexed.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_INDEXED </td>
+ * <td>Attribute creation order is indexed (requires
+ * #H5P_CRT_ORDER_TRACKED).</td>
+ * </tr>
+ * </table>
+ *
+ * If \p crt_order_flags is returned with a value of 0 (zero),
+ * attribute creation order is neither tracked nor indexed.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags);
-H5_DLL herr_t H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Retrieves attribute storage phase change thresholds
+ *
+ * \plist_id
+ * \param[out] max_compact Maximum number of attributes to be stored in
+ * compact storage (Default: 8)
+ * \param[out] min_dense Minimum number of attributes to be stored in
+ * dense storage (Default: 6)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_attr_phase_change() retrieves threshold values for
+ * attribute storage on an object. These thresholds determine the
+ * point at which attribute storage changes from compact storage
+ * (i.e., storage in the object header) to dense storage (i.e.,
+ * storage in a heap and indexed with a B-tree).
+ *
+ * In the general case, attributes are initially kept in compact
+ * storage. When the number of attributes exceeds \p max_compact,
+ * attribute storage switches to dense storage. If the number of
+ * attributes subsequently falls below \p min_dense, the
+ * attributes are returned to compact storage.
+ *
+ * If \p max_compact is set to 0 (zero), dense storage always used.
+ *
+ * \p plist_id is an object creation property list (\p ocpl), as it
+ * can be a dataset or group creation property list identifier.
+ * The term \p ocpl is used when different types of objects may be
+ * involved.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Returns information about a filter in a pipeline
+ *
+ * \todo Signature for H5Pget_filter2 is different in H5Pocpl.c than in
+ * H5Ppublic.h
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] idx Sequence number within the filter pipeline of the filter
+ * for which information is sought
+ * \param[out] flags Bit vector specifying certain general properties of the
+ * filter
+ * \param[in,out] cd_nelmts Number of elements in \p cd_values
+ * \param[out] cd_values Auxiliary data for the filter
+ * \param[in] namelen Anticipated number of characters in \p name
+ * \param[out] name Name of the filter
+ * \param[out] filter_config Bit field, as described in H5Zget_filter_info()
+ *
+ * \return Returns a negative value on failure, and the filter identifier
+ * if successful (see #H5Z_filter_t):
+ * - #H5Z_FILTER_DEFLATE Data compression filter,
+ * employing the gzip algorithm
+ * - #H5Z_FILTER_SHUFFLE Data shuffling filter
+ * - #H5Z_FILTER_FLETCHER32 Error detection filter, employing the
+ * Fletcher32 checksum algorithm
+ * - #H5Z_FILTER_SZIP Data compression filter, employing the
+ * SZIP algorithm
+ * - #H5Z_FILTER_NBIT Data compression filter, employing the
+ * N-bit algorithm
+ * - #H5Z_FILTER_SCALEOFFSET Data compression filter, employing the
+ * scale-offset algorithm
+ *
+ * \details H5Pget_filter2() returns information about a filter specified by
+ * its filter number, in a filter pipeline specified by the property
+ * list with which it is associated.
+ *
+ * \p plist_id must be a dataset or group creation property list.
+ *
+ * \p idx is a value between zero and N-1, as described in
+ * H5Pget_nfilters(). The function will return a negative value if
+ * the filter number is out of range.
+ *
+ * The structure of the \p flags argument is discussed in
+ * H5Pset_filter().
+ *
+ * On input, \p cd_nelmts indicates the number of entries in the
+ * \p cd_values array, as allocated by the caller; on return,
+ * \p cd_nelmts contains the number of values defined by the filter.
+ *
+ * If \p name is a pointer to an array of at least \p namelen bytes,
+ * the filter name will be copied into that array. The name will be
+ * null terminated if \p namelen is large enough. The filter name
+ * returned will be the name appearing in the file, the name
+ * registered for the filter, or an empty string.
+ *
+ * \p filter_config is the bit field described in
+ * H5Zget_filter_info().
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \since 1.8.0
+ *
+ */
+H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/,
+ size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
+ char name[], unsigned *filter_config /*out*/);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Returns information about the specified filter
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] filter_id Filter identifier
+ * \param[out] flags Bit vector specifying certain general
+ * properties of the filter
+ * \param[in,out] cd_nelmts Number of elements in \p cd_values
+ * \param[out] cd_values[] Auxiliary data for the filter
+ * \param[in] namelen Length of filter name and number of
+ * elements in \p name
+ * \param[out] name[] Name of filter
+ * \param[out] filter_config Bit field, as described in
+ * H5Zget_filter_info()
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_filter_by_id2() returns information about the filter
+ * specified in \p filter_id, a filter identifier.
+ *
+ * \p plist_id must be a dataset or group creation property list
+ * and \p filter_id must be in the associated filter pipeline.
+ *
+ * The \p filter_id and \p flags parameters are used in the same
+ * manner as described in the discussion of H5Pset_filter().
+ *
+ * Aside from the fact that they are used for output, the
+ * parameters \p cd_nelmts and \p cd_values[] are used in the same
+ * manner as described in the discussion of H5Pset_filter(). On
+ * input, the \p cd_nelmts parameter indicates the number of
+ * entries in the \p cd_values[] array allocated by the calling
+ * program; on exit it contains the number of values defined by
+ * the filter.
+ *
+ * On input, the \p namelen parameter indicates the number of
+ * characters allocated for the filter name by the calling program
+ * in the array \p name[]. On exit \p name[] contains the name of the
+ * filter with one character of the name in each element of the
+ * array.
+ *
+ * \p filter_config is the bit field described in
+ * H5Zget_filter_info().
+ *
+ * If the filter specified in \p filter_id is not set for the
+ * property list, an error will be returned and
+ * H5Pget_filter_by_id2() will fail.
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsigned int *flags /*out*/,
+ size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
+ char name[] /*out*/, unsigned *filter_config /*out*/);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Returns the number of filters in the pipeline
+ *
+ * \ocpl_id{plist_id}
+ *
+ * \return Returns the number of filters in the pipeline if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Pget_nfilters() returns the number of filters defined in the
+ * filter pipeline associated with the property list \p plist_id.
+ *
+ * In each pipeline, the filters are numbered from 0 through \Code{N-1},
+ * where \c N is the value returned by this function. During output to
+ * the file, the filters are applied in increasing order; during
+ * input from the file, they are applied in decreasing order.
+ *
+ * H5Pget_nfilters() returns the number of filters in the pipeline,
+ * including zero (0) if there are none.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Pget_nfilters(hid_t plist_id);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Determines whether times associated with an object
+ * are being recorded
+ *
+ * \plist_id
+ * \param[out] track_times Boolean value, 1 (TRUE) or 0 (FALSE),
+ * specifying whether object times are being recorded
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_obj_track_times() queries the object creation property
+ * list, \p plist_id, to determine whether object times are being
+ * recorded.
+ *
+ * If \p track_times is returned as 1, times are being recorded;
+ * if \p track_times is returned as 0, times are not being
+ * recorded.
+ *
+ * Time data can be retrieved with H5Oget_info(), which will return
+ * it in the #H5O_info_t struct.
+ *
+ * If times are not tracked, they will be reported as follows
+ * when queried: 12:00 AM UDT, Jan. 1, 1970
+ *
+ * See H5Pset_obj_track_times() for further discussion.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Modifies a filter in the filter pipeline
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] filter Filter to be modified
+ * \param[in] flags Bit vector specifying certain general properties
+ * of the filter
+ * \param[in] cd_nelmts Number of elements in \p cd_values
+ * \param[in] cd_values[] Auxiliary data for the filter
+ *
+ * \return \herr_t
+ *
+ * \details H5Pmodify_filter() modifies the specified \p filter in the
+ * filter pipeline. \p plist_id must be a dataset or group
+ * creation property list.
+ *
+ * The \p filter, \p flags \p cd_nelmts[], and \p cd_values
+ * parameters are used in the same manner and accept the same
+ * values as described in the discussion of H5Pset_filter().
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \since 1.6.0
+ *
+ */
H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts,
const unsigned int cd_values[/*cd_nelmts*/]);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Delete one or more filters in the filter pipeline
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] filter Filter to be deleted
+ *
+ * \return \herr_t
+ *
+ * \details H5Premove_filter() removes the specified \p filter from the
+ * filter pipeline in the dataset or group creation property
+ * list \p plist_id.
+ *
+ * The \p filter parameter specifies the filter to be removed.
+ * Valid values for use in \p filter are as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5Z_FILTER_ALL</td>
+ * <td>Removes all filters from the filter pipeline</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_DEFLATE</td>
+ * <td>Data compression filter, employing the gzip
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SHUFFLE</td>
+ * <td>Data shuffling filter</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_FLETCHER32</td>
+ * <td>Error detection filter, employing the Fletcher32
+ * checksum algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SZIP</td>
+ * <td>Data compression filter, employing the SZIP
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_NBIT</td>
+ * <td>Data compression filter, employing the N-Bit
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SCALEOFFSET</td>
+ * <td>Data compression filter, employing the scale-offset
+ * algorithm</td>
+ * </tr>
+ * </table>
+ *
+ * Additionally, user-defined filters can be removed with this
+ * routine by passing the filter identifier with which they were
+ * registered with the HDF5 library.
+ *
+ * Attempting to remove a filter that is not in the filter
+ * pipeline is an error.
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \since 1.6.3
+ *
+ */
+H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Sets tracking and indexing of attribute creation order
+ *
+ * \plist_id
+ * \param[in] crt_order_flags Flags specifying whether to track and index
+ * attribute creation order. \em Default: No
+ * flag set; attribute creation order is neither
+ * tracked not indexed
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_attr_creation_order() sets flags for tracking and
+ * indexing attribute creation order on an object.
+ *
+ * \p plist_id is a dataset or group creation property list
+ * identifier.
+ *
+ * \p crt_order_flags contains flags with the following meanings:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_TRACKED</td>
+ * <td>Attribute creation order is tracked but not necessarily
+ * indexed.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_INDEXED </td>
+ * <td>Attribute creation order is indexed (requires
+ * #H5P_CRT_ORDER_TRACKED).</td>
+ * </tr>
+ * </table>
+ *
+ * Default behavior is that attribute creation order is neither
+ * tracked nor indexed.
+ *
+ * H5Pset_attr_creation_order() can be used to set attribute
+ * creation order tracking, or to set attribute creation order
+ * tracking and indexing.
+ *
+ * \note If a creation order index is to be built, it must be specified in
+ * the object creation property list. HDF5 currently provides no
+ * mechanism to turn on attribute creation order tracking at object
+ * creation time and to build the index later.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Sets attribute storage phase change thresholds
+ *
+ * \plist_id
+ * \param[in] max_compact Maximum number of attributes to be stored in
+ * compact storage (\em Default: 8); must be greater
+ * than or equal to \p min_dense
+ *
+ * \param[in] min_dense Minimum number of attributes to be stored in
+ * dense storage (\em Default: 6)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_attr_phase_change() sets threshold values for attribute
+ * storage on an object. These thresholds determine the point at
+ * which attribute storage changes from compact storage (i.e.,
+ * storage in the object header) to dense storage (i.e., storage
+ * in a heap and indexed with a B-tree).
+ *
+ * In the general case, attributes are initially kept in compact
+ * storage. When the number of attributes exceeds \p max_compact,
+ * attribute storage switches to dense storage. If the number of
+ * attributes subsequently falls below \p min_dense, the attributes
+ * are returned to compact storage.
+ *
+ * If \p max_compact is set to 0 (zero), dense storage is always
+ * used. \p min_dense must be set to 0 (zero) when \p max_compact
+ * is 0 (zero).
+ *
+ * \p plist_id is a dataset or group creation property list
+ * identifier.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Sets deflate (GNU gzip) compression method and compression level
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] level Compression level
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_deflate() sets the deflate compression method and the
+ * compression level, \p level, for a dataset or group creation
+ * property list, \p plist_id.
+ *
+ * The filter identifier set in the property list is
+ * #H5Z_FILTER_DEFLATE.
+ *
+ * The compression level, \p level, is a value from zero to nine,
+ * inclusive. A compression level of 0 (zero) indicates no
+ * compression; compression improves but speed slows progressively
+ * from levels 1 through 9:
+ *
+ * <table>
+ * <tr>
+ * <th>Compression Level</th>
+ * <th>Gzip Action</th>
+ * </tr>
+ * <tr>
+ * <td>0</td>
+ * <td>No compression</td>
+ * </tr>
+ * <tr>
+ * <td>1</td>
+ * <td>Best compression speed; least compression</td>
+ * </tr>
+ * <tr>
+ * <td>2 through 8</td>
+ * <td>Compression improves; speed degrades</td>
+ * </tr>
+ * <tr>
+ * <td>9</td>
+ * <td>Best compression ratio; slowest speed</td>
+ * </tr>
+ * </table>
+ *
+ * Note that setting the compression level to 0 (zero) does not turn
+ * off use of the gzip filter; it simply sets the filter to perform
+ * no compression as it processes the data.
+ *
+ * HDF5 relies on GNU gzip for this compression.
+ *
+ * \version 1.8.5 Function extended to work with group creation property lists.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Adds a filter to the filter pipeline
+ *
+ * \ocpl_id{plist_id}
+ * \param[in] filter Filter identifier for the filter to be added to the
+ * pipeline
+ * \param[in] flags Bit vector specifying certain general properties of
+ * the filter
+ * \param[in] cd_nelmts Number of elements in \p c_values
+ * \param[in] c_values Auxiliary data for the filter
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_filter() adds the specified \p filter identifier and
+ * corresponding properties to the end of an output filter
+ * pipeline.
+ *
+ * \p plist_id must be either a dataset creation property list or
+ * group creation property list identifier. If \p plist_id is a
+ * dataset creation property list identifier, the filter is added
+ * to the raw data filter pipeline.
+ *
+ * If \p plist_id is a group creation property list identifier,
+ * the filter is added to the link filter pipeline, which filters
+ * the fractal heap used to store most of the link metadata in
+ * certain types of groups. The only predefined filters that can
+ * be set in a group creation property list are the gzip filter
+ * (#H5Z_FILTER_DEFLATE) and the Fletcher32 error detection filter
+ * (#H5Z_FILTER_FLETCHER32).
+ *
+ * The array \p c_values contains \p cd_nelmts integers which are
+ * auxiliary data for the filter. The integer values will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The \p flags argument is a bit vector with the following
+ * fields specifying certain general properties of the filter:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5Z_FLAG_OPTIONAL</td>
+ * <td>If this bit is set then the filter is optional. If the
+ * filter fails (see below) during an H5Dwrite() operation
+ * then the filter is just excluded from the pipeline for
+ * the chunk for which it failed; the filter will not
+ * participate in the pipeline during an H5Dread() of the
+ * chunk. This is commonly used for compression filters:
+ * if the filter result would be larger than the input,
+ * then the compression filter returns failure and the
+ * uncompressed data is stored in the file.<br /><br />
+ * This flag should not be set for the Fletcher32 checksum
+ * filter as it will bypass the checksum filter without
+ * reporting checksum errors to an application.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FLAG_MANDATORY</td>
+ * <td>If the filter is required, that is, set to mandatory,
+ * and the filter fails, the library’s behavior depends
+ * on whether the chunk cache is in use:
+ * \li If the chunk cache is enabled, data chunks will
+ * be flushed to the file during H5Dclose() and the
+ * library will return the failure in H5Dclose().
+ * \li When the chunk cache is disabled or not big enough,
+ * or the chunk is being evicted from the cache, the
+ * failure will happen during H5Dwrite().
+ *
+ * In each case, the library will still write to the file
+ * all data chunks that were processed by the filter
+ * before the failure occurred.<br /><br />
+ * For example, assume that an application creates a
+ * dataset of four chunks, the chunk cache is enabled and
+ * is big enough to hold all four chunks, and the filter
+ * fails when it tries to write the fourth chunk. The
+ * actual flush of the chunks will happen during
+ * H5Dclose(), not H5Dwrite(). By the time H5Dclose()
+ * fails, the first three chunks will have been written
+ * to the file. Even though H5Dclose() fails, all the
+ * resources will be released and the file can be closed
+ * properly. <br /><br />
+ * If, however, the filter fails on the second chunk, only
+ * the first chunk will be written to the file as nothing
+ * further can be written once the filter fails.</td>
+ * </tr>
+ * </table>
+ * The \p filter parameter specifies the filter to be set. Valid
+ * pre-defined filter identifiers are as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5Z_FILTER_DEFLATE</td>
+ * <td>Data compression filter, employing the gzip
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SHUFFLE</td>
+ * <td>Data shuffling filter</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_FLETCHER32</td>
+ * <td>Error detection filter, employing the Fletcher32
+ * checksum algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SZIP</td>
+ * <td>Data compression filter, employing the SZIP
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_NBIT</td>
+ * <td>Data compression filter, employing the N-Bit
+ * algorithm</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_FILTER_SCALEOFFSET</td>
+ * <td>Data compression filter, employing the scale-offset
+ * algorithm</td>
+ * </tr>
+ * </table>
+ * Also see H5Pset_edc_check() and H5Pset_filter_callback().
+ *
+ * \note When a non-empty filter pipeline is used with a group creation
+ * property list, the group will be created with the new group file
+ * format. The filters will come into play only when dense storage
+ * is used (see H5Pset_link_phase_change()) and will be applied to
+ * the group’s fractal heap. The fractal heap will contain most of
+ * the the group’s link metadata, including link names.
+ *
+ * \note When working with group creation property lists, if you are
+ * adding a filter that is not in HDF5’s set of predefined filters,
+ * i.e., a user-defined or third-party filter, you must first
+ * determine that the filter will work for a group. See the
+ * discussion of the set local and can apply callback functions
+ * in H5Zregister().
+ *
+ * \note If multiple filters are set for a property list, they will be
+ * applied to each chunk of raw data for datasets or each block
+ * of the fractal heap for groups in the order in which they were
+ * set.
+ *
+ * \note Filters can be applied only to chunked datasets; they cannot be
+ * used with other dataset storage methods, such as contiguous,
+ * compact, or external datasets.
+ *
+ * \note Dataset elements of variable-length and dataset region
+ * reference datatypes are stored in separate structures in the
+ * file called heaps. Filters cannot currently be applied to
+ * these heaps.
+ *
+ * \note <b>Filter Behavior in HDF5:</b><br />
+ * Filters can be inserted into the HDF5 pipeline to perform
+ * functions such as compression and conversion. As such, they are
+ * a very flexible aspect of HDF5; for example, a user-defined
+ * filter could provide encryption for an HDF5 dataset.
+ *
+ * \note A filter can be declared as either required or optional.
+ * Required is the default status; optional status must be
+ * explicitly declared.
+ *
+ * \note A required filter that fails or is not defined causes an
+ * entire output operation to fail; if it was applied when the
+ * data was written, such a filter will cause an input operation
+ * to fail.
+ *
+ * \note The following table summarizes required filter behavior.
+ * <table>
+ * <tr>
+ * <th></th>
+ * <th>Required FILTER_X not available</th>
+ * <th>FILTER_X available</th>
+ * </tr>
+ * <tr>
+ * <td>H5Pset_<FILTER_X></td>
+ * <td>Will fail.</td>
+ * <td>Will succeed.</td>
+ * </tr>
+ * <tr>
+ * <td>H5Dwrite with FILTER_X set</td>
+ * <td>Will fail.</td>
+ * <td>Will succeed; FILTER_X will be applied to
+ * the data.</td>
+ * </tr>
+ * <tr>
+ * <td>H5Dread with FILTER_X set</td>
+ * <td>Will fail.</td>
+ * <td>Will succeed.</td>
+ * </tr>
+ * </table>
+ * \note An optional filter can be set for an HDF5 dataset even when
+ * the filter is not available. Such a filter can then be
+ * applied to the dataset when it becomes available on the
+ * original system or when the file containing the dataset is
+ * processed on a system on which it is available.
+ *
+ * \note A filter can be declared as optional through the use of the
+ * #H5Z_FLAG_OPTIONAL flag with H5Pset_filter().
+ *
+ * \note Consider a situation where one is creating files that will
+ * normally be used only on systems where the optional (and
+ * fictional) filter FILTER_Z is routinely available. One can
+ * create those files on system A, which lacks FILTER_Z, create
+ * chunked datasets in the files with FILTER_Z defined in the
+ * dataset creation property list, and even write data to those
+ * datasets. The dataset object header will indicate that FILTER_Z
+ * has been associated with this dataset. But since system A does
+ * not have FILTER_Z, dataset chunks will be written without it
+ * being applied.
+ *
+ * \note HDF5 has a mechanism for determining whether chunks are
+ * actually written with the filters specified in the object
+ * header, so while the filter remains unavailable, system A will
+ * be able to read the data. Once the file is moved to system B,
+ * where FILTER_Z is available, HDF5 will apply FILTER_Z to any
+ * data rewritten or new data written in these datasets. Dataset
+ * chunks that have been written on system B will then be
+ * unreadable on system A; chunks that have not been re-written
+ * since being written on system A will remain readable on system
+ * A. All chunks will be readable on system B.
+ *
+ * \note The following table summarizes optional filter behavior.
+ * <table>
+ * <tr>
+ * <th></th>
+ * <th>FILTER_Z not available</th>
+ * <th>FILTER_Z available<br /> with encode and decode</th>
+ * <th>FILTER_Z available decode only</th>
+ * </tr>
+ * <tr>
+ * <td>H5Pset_<FILTER_Z></td>
+ * <td>Will succeed.</td>
+ * <td>Will succeed.</td>
+ * <td>Will succeed.</td>
+ * </tr>
+ * <tr>
+ * <td>H5Dread with FILTER_Z set</td>
+ * <td>Will succeed if FILTER_Z has not actually<br />
+ * been applied to data.</td>
+ * <td>Will succeed.</td>
+ * <td>Will succeed.</td>
+ * </tr>
+ * <tr>
+ * <td>H5Dwrite with FILTER_Z set</td>
+ * <td>Will succeed;<br />
+ * FILTER_Z will not be applied to the data.</td>
+ * <td>Will succeed;<br />
+ * FILTER_Z will be applied to the data.</td>
+ * <td>Will succeed;<br />
+ * FILTER_Z will not be applied to the data.</td>
+ * </tr>
+ * </table>
+ * \note The above principles apply generally in the use of HDF5
+ * optional filters insofar as HDF5 does as much as possible to
+ * complete an operation when an optional filter is unavailable.
+ * (The SZIP filter is an exception to this rule; see H5Pset_szip()
+ * for details.)
+ *
+ * \see \ref_filter_pipe, \ref_group_impls
+ *
+ * \version 1.8.5 Function applied to group creation property lists.
+ * \since 1.6.0
+ *
+ */
H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts,
const unsigned int c_values[]);
-H5_DLL int H5Pget_nfilters(hid_t plist_id);
-H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned filter, unsigned int *flags /*out*/,
- size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
- char name[], unsigned *filter_config /*out*/);
-H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
- size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
- char name[] /*out*/, unsigned *filter_config /*out*/);
-H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
-H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
-H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
-H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Sets up use of the Fletcher32 checksum filter
+ *
+ * \ocpl_id{plist_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_fletcher32() sets the Fletcher32 checksum filter in the
+ * dataset or group creation property list \p plist_id.
+ *
+ * \attention The Fletcher32 EDC checksum filter was added in HDF5 Release
+ * 1.6.0. In the original implementation, however, the checksum
+ * value was calculated incorrectly on little-endian systems.
+ * The error was fixed in HDF5 Release 1.6.3.
+ *
+ * \attention As a result of this fix, an HDF5 library of Release 1.6.0
+ * through Release 1.6.2 cannot read a dataset created or written
+ * with Release 1.6.3 or later if the dataset was created with
+ * the checksum filter and the filter is enabled in the reading
+ * library. (Libraries of Release 1.6.3 and later understand the
+ * earlier error and compensate appropriately.)
+ *
+ * \attention \b Work-around: An HDF5 library of Release 1.6.2 or earlier
+ * will be able to read a dataset created or written with the
+ * checksum filter by an HDF5 library of Release 1.6.3 or later
+ * if the checksum filter is disabled for the read operation.
+ * This can be accomplished via a call to H5Pset_edc_check()
+ * with the value #H5Z_DISABLE_EDC in the second parameter.
+ * This has the obvious drawback that the application will be
+ * unable to verify the checksum, but the data does remain
+ * accessible.
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \version 1.6.3 Error in checksum calculation on little-endian systems
+ * corrected in this release.
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id);
+/**
+ * \ingroup OCPL
+ *
+ * \brief Sets the recording of times associated with an object
+ *
+ * \param[in] plist_id Object creation property list identifier
+ * \param[in] track_times Boolean value, 1 or 0, specifying whether object
+ * times are to be tracked
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_obj_track_times() sets a property in the object creation
+ * property list, \p plist_id, that governs the recording of times
+ * associated with an object.
+ *
+ * If \p track_times is set to 1, time data will be recorded. If
+ * \p track_times is set to 0, time data will not be recorded.
+ *
+ * Time data can be retrieved with H5Oget_info(), which will
+ * return it in the #H5O_info_t struct.
+ *
+ * If times are not tracked, they will be reported as follows when queried:
+ * \Code{ 12:00 AM UDT, Jan. 1, 1970}
+ *
+ * That date and time are commonly used to represent the beginning of the UNIX epoch.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times);
/* File creation property list (FCPL) routines */
-H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size);
-H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size);
-H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size);
-H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/);
-H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk);
-H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/);
-H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the file space page size for a file creation property
+ * list
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] fsp_size File space page size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_file_space_page_size() retrieves the file space page
+ * size for paged aggregation in the parameter \p fsp_size.
+ *
+ * The library default is 4KB (4096) if \p fsp_size is not
+ * previously set via a call to H5Pset_file_space_page_size().
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the file space handling strategy, persisting free-space
+ * condition and threshold value for a file creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] strategy The file space handling strategy
+ * \param[out] persist The boolean value indicating whether free space is
+ * persistent or not
+ * \param[out] threshold The free-space section size threshold value
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_file_space_strategy() retrieves the file space handling
+ * strategy, the persisting free-space condition and the threshold
+ * value in the parameters \p strategy, \p persist and
+ * \p threshold respectively.
+ *
+ * The library default values returned when
+ * H5Pset_file_space_strategy() has not been called are:
+ *
+ * \li \p strategy - #H5F_FSPACE_STRATEGY_FSM_AGGR
+ * \li \p persist - 0
+ * \li \p threshold - 1
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist,
+ hsize_t *threshold);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Queries the 1/2 rank of an indexed storage B-tree
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] ik Pointer to location to return the chunked storage B-tree
+ * 1/2 rank (<em>Default value of B-tree 1/2 rank: 32</em>)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_istore_k() queries the 1/2 rank of an indexed storage
+ * B-tree.
+ *
+ * The argument \p ik may be the null pointer (NULL).
+ * This function is valid only for file creation property lists.
+ *
+ * \see H5Pset_istore_k()
+ *
+ * \version 1.6.4 \p ik parameter type changed to \em unsigned.
+ * \since 1.0.0
+ *
+ */
H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/);
-H5_DLL herr_t H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes);
-H5_DLL herr_t H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes);
-H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags,
- unsigned min_mesg_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the configuration settings for a shared message index
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] index_num Index being configured
+ * \param[out] mesg_type_flags Types of messages that may be stored in
+ * this index
+ * \param[out] min_mesg_size Minimum message size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_shared_mesg_index() retrieves the message type and
+ * minimum message size settings from the file creation property
+ * list \p plist_id for the shared object header message index
+ * specified by \p index_num.
+ *
+ * \p index_num specifies the index. \p index_num is zero-indexed,
+ * so in a file with three indexes, they will be numbered 0, 1,
+ * and 2.
+ *
+ * \p mesg_type_flags and \p min_mesg_size will contain,
+ * respectively, the types of messages and the minimum size, in
+ * bytes, of messages that can be stored in this index.
+ *
+ * Valid message types are described in H5Pset_shared_mesg_index().
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags,
unsigned *min_mesg_size);
-H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the number of shared object header message indexes in file
+ * creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] nindexes Number of shared object header message indexes
+ * available in files created with this property list
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_shared_mesg_nindexes() retrieves the number of shared
+ * object header message indexes in the specified file creation
+ * property list \p plist_id.
+ *
+ * If the value of \p nindexes is 0 (zero), shared object header
+ * messages are disabled in files created with this property list.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves shared object header message phase change information
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] max_list Threshold above which storage of a shared object
+ * header message index shifts from list to B-tree
+ * \param[out] min_btree Threshold below which storage of a shared object
+ * header message index reverts to list format
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_shared_mesg_phase_change() retrieves the threshold values
+ * for storage of shared object header message indexes in a file.
+ * These phase change thresholds determine the point at which the
+ * index storage mechanism changes from a more compact list format
+ * to a more performance-oriented B-tree format, and vice-versa.
+ *
+ * By default, a shared object header message index is initially
+ * stored as a compact list. When the number of messages in an
+ * index exceeds the specified \p max_list threshold, storage
+ * switches to a B-tree format for improved performance. If the
+ * number of messages subsequently falls below the \p min_btree
+ * threshold, the index will revert to the list format.
+ *
+ * If \p max_list is set to 0 (zero), shared object header message
+ * indexes in the file will always be stored as B-trees.
+ *
+ * \p plist_id specifies the file creation property list.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the size of the offsets and lengths used in an HDF5
+ * file
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] sizeof_addr Pointer to location to return offset size in
+ * bytes
+ * \param[out] sizeof_size Pointer to location to return length size in
+ * bytes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_sizes() retrieves the size of the offsets and lengths
+ * used in an HDF5 file. This function is only valid for file
+ * creation property lists.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the size of the symbol table B-tree 1/2 rank and the
+ * symbol table leaf node 1/2 size
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] ik Pointer to location to return the symbol table's B-tree
+ * 1/2 rank (<em>Default value of B-tree 1/2 rank: 16</em>)
+ * \param[out] lk Pointer to location to return the symbol table's leaf
+ * node 1/2 size (<em>Default value of leaf node 1/2
+ * size: 4</em>)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_sym_k() retrieves the size of the symbol table B-tree
+ * 1/2 rank and the symbol table leaf node 1/2 size.
+ *
+ * This function is valid only for file creation property lists.
+ *
+ * If a parameter value is set to NULL, that parameter is not
+ * retrieved.
+ *
+ * \see H5Pset_sym_k()
+ *
+ * \version 1.6.4 \p ik parameter type changed to \em unsigned
+ * \version 1.6.0 The \p ik parameter has changed from type int to
+ * \em unsigned
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the size of a user block
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] size Pointer to location to return user-block size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_userblock() retrieves the size of a user block in a
+ * file creation property list.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the file space page size for a file creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] fsp_size File space page size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_space_page_size() sets the file space page size
+ * \p fsp_size used in paged aggregation and paged buffering.
+ *
+ * \p fsp_size has a minimum size of 512. Setting a value less
+ * than 512 will return an error. The library default size for
+ * the file space page size when not set is 4096.
+ *
+ * The size set via this routine may not be changed for the life
+ * of the file.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the file space handling strategy and persisting free-space
+ * values for a file creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] strategy The file space handling strategy to be used. See:
+ * #H5F_fspace_strategy_t
+ * \param[in] persist A boolean value to indicate whether free space
+ * should be persistent or not
+ * \param[in] threshold The smallest free-space section size that the free
+ * space manager will track
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_space_strategy() sets the file space handling
+ * \p strategy, specifies persisting free-space or not (\p persist),
+ * and sets the free-space section size \p threshold in the file
+ * creation property list \p plist_id.
+ *
+ * #H5F_fspace_strategy_t is a struct defined in H5Fpublic.h as
+ * follows:
+ *
+ * \snippet H5Fpublic.h H5F_fspace_strategy_t_snip
+ *
+ * This setting cannot be changed for the life of the file.
+ *
+ * As the #H5F_FSPACE_STRATEGY_AGGR and #H5F_FSPACE_STRATEGY_NONE
+ * strategies do not use the free-space managers, the \p persist
+ * and \p threshold settings will be ignored for those strategies.
+ *
+ * \since 1.10.1
+ *
+ */
H5_DLL herr_t H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool_t persist,
hsize_t threshold);
-H5_DLL herr_t H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist,
- hsize_t *threshold);
-H5_DLL herr_t H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size);
-H5_DLL herr_t H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the size of the parameter used to control the B-trees for
+ * indexing chunked datasets
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] ik 1/2 rank of chunked storage B-tree
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_istore_k() sets the size of the parameter used to
+ * control the B-trees for indexing chunked datasets. This
+ * function is valid only for file creation property lists.
+ *
+ * \p ik is one half the rank of a tree that stores chunked
+ * raw data. On average, such a tree will be 75% full, or have
+ * an average rank of 1.5 times the value of \p ik.
+ *
+ * The HDF5 library uses (\p ik*2) as the maximum # of entries
+ * before splitting a B-tree node. Since only 2 bytes are used
+ * in storing # of entries for a B-tree node in an HDF5 file,
+ * (\p ik*2) cannot exceed 65536. The default value for
+ * \p ik is 32.
+ *
+ * \version 1.6.4 \p ik parameter type changed to \p unsigned.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Configures the specified shared object header message index
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] index_num Index being configured
+ * \param[in] mesg_type_flags Types of messages that should be stored in
+ * this index
+ * \param[in] min_mesg_size Minimum message size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_shared_mesg_index() is used to configure the specified
+ * shared object header message index, setting the types of
+ * messages that may be stored in the index and the minimum size
+ * of each message.
+ *
+ * \p plist_id specifies the file creation property list.
+ *
+ * \p index_num specifies the index to be configured.
+ * \p index_num is zero-indexed, so in a file with three indexes,
+ * they will be numbered 0, 1, and 2.
+ *
+ * \p mesg_type_flags and \p min_mesg_size specify, respectively,
+ * the types and minimum size of messages that can be stored in
+ * this index.
+ *
+ * Valid message types are as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5O_SHMESG_NONE_FLAG</td>
+ * <td>No shared messages</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_SDSPACE_FLAG</td>
+ * <td>Simple dataspace message</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_DTYPE_FLAG</td>
+ * <td>Datatype message</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_FILL_FLAG</td>
+ * <td>Fill value message</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_PLINE_FLAG</td>
+ * <td>Filter pipeline message</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_ATTR_FLAG</td>
+ * <td>Attribute message</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_SHMESG_ALL_FLAG</td>
+ * <td>All message types; i.e., equivalent to the following:
+ * (#H5O_SHMESG_SDSPACE_FLAG | #H5O_SHMESG_DTYPE_FLAG |
+ * #H5O_SHMESG_FILL_FLAG | #H5O_SHMESG_PLINE_FLAG |
+ * #H5O_SHMESG_ATTR_FLAG)</td>
+ * </tr>
+ * </table>
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags,
+ unsigned min_mesg_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets number of shared object header message indexes
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] nindexes Number of shared object header message indexes to be
+ * available in files created with this property list
+ * (\p nindexes must be <= #H5O_SHMESG_MAX_NINDEXES (8))
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_shared_mesg_nindexes() sets the number of shared object
+ * header message indexes in the specified file creation property
+ * list.
+ *
+ * This setting determines the number of shared object header
+ * message indexes, \p nindexes, that will be available in files
+ * created with this property list. These indexes can then be
+ * configured with H5Pset_shared_mesg_index().
+ *
+ * If \p nindexes is set to 0 (zero), shared object header messages
+ * are disabled in files created with this property list.
+ *
+ * There is a limit of #H5O_SHMESG_MAX_NINDEXES (8) that can be set
+ * with H5Pset_shared_mesg_nindexes(). An error will occur if
+ * specifying a value of \p nindexes that is greater than this value.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets shared object header message storage phase change thresholds
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] max_list Threshold above which storage of a shared object
+ * header message index shifts from list to B-tree
+ * \param[in] min_btree Threshold below which storage of a shared object
+ * header message index reverts to list format
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_shared_mesg_phase_change() sets threshold values for
+ * storage of shared object header message indexes in a file.
+ * These phase change thresholds determine the point at which the
+ * index storage mechanism changes from a more compact list format
+ * to a more performance-oriented B-tree format, and vice-versa.
+ *
+ * By default, a shared object header message index is initially
+ * stored as a compact list. When the number of messages in an
+ * index exceeds the threshold value of \p max_list, storage
+ * switches to a B-tree for improved performance. If the number
+ * of messages subsequently falls below the \p min_btree threshold,
+ * the index will revert to the list format.
+ *
+ * If \p max_list is set to 0 (zero), shared object header message
+ * indexes in the file will be created as B-trees and will never
+ * revert to lists.
+ *
+ * \p plist_id specifies the file creation property list.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the byte size of the offsets and lengths used to address
+ * objects in an HDF5 file
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] sizeof_addr Size of an object offset in bytes
+ * \param[in] sizeof_size Size of an object length in bytes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_sizes() sets the byte size of the offsets and lengths
+ * used to address objects in an HDF5 file. This function is only
+ * valid for file creation property lists. Passing in a value
+ * of 0 for one of the parameters retains the current value. The
+ * default value for both values is the same as sizeof(hsize_t)
+ * in the library (normally 8 bytes). Valid values currently
+ * are 2, 4, 8 and 16.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size);
+/**
+ * \ingroup FCPL
+ *
+ * \brief
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] ik Symbol table tree rank
+ * \param[in] lk Symbol table node size
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_sym_k() sets the size of parameters used to control the
+ * symbol table nodes.
+ *
+ * This function is valid only for file creation property lists.
+ * Passing in a value of zero (0) for one of the parameters retains
+ * the current value.
+ *
+ * \p ik is one half the rank of a B-tree that stores a symbol
+ * table for a group. Internal nodes of the symbol table are on
+ * average 75% full. That is, the average rank of the tree is
+ * 1.5 times the value of \p ik. The HDF5 library uses (\p ik*2) as
+ * the maximum # of entries before splitting a B-tree node. Since
+ * only 2 bytes are used in storing # of entries for a B-tree node
+ * in an HDF5 file, (\p ik*2) cannot exceed 65536. The default value
+ * for \p ik is 16.
+ *
+ * \p lk is one half of the number of symbols that can be stored in
+ * a symbol table node. A symbol table node is the leaf of a symbol
+ * table tree which is used to store a group. When symbols are
+ * inserted randomly into a group, the group's symbol table nodes are
+ * 75% full on average. That is, they contain 1.5 times the number of
+ * symbols specified by \p lk. The default value for \p lk is 4.
+ *
+ * \version 1.6.4 \p ik parameter type changed to \em unsigned.
+ * \version 1.6.0 The \p ik parameter has changed from type int to
+ * \em unsigned.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets user block size
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] size Size of the user-block in bytes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_userblock() sets the user block size of a file creation
+ * property list. The default user block size is 0; it may be set
+ * to any power of 2 equal to 512 or greater (512, 1024, 2048, etc.).
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size);
/* File access property list (FAPL) routines */
-H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment);
-H5_DLL herr_t H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment /*out*/);
-H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info);
-H5_DLL hid_t H5Pget_driver(hid_t plist_id);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the current settings for alignment properties from a
+ * file access property list
+ *
+ * \fapl_id
+ * \param[out] threshold Pointer to location of return threshold value
+ * \param[out] alignment Pointer to location of return alignment value
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_alignment() retrieves the current settings for
+ * alignment properties from a file access property list. The
+ * \p threshold and/or \p alignment pointers may be null
+ * pointers (NULL).
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Queries the raw data chunk cache parameters
+ *
+ * \fapl_id{plist_id}
+ * \param[in,out] mdc_nelmts <i>No longer used</i>
+ * \param[in,out] rdcc_nslots Number of elements (objects) in the raw data
+ * chunk cache
+ * \param[in,out] rdcc_nbytes Total size of the raw data chunk cache, in
+ * bytes
+ * \param[in,out] rdcc_w0 Preemption policy
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_cache() retrieves the maximum possible number of
+ * elements in the raw data chunk cache, the maximum possible
+ * number of bytes in the raw data chunk cache, and the
+ * preemption policy value.
+ *
+ * Any (or all) arguments may be null pointers, in which case
+ * the corresponding datum is not returned.
+ *
+ * Note that the \p mdc_nelmts parameter is no longer used.
+ *
+ * \version 1.8.0 Use of the \p mdc_nelmts parameter discontinued.
+ * Metadata cache configuration is managed with
+ * H5Pset_mdc_config() and H5Pget_mdc_config()
+ * \version 1.6.0 The \p rdcc_nbytes and \p rdcc_nslots parameters changed
+ * from type int to size_t.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* out */
+ size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, double *rdcc_w0);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Gets information about the write tracking feature used by
+ * the core VFD
+ *
+ * \fapl_id
+ * \param[out] is_enabled Whether the feature is enabled
+ * \param[out] page_size Size, in bytes, of write aggregation pages
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_core_write_tracking() retrieves information about the
+ * write tracking feature used by the core VFD.
+ *
+ * When a file is created or opened for writing using the core
+ * virtual file driver (VFD) with the backing store option turned
+ * on, the VFD can be configured to track changes to the file
+ * and only write out the modified bytes. To avoid a large number
+ * of small writes, the changes can be aggregated into pages of
+ * a user-specified size. The core VFD is also known as the
+ * memory VFD. The driver identifier is #H5FD_CORE.
+ *
+ * \note This function is only for use with the core VFD and must be used
+ * after the call to H5Pset_fapl_core(). It is an error to use this
+ * function with any other VFD.
+ *
+ * \note This function only applies to the backing store write operation
+ * which typically occurs when the file is flushed or closed. This
+ * function has no relationship to the increment parameter passed
+ * to H5Pset_fapl_core().
+ *
+ * \note For optimum performance, the \p page_size parameter should be
+ * a power of two.
+ *
+ * \since 1.8.13
+ *
+ */
+H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns low-lever driver identifier
+ *
+ * \plist_id
+ *
+ * \return \hid_t{low level driver}
+ *
+ * \details H5Pget_driver() returns the identifier of the low-level file
+ * driver associated with the file access property list or
+ * data transfer property list \p plist_id.
+ *
+ * Valid driver identifiers distributed with HDF5 are listed and
+ * described in the following table.
+ *
+ * <table>
+ * <tr>
+ * <th>Driver Name</th>
+ * <th>Driver Identifier</th>
+ * <th>Description</th>
+ * <th>Related Function</th>
+ * </tr>
+ * <tr>
+ * <td>POSIX</td>
+ * <td>#H5FD_SEC2</td>
+ * <td>This driver uses POSIX file-system functions like read and
+ * write to perform I/O to a single, permanent file on local disk
+ * with no system buffering. This driver is POSIX-compliant and
+ * is the default file driver for all systems.</td>
+ * <td>H5Pset_fapl_sec2()</td>
+ * </tr>
+ * <tr>
+ * <td>Direct</td>
+ * <td>#H5FD_DIRECT</td>
+ * <td>This is the #H5FD_SEC2 driver except data is written to or
+ * read from the file synchronously without being cached by the
+ * system.</td>
+ * <td>H5Pset_fapl_direct()</td>
+ * </tr>
+ * <tr>
+ * <td>Log</td>
+ * <td>#H5FD_LOG</td>
+ * <td>This is the #H5FD_SEC2 driver with logging capabilities.</td>
+ * <td>H5Pset_fapl_log()</td>
+ * </tr>
+ * <tr>
+ * <td>Windows</td>
+ * <td>#H5FD_WINDOWS</td>
+ * <td>This driver was modified in HDF5-1.8.8 to be a wrapper of the
+ * POSIX driver, #H5FD_SEC2. This change should not affect user
+ * applications.</td>
+ * <td>H5Pset_fapl_windows()</td>
+ * </tr>
+ * <tr>
+ * <td>STDIO</td>
+ * <td>#H5FD_STDIO</td>
+ * <td>This driver uses functions from the standard C stdio.h to
+ * perform I/O to a single, permanent file on local disk with
+ * additional system buffering.</td>
+ * <td>H5Pset_fapl_stdio()</td>
+ * </tr>
+ * <tr>
+ * <td>Memory</td>
+ * <td>#H5FD_CORE</td>
+ * <td>With this driver, an application can work with a file in
+ * memory for faster reads and writes. File contents are kept in
+ * memory until the file is closed. At closing, the memory
+ * version of the file can be written back to disk or abandoned.
+ * </td>
+ * <td>H5Pset_fapl_core()</td>
+ * </tr>
+ * <tr>
+ * <td>Family</td>
+ * <td>#H5FD_FAMILY</td>
+ * <td>With this driver, the HDF5 file’s address space is partitioned
+ * into pieces and sent to separate storage files using an
+ * underlying driver of the user’s choice. This driver is for
+ * systems that do not support files larger than 2 gigabytes.
+ * </td>
+ * <td>H5Pset_fapl_family()</td>
+ * </tr>
+ * <tr>
+ * <td>Multi</td>
+ * <td>#H5FD_MULTI</td>
+ * <td>With this driver, data can be stored in multiple files
+ * according to the type of the data. I/O might work better if
+ * data is stored in separate files based on the type of data.
+ * The Split driver is a special case of this driver.</td>
+ * <td>H5Pset_fapl_multi()</td>
+ * </tr>
+ * <tr>
+ * <td>Parallel</td>
+ * <td>#H5FD_MPIO</td>
+ * <td>This is the standard HDF5 file driver for parallel file
+ * systems. This driver uses the MPI standard for both
+ * communication and file I/O.</td>
+ * <td>H5Pset_fapl_mpio()</td>
+ * </tr>
+ * <tr>
+ * <td>Parallel POSIX</td>
+ * <td>H5FD_MPIPOSIX</td>
+ * <td>This driver is no longer available.</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>Stream</td>
+ * <td>H5FD_STREAM</td>
+ * <td>This driver is no longer available.</td>
+ * <td></td>
+ * </tr>
+ * </table>
+ *
+ * This list does not include custom drivers that might be
+ * defined and registered by a user.
+ *
+ * The returned driver identifier is only valid as long as the
+ * file driver remains registered.
+ *
+ *
+ * \since 1.4.0
+ *
+ */
+H5_DLL hid_t H5Pget_driver(hid_t plist_id);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns a pointer to file driver information
+ *
+ * \param[in] plist_id File access or data transfer property list
+ * identifier
+ *
+ * \return Returns a pointer to a struct containing low-level driver
+ * information. Otherwise returns NULL. NULL is also returned if
+ * no driver-specific properties have been registered. No error
+ * is pushed on the stack in this case.
+ *
+ * \details H5Pget_driver_info() returns a pointer to file driver-specific
+ * information for the low-level driver associated with the file
+ * access or data transfer property list \p plist_id.
+ *
+ * The pointer returned by this function points to an “uncopied”
+ * struct. Driver-specific versions of that struct are defined
+ * for each low-level driver in the relevant source code file
+ * H5FD*.c. For example, the struct used for the MULTI driver is
+ * \c H5FD_multi_fapl_t defined in H5FDmulti.c.
+ *
+ * If no driver-specific properties have been registered,
+ * H5Pget_driver_info() returns NULL.
+ *
+ * \note H5Pget_driver_info() and H5Pset_driver() are used only when
+ * creating a virtual file driver (VFD) in the virtual file
+ * layer (VFL).
+ *
+ * \version 1.10.1 Return value was changed from \em void * to
+ * \em const \em void *.
+ * \version 1.8.2 Function publicized in this release; previous releases
+ * described this function only in the virtual file driver
+ * documentation.
+ *
+ */
H5_DLL const void *H5Pget_driver_info(hid_t plist_id);
-H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
-H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
-H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
-H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
-H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset);
-H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type);
-H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type);
-H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes,
- double rdcc_w0);
-H5_DLL herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* out */
- size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, double *rdcc_w0);
-H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */
-H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
-H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/);
-H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree);
-H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree);
-H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size);
-H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size /*out*/);
-H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size);
-H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/);
-H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size);
-H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/);
-H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high);
-H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high);
-H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size);
-H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size);
-H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len);
-H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr);
-H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
-H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
-H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
-H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
-H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts);
-H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts);
-H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata);
-H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata);
-H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
- hbool_t start_on_access);
-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);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the size of the external link open file cache
+ *
+ * \fapl_id{plist_id}
+ * \param[out] efc_size External link open file cache size in number of files
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_elink_file_cache_size() retrieves the number of files that
+ * can be held open in an external link open file cache.
+ *
+ * \since 1.8.7
+ *
+ */
+H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the file access property list setting that determines
+ * whether an HDF5 object will be evicted from the library's metadata
+ * cache when it is closed
+ *
+ * \fapl_id
+ * \param[out] evict_on_close Pointer to a variable that will indicate if
+ * the object will be evicted on close
+ *
+ * \return \herr_t
+ *
+ * \details The library's metadata cache is fairly conservative about holding on
+ * to HDF5 object metadata (object headers, chunk index structures,
+ * etc.), which can cause the cache size to grow, resulting in memory
+ * pressure on an application or system. When enabled, the "evict on
+ * close" property will cause all metadata for an object to be
+ * immediately evicted from the cache as long as it is not referenced
+ * by any other open object.
+ *
+ * See H5Pset_evict_on_close() for additional notes on behavior.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves a data offset from the file access property list
+ *
+ * \fapl_id
+ * \param[out] offset Offset in bytes within the HDF5 file
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_family_offset() retrieves the value of offset from the
+ * file access property list \p fapl_id so that the user
+ * application can retrieve a file handle for low-level access to
+ * a particular member of a family of files. The file handle is
+ * retrieved with a separate call to H5Fget_vfd_handle() (or,
+ * in special circumstances, to H5FDget_vfd_handle(), see \ref VFL).
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns the file close degree
+ *
+ * \fapl_id
+ * \param[out] degree Pointer to a location to which to return the file
+ * close degree property, the value of \p degree
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_fclose_degree() returns the current setting of the file
+ * close degree property \p degree in the file access property
+ * list \p fapl_id. The value of \p degree determines how
+ * aggressively H5Fclose() deals with objects within a file that
+ * remain open when H5Fclose() is called to close that file.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves a copy of the file image designated as the initial content
+ * and structure of a file
+ *
+ * \fapl_id
+ * \param[in,out] buf_ptr_ptr On input, \c NULL or a pointer to a
+ * pointer to a buffer that contains the
+ * file image.\n On successful return, if \p buf_ptr_ptr is not
+ * \c NULL, \Code{*buf_ptr_ptr} will contain a pointer to a copy
+ * of the initial image provided in the last call to
+ * H5Pset_file_image() for the supplied \p fapl_id. If no initial
+ * image has been set, \Code{*buf_ptr_ptr} will be \c NULL.
+ * \param[in,out] buf_len_ptr On input, \c NULL or a pointer to a buffer
+ * specifying the required size of the buffer to hold the file
+ * image.\n On successful return, if \p buf_len_ptr was not
+ * passed in as \c NULL, \p buf_len_ptr will return the required
+ * size in bytes of the buffer to hold the initial file image in
+ * the supplied file access property list, \p fapl_id. If no
+ * initial image is set, the value of \Code{*buf_len_ptr} will be
+ * set to 0 (zero)
+ * \return \herr_t
+ *
+ * \details H5Pget_file_image() allows an application to retrieve a copy of the
+ * file image designated for a VFD to use as the initial contents of a file.
+ *
+ * If file image callbacks are defined, H5Pget_file_image() will use
+ * them when allocating and loading the buffer to return to the
+ * application (see H5Pset_file_image_callbacks()). If file image
+ * callbacks are not defined, the function will use \c malloc and \c
+ * memcpy. When \c malloc and \c memcpy are used, it is the caller’s
+ * responsibility to discard the returned buffer with a call to \c
+ * free.
+ *
+ * It is the responsibility of the calling application to free the
+ * buffer whose address is returned in \p buf_ptr_ptr. This can be
+ * accomplished with \c free if file image callbacks have not been set
+ * (see H5Pset_file_image_callbacks()) or with the appropriate method
+ * if file image callbacks have been set.
+ *
+ * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(),
+ * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(),
+ * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t,
+ * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations">
+ * HDF5 File Image Operations</a>.
+ *
+ *
+ * \since 1.8.9
+ *
+ */
+H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves callback routines for working with file images
+ *
+ * \fapl_id
+ * \param[in,out] callbacks_ptr Pointer to the instance of the
+ * #H5FD_file_image_callbacks_t struct in which the callback
+ * routines are to be returned\n
+ * Struct fields must be initialized to NULL before the call
+ * is made.\n
+ * Struct field contents upon return will match those passed in
+ * in the last H5Pset_file_image_callbacks() call for the file
+ * access property list \p fapl_id.
+ * \return \herr_t
+ *
+ * \details H5Pget_file_image_callbacks() retrieves the callback routines set for
+ * working with file images opened with the file access property list
+ * \p fapl_id.
+ *
+ * The callbacks must have been previously set with
+ * H5Pset_file_image_callbacks() in the file access property list.
+ *
+ * Upon the successful return of H5Pset_file_image_callbacks(), the
+ * fields in the instance of the #H5FD_file_image_callbacks_t struct
+ * pointed to by \p callbacks_ptr will contain the same values as were
+ * passed in the most recent H5Pset_file_image_callbacks() call for the
+ * file access property list \p fapl_id.
+ *
+ * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(),
+ * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(),
+ * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t,
+ * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations">
+ * HDF5 File Image Operations</a>.
+ *
+ * \since 1.8.9
+ *
+ */
+H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the file locking property values
+ *
+ * \fapl_id
+ * \param[out] use_file_locking File locking flag
+ * \param[out] ignore_when_disabled Ignore when disabled flag
+ * \return \herr_t
+ *
+ * \details H5Pget_file_locking() retrieves the file locking property values for
+ * the file access property list specified by \p fapl_id.
+ *
+ * \since 1.10.7
+ *
+ */
+H5_DLL herr_t H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns garbage collecting references setting
+ *
+ * \fapl_id
+ * \param[out] gc_ref Flag returning the state of reference garbage
+ * collection. A returned value of 1 indicates that
+ * garbage collection is on while 0 indicates that
+ * garbage collection is off.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_gc_references() returns the current setting for the
+ * garbage collection references property from the specified
+ * file access property list. The garbage collection references
+ * property is set by H5Pset_gc_references().
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves library version bounds settings that indirectly control
+ * the format versions used when creating objects
+ *
+ * \fapl_id{plist_id}
+ * \param[out] low The earliest version of the library that will be used
+ * for writing objects
+ * \param[out] high The latest version of the library that will be used for
+ * writing objects
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_libver_bounds() retrieves the lower and upper bounds on
+ * the HDF5 library release versions that indirectly determine the
+ * object format versions used when creating objects in the file.
+ *
+ * This property is retrieved from the file access property list
+ * specified by the parameter \p fapl_id.
+ *
+ * The value returned in the parameters \p low and \p high is one
+ * of the enumerated values in the #H5F_libver_t struct, which is
+ * defined in H5Fpublic.h.
+ *
+ * \version 1.10.2 Add #H5F_LIBVER_V18 to the enumerated defines in
+ * #H5F_libver_t
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Get the current initial metadata cache configuration from the
+ * provided file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in,out] config_ptr Pointer to the instance of #H5AC_cache_config_t
+ * in which the current metadata cache configuration is to be
+ * reported
+ * \return \herr_t
+ *
+ * \note The \c in direction applies only to the \ref H5AC_cache_config_t.version
+ * field. All other fields are \c out parameters.
+ *
+ * \details The fields of the #H5AC_cache_config_t structure are shown
+ * below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * H5Pget_mdc_config() gets the initial metadata cache configuration
+ * contained in a file access property list and loads it into the
+ * instance of #H5AC_cache_config_t pointed to by the \p config_ptr
+ * parameter. This configuration is used when the file is opened.
+ *
+ * Note that the version field of \Code{*config_ptr} must be
+ * initialized; this allows the library to support earlier versions of
+ * the #H5AC_cache_config_t structure.
+ *
+ * See the overview of the metadata cache in the special topics section
+ * of the user guide for details on the configuration data returned. If
+ * you haven't read and understood that documentation, the results of
+ * this call will not make much sense.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the metadata cache image configuration values for a file
+ * access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] config_ptr Pointer to metadata cache image configuration values
+ * \return \herr_t
+ *
+ * \details H5Pget_mdc_image_config() retrieves the metadata cache image values
+ * into \p config_ptr for the file access property list specified in \p
+ * plist_id.
+ *
+ * #H5AC_cache_image_config_t is defined as follows:
+ * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip
+ * \click4more
+ *
+ * \since 1.10.1
+ */
+H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Gets metadata cache logging options
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_enabled Flag whether logging is enabled
+ * \param[out] location Location of log in UTF-8/ASCII (file path/name) (On
+ * Windows, this must be ASCII)
+ * \param[out] location_size Size in bytes of the location string
+ * \param[out] start_on_access Whether the logging begins as soon as the file is
+ * opened or created
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all file metadata reads and writes take place. File metadata
+ * is normally invisible to the user and is used by the library for
+ * purposes such as locating and indexing data. File metadata should
+ * not be confused with user metadata, which consists of attributes
+ * created by users and attached to HDF5 objects such as datasets via
+ * \ref H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has been
+ * created that can be used by HDF5 developers for debugging and
+ * performance analysis. The functions that control this functionality
+ * will normally be of use to a very limited number of developers
+ * outside of The HDF Group. The functions have been documented to help
+ * users create logs that can be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is
+ * enabled via the H5Pset_mdc_log_options() function, which will modify
+ * the file access property list used to open or create a file. This
+ * function has a flag that determines whether logging begins at file
+ * open or starts in a paused state. Log messages can then be
+ * controlled via the H5Fstart_mdc_logging() / H5Fstop_mdc_logging()
+ * functions. H5Pget_mdc_log_options() can be used to examine a file
+ * access property list, and H5Fget_mdc_logging_status() will return
+ * the current state of the logging flags.
+ *
+ * The log format is described in the
+ * <a href="https://bit.ly/2PG6fNv">Metadata Cache Logging</a> document.
+ *
+ * \since 1.10.0
+ */
+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);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns the current metadata block size setting
+ *
+ * \fapl_id{fapl_id}
+ * \param[out] size Minimum size, in bytes, of metadata block allocations
+ *
+ * \return \herr_t
+ *
+ * \details Returns the current minimum size, in bytes, of new
+ * metadata block allocations. This setting is retrieved from the
+ * file access property list \p fapl_id.
+ *
+ * This value is set by H5Pset_meta_block_size() and is
+ * retrieved from the file access property list \p fapl_id.
+ *
+ * \since 1.4.0
+ */
+H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the number of read attempts from a file access
+ * property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] attempts The number of read attempts
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_metadata_read_attempts() retrieves the number of read
+ * attempts that is set in the file access property list \p plist_id.
+ *
+ * For a default file access property list, the value retrieved
+ * will depend on whether the user sets the number of attempts via
+ * H5Pset_metadata_read_attempts():
+ *
+ * <ul>
+ *
+ * <li>If the number of attempts is set to N, the value
+ * returned will be N.
+ * <li>If the number of attempts is not set, the value returned
+ * will be the default for non-SWMR access (1). SWMR is short
+ * for single-writer/multiple-reader.
+ * </ul>
+ *
+ * For the file access property list of a specified HDF5 file,
+ * the value retrieved will depend on how the file is opened
+ * and whether the user sets the number of read attempts via
+ * H5Pset_metadata_read_attempts():
+ *
+ * <ul>
+ * <li>For a file opened with SWMR access:
+ *
+ * <ul>
+ * <li> If the number of attempts is set to N, the value
+ * returned will be N.
+ * <li> If the number of attempts is not set, the value
+ * returned will be the default for SWMR access (100).
+ * </ul>
+ * <li>For a file opened without SWMR access, the value
+ * retrieved will always be the default for non-SWMR access
+ * (1). The value set via H5Pset_metadata_read_attempts() does
+ * not have any effect on non-SWMR access.
+ * </ul>
+ *
+ * \par Failure Modes
+ * \parblock
+ *
+ * When the input property list is not a file access property list.
+ *
+ * When the library is unable to retrieve the number of read attempts from
+ * the file access property list.
+ *
+ * \endparblock
+ *
+ * \par Examples
+ * \parblock
+ *
+ * The first example illustrates the two cases for retrieving the number
+ * of read attempts from a default file access property list.
+ *
+ * \include H5Pget_metadata_read_attempts.1.c
+ *
+ * The second example illustrates the two cases for retrieving the
+ * number of read attempts from the file access property list of a file
+ * opened with SWMR acccess.
+ *
+ * \include H5Pget_metadata_read_attempts.2.c
+ *
+ * The third example illustrates the two cases for retrieving the number
+ * of read attempts from the file access property list of a file opened
+ * with non-SWMR acccess.
+ *
+ * \include H5Pget_metadata_read_attempts.3.c
+ *
+ * \endparblock
+ *
+ * \since 1.10.0
+ */
+H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves type of data property for MULTI driver
+ *
+ * \param[in] fapl_id File access property list or data transfer property
+ * list identifier
+ * \param[out] type Type of data
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_multi_type() retrieves the type of data setting from
+ * the file access or data transfer property list \p fapl_id.
+ * This enables a user application to specify the type of data
+ * the application wishes to access so that the application can
+ * retrieve a file handle for low-level access to the particular
+ * member of a set of MULTI files in which that type of data is
+ * stored. The file handle is retrieved with a separate call to
+ * H5Fget_vfd_handle() (or, in special circumstances, to
+ * H5FDget_vfd_handle(); see the Virtual File Layer documentation
+ * for more information.
+ *
+ * The type of data returned in \p type will be one of those
+ * listed in the discussion of the \p type parameter in the the
+ * description of the function H5Pset_multi_type().
+ *
+ * Use of this function is only appropriate for an HDF5 file
+ * written as a set of files with the MULTI file driver.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the object flush property values from the file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in] func The user-defined callback function
+ * \param[in] udata The user-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_object_flush_cb() gets the user-defined callback
+ * function that is set in the file access property list
+ * \p fapl_id and stored in the parameter \p func. The callback is
+ * invoked whenever an object flush occurs in the file. This
+ * routine also obtains the user-defined input data that is
+ * passed along to the callback function in the parameter
+ * \p udata.
+ *
+ * \par Example
+ * \parblock
+ * The example below illustrates the usage of this routine to obtain the
+ * object flush property values.
+ *
+ * \include H5Pget_object_flush_cb.c
+ * \endparblock
+ *
+ * \since 1.10.0
+ */
+H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the maximum size for the page buffer and the minimum
+ percentage for metadata and raw data pages
+ *
+ * \fapl_id{plist_id}
+ * \param[out] buf_size Maximum size, in bytes, of the page buffer
+ * \param[out] min_meta_perc Minimum metadata percentage to keep in the
+ * page buffer before allowing pages containing metadata to
+ * be evicted
+ *
+ * \param[out] min_raw_perc Minimum raw data percentage to keep in the
+ * page buffer before allowing pages containing raw data to
+ * be evicted
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_page_buffer_size() retrieves \p buf_size, the maximum
+ * size in bytes of the page buffer, \p min_meta_perc, the
+ * minimum metadata percentage, and \p min_raw_perc, the
+ * minimum raw data percentage.
+ *
+ * \since 1.10.1
+ */
+H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc,
+ unsigned *min_raw_perc);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns maximum data sieve buffer size
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of data sieve buffer
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_sieve_buf_size() retrieves, size, the current maximum
+ * size of the data sieve buffer.
+ *
+ * This value is set by H5Pset_sieve_buf_size() and is retrieved
+ * from the file access property list fapl_id.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type \c hsize_t
+ * to \c size_t
+ * \since 1.4.0
+ */
+H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the current small data block size setting
+ *
+ * \fapl_id{fapl_id}
+ * \param[out] size Maximum size, in bytes, of the small data block
+ *
+ * \result \herr_t
+ *
+ * \details H5Pget_small_data_block_size() retrieves the current setting
+ * for the size of the small data block.
+ *
+ * If the returned value is zero (0), the small data block
+ * mechanism has been disabled for the file.
+ *
+ * \since 1.4.4
+ */
+H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns the identifier of the current VOL connector
+ *
+ * \fapl_id{plist_id}
+ * \param[out] vol_id Current VOL connector identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vol_id() returns the VOL connector identifier \p vol_id for
+ * the file access property list \p plist_id. This identifier should
+ * be closed with H5VLclose().
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns a copy of the VOL information for a connector
+ *
+ * \fapl_id{plist_id}
+ * \param[out] vol_info The VOL information for a connector
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vol_info() returns a copy of the VOL information \p vol_info
+ * for a connector specified by the file access property list
+ * \p plist_id.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets alignment properties of a file access property list
+ *
+ * \fapl_id
+ * \param[in] threshold Threshold value. Note that setting the threshold
+ * value to 0 (zero) has the effect of a special case,
+ * forcing everything to be aligned
+ * \param[in] alignment Alignment value
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_alignment() sets the alignment properties of a
+ * file access property list so that any file object greater
+ * than or equal in size to \p threshold bytes will be aligned
+ * on an address which is a multiple of \p alignment. The
+ * addresses are relative to the end of the user block; the
+ * alignment is calculated by subtracting the user block size
+ * from the absolute file address and then adjusting the address
+ * to be a multiple of \p alignment.
+ *
+ * Default values for \p threshold and \p alignment are one,
+ * implying no alignment. Generally the default values will
+ * result in the best performance for single-process access to
+ * the file. For MPI IO and other parallel systems, choose an
+ * alignment which is a multiple of the disk block size.
+ *
+ * If the file space handling strategy is set to
+ * #H5F_FSPACE_STRATEGY_PAGE, then the alignment set via this
+ * routine is ignored. The file space handling strategy is set
+ * by H5Pset_file_space_strategy().
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the raw data chunk cache parameters
+ *
+ * \fapl_id{plist_id}
+ * \param[in] mdc_nelmts No longer used; any value passed is ignored
+ * \param[in] rdcc_nslots The number of chunk slots in the raw data chunk
+ * cache for this dataset. Increasing this value
+ * reduces the number of cache collisions, but
+ * slightly increases the memory used. Due to the
+ * hashing strategy, this value should ideally be a
+ * prime number. As a rule of thumb, this value
+ * should be at least 10 times the number of chunks
+ * that can fit in \p rdcc_nbytes bytes. For
+ * maximum performance, this value should be set
+ * approximately 100 times that number of chunks.
+ * The default value is 521.
+ * \param[in] rdcc_nbytes Total size of the raw data chunk cache in bytes.
+ * The default size is 1 MB per dataset.
+ * \param[in] rdcc_w0 The chunk preemption policy for all datasets.
+ * This must be between 0 and 1 inclusive and
+ * indicates the weighting according to which chunks
+ * which have been fully read or written are
+ * penalized when determining which chunks to flush
+ * from cache. A value of 0 means fully read or
+ * written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU)
+ * while a value of 1 means fully read or written
+ * chunks are always preempted before other chunks.
+ * If your application only reads or writes data once,
+ * this can be safely set to 1. Otherwise, this should
+ * be set lower depending on how often you re-read or
+ * re-write the same data. The default value is 0.75.
+ * If the value passed is #H5D_CHUNK_CACHE_W0_DEFAULT,
+ * then the property will not be set on the dataset
+ * access property list, and the parameter will come
+ * from the file access property list.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_cache() sets the number of elements, the total number of
+ * bytes, and the preemption policy value for all datasets in a file
+ * on the file’s file access property list.
+ *
+ * The raw data chunk cache inserts chunks into the cache by first
+ * computing a hash value using the address of a chunk and then by
+ * using that hash value as the chunk’s index into the table of
+ * cached chunks. In other words, the size of this hash table and the
+ * number of possible hash values is determined by the \p rdcc_nslots
+ * parameter. If a different chunk in the cache has the same hash value,
+ * a collision will occur, which will reduce efficiency. If inserting
+ * the chunk into the cache would cause the cache to be too big, then
+ * the cache will be pruned according to the \p rdcc_w0 parameter.
+ *
+ * The \p mdc_nelmts parameter is no longer used; any value passed
+ * in that parameter will be ignored.
+ *
+ * \b Motivation: Setting raw data chunk cache parameters
+ * can be done with H5Pset_cache(), H5Pset_chunk_cache(),
+ * or a combination of both. H5Pset_cache() is used to
+ * adjust the chunk cache parameters for all datasets via
+ * a global setting for the file, and H5Pset_chunk_cache()
+ * is used to adjust the chunk cache parameters for
+ * individual datasets. When both are used, parameters
+ * set with H5Pset_chunk_cache() will override any parameters
+ * set with H5Pset_cache().
+ *
+ * \note Optimum chunk cache parameters may vary widely depending
+ * on different data layout and access patterns. For datasets
+ * with low performance requirements for example, changing
+ * the cache settings can save memory.
+ *
+ * \note Note: Raw dataset chunk caching is not currently
+ * supported when using the MPI I/O and MPI POSIX file drivers
+ * in read/write mode; see H5Pset_fapl_mpio() and
+ * H5Pset_fapl_mpiposix(), respectively. When using one of these
+ * file drivers, all calls to H5Dread() and H5Dwrite() will access
+ * the disk directly, and H5Pset_cache() will have no effect on
+ * performance.
+ *
+ * \note Raw dataset chunk caching is supported when these drivers are
+ * used in read-only mode.
+ *
+ * \todo Check on H5Pset_fapl_mpio() and H5Pset_fapl_mpiposix().
+ *
+ * \version 1.8.0 The use of the \p mdc_nelmts parameter was discontinued.
+ * Metadata cache configuration is managed with
+ * H5Pset_mdc_config() and H5Pget_mdc_config().
+ * \version 1.6.0 The \p rdcc_nbytes and \p rdcc_nelmts parameters
+ * changed from type int to size_t.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes,
+ double rdcc_w0);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets write tracking information for core driver, #H5FD_CORE
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] is_enabled Boolean value specifying whether feature is
+ enabled
+ * \param[in] page_size Positive integer specifying size, in bytes, of
+ * write aggregation pages Value of 1 (one) enables
+ * tracking with no paging.
+ *
+ * \return \herr_t
+ *
+ * \details When a file is created or opened for writing using the core
+ * virtual file driver (VFD) with the backing store option
+ * turned on, the core driver can be configured to track
+ * changes to the file and write out only the modified bytes.
+ *
+ * This write tracking feature is enabled and disabled with \p
+ * is_enabled. The default setting is that write tracking is
+ * disabled, or off.
+ *
+ * To avoid a large number of small writes, changes can
+ * be aggregated into pages of a user-specified size, \p
+ * page_size.
+ *
+ * Setting \p page_size to 1 enables tracking with no page
+ * aggregation.
+ *
+ * The backing store option is set via the function
+ * H5Pset_fapl_core.
+ *
+ * \attention
+ * \parblock
+ * This function is only for use with the core VFD and must
+ * be used after the call to H5Pset_fapl_core(). It is an error
+ * to use this function with any other VFD.
+ *
+ * It is an error to use this function when the backing store
+ * flag has not been set using H5Pset_fapl_core().
+ *
+ * This function only applies to the backing store write
+ * operation which typically occurs when the file is flushed
+ * or closed. This function has no relationship to the
+ * increment parameter passed to H5Pset_fapl_core().
+ *
+ * For optimum performance, the \p page_size parameter should be
+ * a power of two.
+ *
+ * It is an error to set the page size to 0.
+ * \endparblock
+ *
+ * \version 1.8.14 C function modified in this release to return error
+ * if \p page_size is set to 0 (zero).
+ * \since 1.8.13
+ *
+ */
+H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets a file driver
+ *
+ * \plist_id
+ * \param[in] driver_id The new driver identifier
+ * \param[in] driver_info Optional struct containing driver properties
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_driver() sets the file driver, driver_id, for a file
+ * access or data transfer property list, \p plist_id, and
+ * supplies an optional struct containing the driver-specific
+ * properties, \p driver_info.
+ *
+ * The driver properties will be copied into the property list
+ * and the reference count on the driver will be incremented,
+ * allowing the caller to close the driver identifier but still
+ * use the property list.
+ *
+ * \version 1.8.2 Function publicized in this release; previous releases
+ * described this function only in the virtual file driver
+ * documentation.
+ *
+ */
+H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the number of files that can be held open in an external
+ * link open file cache
+ *
+ * \par Motivation
+ * \parblock
+ * The <em>external link open file cache</em> holds files open after
+ * they have been accessed via an external link. This cache reduces
+ * the number of times such files are opened when external links are
+ * accessed repeatedly and can siginificantly improves performance in
+ * certain heavy-use situations and when low-level file opens or closes
+ * are expensive.
+ *
+ * H5Pset_elink_file_cache_size() sets the number of files
+ * that will be held open in an external link open file
+ * cache. H5Pget_elink_file_cache_size() retrieves the size of an existing
+ * cache; and H5Fclear_elink_file_cache() clears an existing cache without
+ * closing it.
+ * \endparblock
+ *
+ * \fapl_id{plist_id}
+ * \param[in] efc_size External link open file cache size in number of files
+ * <em>Default setting is 0 (zero).</em>
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_file_cache_size() specifies the number of files
+ * that will be held open in an external link open file cache.
+ *
+ * The default external link open file cache size is 0 (zero),
+ * meaning that files accessed via an external link are not
+ * held open. Setting the cache size to a positive integer
+ * turns on the cache; setting the size back to zero turns it
+ * off.
+ *
+ * With this property set, files are placed in the external
+ * link open file cache cache when they are opened via an
+ * external link. Files are then held open until either
+ * they are evicted from the cache or the parent file is
+ * closed. This property setting can improve performance when
+ * external links are repeatedly accessed.
+ *
+ * When the cache is full, files will be evicted using a least
+ * recently used (LRU) scheme; the file which has gone the
+ * longest time without being accessed through the parent file
+ * will be evicted and closed if nothing else is holding that
+ * file open.
+ *
+ * Files opened through external links inherit the parent
+ * file’s file access property list by default, and therefore
+ * inherit the parent file’s external link open file cache
+ * setting.
+ *
+ * When child files contain external links of their own, the
+ * caches can form a graph of cached external files. Closing
+ * the last external reference to such a graph will recursively
+ * close all files in the graph, even if cycles are present.
+ * \par Example
+ * \parblock
+ * The following code sets up an external link open file cache that will
+ * hold open up to 8 files reached through external links:
+ *
+ * \code
+ * status = H5Pset_elink_file_cache_size(fapl_id, 8);
+ * \endcode
+ * \endparblock
+ *
+ * \since 1.8.7
+ */
+H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Controls the library's behavior of evicting metadata associated with
+ * a closed object
+ *
+ * \fapl_id
+ * \param[in] evict_on_close Whether the HDF5 object should be evicted on close
+ *
+ * \return \herr_t
+ *
+ * \details The library's metadata cache is fairly conservative about holding
+ * on to HDF5 object metadata(object headers, chunk index structures,
+ * etc.), which can cause the cache size to grow, resulting in memory
+ * pressure on an application or system. When enabled, the "evict on
+ * close" property will cause all metadata for an object to be evicted
+ * from the cache as long as metadata is not referenced by any other
+ * open object.
+ *
+ * This function only applies to file access property lists.
+ *
+ * The default library behavior is to not evict on object or file
+ * close.
+ *
+ * When applied to a file access property list, any subsequently opened
+ * object will inherit the "evict on close" property and will have
+ * its metadata evicted when the object is closed.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets offset property for low-level access to a file in a family of
+ * files
+ *
+ * \fapl_id
+ * \param[in] offset Offset in bytes within the HDF5 file
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_family_offset() sets the offset property in the file access
+ * property list \p fapl_id so that the user application can
+ * retrieve a file handle for low-level access to a particular member
+ * of a family of files. The file handle is retrieved with a separate
+ * call to H5Fget_vfd_handle() (or, in special circumstances, to
+ * H5FDget_vfd_handle(); see \ref VFL).
+ *
+ * The value of \p offset is an offset in bytes from the beginning of
+ * the HDF5 file, identifying a user-determined location within the
+ * HDF5 file.
+ * The file handle the user application is seeking is for the specific
+ * member-file in the associated family of files to which this offset
+ * is mapped.
+ *
+ * Use of this function is only appropriate for an HDF5 file written as
+ * a family of files with the \c FAMILY file driver.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the file close degree
+ *
+ * \fapl_id
+ * \param[in] degree Pointer to a location containing the file close
+ * degree property, the value of \p degree
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_fclose_degree() sets the file close degree property
+ * \p degree in the file access property list \p fapl_id.
+ *
+ * The value of \p degree determines how aggressively
+ * H5Fclose() deals with objects within a file that remain open
+ * when H5Fclose() is called to close that file. \p degree can
+ * have any one of four valid values:
+ *
+ * <table>
+ * <tr>
+ * <th>Degree name</th>
+ * <th>H5Fclose behavior with no open object in file</th>
+ * <th>H5Fclose behavior with open object(s) in file</th>
+ * </tr>
+ * <tr>
+ * <td>#H5F_CLOSE_WEAK</td>
+ * <td>Actual file is closed.</td>
+ * <td>Access to file identifier is terminated; actual file
+ * close is delayed until all objects in file are closed
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5F_CLOSE_SEMI</td>
+ * <td>Actual file is closed.</td>
+ * <td>Function returns FAILURE</td>
+ * </tr>
+ * <tr>
+ * <td>#H5F_CLOSE_STRONG</td>
+ * <td>Actual file is closed.</td>
+ * <td>All open objects remaining in the file are closed then
+ * file is closed</td>
+ * </tr>
+ * <tr>
+ * <td>#H5F_CLOSE_DEFAULT</td>
+ * <td>The VFL driver chooses the behavior. Currently, all VFL
+ * drivers set this value to #H5F_CLOSE_WEAK, except for the
+ * MPI-I/O driver, which sets it to #H5F_CLOSE_SEMI.</td>
+ * <td></td>
+ * </tr>
+ *
+ * </table>
+ * \warning If a file is opened multiple times without being closed, each
+ * open operation must use the same file close degree setting.
+ * For example, if a file is already open with #H5F_CLOSE_WEAK,
+ * an H5Fopen() call with #H5F_CLOSE_STRONG will fail.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets an initial file image in a memory buffer
+ *
+ * \fapl_id
+ * \param[in] buf_ptr Pointer to the initial file image, or
+ * NULL if no initial file image is desired
+ * \param[in] buf_len Size of the supplied buffer, or
+ * 0 (zero) if no initial image is desired
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_image() allows an application to provide a file image
+ * to be used as the initial contents of a file.
+ * Calling H5Pset_file_image()makes a copy of the buffer specified in
+ * \p buf_ptr of size \p buf_len.
+ *
+ * \par Motivation:
+ * H5Pset_file_image() and other elements of HDF5 are
+ * used to load an image of an HDF5 file into system memory and open
+ * that image as a regular HDF5 file. An application can then use the
+ * file without the overhead of disk I/O.
+ *
+ * \par Recommended Reading:
+ * This function is part of the file image
+ * operations feature set. It is highly recommended to study the guide
+ * [<em>HDF5 File Image Operations</em>]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations
+ * ) before using this feature set. See the “See Also” section below
+ * for links to other elements of HDF5 file image operations.
+ *
+ * \see
+ * \li H5LTopen_file_image()
+ * \li H5Fget_file_image()
+ * \li H5Pget_file_image()
+ * \li H5Pset_file_image_callbacks()
+ * \li H5Pget_file_image_callbacks()
+ *
+ * \li [HDF5 File Image Operations]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations)
+ * in [Advanced Topics in HDF5]
+ * (https://portal.hdfgroup.org/display/HDF5/Advanced+Topics+in+HDF5)
+ *
+ * \li Within H5Pset_file_image_callbacks():
+ * \li Callback #H5FD_file_image_callbacks_t
+ * \li Callback #H5FD_file_image_op_t
+ *
+ * \version 1.8.13 Fortran subroutine added in this release.
+ * \since 1.8.9
+ *
+ */
+H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the callbacks for working with file images
+ *
+ * \note **Motivation:** H5Pset_file_image_callbacks() and other elements
+ * of HDF5 are used to load an image of an HDF5 file into system
+ * memory and open that image as a regular HDF5 file. An application
+ * can then use the file without the overhead of disk I/O.\n
+ * **Recommended Reading:** This function is part of the file
+ * image operations feature set. It is highly recommended to study
+ * the guide [HDF5 File Image Operations]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations
+ * ) before using this feature set. See the “See Also” section below
+ * for links to other elements of HDF5 file image operations.
+ *
+ * \fapl_id
+ * \param[in,out] callbacks_ptr Pointer to the instance of the
+ * #H5FD_file_image_callbacks_t structure
+ *
+ * \return \herr_t \n
+ * **Failure Modes**: Due to interactions between this function and
+ * H5Pset_file_image() and H5Pget_file_image(),
+ * H5Pset_file_image_callbacks() will fail if a file image has
+ * already been set in the target file access property list, \p fapl_id.
+ *
+ * \details H5Pset_file_image_callbacks() sets callback functions for working
+ * with file images in memory.
+ *
+ * H5Pset_file_image_callbacks() allows an application to control the
+ * management of file image buffers through user defined callbacks.
+ * These callbacks can be used in the management of file image buffers
+ * in property lists and with certain file drivers.
+ *
+ * H5Pset_file_image_callbacks() must be used before any file image has
+ * been set in the file access property list. Once a file image has
+ * been set, the function will fail.
+ *
+ * The callback routines set up by H5Pset_file_image_callbacks() are
+ * invoked when a new file image buffer is allocated, when an existing
+ * file image buffer is copied or resized, or when a file image buffer
+ * is released from use.
+ *
+ * Some file drivers allow the use of user-defined callback functions
+ * for allocating, freeing, and copying the driver’s internal buffer,
+ * potentially allowing optimizations such as avoiding large \c malloc
+ * and \c memcpy operations, or to perform detailed logging.
+ *
+ * From the perspective of the HDF5 library, the operations of the
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc",
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy",
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks
+ * must be identical to those of the
+ * corresponding C standard library calls (\c malloc, \c memcpy,
+ * \c realloc, and \c free). While the operations must be identical,
+ * the file image callbacks have more parameters. The return values
+ * of \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" are identical to
+ * the return values of \c malloc and \c realloc. The return values of
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" differ from the return
+ * values of \c memcpy and \c free in that the return values of
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" can also indicate failure.
+ *
+ * The callbacks and their parameters, along with a struct and
+ * an \c ENUM required for their use, are described below.
+ *
+ * <b>Callback struct and \c ENUM:</b>
+ *
+ * The callback functions set up by H5Pset_file_image_callbacks() use
+ * a struct and an \c ENUM that are defined as follows
+ *
+ * The struct #H5FD_file_image_callbacks_t serves as a container
+ * for the callback functions and a pointer to user-supplied data.
+ * The struct is defined as follows:
+ * \snippet H5FDpublic.h H5FD_file_image_callbacks_t_snip
+ *
+ * Elements of the #H5FD_file_image_op_t are used by the
+ * callbacks to invoke certain operations on file images. The ENUM is
+ * defined as follows:
+ * \snippet H5FDpublic.h H5FD_file_image_op_t_snip
+ *
+ * The elements of the #H5FD_file_image_op_t are used in the following
+ * callbacks:
+ *
+ * - The \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" callback
+ * contains a pointer to a function that must appear to HDF5 to have
+ * functionality identical to that of the standard C library \c malloc() call.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_malloc_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy"
+ * callback contains a pointer to a function
+ * that must appear to HDF5 to have functionality identical to that
+ * of the standard C library \c memcopy() call, except that it returns
+ * a \p NULL on failure. (The \c memcpy C Library routine is defined
+ * to return the \p dest parameter in all cases.)
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy"
+ * to \c NULL indicates that HDF5 should invoke
+ * the standard C library \c memcpy() routine when copying buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_memcpy_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" callback
+ * contains a pointer to a function that must appear to HDF5 to have
+ * functionality identical to that of the standard C library \c realloc() call.
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc"
+ * to \p NULL indicates that HDF5 should
+ * invoke the standard C library \c realloc() routine when resizing
+ * file image buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_realloc_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_free "image_free" callback contains
+ * a pointer to a function that must appear to HDF5 to have functionality
+ * identical to that of the standard C library \c free() call, except
+ * that it will return \c 0 (\c SUCCEED) on success and \c -1 (\c FAIL) on failure.
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_free "image_free"
+ * to \c NULL indicates that HDF5 should invoke
+ * the standard C library \c free() routine when releasing file image
+ * buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_free_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.udata_copy "udata_copy"
+ * callback contains a pointer to a function
+ * that, from the perspective of HDF5, allocates a buffer of suitable
+ * size, copies the contents of the supplied \p udata into the new
+ * buffer, and returns the address of the new buffer. The function
+ * returns NULL on failure. This function is necessary if a non-NULL
+ * \p udata parameter is supplied, so that property lists containing
+ * the image callbacks can be copied. If the \p udata parameter below
+ * is \c NULL, then this parameter should be \c NULL as well.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h udata_copy_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.udata_free "udata_free"
+ * callback contains a pointer to a function
+ * that, from the perspective of HDF5, frees a user data block. This
+ * function is necessary if a non-NULL udata parameter is supplied so
+ * that property lists containing image callbacks can be discarded
+ * without a memory leak. If the udata parameter below is \c NULL,
+ * this parameter should be \c NULL as well.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h udata_free_snip
+ *
+ * - \p **udata**, the final field in the #H5FD_file_image_callbacks_t
+ * struct, provides a pointer to user-defined data. This pointer will
+ * be passed to the
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc",
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy",
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks.
+ * Define udata as \c NULL if no user-defined data is provided.
+ *
+ * \since 1.8.9
+ *
+ */
+H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the file locking property values
+ *
+ * \fapl_id
+ * \param[in] use_file_locking Toggle to specify file locking (or not)
+ * \param[in] ignore_when_disabled Toggle to ignore when disabled (or not)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_locking() overrides the default file locking flag
+ * setting that was set when the library was configured.
+ *
+ * This setting can be overridden by the \c HDF5_USE_FILE_LOCKING
+ * environment variable.
+ *
+ * File locking is used when creating/opening a file to prevent
+ * problematic file accesses.
+ *
+ * \since 1.10.7
+ *
+ */
+H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets garbage collecting references flag
+ *
+ * \fapl_id
+ * \param[in] gc_ref Flag setting reference garbage collection to on (1) or off (0)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_gc_references() sets the flag for garbage collecting
+ * references for the file.
+ *
+ * Dataset region references and other reference types use space in an
+ * HDF5 file's global heap. If garbage collection is on and the user
+ * passes in an uninitialized value in a reference structure, the heap
+ * might get corrupted. When garbage collection is off, however, and
+ * the user re-uses a reference, the previous heap block will be
+ * orphaned and not returned to the free heap space.
+ *
+ * When garbage collection is on, the user must initialize the
+ * reference structures to 0 or risk heap corruption.
+ *
+ * The default value for garbage collecting references is off.
+ *
+ */
+H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Controls the range of library release versions used when creating
+ * objects in a file
+ *
+ * \fapl_id{plist_id}
+ * \param[in] low The earliest version of the library that will be used
+ * for writing objects
+ * \param[in] high The latest version of the library that will be used for
+ * writing objects
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_libver_bounds() controls the range of library release
+ * versions that will be used when creating objects in a file.
+ * The object format versions are determined indirectly from the
+ * library release versions specified in the call.
+ *
+ * This property is set in the file access property list
+ * specified by the parameter \p fapl_id.
+ *
+ * The parameter \p low sets the earliest possible format
+ * versions that the library will use when creating objects in
+ * the file. Note that earliest possible is different from
+ * earliest, as some features introduced in library versions
+ * later than 1.0.0 resulted in updates to object formats.
+ * The parameter \p high sets the latest format versions that
+ * the library will be allowed to use when creating objects in
+ * the file.
+ *
+ * The parameters \p low and \p high must be one of the
+ * enumerated values in the #H5F_libver_t struct, which is
+ * defined in H5Fpublic.h.
+ *
+ * The macro #H5F_LIBVER_LATEST is aliased to the highest
+ * enumerated value in #H5F_libver_t, indicating that this is
+ * currently the latest format available.
+ *
+ * The library supports the following five pairs of
+ * (\p low, \p high) combinations as derived from the values
+ * in #H5F_libver_t:
+ *
+ * <table>
+ * <tr>
+ * <th>Value of \p low and \p high</th>
+ * <th>Result</th>
+ * </tr>
+ * <tr>
+ * <td>\p low=#H5F_LIBVER_EARLIEST<br />
+ * \p high=#H5F_LIBVER_V18</td>
+ * <td>
+ * \li The library will create objects with the earliest
+ * possible format versions.
+ * \li The library will allow objects to be created with the
+ * latest format versions available to library release 1.8.x.
+ * \li API calls that create objects or features that are
+ * available to versions of the library greater than 1.8.x
+ * release will fail.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>\p low=#H5F_LIBVER_EARLIEST<br />
+ * \p high=#H5F_LIBVER_V110</td>
+ * <td>
+ * \li The library will create objects with the earliest possible
+ * format versions.
+ * \li The library will allow objects to be created with the latest
+ * format versions available to library release 1.10.x.
+ * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper
+ * limit on the format versions to use. For example, if a newer
+ * format version is required to support a feature e.g. virtual
+ * dataset, this setting will allow the object to be created.
+ * \li This is the library default setting and provides the greatest
+ * format compatibility.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>\p low=#H5F_LIBVER_V18<br />
+ * \p high=#H5F_LIBVER_V18</td>
+ * <td>
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.8.x.
+ * \li API calls that create objects or features that are available
+ * to versions of the library greater than 1.8.x release will
+ * fail.
+ * \li Earlier versions of the library may not be able to access
+ * objects created with this setting.</td>
+ * </tr>
+ * <tr>
+ * <td>\p low=#H5F_LIBVER_V18<br />
+ * \p high=#H5F_LIBVER_V110</td>
+ * <td>
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.8.x.
+ * \li The library will allow objects to be created with the latest
+ * format versions available to library release 1.10.x.
+ * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper
+ * limit on the format versions to use. For example, if a
+ * newer format version is required to support a feature e.g.
+ * virtual dataset, this setting will allow the object to be
+ * created.
+ * \li Earlier versions of the library may not be able to access
+ * objects created with this setting.</td>
+ * </tr>
+ * <tr>
+ * <td>\p low=#H5F_LIBVER_V110<br />
+ * \p high=#H5F_LIBVER_V110
+ * </td>
+ * <td>
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.10.x.
+ * \li The library will allow objects to be created with the latest
+ * format versions available to library release 1.10.x.
+ * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper
+ * limit on the format versions to use. For example, if a
+ * newer format version is required to support a feature e.g.
+ * virtual dataset, this setting will allow the object to be
+ * created.
+ * \li This setting allows users to take advantage of the latest
+ * features and performance enhancements in the library.
+ * However, objects written with this setting may be
+ * accessible to a smaller range of library versions than
+ * would be the case if low is set to #H5F_LIBVER_EARLIEST.
+ * \li Earlier versions of the library may not be able to access
+ * objects created with this
+ * setting.
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in
+ * #H5F_libver_t.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Set the initial metadata cache configuration in the indicated File
+ * Access Property List to the supplied value
+ *
+ * \fapl_id{plist_id}
+ * \param[in] config_ptr Pointer to the instance of \p H5AC_cache_config_t
+ * containing the desired configuration
+ * \return \herr_t
+ *
+ * \details The fields of the #H5AC_cache_config_t structure are shown
+ * below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * \details H5Pset_mdc_config() attempts to set the initial metadata cache
+ * configuration to the supplied value. It will fail if an invalid
+ * configuration is detected. This configuration is used when the file
+ * is opened.
+ *
+ * See the overview of the metadata cache in the special topics section
+ * of the user manual for details on what is being configured. If you
+ * have not read and understood that documentation, you really should
+ * not be using this API call.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets metadata cache logging options
+ *
+ * \fapl_id{plist_id}
+ * \param[in] is_enabled Whether logging is enabled
+ * \param[in] location Location of log in UTF-8/ASCII (file path/name)
+ * (On Windows, this must be ASCII)
+ * \param[in] start_on_access Whether the logging will begin as soon as the
+ * file is opened or created
+ *
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all file metadata reads and writes take place. File metadata
+ * is normally invisible to the user and is used by the library for
+ * purposes such as locating and indexing data. File metadata should
+ * not be confused with user metadata, which consists of attributes
+ * created by users and attached to HDF5 objects such as datasets via
+ * H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has
+ * been created that can be used by HDF5 developers for debugging and
+ * performance analysis. The functions that control this functionality
+ * will normally be of use to a very limited number of developers
+ * outside of The HDF Group. The functions have been documented to
+ * help users create logs that can be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is
+ * enabled via the H5Pset_mdc_log_options() function,
+ * which will modify the file access property list used to open or
+ * create a file. This function has a flag that determines whether
+ * logging begins at file open or starts in a paused state. Log
+ * messages can then be controlled via the H5Fstart_mdc_logging()
+ * and H5Fstop_mdc_logging() function.
+ *
+ * H5Pget_mdc_log_options() can be used to examine a file access
+ * property list, and H5Fget_mdc_logging_status() will return the
+ * current state of the logging flags.
+ *
+ * The log format is described in [<em>Metadata Cache Logging</em>]
+ * (https://portal.hdfgroup.org/display/HDF5/Fine-tuning+the+Metadata+Cache).
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
+ hbool_t start_on_access);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the minimum metadata block size
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Minimum size, in bytes, of metadata block allocations
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_meta_block_size() sets the minimum size, in bytes, of
+ * metadata block allocations when #H5FD_FEAT_AGGREGATE_METADATA is set by a VFL
+ * driver.
+
+ * Each raw metadata block is initially allocated to be of the given size.
+ * Specific metadata objects (e.g., object headers, local heaps, B-trees) are then
+ * sub-allocated from this block.
+ *
+ * The default setting is 2048 bytes, meaning that the library will
+ * attempt to aggregate metadata in at least 2K blocks in the file.
+ * Setting the value to zero (\Code{0}) with this function will turn
+ * off metadata aggregation, even if the VFL driver attempts to use the
+ * metadata aggregation strategy.
+ *
+ * Metadata aggregation reduces the number of small data objects in the file that
+ * would otherwise be required for metadata. The aggregated block of metadata is
+ * usually written in a single write action and always in a contiguous block,
+ * potentially significantly improving library and application performance.
+ *
+ * \since 1.4.0
+ */
+H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the number of read attempts in a file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in] attempts The number of read attempts. Must be a value greater than \Code{0}
+ *
+ * \return \herr_t
+ *
+ * \return Failure Modes:
+ * - When the user sets the number of read attempts to \Code{0}.
+ * - When the input property list is not a file access property list.
+ * - When the library is unable to set the number of read attempts in the file access property list.
+ *
+ * \details H5Pset_metadata_read_attempts() sets the number of reads that the
+ * library will try when reading checksummed metadata in an HDF5 file opened
+ * with SWMR access. When reading such metadata, the library will compare the
+ * checksum computed for the metadata just read with the checksum stored within
+ * the piece of checksum. When performing SWMR operations on a file, the
+ * checksum check might fail when the library reads data on a system that is not
+ * atomic. To remedy such situations, the library will repeatedly read the piece
+ * of metadata until the check passes or finally fails the read when the allowed
+ * number of attempts is reached.
+ *
+ * The number of read attempts used by the library will depend on how the file is
+ * opened and whether the user sets the number of read attempts via this routine:
+
+ * - For a file opened with SWMR access:
+ * - If the user sets the number of attempts to \Code{N}, the library will use \Code{N}.
+ * - If the user does not set the number of attempts, the library will use the
+ * default for SWMR access (\Code{100}).
+ * - For a file opened with non-SWMR access, the library will always use the default
+ * for non-SWMR access (\Code{1}). The value set via this routine does not have any effect
+ * during non-SWMR access.
+ *
+ * \b Example: The first example illustrates the case in setting the number of read attempts for a file
+ * opened with SWMR access.
+ *
+ * \snippet H5Pset_metadata_read_attempts.c SWMR Access
+ *
+ * \b Example: The second example illustrates the case in setting the number of
+ * read attempts for a file opened with non-SWMR access. The value
+ * set in the file access property list does not have any effect.
+ *
+ * \snippet H5Pset_metadata_read_attempts.c non-SWMR Access
+ *
+ * \note \b Motivation: On a system that is not atomic, the library might
+ * possibly read inconsistent metadata with checksum when performing
+ * single-writer/multiple-reader (SWMR) operations for an HDF5 file. Upon
+ * encountering such situations, the library will try reading the metadata
+ * again to obtain consistent data. This routine provides the means to set
+ * the number of read attempts other than the library default.
+ *
+ * \since 1.10.0
+ */
+H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Specifies type of data to be accessed via the \Code{MULTI} driver,
+ * enabling more direct access
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] type Type of data to be accessed
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_multi_type() sets the \Emph{type of data} property in the file
+ * access property list \p fapl_id. This setting enables a user
+ * application to specify the type of data the application wishes to
+ * access so that the application can retrieve a file handle for
+ * low-level access to the particular member of a set of \Code{MULTI}
+ * files in which that type of data is stored. The file handle is
+ * retrieved with a separate call to H5Fget_vfd_handle() (or, in special
+ * circumstances, to H5FDget_vfd_handle(); see \ref VFL.
+ *
+ * The type of data specified in \p type may be one of the following:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5FD_MEM_SUPER</td> <td>Super block data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_BTREE</td> <td>B-tree data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_DRAW</td> <td>Dataset raw data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_GHEAP</td> <td>Global heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_LHEAP</td> <td>Local Heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_OHDR</td> <td>Object header data</td>
+ * </tr>
+ * </table>
+ *
+ * This function is for use only when accessing an HDF5 file written as a set of
+ * files with the \Code{MULTI} file driver.
+ *
+ * \since 1.6.0
+ */
+H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets a callback function to invoke when an object flush occurs in the file
+ *
+ * \fapl_id{plist_id}
+ * \op{func}
+ * \op_data_in{udata}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_object_flush_cb() sets the callback function to invoke in the
+ * file access property list \p plist_id whenever an object flush occurs in
+ * the file. Library objects are group, dataset, and committed
+ * datatype.
+ *
+ * The callback function \p func must conform to the prototype defined below:
+ * \code
+ * typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *user_data)
+ * \endcode
+ *
+ * The parameters of the callback function, per the above prototypes, are defined as follows:
+ * - \Code{object_id} is the identifier of the object which has just been flushed.
+ * - \Code{user_data} is the user-defined input data for the callback function.
+ *
+ * \b Example: The example below illustrates the usage of this routine to set
+ * the callback function to invoke when an object flush occurs.
+ *
+ * \include H5Pset_object_flush_cb.c
+ *
+ * \since 1.10.0
+ */
+H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the maximum size of the data sieve buffer
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of data sieve buffer
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_sieve_buf_size() sets \p size, the maximum size in bytes of the
+ * data sieve buffer, which is used by file drivers that are capable of
+ * using data sieving.
+ *
+ * The data sieve buffer is used when performing I/O on datasets in the
+ * file. Using a buffer which is large enough to hold several pieces of
+ * the dataset being read in for hyperslab selections boosts
+ * performance by quite a bit.
+ *
+ * The default value is set to 64KB, indicating that file I/O for raw
+ * data reads and writes will occur in at least 64KB blocks. Setting
+ * the value to zero (\Code{0}) with this API function will turn off
+ * the data sieving, even if the VFL driver attempts to use that
+ * strategy.
+ *
+ * Internally, the library checks the storage sizes of the datasets in
+ * the file. It picks the smaller one between the size from the file
+ * access property and the size of the dataset to allocate the sieve
+ * buffer for the dataset in order to save memory usage.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type \Code{hsize_t} to \Code{size_t}.
+ *
+ * \since 1.4.0
+ */
+H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the size of a contiguous block reserved for small data
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of the small data block.
+ The default size is \Code{2048}.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_small_data_block_size() reserves blocks of \p size bytes for the
+ * contiguous storage of the raw data portion of \Emph{small} datasets. The
+ * HDF5 library then writes the raw data from small datasets to this
+ * reserved space, thus reducing unnecessary discontinuities within
+ * blocks of meta data and improving I/O performance.
+ *
+ * A small data block is actually allocated the first time a qualifying
+ * small dataset is written to the file. Space for the raw data portion
+ * of this small dataset is suballocated within the small data block.
+ * The raw data from each subsequent small dataset is also written to
+ * the small data block until it is filled; additional small data
+ * blocks are allocated as required.
+ *
+ * The HDF5 library employs an algorithm that determines whether I/O
+ * performance is likely to benefit from the use of this mechanism with
+ * each dataset as storage space is allocated in the file. A larger
+ * \p size will result in this mechanism being employed with larger
+ * datasets.
+ *
+ * The small data block size is set as an allocation property in the
+ * file access property list identified by \p fapl_id.
+ *
+ * Setting \p size to zero (\Code{0}) disables the small data block mechanism.
+ *
+ * \since 1.4.4
+ */
+H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Set the file VOL connector for a file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in] new_vol_id VOL connector identifier
+ * \param[in] new_vol_info Optional VOL information
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_vol() sets the VOL connector \p new_vol_id for a file access
+ * property list \p plist_id using the (optional) VOL information in
+ * \p new_vol_info.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
+
#ifdef H5_HAVE_PARALLEL
+/**
+ * \ingroup GACPL
+ *
+ * \brief Sets metadata I/O mode for read operations to collective or independent (default)
+ *
+ * \gacpl_id
+ * \param[in] is_collective Boolean value indicating whether metadata reads are collective
+ * (\Code{1}) or independent (\Code{0}).
+ * Default mode: Independent (\Code{0})
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_all_coll_metadata_ops() sets the metadata I/O mode for read
+ * operations in the access property list \p plist_id.
+ *
+ * When engaging in parallel I/O, all metadata write operations must be
+ * collective. If \p is_collective is \Code{1}, this property specifies
+ * that the HDF5 library will perform all metadata read operations
+ * collectively; if \p is_collective is \Code{0}, such operations may
+ * be performed independently.
+ *
+ * Users must be aware that several HDF5 operations can potentially
+ * issue metadata reads. These include opening a dataset, datatype, or
+ * group; reading an attribute; or issuing a \Emph{get info} call such
+ * as getting information for a group with H5Fget_info(). Collective
+ * I/O requirements must be kept in mind when issuing such calls in the
+ * context of parallel I/O.
+ *
+ * If this property is collective on a file access property list that
+ * is used in creating or opening a file, then the HDF5 library will
+ * assume that all metadata read operations issued on that file
+ * identifier will be issued collectively from all ranks irrespective
+ * of the individual setting of a particular operation. If this
+ * assumption is not adhered to, corruption will be introduced in the
+ * metadata cache and HDF5’s behavior will be undefined.
+ *
+ * Alternatively, a user may wish to avoid setting this property
+ * globally on the file access property list, and individually set it
+ * on particular object access property lists (dataset, group, link,
+ * datatype, attribute access property lists) for certain operations.
+ * This will indicate that only the operations issued with such an
+ * access property list will be called collectively and other
+ * operations may potentially be called independently. There are,
+ * however, several HDF5 operations that can issue metadata reads but
+ * have no property list in their function signatures to allow passing
+ * the collective requirement property. For those operations, the only
+ * option is to set the global collective requirement property on the
+ * file access property list; otherwise the metadata reads that can be
+ * triggered from those operations will be done independently by each
+ * process.
+ *
+ * Functions that do not accommodate an access property list but that
+ * might issue metadata reads are listed in \ref maybe_metadata_reads.
+ *
+ * \attention As noted above, corruption will be introduced into the metadata
+ * cache and HDF5 library behavior will be undefined when both of the following
+ * conditions exist:
+ * - A file is created or opened with a file access property list in which the
+ * collective metadata I/O property is set to \Code{1}.
+ * - Any function is called that triggers an independent metadata read while the
+ * file remains open with that file access property list.
+ *
+ * \attention An approach that avoids this corruption risk is described above.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective);
+/**
+ * \ingroup GACPL
+ *
+ * \brief Retrieves metadata read mode setting
+ *
+ * \gacpl_id
+ * \param[out] is_collective Pointer to a buffer containing the Boolean value indicating whether metadata
+ * reads are collective (\Code{>0}) or independent (\Code{0}).
+ * Default mode: Independent (\Code{0})
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_all_coll_metadata_ops() retrieves the collective metadata read setting from the access
+ * property list \p plist_id into \p is_collective.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets metadata write mode to collective or independent (default)
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_collective Boolean value indicating whether metadata
+ * writes are collective (\Code{>0}) or independent (\Code{0}).
+ * \Emph{Default mode:} Independent (\Code{0})
+ * \return \herr_t
+ *
+ * \details H5Pset_coll_metadata_write() tells the HDF5 library whether to
+ * perform metadata writes collectively (1) or independently (0).
+ *
+ * If collective access is selected, then on a flush of the metadata
+ * cache, all processes will divide the metadata cache entries to be
+ * flushed evenly among themselves and issue a single MPI-IO collective
+ * write operation. This is the preferred method when the size of the
+ * metadata created by the application is large.
+ *
+ * If independent access is selected, the library uses the default
+ * method for doing metadata I/O either from process zero or
+ * independently from each process.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves metadata write mode setting
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_collective Pointer to a boolean value indicating whether
+ * metadata writes are collective (\Code{>0}) or independent (\Code{0}).
+ * \Emph{Default mode:} Independent (\Code{0})
+ * \return \herr_t
+ *
+ * \details H5Pget_coll_metadata_write() retrieves the collective metadata write
+ * setting from the file access property into \p is_collective.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective);
+
+/**
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_mpi_params(hid_t fapl_id, MPI_Comm *comm, MPI_Info *info);
+
+/**
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_mpi_params(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
#endif /* H5_HAVE_PARALLEL */
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the metadata cache image option for a file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] config_ptr Pointer to metadata cache image configuration values
+ * \return \herr_t
+ *
+ * \details H5Pset_mdc_image_config() sets the metadata cache image option with
+ * configuration values specified by \p config_ptr for the file access
+ * property list specified in \p plist_id.
+ *
+ * #H5AC_cache_image_config_t is defined as follows:
+ * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip
+ * \click4more
+ *
+ * \par Limitations: While it is an obvious error to request a cache image when
+ * opening the file read only, it is not in general possible to test for
+ * this error in the H5Pset_mdc_image_config() call. Rather than fail the
+ * subsequent file open, the library silently ignores the file image
+ * request in this case.\n It is also an error to request a cache image on
+ * a file that does not support superblock extension messages (i.e. a
+ * superblock version less than 2). As above, it is not always possible to
+ * detect this error in the H5Pset_mdc_image_config() call, and thus the
+ * request for a cache image will fail silently in this case as well.\n
+ * Creation of cache images is currently disabled in parallel -- as above,
+ * any request for a cache image in this context will fail silently.\n
+ * Files with cache images may be read in parallel applications, but note
+ * that the load of the cache image is a collective operation triggered by
+ * the first operation that accesses metadata after file open (or, if
+ * persistent free space managers are enabled, on the first allocation or
+ * deallocation of file space, or read of file space manager status,
+ * whichever comes first). Thus the parallel process may deadlock if any
+ * process does not participate in this access.\n
+ * In long sequences of file closes and opens, infrequently accessed
+ * metadata can accumulate in the cache image to the point where the cost
+ * of storing and restoring this metadata exceeds the benefit of retaining
+ * frequently used metadata in the cache image. When implemented, the
+ * #H5AC_cache_image_config_t::entry_ageout should address this problem. In
+ * the interim, not requesting a cache image every n file close/open cycles
+ * may be an acceptable work around. The choice of \c n will be driven by
+ * application behavior, but \Code{n = 10} seems a good starting point.
+ *
+ * \since 1.10.1
+ */
H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
-H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the maximum size for the page buffer and the minimum percentage
+ * for metadata and raw data pages
+ *
+ * \fapl_id{plist_id}
+ * \param[in] buf_size Maximum size, in bytes, of the page buffer
+ * \param[in] min_meta_per Minimum metadata percentage to keep in the page buffer
+ * before allowing pages containing metadata to be evicted (Default is 0)
+ * \param[in] min_raw_per Minimum raw data percentage to keep in the page buffer
+ * before allowing pages containing raw data to be evicted (Default is 0)
+ * \return \herr_t
+ *
+ * \details H5Pset_page_buffer_size() sets buf_size, the maximum size in bytes
+ * of the page buffer. The default value is zero, meaning that page
+ * buffering is disabled. When a non-zero page buffer size is set, the
+ * library will enable page buffering if that size is larger or equal
+ * than a single page size if a paged file space strategy is enabled
+ * using the functions H5Pset_file_space_strategy() and
+ * H5Pset_file_space_page_size().
+ *
+ * The page buffer layer captures all I/O requests before they are
+ * issued to the VFD and "caches" them in fixed sized pages. Once the
+ * total number of pages exceeds the page buffer size, the library
+ * evicts pages from the page buffer by writing them to the VFD. At
+ * file close, the page buffer is flushed writing all the pages to the
+ * file.
+ *
+ * If a non-zero page buffer size is set, and the file space strategy
+ * is not set to paged or the page size for the file space strategy is
+ * larger than the page buffer size, the subsequent call to H5Fcreate()
+ * or H5Fopen() using the \p plist_id will fail.
+ *
+ * The function also allows setting the minimum percentage of pages for
+ * metadata and raw data to prevent a certain type of data to evict hot
+ * data of the other type.
+ *
+ * \since 1.10.1
+ *
+ */
H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per,
unsigned min_raw_per);
-H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_per,
- unsigned *min_raw_per);
/* Dataset creation property list (DCPL) routines */
-H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Determines whether fill value is defined
+ *
+ * \dcpl_id{plist}
+ * \param[out] status Status of fill value in property list
+ *
+ * \return \herr_t
+ *
+ * \details H5Pfill_value_defined() determines whether a fill value is
+ * defined in the dataset creation property list \p plist. Valid
+ * values returned in status are as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5D_FILL_VALUE_UNDEFINED</td>
+ * <td>Fill value is undefined.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_VALUE_DEFAULT</td>
+ * <td>Fill value is the library default.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_VALUE_USER_DEFINED</td>
+ * <td>Fill value is defined by the application.</td>
+ * </tr>
+ * </table>
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Retrieves the timing for storage space allocation
+ *
+ * \dcpl_id{plist_id}
+ * \param[out] alloc_time The timing setting for allocating dataset
+ * storage space
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_alloc_time() retrieves the timing for allocating storage
+ * space for a dataset's raw data. This property is set in the
+ * dataset creation property list \p plist_id. The timing setting
+ * is returned in \p alloc_time as one of the following values:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_DEFAULT<br />&nbsp;</td>
+ * <td>Uses the default allocation time, based on the dataset
+ * storage method. <br />See the \p alloc_time description in
+ * H5Pset_alloc_time() for default allocation times for
+ * various storage methods.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_EARLY</td>
+ * <td>All space is allocated when the dataset is created.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_INCR</td>
+ * <td>Space is allocated incrementally as data is written
+ * to the dataset.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_LATE</td>
+ * <td>All space is allocated when data is first written to
+ * the dataset.</td>
+ * </tr>
+ * </table>
+ *
+ * \note H5Pget_alloc_time() is designed to work in concert with the
+ * dataset fill value and fill value write time properties, set
+ * with the functions H5Pget_fill_value() and H5Pget_fill_time().
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Retrieves the size of chunks for the raw data of a chunked
+ * layout dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] max_ndims Size of the \p dims array
+ * \param[out] dim Array to store the chunk dimensions
+ *
+ * \return Returns chunk dimensionality if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Pget_chunk() retrieves the size of chunks for the raw data
+ * of a chunked layout dataset. This function is only valid for
+ * dataset creation property lists. At most, \p max_ndims elements
+ * of \p dim will be initialized.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/);
+/**
+ *
+ * \ingroup DCPL
+ *
+ * \brief Retrieves the edge chunk option setting from a dataset creation
+ * property list
+ *
+ * \dcpl_id{plist_id}
+ * \param[out] opts Edge chunk option flag. Valid values are described in
+ * H5Pset_chunk_opts(). The option status can be
+ * retrieved using the bitwise AND operator ( & ). For
+ * example, the expression
+ * (opts&#H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) will
+ * evaluate to #H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS if
+ * that option has been enabled. Otherwise, it will
+ * evaluate to 0 (zero).
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_chunk_opts() retrieves the edge chunk option setting
+ * stored in the dataset creation property list \p plist_id.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Retrieves the setting for whether or not to create minimized
+ * dataset object headers
+ *
+ * \dcpl_id
+ * \param[out] minimize Flag indicating whether the library will or will
+ * not create minimized dataset object headers
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_dset_no_attrs_hint() retrieves the
+ * <i>no dataset attributes</i> hint setting for the dataset
+ * creation property list \p dcpl_id. This setting is used to
+ * inform the library to create minimized dataset object headers
+ * when TRUE. The setting value is returned in the boolean pointer
+ * \p minimize.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns information about an external file
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] idx External file index
+ * \param[in] name_size Maximum length of \p name array
+ * \param[out] name Name of the external file
+ * \param[out] offset Pointer to a location to return an offset value
+ * \param[out] size Pointer to a location to return the size of the
+ * external file data
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_external() returns information about an external file.
+ * The external file is specified by its index, \p idx, which
+ * is a number from zero to N-1, where N is the value returned
+ * by H5Pget_external_count(). At most \p name_size characters
+ * are copied into the \p name array. If the external file name
+ * is longer than \p name_size with the null terminator, the
+ * return value is not null terminated (similar to strncpy()).
+ *
+ * If \p name_size is zero or \p name is the null pointer, the
+ * external file name is not returned. If \p offset or \p size
+ * are null pointers then the corresponding information is not
+ * returned.
+ *
+ * \version 1.6.4 \p idx parameter type changed to unsigned.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/,
+ off_t *offset /*out*/, hsize_t *size /*out*/);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns the number of external files for a dataset
+ *
+ * \dcpl_id{plist_id}
+ *
+ * \return Returns the number of external files if successful; otherwise
+ * returns a negative value.
+ *
+ * \details H5Pget_external_count() returns the number of external files
+ * for the specified dataset.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Pget_external_count(hid_t plist_id);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Retrieves the time when fill values are written to a dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[out] fill_time Setting for the timing of writing fill values to
+ * the dataset
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_fill_time() examines the dataset creation property list
+ * \p plist_id to determine when fill values are to be written to
+ * a dataset. Valid values returned in \p fill_time are as
+ * follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5D_FILL_TIME_IFSET</td>
+ * <td>Fill values are written to the dataset when storage
+ * space is allocated only if there is a user-defined fill
+ * value, i.e., one set with H5Pset_fill_value(). (Default)
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_TIME_ALLOC</td>
+ * <td>Fill values are written to the dataset when storage
+ * space is allocated.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_TIME_NEVER</td>
+ * <td>Fill values are never written to the dataset.</td>
+ * </tr>
+ * </table>
+ *
+ * \note H5Pget_fill_time() is designed to work in coordination with the
+ * dataset fill value and dataset storage allocation time properties,
+ * retrieved with the functions H5Pget_fill_value() and
+ * H5Pget_alloc_time().
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Retrieves a dataset fill value
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] type_id Datatype identifier for the value passed via
+ * \p value
+ * \param[out] value Pointer to buffer to contain the returned
+ * fill value
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_fill_value() returns the dataset fill value defined in
+ * the dataset creation property list \p plist_id. The fill value
+ * is returned through the \p value pointer and will be converted
+ * to the datatype specified by \p type_id. This datatype may
+ * differ from the fill value datatype in the property list, but
+ * the HDF5 library must be able to convert between the two
+ * datatypes.
+ *
+ * If the fill value is undefined, i.e., set to NULL in the
+ * property list, H5Pget_fill_value() will return an error.
+ * H5Pfill_value_defined() should be used to check for this
+ * condition before H5Pget_fill_value() is called.
+ *
+ * Memory must be allocated by the calling application.
+ *
+ * \note H5Pget_fill_value() is designed to coordinate with the dataset
+ * storage allocation time and fill value write time properties,
+ * which can be retrieved with the functions H5Pget_alloc_time()
+ * and H5Pget_fill_time(), respectively.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns the layout of the raw data for a dataset
+ *
+ * \dcpl_id{plist_id}
+ *
+ * \return Returns the layout type (a non-negative value) of a dataset
+ * creation property list if successful. Valid return values are:
+ * - #H5D_COMPACT: Raw data is stored in the object header in the
+ * file.
+ * - #H5D_CONTIGUOUS: Raw data is stored separately from the object
+ * header in one contiguous chunk in the file.
+ * - #H5D_CHUNKED: Raw data is stored separately from the object
+ * header in chunks in separate locations in the
+ * file.
+ * - #H5D_VIRTUAL: Raw data is drawn from multiple datasets in
+ * different files.
+ * \return
+ * Otherwise, returns a negative value indicating failure.
+ *
+ * \details H5Pget_layout() returns the layout of the raw data for a
+ * dataset. This function is only valid for dataset creation
+ * property lists.
+ *
+ * Note that a compact storage layout may affect writing data to
+ * the dataset with parallel applications. See the H5Dwrite()
+ * documentation for details.
+ *
+ * \version 1.10.0 #H5D_VIRTUAL added in this release.
+ *
+ * \since 1.0.0
+ *
+ */
H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id);
-H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]);
-H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/);
-H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
- const char *src_dset_name, hid_t src_space_id);
-H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/);
-H5_DLL hid_t H5Pget_virtual_vspace(hid_t dcpl_id, size_t index);
-H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index);
-H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size);
-H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size);
-H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size);
-H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts);
-H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts);
-H5_DLL int H5Pget_external_count(hid_t plist_id);
-H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/,
- off_t *offset /*out*/, hsize_t *size /*out*/);
-H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block);
-H5_DLL herr_t H5Pset_shuffle(hid_t plist_id);
-H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
-H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_factor);
-H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value);
-H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/);
-H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status);
-H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time);
-H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/);
-H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
-H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/);
-H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
-H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Gets the number of mappings for the virtual dataset
+ *
+ * \dcpl_id
+ * \param[out] count The number of mappings
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_virtual_count() gets the number of mappings for a
+ * virtual dataset that has the creation property list specified
+ * by \p dcpl_id.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Gets the name of a source dataset used in the mapping
+ *
+ * \dcpl_id
+ * \param[in] index Mapping index. The value of \p index is 0 (zero) or
+ * greater and less than \p count
+ * (0 ≤ \p index < \p count), where \p count is the
+ * number of mappings returned by H5Pget_virtual_count().
+ * \param[out] name A buffer containing the name of the source dataset
+ * \param[in] size The size, in bytes, of the name buffer. Must be the
+ * size of the dataset name in bytes plus 1 for a NULL
+ * terminator
+ *
+ * \return Returns the length of the dataset name if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Pget_virtual_dsetname() takes the dataset creation property
+ * list for the virtual dataset, \p dcpl_id, the mapping index,
+ * \p index, the size of the dataset name for a source dataset,
+ * \p size, and retrieves the name of the source dataset used in
+ * the mapping.
+ *
+ * Up to \p size characters of the dataset name are returned in
+ * \p name; additional characters, if any, are not returned to
+ * the user application.
+ *
+ * If the length of the dataset name, which determines the
+ * required value of \p size, is unknown, a preliminary call
+ * to H5Pget_virtual_dsetname() with the last two parameters
+ * set to NULL and zero respectively can be made. The return
+ * value of this call will be the size in bytes of the dataset
+ * name. That value, plus 1 for a NULL terminator, must then be
+ * assigned to \p size for a second H5Pget_virtual_dsetname()
+ * call, which will retrieve the actual dataset name.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Gets the filename of a source dataset used in the mapping
+ *
+ * \dcpl_id
+ * \param[in] index Mapping index. The value of \p index is 0 (zero) or
+ * greater and less than \p count
+ * (0 ≤ \p index < \p count), where \p count is the
+ * number of mappings returned by H5Pget_virtual_count().
+ * \param[out] name A buffer containing the name of the file containing
+ * the source dataset
+ * \param[in] size The size, in bytes, of the name buffer. Must be the
+ * size of the filename in bytes plus 1 for a NULL
+ * terminator
+ *
+ * \return Returns the length of the filename if successful; otherwise
+ * returns a negative value.
+ *
+ * \details H5Pget_virtual_filename() takes the dataset creation property
+ * list for the virtual dataset, \p dcpl_id, the mapping index,
+ * \p index, the size of the filename for a source dataset,
+ * \p size, and retrieves the name of the file for a source dataset
+ * used in the mapping.
+ *
+ * Up to \p size characters of the filename are returned in
+ * \p name; additional characters, if any, are not returned to
+ * the user application.
+ *
+ * If the length of the filename, which determines the required
+ * value of \p size, is unknown, a preliminary call to
+ * H5Pget_virtual_filename() with the last two parameters set
+ * to NULL and zero respectively can be made. The return value
+ * of this call will be the size in bytes of the filename. That
+ * value, plus 1 for a NULL terminator, must then be assigned to
+ * \p size for a second H5Pget_virtual_filename() call, which
+ * will retrieve the actual filename.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Gets a dataspace identifier for the selection within the source
+ * dataset used in the mapping
+ *
+ * \dcpl_id
+ * \param[in] index Mapping index. The value of \p index is 0 (zero) or
+ * greater and less than \p count
+ * (0 ≤ \p index < \p count), where \p count is the number
+ * of mappings returned by H5Pget_virtual_count().
+ *
+ * \return \hid_t{valid dataspace identifier}
+ *
+ * \details H5Pget_virtual_srcspace() takes the dataset creation property
+ * list for the virtual dataset, \p dcpl_id, and the mapping
+ * index, \p index, and returns a dataspace identifier for the
+ * selection within the source dataset used in the mapping.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Gets a dataspace identifier for the selection within the virtual
+ * dataset used in the mapping
+ *
+ * \dcpl_id
+ * \param[in] index Mapping index. The value of \p index is 0 (zero) or
+ * greater and less than \p count
+ * (0 ≤ \p index < \p count), where \p count is the number
+ * of mappings returned by H5Pget_virtual_count()
+ *
+ * \return \hid_t{valid dataspace identifier}
+ *
+ * \details H5Pget_virtual_vspace() takes the dataset creation property
+ * list for the virtual dataset, \p dcpl_id, and the mapping
+ * index, \p index, and returns a dataspace identifier for the
+ * selection within the virtual dataset used in the mapping.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL hid_t H5Pget_virtual_vspace(hid_t dcpl_id, size_t index);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the timing for storage space allocation
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] alloc_time When to allocate dataset storage space
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_alloc_time() sets up the timing for the allocation of
+ * storage space for a dataset's raw data. This property is set
+ * in the dataset creation property list \p plist_id. Timing is
+ * specified in \p alloc_time with one of the following values:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_DEFAULT</td>
+ * <td>Allocate dataset storage space at the default time<br />
+ * (Defaults differ by storage method.)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_EARLY</td>
+ * <td>Allocate all space when the dataset is created<br />
+ * (Default for compact datasets.)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_INCR</td>
+ * <td>Allocate space incrementally, as data is written to
+ * the dataset<br />(Default for chunked storage datasets.)
+ *
+ * \li Chunked datasets: Storage space allocation for each
+ * chunk is deferred until data is written to the chunk.
+ * \li Contiguous datasets: Incremental storage space
+ * allocation for contiguous data is treated as late
+ * allocation.
+ * \li Compact datasets: Incremental allocation is not
+ * allowed with compact datasets; H5Pset_alloc_time()
+ * will return an error.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_ALLOC_TIME_LATE</td>
+ * <td>Allocate all space when data is first written to the
+ * dataset<br />
+ * (Default for contiguous datasets.)</td>
+ * </tr>
+ * </table>
+ *
+ * \note H5Pset_alloc_time() is designed to work in concert with the
+ * dataset fill value and fill value write time properties, set
+ * with the functions H5Pset_fill_value() and H5Pset_fill_time().
+ *
+ * \note See H5Dcreate() for further cross-references.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the size of the chunks used to store a chunked layout
+ * dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] ndims The number of dimensions of each chunk
+ * \param[in] dim An array defining the size, in dataset elements, of
+ * each chunk
+ *
+ * \return \herr_t
+ * \details H5Pset_chunk() sets the size of the chunks used to store a
+ * chunked layout dataset. This function is only valid for dataset
+ * creation property lists.
+ *
+ * The \p ndims parameter currently must be the same size as the
+ * rank of the dataset.
+ *
+ * The values of the \p dim array define the size of the chunks
+ * to store the dataset's raw data. The unit of measure for \p dim
+ * values is dataset elements.
+ *
+ * As a side-effect of this function, the layout of the dataset is
+ * changed to #H5D_CHUNKED, if it is not already so set.
+ *
+ * \note Chunk size cannot exceed the size of a fixed-size dataset. For
+ * example, a dataset consisting of a 5x4 fixed-size array cannot be
+ * defined with 10x10 chunks. Chunk maximums:
+ * - The maximum number of elements in a chunk is 2<sup>32</sup>-1 which
+ * is equal to 4,294,967,295. If the number of elements in a chunk is
+ * set via H5Pset_chunk() to a value greater than 2<sup>32</sup>-1,
+ * then H5Pset_chunk() will fail.
+ * - The maximum size for any chunk is 4GB. If a chunk that is larger
+ * than 4GB attempts to be written with H5Dwrite(), then H5Dwrite()
+ * will fail.
+ *
+ * \see H5Pset_layout(), H5Dwrite()
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the edge chunk option in a dataset creation property list
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] opts Edge chunk option flag. Valid values are:
+ * \li #H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS
+ * When enabled, filters are not applied to partial
+ * edge chunks. When disabled, partial edge chunks are
+ * filtered. Enabling this option will improve
+ * performance when appending to the dataset and, when
+ * compression filters are used, prevent reallocation
+ * of these chunks. Datasets created with this option
+ * enabled will be inaccessible with HDF5 library
+ * versions before Release 1.10. Default: \e Disabled
+ * \li 0 (zero) Disables option; partial edge chunks
+ * will be compressed.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_chunk_opts() sets the edge chunk option in the
+ * dataset creation property list \p dcpl_id.
+ *
+ * The available option is detailed in the parameters section.
+ * Only chunks that are not completely filled by the dataset’s
+ * dataspace are affected by this option. Such chunks are
+ * referred to as partial edge chunks.
+ *
+ * \b Motivation: H5Pset_chunk_opts() is used to specify storage
+ * options for chunks on the edge of a dataset’s dataspace. This
+ * capability allows the user to tune performance in cases where
+ * the dataset size may not be a multiple of the chunk size and
+ * the handling of partial edge chunks can impact performance.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the flag to create minimized dataset object headers
+ *
+ * \dcpl_id
+ * \param[in] minimize Flag for indicating whether or not a dataset's
+ * object header will be minimized
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_dset_no_attrs_hint() sets the no dataset attributes
+ * hint setting for the dataset creation property list \p dcpl_id.
+ * Datasets created with the dataset creation property list
+ * \p dcpl_id will have their object headers minimized if the
+ * boolean flag \p minimize is set to TRUE. By setting \p minimize
+ * to TRUE, the library expects that no attributes will be added
+ * to the dataset. Attributes can be added, but they are appended
+ * with a continuation message, which can reduce performance.
+ *
+ * This setting interacts with H5Fset_dset_no_attrs_hint(): if
+ * either is set to TRUE, then the created dataset's object header
+ * will be minimized.
+ *
+ * \since 1.10.5
+ *
+ */
+H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Adds an external file to the list of external files
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] name Name of an external file
+ * \param[in] offset Offset, in bytes, from the beginning of the file to
+ * the location in the file where the data starts
+ * \param[in] size Number of bytes reserved in the file for the data
+ *
+ * \return \herr_t
+ *
+ * \details The first call to H5Pset_external() sets the external
+ * storage property in the property list, thus designating that
+ * the dataset will be stored in one or more non-HDF5 file(s)
+ * external to the HDF5 file. This call also adds the file
+ * \p name as the first file in the list of external files.
+ * Subsequent calls to the function add the named file as the
+ * next file in the list.
+ *
+ * If a dataset is split across multiple files, then the files
+ * should be defined in order. The total size of the dataset is
+ * the sum of the \p size arguments for all the external files.
+ * If the total size is larger than the size of a dataset then
+ * the dataset can be extended (provided the data space also
+ * allows the extending).
+ *
+ * The \p size argument specifies the number of bytes reserved
+ * for data in the external file. If \p size is set to
+ * #H5F_UNLIMITED, the external file can be of unlimited size
+ * and no more files can be added to the external files list.
+ * If \p size is set to 0 (zero), no external file will actually
+ * be created.
+ *
+ * All of the external files for a given dataset must be specified
+ * with H5Pset_external() before H5Dcreate() is called to create
+ * the dataset. If one these files does not exist on the system
+ * when H5Dwrite() is called to write data to it, the library
+ * will create the file.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the time when fill values are written to a dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] fill_time When to write fill values to a dataset
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_fill_time() sets up the timing for writing fill values
+ * to a dataset. This property is set in the dataset creation
+ * property list \p plist_id. Timing is specified in \p fill_time
+ * with one of the following values:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5D_FILL_TIME_IFSET</td>
+ * <td>Write fill values to the dataset when storage space is
+ * allocated only if there is a user-defined fill value,
+ * i.e.,one set with H5Pset_fill_value(). (Default)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_TIME_ALLOC</td>
+ * <td>Write fill values to the dataset when storage space is
+ * allocated.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5D_FILL_TIME_NEVER</td>
+ * <td>Never write fill values to the dataset.</td>
+ * </tr>
+ * </table>
+ *
+ * \note H5Pset_fill_time() is designed for coordination with the dataset
+ * fill value and dataset storage allocation time properties, set
+ * with the functions H5Pset_fill_value() and H5Pset_alloc_time().
+ * See H5Dcreate() for further cross-references.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the fill value for a dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] type_id Datatype of \p value
+ * \param[in] value Pointer to buffer containing value to use as
+ * fill value
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_fill_value() sets the fill value for a dataset in the
+ * dataset creation property list. \p value is interpreted as
+ * being of datatype \p type_id. This datatype may differ from
+ * that of the dataset, but the HDF5 library must be able to
+ * convert \p value to the dataset datatype when the dataset is
+ * created.
+ *
+ * The default fill value is 0 (zero), which is interpreted
+ * according to the actual dataset datatype.
+ *
+ * Setting \p value to NULL indicates that the fill value is to
+ * be undefined.
+ *
+ * \note Applications sometimes write data only to portions of an allocated
+ * dataset. It is often useful in such cases to fill the unused space
+ * with a known fill value. This function allows the user application
+ * to set that fill value; the functions H5Dfill() and
+ * H5Pset_fill_time(), respectively, provide the ability to apply the
+ * fill value on demand or to set up its automatic application.
+ *
+ * \note A fill value should be defined so that it is appropriate for the
+ * application. While the HDF5 default fill value is 0 (zero), it is
+ * often appropriate to use another value. It might be useful, for
+ * example, to use a value that is known to be impossible for the
+ * application to legitimately generate.
+ *
+ * \note H5Pset_fill_value() is designed to work in concert with
+ * H5Pset_alloc_time() and H5Pset_fill_time(). H5Pset_alloc_time()
+ * and H5Pset_fill_time() govern the timing of dataset storage
+ * allocation and fill value write operations and can be important in
+ * tuning application performance.
+ *
+ * \note See H5Dcreate() for further cross-references.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets up use of the shuffle filter
+ *
+ * \dcpl_id{plist_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_shuffle() sets the shuffle filter, #H5Z_FILTER_SHUFFLE,
+ * in the dataset creation property list \p plist_id. The shuffle
+ * filter de-interlaces a block of data by reordering the bytes.
+ * All the bytes from one consistent byte position of each data
+ * element are placed together in one block; all bytes from a
+ * second consistent byte position of each data element are placed
+ * together a second block; etc. For example, given three data
+ * elements of a 4-byte datatype stored as 012301230123, shuffling
+ * will re-order data as 000111222333. This can be a valuable step
+ * in an effective compression algorithm because the bytes in each
+ * byte position are often closely related to each other and
+ * putting them together can increase the compression ratio.
+ *
+ * As implied above, the primary value of the shuffle filter lies
+ * in its coordinated use with a compression filter; it does not
+ * provide data compression when used alone. When the shuffle
+ * filter is applied to a dataset immediately prior to the use of
+ * a compression filter, the compression ratio achieved is often
+ * superior to that achieved by the use of a compression filter
+ * without the shuffle filter.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_shuffle(hid_t plist_id);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the type of storage used to store the raw data for a dataset
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] layout Type of storage layout for raw data
+ *
+ * \return \herr_t
+ * \details H5Pset_layout() sets the type of storage used to store the raw
+ * data for a dataset. This function is only valid for dataset
+ * creation property lists.
+ *
+ * Valid values for \p layout are:
+ * - #H5D_COMPACT: Store raw data in the dataset object header
+ * in file. This should only be used for datasets
+ * with small amounts of raw data. The raw data
+ * size limit is 64K (65520 bytes). Attempting
+ * to create a dataset with raw data larger than
+ * this limit will cause the H5Dcreate() call to
+ * fail.
+ * - #H5D_CONTIGUOUS: Store raw data separately from the object
+ * header in one large chunk in the file.
+ * - #H5D_CHUNKED: Store raw data separately from the object header
+ * as chunks of data in separate locations in
+ * the file.
+ * - #H5D_VIRTUAL: Draw raw data from multiple datasets in
+ * different files.
+ *
+ * Note that a compact storage layout may affect writing data to
+ * the dataset with parallel applications. See the note in
+ * H5Dwrite() documentation for details.
+ * \version 1.10.0 #H5D_VIRTUAL added in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets up the use of the N-Bit filter
+ *
+ * \dcpl_id{plist_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_nbit() sets the N-Bit filter, #H5Z_FILTER_NBIT, in the
+ * dataset creation property list \p plist_id.
+ *
+ * The HDF5 user can create an N-Bit datatype with the following
+ * code:
+ * <pre>
+ * hid_t nbit_datatype = H5Tcopy(H5T_STD_I32LE);
+ * H5Tset_precision(nbit_datatype, 16);
+ * H5Tset_offset(nbit_datatype, 4);
+ * </pre>
+ *
+ * In memory, one value of the N-Bit datatype in the above example
+ * will be stored on a little-endian machine as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>byte 3</td>
+ * <td>byte 2</td>
+ * <td>byte 1</td>
+ * <td>byte 0</td>
+ * </tr>
+ * <tr>
+ * <td>????????</td>
+ * <td>????SPPP</td>
+ * <td>PPPPPPPP</td>
+ * <td>PPPP????</td>
+ * </tr>
+ * </table>
+ * Note: S - sign bit, P - significant bit, ? - padding bit; For
+ * signed integer, the sign bit is included in the precision.
+ *
+ * When data of the above datatype is stored on disk using the
+ * N-bit filter, all padding bits are chopped off and only
+ * significant bits are stored. The values on disk will be
+ * something like:
+ *
+ * <table>
+ * <tr>
+ * <td>1st value</td>
+ * <td>2nd value</td>
+ * <td>...</td>
+ * </tr>
+ * <tr>
+ * <td>SPPPPPPPPPPPPPPP</td>
+ * <td>SPPPPPPPPPPPPPPP</td>
+ * <td>...</td>
+ * </tr>
+ * </table>
+ * The N-Bit filter is used effectively for compressing data of
+ * an N-Bit datatype as well as a compound and an array
+ * datatype with N-Bit fields. However, the datatype classes of
+ * the N-Bit datatype or the N-Bit field of the compound
+ * datatype or the array datatype are limited to integer or
+ * floating-point.
+ *
+ * The N-Bit filter supports complex situations where a compound
+ * datatype contains member(s) of a compound datatype or an array
+ * datatype that has a compound datatype as the base type.
+ * However, it does not support the situation where an array
+ * datatype has a variable-length or variable-length string as
+ * its base datatype. The filter does support the situation where
+ * a variable-length or variable-length string is a member of a
+ * compound datatype.
+ *
+ * The N-Bit filter allows all other HDF5 datatypes (such as
+ * time, string, bitfield, opaque, reference, enum, and variable
+ * length) to pass through as a no-op.
+ *
+ * Like other I/O filters supported by the HDF5 library,
+ * application using the N-Bit filter must store data with
+ * chunked storage.
+ *
+ * By nature, the N-Bit filter should not be used together with
+ * other I/O filters.
+ *
+ * \version 1.8.8 Fortran subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets up the use of the scale-offset filter
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] scale_type Flag indicating compression method
+ * \param[in] scale_factor Parameter related to scale. Must be
+ * non-negative
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_scaleoffset() sets the scale-offset filter,
+ * #H5Z_FILTER_SCALEOFFSET, for a dataset.
+ *
+ * Generally speaking, scale-offset compression performs a scale and/or
+ * offset operation on each data value and truncates the resulting
+ * value to a minimum number of bits (MinBits) before storing it. The
+ * current scale-offset filter supports integer and floating-point
+ * datatypes.
+ *
+ * For an integer datatype, the parameter \p scale_type should be set
+ * to #H5Z_SO_INT (2). The parameter \p scale_factor denotes MinBits.
+ * If the user sets it to H5Z_SO_INT_MINBITS_DEFAULT (0), the filter
+ * will calculate MinBits. If \p scale_factor is set to a positive
+ * integer, the filter does not do any calculation and just uses the
+ * number as MinBits. However, if the user gives a MinBits that is less
+ * than what would be generated by the filter, the compression will be
+ * lossy. Also, the MinBits supplied by the user cannot exceed the
+ * number of bits to store one value of the dataset datatype.
+ *
+ * For a floating-point datatype, the filter adopts the GRiB data
+ * packing mechanism, which offers two alternate methods: E-scaling and
+ * D-scaling. Both methods are lossy compression. If the parameter
+ * \p scale_type is set to #H5Z_SO_FLOAT_DSCALE (0), the filter will
+ * use the D-scaling method; if it is set to #H5Z_SO_FLOAT_ESCALE (1),
+ * the filter will use the E-scaling method. Since only the D-scaling
+ * method is implemented, \p scale_type should be set to
+ * #H5Z_SO_FLOAT_DSCALE or 0.
+ *
+ * When the D-scaling method is used, the original data is "D" scaled
+ * — multiplied by 10 to the power of \p scale_factor, and the
+ * "significant" part of the value is moved to the left of the decimal
+ * point. Care should be taken in setting the decimal \p scale_factor
+ * so that the integer part will have enough precision to contain the
+ * appropriate information of the data value. For example, if
+ * \p scale_factor is set to 2, the number 104.561 will be 10456.1
+ * after "D" scaling. The last digit 1 is not "significant" and is
+ * thrown off in the process of rounding. The user should make sure that
+ * after "D" scaling and rounding, the data values are within the range
+ * that can be represented by the integer (same size as the
+ * floating-point type).
+ *
+ * Valid values for scale_type are as follows:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5Z_SO_FLOAT_DSCALE (0)</td>
+ * <td>Floating-point type, using variable MinBits method</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_SO_FLOAT_ESCALE (1)</td>
+ * <td>Floating-point type, using fixed MinBits method</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_SO_INT (2)</td>
+ * <td>Integer type</td>
+ * </tr>
+ * </table>
+ *
+ * The meaning of \p scale_factor varies according to the value
+ * assigned to \p scale_type:
+ *
+ * <table>
+ * <tr>
+ * <th>\p scale_type value</th>
+ * <th>\p scale_factor description</th>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_SO_FLOAT_DSCALE</td>
+ * <td>Denotes the decimal scale factor for D-scaling and can be
+ * positive, negative or zero. This is the current
+ * implementation of the library.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_SO_FLOAT_ESCALE</td>
+ * <td>Denotes MinBits for E-scaling and must be a positive integer.
+ * This is not currently implemented by the library.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5Z_SO_INT</td>
+ * <td>Denotes MinBits and it should be a positive integer or
+ * #H5Z_SO_INT_MINBITS_DEFAULT (0). If it is less than 0, the
+ * library will reset it to 0 since it is not implemented.
+ * </td>
+ * </tr>
+ * </table>
+ * Like other I/O filters supported by the HDF5 library, an
+ * application using the scale-offset filter must store data with
+ * chunked storage.
+ *
+ * \version 1.8.8 Fortran90 subroutine introduced in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_factor);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets up use of the SZIP compression filter
+ *
+ * \dcpl_id{plist_id}
+ * \param[in] options_mask A bit-mask conveying the desired SZIP options;
+ * Valid values are #H5_SZIP_EC_OPTION_MASK and
+ * #H5_SZIP_NN_OPTION_MASK.
+ * \param[in] pixels_per_block The number of pixels or data elements in each
+ * data block
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_szip() sets an SZIP compression filter, #H5Z_FILTER_SZIP,
+ * for a dataset. SZIP is a compression method designed for use with
+ * scientific data.
+ *
+ * Before proceeding, all users should review the “Limitations”
+ * section below.
+ *
+ * Users familiar with SZIP outside the HDF5 context may benefit
+ * from reviewing the Note “For Users Familiar with SZIP in Other
+ * Contexts” below.
+ *
+ * In the text below, the term pixel refers to an HDF5 data element.
+ * This terminology derives from SZIP compression's use with image
+ * data, where pixel referred to an image pixel.
+ *
+ * The SZIP \p bits_per_pixel value (see Note, below) is automatically
+ * set, based on the HDF5 datatype. SZIP can be used with atomic
+ * datatypes that may have size of 8, 16, 32, or 64 bits.
+ * Specifically, a dataset with a datatype that is 8-, 16-, 32-, or
+ * 64-bit signed or unsigned integer; char; or 32- or 64-bit float
+ * can be compressed with SZIP. See Note, below, for further
+ * discussion of the the SZIP \p bits_per_pixel setting.
+ *
+ * SZIP options are passed in an options mask, \p options_mask,
+ * as follows.
+ *
+ * <table>
+ * <tr>
+ * <th>Option</th>
+ * <th>Description (Mutually exclusive; select one.)</th>
+ * </tr>
+ * <tr>
+ * <td>#H5_SZIP_EC_OPTION_MASK</td>
+ * <td>Selects entropy coding method</td>
+ * </tr>
+ * <tr>
+ * <td>#H5_SZIP_NN_OPTION_MASK</td>
+ * <td>Selects nearest neighbor coding method</td>
+ * </tr>
+ * </table>
+ *
+ * The following guidelines can be used in determining which
+ * option to select:
+ *
+ * - The entropy coding method, the EC option specified by
+ * #H5_SZIP_EC_OPTION_MASK, is best suited for data that has been
+ * processed. The EC method works best for small numbers.
+ * - The nearest neighbor coding method, the NN option specified
+ * by #H5_SZIP_NN_OPTION_MASK, preprocesses the data then the
+ * applies EC method as above.
+ *
+ * Other factors may affect results, but the above criteria
+ * provides a good starting point for optimizing data compression.
+ *
+ * SZIP compresses data block by block, with a user-tunable block
+ * size. This block size is passed in the parameter
+ * \p pixels_per_block and must be even and not greater than 32,
+ * with typical values being 8, 10, 16, or 32. This parameter
+ * affects compression ratio; the more pixel values vary, the
+ * smaller this number should be to achieve better performance.
+ *
+ * In HDF5, compression can be applied only to chunked datasets.
+ * If \p pixels_per_block is bigger than the total number of
+ * elements in a dataset chunk, H5Pset_szip() will succeed but
+ * the subsequent call to H5Dcreate() will fail; the conflict
+ * can be detected only when the property list is used.
+ *
+ * To achieve optimal performance for SZIP compression, it is
+ * recommended that a chunk's fastest-changing dimension be equal
+ * to N times \p pixels_per_block where N is the maximum number of
+ * blocks per scan line allowed by the SZIP library. In the
+ * current version of SZIP, N is set to 128.
+ *
+ * SZIP compression is an optional HDF5 filter.
+ *
+ * \b Limitations:
+ *
+ * - SZIP compression cannot be applied to compound, array,
+ * variable-length, enumeration, or any other user-defined
+ * datatypes. If an SZIP filter is set in a dataset creation
+ * property list used to create a dataset containing a
+ * non-allowed datatype, the call to H5Dcreate() will fail; the
+ * conflict can be detected only when the property list is used.
+ * - Users should be aware that there are factors that affect one’s
+ * rights and ability to use SZIP compression by reviewing the
+ * SZIP copyright notice.
+ *
+ * \note \b For \b Users \b Familiar \b with \b SZIP \b in \b Other \b Contexts:
+ *
+ * \note The following notes are of interest primarily to those who have
+ * used SZIP compression outside of the HDF5 context.
+ * In non-HDF5 applications, SZIP typically requires that the user
+ * application supply additional parameters:
+ * - \p pixels_in_object, the number of pixels in the object to
+ * be compressed
+ * - \p bits_per_pixel, the number of bits per pixel
+ * - \p pixels_per_scanline, the number of pixels per scan line
+ *
+ * \note These values need not be independently supplied in the HDF5
+ * environment as they are derived from the datatype and dataspace,
+ * which are already known. In particular, HDF5 sets
+ * \p pixels_in_object to the number of elements in a chunk and
+ * \p bits_per_pixel to the size of the element or pixel datatype.
+ *
+ * \note The following algorithm is used to set \p pixels_per_scanline:
+ * - If the size of a chunk's fastest-changing dimension, size,
+ * is greater than 4K, set \p pixels_per_scanline to 128 times
+ * \p pixels_per_block.
+ * - If size is less than 4K but greater than \p pixels_per_block,
+ * set \p pixels_per_scanline to the minimum of size and 128
+ * times \p pixels_per_block.
+ * - If size is less than \p pixels_per_block but greater than the
+ * number elements in the chunk, set \p pixels_per_scanline to
+ * the minimum of the number elements in the chunk and 128 times
+ * \p pixels_per_block.
+ *
+ * \note The HDF5 datatype may have precision that is less than the full
+ * size of the data element, e.g., an 11-bit integer can be defined
+ * using H5Tset_precision(). To a certain extent, SZIP can take
+ * advantage of the precision of the datatype to improve compression:
+ * - If the HDF5 datatype size is 24-bit or less and the offset of
+ * the bits in the HDF5 datatype is zero (see H5Tset_offset() or
+ * H5Tget_offset()), the data is the in lowest N bits of the data
+ * element. In this case, the SZIP \p bits_per_pixel is set to the
+ * precision of the HDF5 datatype.
+ * - If the offset is not zero, the SZIP \p bits_per_pixel will be
+ * set to the number of bits in the full size of the data element.
+ * - If the HDF5 datatype precision is 25-bit to 32-bit, the SZIP
+ * \p bits_per_pixel will be set to 32.
+ * - If the HDF5 datatype precision is 33-bit to 64-bit, the SZIP
+ * \p bits_per_pixel will be set to 64.
+ *
+ * \note HDF5 always modifies the options mask provided by the user to set up
+ * usage of RAW_OPTION_MASK, ALLOW_K13_OPTION_MASK, and one of
+ * LSB_OPTION_MASK or MSB_OPTION_MASK, depending on endianness of the
+ * datatype.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block);
+
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the mapping between virtual and source datasets
+ *
+ * \dcpl_id
+ * \param[in] vspace_id The dataspace identifier with the selection within the
+ * virtual dataset applied, possibly an unlimited selection
+ * \param[in] src_file_name The name of the HDF5 file where the source dataset is
+ * located or a \Code{"."} (period) for a source dataset in the same
+ * file. The file might not exist yet. The name can be specified using
+ * a C-style \c printf statement as described below.
+ * \param[in] src_dset_name The path to the HDF5 dataset in the file specified by
+ * \p src_file_name. The dataset might not exist yet. The dataset name
+ * can be specified using a C-style \c printf statement as described below.
+ * \param[in] src_space_id The source dataset’s dataspace identifier with a
+ * selection applied, possibly an unlimited selection
+ * \return \herr_t
+ *
+ * \details H5Pset_virtual() maps elements of the virtual dataset (VDS)
+ * described by the virtual dataspace identifier \p vspace_id to the
+ * elements of the source dataset described by the source dataset
+ * dataspace identifier \p src_space_id. The source dataset is
+ * identified by the name of the file where it is located,
+ * \p src_file_name, and the name of the dataset, \p src_dset_name.
+ *
+ * \par C-style \c printf Formatting Statements:
+ * C-style \c printf formatting allows a pattern to be specified in the name
+ * of a source file or dataset. Strings for the file and dataset names are
+ * treated as literals except for the following substitutions:
+ * <table>
+ * <tr>
+ * <td>\Code{"%%"}</td>
+ * <td>Replaced with a single \Code{"%"} (percent) character.</td>
+ * </tr>
+ * <tr>
+ * <td><code>"%<d>b"</code></td>
+ * <td>Where <code>"<d>"</code> is the virtual dataset dimension axis (0-based)
+ * and \Code{"b"} indicates that the block count of the selection in that
+ * dimension should be used. The full expression (for example, \Code{"%0b"})
+ * is replaced with a single numeric value when the mapping is evaluated at
+ * VDS access time. Example code for many source and virtual dataset mappings
+ * is available in the "Examples of Source to Virtual Dataset Mapping"
+ * chapter in the
+ * <a href="https://portal.hdfgroup.org/display/HDF5/RFC+HDF5+Virtual+Dataset">
+ * RFC: HDF5 Virtual Dataset</a>.
+ * </td>
+ * </tr>
+ * </table>
+ * If the printf form is used for the source file or dataset names, the
+ * selection in the source dataset’s dataspace must be fixed-size.
+ *
+ * \par Source File Resolutions:
+ * When a source dataset residing in a different file is accessed, the
+ * library will search for the source file \p src_file_name as described
+ * below:
+ * \li If \p src_file_name is a \Code{"."} (period) then it refers to the
+ * file containing the virtual dataset.
+ * \li If \p src_file_name is a relative pathname, the following steps are
+ * performed:
+ * - The library will get the prefix(es) set in the environment
+ * variable \c HDF5_VDS_PREFIX and will try to prepend each prefix
+ * to \p src_file_name to form a new \p src_file_name. If the new
+ * \p src_file_name does not exist or if \c HDF5_VDS_PREFIX is not
+ * set, the library will get the prefix set via H5Pset_virtual_prefix()
+ * and prepend it to \p src_file_name to form a new \p src_file_name.
+ * If the new \p src_file_name does not exist or no prefix is being
+ * set by H5Pset_virtual_prefix() then the path of the file containing
+ * the virtual dataset is obtained. This path can be the absolute path
+ * or the current working directory plus the relative path of that
+ * file when it is created/opened. The library will prepend this path
+ * to \p src_file_name to form a new \p src_file_name.
+ * - If the new \p src_file_name does not exist, then the library will
+ * look for \p src_file_name and will return failure/success accordingly.
+ * \li If \p src_file_name is an absolute pathname, the library will first
+ * try to find \p src_file_name. If \p src_file_name does not exist,
+ * \p src_file_name is stripped of directory paths to form a new
+ * \p src_file_name. The search for the new \p src_file_name then follows
+ * the same steps as described above for a relative pathname. See
+ * examples below illustrating how \p src_file_name is stripped to form
+ * a new \p src_file_name.
+ * \par
+ * Note that \p src_file_name is considered to be an absolute pathname when
+ * the following condition is true:
+ * \li For Unix, the first character of \p src_file_name is a slash
+ * (\Code{/}).\n For example, consider a \p src_file_name of
+ * \Code{/tmp/A.h5}. If that source file does not exist, the new
+ * \p src_file_name after stripping will be \Code{A.h5}.
+ * \li For Windows, there are 6 cases:
+ * 1. \p src_file_name is an absolute drive with absolute pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 2. \p src_file_name is an absolute pathname without specifying
+ * drive name.\n For example, consider a \p src_file_name of
+ * \Code{/tmp/A.h5}. If that source file does not exist, the new
+ * \p src_file_name after stripping will be \Code{A.h5}.
+ * 3. \p src_file_name is an absolute drive with relative pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{tmp/A.h5}.
+ * 4. \p src_file_name is in UNC (Uniform Naming Convention) format
+ * with server name, share name, and pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 5. \p src_file_name is in Long UNC (Uniform Naming Convention)
+ * format with server name, share name, and pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 6. \p src_file_name is in Long UNC (Uniform Naming Convention)
+ * format with an absolute drive and an absolute pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}
+ *
+ * \see <a href="https://portal.hdfgroup.org/display/HDF5/Virtual+Dataset++-+VDS">
+ * Virtual Dataset Overview</a>
+ *
+ * \see_virtual
+ *
+ * \version 1.10.2 A change was made to the method of searching for VDS source files.
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
+ const char *src_dset_name, hid_t src_space_id);
/* Dataset access property list (DAPL) routines */
-H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0);
-H5_DLL herr_t H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/,
- double *rdcc_w0 /*out*/);
-H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view);
-H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view);
-H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size);
-H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size);
-H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix);
-H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size);
-H5_DLL herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t boundary[],
- H5D_append_cb_t func, void *udata);
-H5_DLL herr_t H5Pget_append_flush(hid_t plist_id, unsigned dims, hsize_t boundary[], H5D_append_cb_t *func,
- void **udata);
-H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Retrieves the values of the append property that is set up in
+ * the dataset access property list
+ *
+ * \dapl_id
+ * \param[in] dims The number of elements for \p boundary
+ * \param[in] boundary The dimension sizes used to determine the boundary
+ * \param[in] func The user-defined callback function
+ * \param[in] udata The user-defined input data
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_append_flush() obtains the following information
+ * from the dataset access property list, \p dapl_id.
+ *
+ * \p boundary consists of the sizes set up in the access
+ * property list that are used to determine when a dataset
+ * dimension size hits the boundary. Only at most \p dims
+ * boundary sizes are retrieved, and \p dims will not exceed
+ * the corresponding value that is set in the property list.
+ *
+ * \p func is the user-defined callback function to invoke when
+ * a dataset’s appended dimension size reaches a boundary and
+ * \p udata is the user-defined input data for the callback
+ * function.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pget_append_flush(hid_t dapl_id, unsigned dims, hsize_t boundary[], H5D_append_cb_t *func,
+ void **udata);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Retrieves the raw data chunk cache parameters
+ *
+ * \dapl_id
+ * \param[out] rdcc_nslots Number of chunk slots in the raw data chunk
+ * cache hash table
+ * \param[out] rdcc_nbytes Total size of the raw data chunk cache, in
+ * bytes
+ * \param[out] rdcc_w0 Preemption policy
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_chunk_cache() retrieves the number of chunk slots in
+ * the raw data chunk cache hash table, the maximum possible
+ * number of bytes in the raw data chunk cache, and the
+ * preemption policy value.
+ *
+ * These values are retrieved from a dataset access property
+ * list. If the values have not been set on the property list,
+ * then values returned will be the corresponding values from
+ * a default file access property list.
+ *
+ * Any (or all) pointer arguments may be null pointers, in which
+ * case the corresponding data is not returned.
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/,
+ double *rdcc_w0 /*out*/);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Retrieves the prefix for external raw data storage files as set
+ * in the dataset access property list
+ *
+ * \dapl_id
+ * \param[in,out] prefix Dataset external storage prefix in UTF-8 or
+ * ASCII (\em Path and \em filename must be ASCII
+ * on Windows systems.)
+ * \param[in] size Size of prefix buffer in bytes
+ *
+ * \return Returns the size of \p prefix and the prefix string will be
+ * stored in \p prefix if successful.
+ * Otherwise returns a negative value and the contents of \p prefix
+ * will be undefined.
+ *
+ * \details H5Pget_efile_prefix() retrieves the file system path prefix
+ * for locating external files associated with a dataset that
+ * uses external storage. This will be the value set with
+ * H5Pset_efile_prefix() or the HDF5 library’s default.
+ *
+ * The value of \p size is the size in bytes of the prefix,
+ * including the NULL terminator. If the size is unknown, a
+ * preliminary H5Pget_elink_prefix() call with the pointer
+ * \p prefix set to NULL will return the size of the prefix
+ * without the NULL terminator.
+ *
+ * The \p prefix buffer must be allocated by the caller. In a
+ * call that retrieves the actual prefix, that buffer must be
+ * of the size specified in \p size.
+ *
+ * \note See H5Pset_efile_prefix() for a more complete description of
+ * file location behavior and for notes on the use of the
+ * HDF5_EXTFILE_PREFIX environment variable.
+ *
+ * \since 1.10.0, 1.8.17
+ *
+ */
H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Retrieves prefix applied to VDS source file paths
+ *
+ * \dapl_id
+ * \param[out] prefix Prefix applied to VDS source file paths
+ * \param[in] size Size of prefix, including null terminator
+ *
+ * \return If successful, returns a non-negative value specifying the size
+ * in bytes of the prefix without the NULL terminator; otherwise
+ * returns a negative value.
+ *
+ * \details H5Pget_virtual_prefix() retrieves the prefix applied to the
+ * path of any VDS source files traversed.
+ *
+ * When an VDS source file is traversed, the prefix is retrieved
+ * from the dataset access property list \p dapl_id, returned
+ * in the user-allocated buffer pointed to by \p prefix, and
+ * prepended to the filename stored in the VDS virtual file, set
+ * with H5Pset_virtual().
+ *
+ * The size in bytes of the prefix, including the NULL terminator,
+ * is specified in \p size. If \p size is unknown, a preliminary
+ * H5Pget_virtual_prefix() call with the pointer \p prefix set to
+ * NULL will return the size of the prefix without the NULL
+ * terminator.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Returns the maximum number of missing source files and/or datasets
+ * with the printf-style names when getting the extent for an unlimited
+ * virtual dataset
+ *
+ * \dapl_id
+ * \param[out] gap_size Maximum number of the files and/or datasets
+ * allowed to be missing for determining the extent
+ * of an unlimited virtual dataset with printf-style
+ * mappings. (\em Default: 0)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_virtual_printf_gap() returns the maximum number of
+ * missing printf-style files and/or datasets for determining the
+ * extent of an unlimited virtual dataaset, \p gap_size, using
+ * the access property list for the virtual dataset, \p dapl_id.
+ *
+ * The default library value for \p gap_size is 0 (zero).
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t dapl_id, hsize_t *gap_size);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Retrieves the view of a virtual dataset accessed with
+ * \p dapl_id
+ *
+ * \dapl_id
+ * \param[out] view The flag specifying the view of the virtual dataset.
+ * Valid values are:
+ * \li #H5D_VDS_FIRST_MISSING
+ * \li #H5D_VDS_LAST_AVAILABLE
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_virtual_view() takes the virtual dataset access property
+ * list, \p dapl_id, and retrieves the flag, \p view, set by the
+ * H5Pset_virtual_view() call.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets two actions to perform when the size of a dataset’s
+ * dimension being appended reaches a specified boundary
+ *
+ * \dapl_id
+ * \param[in] ndims The number of elements for boundary
+ * \param[in] boundary The dimension sizes used to determine the boundary
+ * \param[in] func The user-defined callback function
+ * \param[in] udata The user-defined input data
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_append_flush() sets the following two actions to
+ * perform for a dataset associated with the dataset access
+ * property list \p dapl_id:
+ *
+ * \li Call the callback function \p func set in the property
+ * list
+ * \li Flush the dataset associated with the dataset access
+ * property list
+ *
+ * When a user is appending data to a dataset via H5DOappend()
+ * and the dataset’s newly extended dimension size hits a
+ * specified boundary, the library will perform the first action
+ * listed above. Upon return from the callback function, the
+ * library will then perform the second action listed above and
+ * return to the user. If no boundary is hit or set, the two
+ * actions above are not invoked.
+ *
+ * The specified boundary is indicated by the parameter
+ * \p boundary. It is a 1-dimensional array with \p ndims
+ * elements, which should be the same as the rank of the
+ * dataset’s dataspace. While appending to a dataset along a
+ * particular dimension index via H5Dappend(), the library
+ * determines a boundary is reached when the resulting dimension
+ * size is divisible by \p boundary[index]. A zero value for
+ * \p boundary[index] indicates no boundary is set for that
+ * dimension index.
+ *
+ * The setting of this property will apply only for a chunked
+ * dataset with an extendible dataspace. A dataspace is extendible
+ * when it is defined with either one of the following:
+ *
+ * \li A dataspace with fixed current and maximum dimension sizes
+ * \li A dataspace with at least one unlimited dimension for its
+ * maximum dimension size
+ *
+ * When creating or opening a chunked dataset, the library will
+ * check whether the boundary as specified in the access property
+ * list is set up properly. The library will fail the dataset
+ * create or open if the following conditions are true:
+ *
+ * \li \p ndims, the number of elements for boundary, is not the
+ * same as the rank of the dataset’s dataspace.
+ * \li A non-zero boundary value is specified for a non-extendible
+ * dimension.
+ *
+ * The callback function \p func must conform to the following
+ * prototype:
+ * \snippet H5Dpublic.h H5D_append_cb_t_snip
+ *
+ * The parameters of the callback function, per the above
+ * prototype, are defined as follows:
+ *
+ * \li \p dataset_id is the dataset identifier.
+ * \li \p cur_dims is the dataset’s current dimension sizes when
+ * a boundary is hit.
+ * \li \p user_data is the user-defined input data.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_append_flush(hid_t dapl_id, unsigned ndims, const hsize_t boundary[],
+ H5D_append_cb_t func, void *udata);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets the raw data chunk cache parameters
+ *
+ * \dapl_id
+ * \param[in] rdcc_nslots The number of chunk slots in the raw data chunk
+ * cache for this dataset. Increasing this value
+ * reduces the number of cache collisions, but
+ * slightly increases the memory used. Due to the
+ * hashing strategy, this value should ideally be a
+ * prime number. As a rule of thumb, this value
+ * should be at least 10 times the number of chunks
+ * that can fit in \p rdcc_nbytes bytes. For maximum
+ * performance, this value should be set
+ * approximately 100 times that number of chunks.
+ * The default value is 521. If the value passed is
+ * #H5D_CHUNK_CACHE_NSLOTS_DEFAULT, then the
+ * property will not be set on \p dapl_id and the
+ * parameter will come from the file access
+ * property list used to open the file.
+ * \param[in] rdcc_nbytes The total size of the raw data chunk cache for
+ * this dataset. In most cases increasing this
+ * number will improve performance, as long as
+ * you have enough free memory.
+ * The default size is 1 MB. If the value passed is
+ * #H5D_CHUNK_CACHE_NBYTES_DEFAULT, then the
+ * property will not be set on \p dapl_id and the
+ * parameter will come from the file access
+ * property list.
+ * \param[in] rdcc_w0 The chunk preemption policy for this dataset.
+ * This must be between 0 and 1 inclusive and
+ * indicates the weighting according to which chunks
+ * which have been fully read or written are
+ * penalized when determining which chunks to flush
+ * from cache. A value of 0 means fully read or
+ * written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU)
+ * while a value of 1 means fully read or written
+ * chunks are always preempted before other chunks.
+ * If your application only reads or writes data
+ * once, this can be safely set to 1. Otherwise,
+ * this should be set lower, depending on how often
+ * you re-read or re-write the same data.
+ * The default value is 0.75. If the value passed is
+ * #H5D_CHUNK_CACHE_W0_DEFAULT, then the property
+ * will not be set on \p dapl_id and the parameter
+ * will come from the file access property list.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_chunk_cache() sets the number of elements, the total
+ * number of bytes, and the preemption policy value in the raw
+ * data chunk cache on a dataset access property list. After
+ * calling this function, the values set in the property list
+ * will override the values in the file's file access property
+ * list.
+ *
+ * The raw data chunk cache inserts chunks into the cache
+ * by first computing a hash value using the address of a chunk,
+ * then using that hash value as the chunk's index into the table
+ * of cached chunks. The size of this hash table, i.e., and the
+ * number of possible hash values, is determined by the
+ * \p rdcc_nslots parameter. If a different chunk in the cache
+ * has the same hash value, this causes a collision, which
+ * reduces efficiency. If inserting the chunk into cache would
+ * cause the cache to be too big, then the cache is pruned
+ * according to the \p rdcc_w0 parameter.
+ *
+ * \b Motivation: H5Pset_chunk_cache() is used to adjust the chunk
+ * cache parameters on a per-dataset basis, as opposed to a global
+ * setting for the file using H5Pset_cache(). The optimum chunk
+ * cache parameters may vary widely with different data layout and
+ * access patterns, so for optimal performance they must be set
+ * individually for each dataset. It may also be beneficial to
+ * reduce the size of the chunk cache for datasets whose
+ * performance is not important in order to save memory space.
+ *
+ * \b Example \b Usage: The following code sets the chunk cache to
+ * use a hash table with 12421 elements and a maximum size of
+ * 16 MB, while using the preemption policy specified for the
+ * entire file:
+ * \Code{
+ * H5Pset_chunk_cache(dapl_id, 12421, 16*1024*1024,
+ * H5D_CHUNK_CACHE_W0_DEFAULT);}
+ *
+ * \b Usage \b Notes: The chunk cache size is a property for
+ * accessing a dataset and is not stored with a dataset or a
+ * file. To guarantee the same chunk cache settings each time
+ * the dataset is opened, call H5Dopen() with a dataset access
+ * property list where the chunk cache size is set by calling
+ * H5Pset_chunk_cache() for that property list. The property
+ * list can be used for multiple accesses in the same
+ * application.
+ *
+ * For files where the same chunk cache size will be
+ * appropriate for all or most datasets, H5Pset_cache() can
+ * be called with a file access property list to set the
+ * chunk cache size for accessing all datasets in the file.
+ *
+ * Both methods can be used in combination, in which case
+ * the chunk cache size set by H5Pset_cache() will apply
+ * except for specific datasets where H5Dopen() is called
+ * with dataset property list with the chunk cache size
+ * set by H5Pset_chunk_cache().
+ *
+ * In the absence of any cache settings, H5Dopen() will
+ * by default create a 1 MB chunk cache for the opened
+ * dataset. If this size happens to be appropriate, no
+ * call will be needed to either function to set the
+ * chunk cache size.
+ *
+ * It is also possible that a change in access pattern
+ * for later access to a dataset will change the
+ * appropriate chunk cache size.
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets the external dataset storage file prefix in the dataset
+ * access property list
+ *
+ * \dapl_id
+ * \param[in] prefix Dataset external storage prefix in UTF-8 or ASCII
+ * (<em>Path and filename must be ASCII on Windows systems.</em>)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_efile_prefix() sets the prefix used to locate raw data
+ * files for a dataset that uses external storage. This prefix
+ * can provide either an absolute path or a relative path to the
+ * external files.
+ *
+ * H5Pset_efile_prefix() is used in conjunction with
+ * H5Pset_external() to control the behavior of the HDF5 library
+ * when searching for the raw data files associated with a dataset
+ * that uses external storage:
+ *
+ * \li The default behavior of the library is to search for the
+ * dataset’s external storage raw data files in the same
+ * directory as the HDF5 file which contains the dataset.
+ * \li If the prefix is set to an absolute path, the target
+ * directory will be searched for the dataset’s external
+ * storage raw data files.
+ * \li If the prefix is set to a relative path, the target
+ * directory, relative to the current working directory, will
+ * be searched for the dataset’s external storage raw data
+ * files.
+ * \li If the prefix is set to a relative path that begins with
+ * the special token ${ORIGIN}, that directory, relative to
+ * the HDF5 file containing the dataset, will be searched for
+ * the dataset’s external storage raw data files.
+ *
+ * The HDF5_EXTFILE_PREFIX environment variable can be used to
+ * override the above behavior (the environment variable
+ * supersedes the API call). Setting the variable to a path
+ * string and calling H5Dcreate() or H5Dopen() is the equivalent
+ * of calling H5Pset_efile_prefix() and calling the same create
+ * or open function. The environment variable is checked at the
+ * time of the create or open action and copied so it can be
+ * safely changed after the H5Dcreate() or H5Dopen() call.
+ *
+ * Calling H5Pset_efile_prefix() with \p prefix set to NULL or
+ * the empty string returns the search path to the default. The
+ * result would be the same as if H5Pset_efile_prefix() had never
+ * been called.
+ *
+ * \note If the external file prefix is not an absolute path and the HDF5
+ * file is moved, the external storage files will also need to be
+ * moved so they can be accessed at the new location.
+ *
+ * \note As stated above, the use of the HDF5_EXTFILE_PREFIX environment
+ * variable overrides any property list setting.
+ * H5Pset_efile_prefix() and H5Pget_efile_prefix(), being property
+ * functions, set and retrieve only the property list setting; they
+ * are unaware of the environment variable.
+ *
+ * \note On Windows, the prefix must be an ASCII string since the Windows
+ * standard C library’s I/O functions cannot handle UTF-8 file names.
+ *
+ * \since 1.10.0, 1.8.17
+ *
+ */
+H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets prefix to be applied to VDS source file paths
+ *
+ * \dapl_id
+ * \param[in] prefix Prefix to be applied to VDS source file paths
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_virtual_prefix() sets the prefix to be applied to the
+ * path of any VDS source files traversed. The prefix is prepended
+ * to the filename stored in the VDS virtual file, set with
+ * H5Pset_virtual().
+ *
+ * The prefix is specified in the user-allocated buffer \p prefix
+ * and set in the dataset access property list \p dapl_id. The
+ * buffer should not be freed until the property list has been
+ * closed.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.2
+ *
+ */
+H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets the maximum number of missing source files and/or datasets
+ * with the printf-style names when getting the extent of an
+ * unlimited virtual dataset
+ *
+ * \dapl_id
+ * \param[in] gap_size Maximum number of files and/or datasets allowed to
+ * be missing for determining the extent of an
+ * unlimited virtual dataset with printf-style
+ * mappings (<em>Default value</em>: 0)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_virtual_printf_gap() sets the access property list for
+ * the virtual dataset, \p dapl_id, to instruct the library to
+ * stop looking for the mapped data stored in the files and/or
+ * datasets with the printf-style names after not finding
+ * \p gap_size files and/or datasets. The found source files and
+ * datasets will determine the extent of the unlimited virtual
+ * dataset with the printf-style mappings.
+ *
+ * Consider the following examples where the regularly spaced
+ * blocks of a virtual dataset are mapped to datasets with the
+ * names d-1, d-2, d-3, ..., d-N, ... :
+ *
+ * \li If the dataset d-2 is missing and \p gap_size is set to 0,
+ * then the virtual dataset will contain only data found
+ * in d-1.
+ * \li If d-2 and d-3 are missing and \p gap_size is set to 2,
+ * then the virtual dataset will contain the data from
+ * d-1, d-3, ..., d-N, ... . The blocks that are mapped to
+ * d-2 and d-3 will be filled according to the virtual
+ * dataset’s fill value setting.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size);
+/**
+ * \ingroup DAPL
+ *
+ * \brief Sets the view of the virtual dataset (VDS) to include or exclude
+ * missing mapped elements
+ *
+ * \dapl_id
+ * \param[in] view Flag specifying the extent of the data to be included
+ * in the view. Valid values are:
+ * \li #H5D_VDS_FIRST_MISSING: View includes all data
+ * before the first missing mapped data
+ * \li #H5D_VDS_LAST_AVAILABLE View includes all
+ * available mapped data
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_virtual_view() takes the access property list for the
+ * virtual dataset, \p dapl_id, and the flag, \p view, and sets
+ * the VDS view according to the flag value.
+ *
+ * If \p view is set to #H5D_VDS_FIRST_MISSING, the view includes
+ * all data before the first missing mapped data. This setting
+ * provides a view containing only the continuous data starting
+ * with the dataset’s first data element. Any break in
+ * continuity terminates the view.
+ *
+ * If \p view is set to #H5D_VDS_LAST_AVAILABLE, the view
+ * includes all available mapped data.
+ *
+ * Missing mapped data is filled with the fill value set in the
+ * VDS creation property list.
+ *
+ * \see_virtual
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pset_virtual_view(hid_t dapl_id, H5D_vds_view_t view);
/* Dataset xfer property list (DXPL) routines */
-H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression);
-H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size);
-H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
-H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/);
-H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status);
-H5_DLL int H5Pget_preserve(hid_t plist_id);
-H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets B-tree split ratios for a dataset transfer property list
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] left The B-tree split ratio for left-most nodes
+ * \param[out] middle The B-tree split ratio for right-most nodes and lone nodes
+ * \param[out] right The B-tree split ratio for all other nodes
+ * \return \herr_t
+ *
+ * \details H5Pget_btree_ratios() returns the B-tree split ratios for a dataset
+ * transfer property list.
+ *
+ * The B-tree split ratios are returned through the non-NULL arguments
+ * \p left, \p middle, and \p right, as set by the H5Pset_btree_ratios()
+ * function.
+ *
+ */
+H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/,
+ double *right /*out*/);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Reads buffer settings
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ * \param[out] tconv Address of the pointer to application-allocated type
+ * conversion buffer
+ * \param[out] bkg Address of the pointer to application-allocated
+ * background buffer
+ *
+ * \return Returns buffer size, in bytes, if successful; otherwise 0 on failure.
+ *
+ * \details H5Pget_buffer() reads values previously set with H5Pset_buffer().
+ *
+ * \version 1.6.0 The return type changed from \p hsize_t to \p size_t.
+ * \version 1.4.0 The return type changed to \p hsize_t.
+ *
+ */
+H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Retrieves a data transform expression
+ *
+ * \param[in] plist_id Identifier of the property list or class
+ * \param[out] expression Pointer to memory where the transform expression will
+ * be copied
+ * \param[in] size Number of bytes of the transform expression to copy
+ * to
+ *
+ * \return Success: the size of the transform expression. Failure: a negative
+ * value.
+ *
+ * \details H5Pget_data_transform() retrieves the data transform expression
+ * previously set in the dataset transfer property list \p plist_id
+ * by H5Pset_data_transform().
+ *
+ * H5Pget_data_transform() can be used to both retrieve the transform
+ * expression and query its size.
+ *
+ * If \p expression is non-NULL, up to \p size bytes of the data
+ * transform expression are written to the buffer. If \p expression
+ * is NULL, \p size is ignored, and the function does not write
+ * anything to the buffer. The function always returns the size of
+ * the data transform expression.
+ *
+ * If 0 is returned for the size of the expression, no data transform
+ * expression exists for the property list.
+ *
+ * If an error occurs, the buffer pointed to by \p expression is
+ * unchanged, and the function returns a negative value.
+ *
+ * \par Example
+ * An example snippet from examples/h5_dtransform.c:
+ * \snippet h5_dtransform.c H5Pget_data_transform_snip
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Determines whether error-detection is enabled for dataset reads
+ *
+ * \param[in] plist_id Dataset transfer property list identifier
+ *
+ * \return Returns \p H5Z_ENABLE_EDC or \p H5Z_DISABLE_EDC if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Pget_edc_check() queries the dataset transfer property
+ * list \p plist to determine whether error detection is enabled for
+ * data read operations.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id);
-H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data);
-H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right);
-H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/,
- double *right /*out*/);
-H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info,
- H5MM_free_t free_func, void *free_info);
-H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info,
- H5MM_free_t *free_func, void **free_info);
-H5_DLL herr_t H5Pset_hyper_vector_size(hid_t fapl_id, size_t size);
-H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/);
-H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data);
-H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Retrieves number of I/O vectors to be read/written in hyperslab I/O
+ *
+ * \param[in] fapl_id Dataset transfer property list identifier
+ * \param[out] size Number of I/O vectors to accumulate in memory for I/O operations
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_hyper_vector_size() retrieves the number of I/O vectors to be accumulated in
+ * memory before being issued to the lower levels of the HDF5 library for reading or
+ * writing the actual data.
+ *
+ * The number of I/O vectors set in the dataset transfer property list \p fapl_id is
+ * returned in \p size. Unless the default value is in use, \p size was
+ * previously set with a call to H5Pset_hyper_vector_size().
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Checks status of the dataset transfer property list (\b DEPRECATED)
+ *
+ * \deprecated{H5Pget_preserve() is deprecated as it is no longer useful;
+ * compound datatype field preservation is now core functionality
+ * in the HDF5 library.}
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ *
+ * \return Returns 1 or 0 if successful; otherwise returns a negative value.
+ *
+ * \details H5Pget_preserve() checks the status of the dataset transfer
+ * property list.
+ *
+ * \version 1.6.0 The flag parameter was changed from INTEGER to LOGICAL to
+ * better match the C API. (Fortran 90)
+ *
+ */
+H5_DLL int H5Pget_preserve(hid_t plist_id);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets user-defined datatype conversion callback function
+ *
+ * \param[in] dxpl_id Dataset transfer property list identifier
+ * \param[out] op User-defined type conversion callback function
+ * \param[out] operate_data User-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_type_conv_cb() gets the user-defined datatype conversion
+ * callback function \p op in the dataset transfer property list
+ * \p dxpl_id.
+ *
+ * The parameter \p operate_data is a pointer to user-defined input
+ * data for the callback function.
+ *
+ * The callback function \p op defines the actions an application is
+ * to take when there is an exception during datatype conversion.
+ *
+ * Please refer to the function H5Pset_type_conv_cb() for more details.
+ *
+ */
+H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets the memory manager for variable-length datatype allocation in H5Dread() and H5Dvlen_reclaim()
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ * \param[out] alloc_func User's allocate routine, or NULL for system malloc
+ * \param[out] alloc_info Extra parameter for user’s allocation routine.
+ * Contents are ignored if preceding
+ * parameter is NULL \param[out] free_func User's free routine, or NULL for
+ * system free \param[out] free_info
+ * Extra parameter for user’s free routine. Contents are ignored if preceding
+ * parameter is NULL
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vlen_mem_manager() is the companion function to
+ * H5Pset_vlen_mem_manager(), returning the parameters set by
+ * that function.
+ *
+ */
+H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info,
+ H5MM_free_t *free_func, void **free_info);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets B-tree split ratios for a dataset transfer property list
+ *
+ * \param[in] plist_id The dataset transfer property list identifier
+ * \param[in] left The B-tree split ratio for left-most nodes
+ * \param[in] middle The B-tree split ratio for all other nodes
+ * \param[in] right The B-tree split ratio for right-most nodes and lone
+ * nodes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_btree_ratios() sets the B-tree split ratios for a dataset
+ * transfer property list. The split ratios determine what percent of
+ * children go in the first node when a node splits.
+ *
+ * The ratio \p left is used when the splitting node is the left-most
+ * node at its level in the tree;
+ * the ratio \p right is used when the splitting node is the right-most
+ * node at its level; and
+ * the ratio \p middle is used for all other cases.
+ *
+ * A node that is the only node at its level in the tree uses the
+ * ratio \p right when it splits.
+ *
+ * All ratios are real numbers between 0 and 1, inclusive.
+ *
+ */
+H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right);
+
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets type conversion and background buffers
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] size Size, in bytes, of the type conversion and background buffers
+ * \param[in] tconv Pointer to application-allocated type conversion buffer
+ * \param[in] bkg Pointer to application-allocated background buffer
+ * \return \herr_t
+ *
+ * \details Given a dataset transfer property list, H5Pset_buffer() sets the
+ * maximum size for the type conversion buffer and background buffer
+ * and optionally supplies pointers to application-allocated
+ * buffers. If the buffer size is smaller than the entire amount of
+ * data being transferred between the application and the file, and a
+ * type conversion buffer or background buffer is required, then strip
+ * mining will be used.
+ *
+ * Note that there are minimum size requirements for the buffer. Strip
+ * mining can only break the data up along the first dimension, so the
+ * buffer must be large enough to accommodate a complete slice that
+ * encompasses all of the remaining dimensions. For example, when strip
+ * mining a \Code{100x200x300} hyperslab of a simple data space, the
+ * buffer must be large enough to hold \Code{1x200x300} data
+ * elements. When strip mining a \Code{100x200x300x150} hyperslab of a
+ * simple data space, the buffer must be large enough to hold
+ * \Code{1x200x300x150} data elements.
+ *
+ * If \p tconv and/or \p bkg are null pointers, then buffers will be
+ * allocated and freed during the data transfer.
+ *
+ * The default value for the maximum buffer is 1 MiB.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type hsize_t to \c size_t.
+ * \version 1.4.0 The \p size parameter has changed to type hsize_t.
+ *
+ */
+H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets a data transform expression
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] expression Pointer to the null-terminated data transform
+ * expression
+ * \return \herr_t
+ *
+ * \details H5Pset_data_transform() sets the data transform to be used for
+ * reading and writing data. This function operates on the dataset
+ * transfer property list \p plist_id.
+ *
+ * The \p expression parameter is a string containing an algebraic
+ * expression, such as \Code{(5/9.0)*(x-32)} or \Code{x*(x-5)}. When a
+ * dataset is read or written with this property list, the transform
+ * expression is applied with the \c x being replaced by the values in
+ * the dataset. When reading data, the values in the file are not
+ * changed and the transformed data is returned to the user.
+ *
+ * Data transforms can only be applied to integer or
+ * floating-point datasets. Order of operations is obeyed and
+ * the only supported operations are +, -, *, and /. Parentheses
+ * can be nested arbitrarily and can be used to change precedence.
+ * When writing data back to the dataset, the transformed data is
+ * written to the file and there is no way to recover the original
+ * values to which the transform was applied.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the dataset transfer property list to enable or disable error
+ * detection when reading data
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] check Specifies whether error checking is enabled or disabled
+ * for dataset read operations
+ * \return \herr_t
+ *
+ * \details H5Pset_edc_check() sets the dataset transfer property list \p plist
+ * to enable or disable error detection when reading data.
+ *
+ * Whether error detection is enabled or disabled is specified in the
+ * \p check parameter. Valid values are #H5Z_ENABLE_EDC (default) and
+ * #H5Z_DISABLE_EDC.
+ *
+ * \note The initial error detection implementation, Fletcher32 checksum,
+ * supports error detection for chunked datasets only.
+ *
+ * \attention The Fletcher32 EDC checksum filter, set with H5Pset_fletcher32(),
+ * was added in HDF5 Release 1.6.0. In the original implementation,
+ * however, the checksum value was calculated incorrectly on
+ * little-endian systems. The error was fixed in HDF5 Release 1.6.3.\n
+ * As a result of this fix, an HDF5 library of Release 1.6.0 through
+ * Release 1.6.2 cannot read a dataset created or written with
+ * Release 1.6.3 or later if the dataset was created with the
+ * checksum filter and the filter is enabled in the reading
+ * library. (Libraries of Release 1.6.3 and later understand the
+ * earlier error and compensate appropriately.)\n
+ * \Bold{Work-around:} An HDF5 library of Release 1.6.2 or earlier
+ * will be able to read a dataset created or written with the
+ * checksum filter by an HDF5 library of Release 1.6.3 or later if
+ * the checksum filter is disabled for the read operation. This can
+ * be accomplished via an H5Pset_edc_check() call with the value
+ * #H5Z_DISABLE_EDC in the second parameter. This has the obvious
+ * drawback that the application will be unable to verify the
+ * checksum, but the data does remain accessible.
+ *
+ * \version 1.6.3 Error in checksum calculation on little-endian systems
+ * corrected in this release.
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets user-defined filter callback function
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] func User-defined filter callback function
+ * \param[in] op_data User-defined input data for the callback function
+ * \return \herr_t
+ *
+ * \details H5Pset_filter_callback() sets the user-defined filter callback
+ * function \p func in the dataset transfer property list \p plist_id.
+ *
+ * The parameter \p op_data is a pointer to user-defined input data for
+ * the callback function and will be passed through to the callback
+ * function.
+ *
+ * The callback function \p func defines the actions an application is
+ * to take when a filter fails. The function prototype is as follows:
+ * \snippet H5Zpublic.h H5Z_filter_func_t_snip
+ * where \c filter indicates which filter has failed, \c buf and \c buf_size
+ * are used to pass in the failed data, and op_data is the required
+ * input data for this callback function.
+ *
+ * Valid callback function return values are #H5Z_CB_FAIL and #H5Z_CB_CONT.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets number of I/O vectors to be read/written in hyperslab I/O
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] size Number of I/O vectors to accumulate in memory for I/O
+ * operations\n
+ * Must be greater than 1 (one)\n
+ * Default value: 1024
+ * \return \herr_t
+ *
+ * \details H5Pset_hyper_vector_size() sets the number of I/O vectors to be
+ * accumulated in memory before being issued to the lower levels of
+ * the HDF5 library for reading or writing the actual data.
+ *
+ * The I/O vectors are hyperslab offset and length pairs and are
+ * generated during hyperslab I/O.
+ *
+ * The number of I/O vectors is passed in \p size to be set in the
+ * dataset transfer property list \p plist_id. \p size must be
+ * greater than 1 (one).
+ *
+ * H5Pset_hyper_vector_size() is an I/O optimization function;
+ * increasing vector_size should provide better performance, but the
+ * library will use more memory during hyperslab I/O. The default value
+ * of \p size is 1024.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t size);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the dataset transfer property list \p status
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] status Status toggle of the dataset transfer property list
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated as it no longer has any effect;
+ * compound datatype field preservation is now core functionality in
+ * the HDF5 library.
+ *
+ * \details H5Pset_preserve() sets the dataset transfer property list status to
+ * \c 1 or \c 0.
+ *
+ * When reading or writing compound datatypes and the destination is
+ * partially initialized and the read/write is intended to initialize
+ * the other members, one must set this property to \c 1. Otherwise the
+ * I/O pipeline treats the destination datapoints as completely
+ * uninitialized.
+ *
+ * \todo Add missing version information: introduction, deprecation, etc.
+ * Why is the declaration not in the deprecated section?
+ *
+ */
+H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets user-defined datatype conversion callback function
+ *
+ * \dxpl_id
+ * \param[in] op User-defined type conversion callback function
+ * \param[in] operate_data User-defined input data for the callback function
+ * \return \herr_t
+ *
+ * \details H5Pset_type_conv_cb() sets the user-defined datatype conversion
+ * callback function \p op in the dataset transfer property list \p
+ * dxpl_id
+ *
+ * The parameter operate_data is a pointer to user-defined input data
+ * for the callback function and will be passed through to the callback
+ * function.
+ *
+ * The callback function \p op defines the actions an application is to
+ * take when there is an exception during datatype conversion. The
+ * function prototype is as follows:
+ * \snippet H5Tpublic.h H5T_conv_except_func_t_snip
+ *
+ * \todo Add version information.
+ *
+ */
+H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the memory manager for variable-length datatype allocation in
+ * H5Dread() and H5Dvlen_reclaim()
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] alloc_func User's allocate routine, or \c NULL for system \c malloc
+ * \param[in] alloc_info Extra parameter for user's allocation routine.
+ * Contents are ignored if preceding parameter is \c NULL.
+ * \param[in] free_func User's free routine, or \c NULL for system \c free
+ * \param[in] free_info Extra parameter for user's free routine. Contents are
+ * ignored if preceding parameter is \c NULL
+ * \return \herr_t
+ *
+ * \details H5Pset_vlen_mem_manager() sets the memory manager for
+ * variable-length datatype allocation in H5Dread() and free in
+ * H5Dvlen_reclaim().
+ *
+ * The \p alloc_func and \p free_func parameters identify the memory
+ * management routines to be used. If the user has defined custom
+ * memory management routines, \p alloc_func and/or free_func should be
+ * set to make those routine calls (i.e., the name of the routine is
+ * used as the value of the parameter); if the user prefers to use the
+ * system's \c malloc and/or \c free, the \p alloc_func and \p
+ * free_func parameters, respectively, should be set to \c NULL
+ *
+ * The prototypes for these user-defined functions are as follows:
+ * \snippet H5MMpublic.h H5MM_allocate_t_snip
+ *
+ * \snippet H5MMpublic.h H5MM_free_t_snip
+ *
+ * The \p alloc_info and \p free_info parameters can be used to pass
+ * along any required information to the user's memory management
+ * routines.
+ *
+ * In summary, if the user has defined custom memory management
+ * routines, the name(s) of the routines are passed in the \p
+ * alloc_func and \p free_func parameters and the custom routines'
+ * parameters are passed in the \p alloc_info and \p free_info
+ * parameters. If the user wishes to use the system \c malloc and \c
+ * free functions, the \p alloc_func and/or \p free_func parameters are
+ * set to \c NULL and the \p alloc_info and \p free_info parameters are
+ * ignored.
+ *
+ * \todo Add version information.
+ */
+H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info,
+ H5MM_free_t free_func, void *free_info);
+
#ifdef H5_HAVE_PARALLEL
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves the type of chunk optimization that HDF5 actually performed
+ * on the last parallel I/O call (not necessarily the type requested)
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] actual_chunk_opt_mode The type of chunk optimization performed by HDF5
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list
+ * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio().
+ * However, HDF5 will sometimes ignore this request and perform independent
+ * I/O instead. This property allows the user to see what kind of I/O HDF5
+ * actually performed. Used in conjunction with H5Pget_mpio_actual_io_mode(),
+ * this property allows the user to determine exactly what HDF5 did when
+ * attempting collective I/O.
+ *
+ * \details H5Pget_mpio_actual_chunk_opt_mode() retrieves the type of chunk
+ * optimization performed when collective I/O was requested. This
+ * property is set before I/O takes place, and will be set even if I/O
+ * fails.
+ *
+ * Valid values returned in \p actual_chunk_opt_mode:
+ * \snippet this H5D_mpio_actual_chunk_opt_mode_t_snip
+ * \click4more
+ *
+ * \since 1.8.8
+ *
+ */
H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id,
H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves the type of I/O that HDF5 actually performed on the last
+ * parallel I/O call (not necessarily the type requested)
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] actual_io_mode The type of I/O performed by this process
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list
+ * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio().
+ * However, HDF5 will sometimes ignore this request and perform independent
+ * I/O instead. This property allows the user to see what kind of I/O HDF5
+ * actually performed. Used in conjunction with H5Pget_mpio_actual_chunk_opt_mode(),
+ * this property allows the user to determine exactly HDF5 did when
+ * attempting collective I/O.
+ *
+ * \details H5Pget_mpio_actual_io_mode() retrieves the type of I/O performed on
+ * the selection of the current process. This property is set after all
+ * I/O is completed; if I/O fails, it will not be set.
+ *
+ * Valid values returned in \p actual_io_mode:
+ * \snippet this H5D_mpio_actual_io_mode_t_snip
+ * \click4more
+ *
+ * \attention All processes do not need to have the same value. For example, if
+ * I/O is being performed using the multi chunk optimization scheme,
+ * one process's selection may include only chunks accessed
+ * collectively, while another may include chunks accessed
+ * independently. In this case, the first process will report
+ * #H5D_MPIO_CHUNK_COLLECTIVE while the second will report
+ * #H5D_MPIO_CHUNK_INDEPENDENT.
+ *
+ * \see H5Pget_mpio_no_collective_cause(), H5Pget_mpio_actual_chunk_opt_mode()
+ *
+ * \since 1.8.8
+ *
+ */
H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves local and global causes that broke collective I/O on the last
+ * parallel I/O call
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] local_no_collective_cause An enumerated set value indicating the
+ * causes that prevented collective I/O in the local process
+ * \param[out] global_no_collective_cause An enumerated set value indicating
+ * the causes across all processes that prevented collective I/O
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list (DXPL)
+ * that has been suitably modified with H5P_SET_DXPL_MPIO. However, there are
+ * conditions that can cause HDF5 to forgo collective I/O and perform
+ * independent I/O. Such causes can be different across the processes of a
+ * parallel application. This function allows the user to determine what
+ * caused the HDF5 library to skip collective I/O locally, that is in the
+ * local process, and globally, across all processes.
+ *
+ * \details H5Pget_mpio_no_collective_cause() serves two purposes. It can be
+ * used to determine whether collective I/O was used for the last
+ * preceding parallel I/O call. If collective I/O was not used, the
+ * function retrieves the local and global causes that broke collective
+ * I/O on that parallel I/O call. The properties retrieved by this
+ * function are set before I/O takes place and are retained even when
+ * I/O fails.
+ *
+ * Valid values returned in \p local_no_collective_cause and \p
+ * global_no_collective_cause are as follows or, if there are multiple
+ * causes, a bitwise OR of the relevant causes; the numbers in the
+ * center column are the bitmask values:
+ * \snippet this H5D_mpio_no_collective_cause_t_snip
+ * \click4more
+ *
+ * \attention Each process determines whether it can perform collective I/O and
+ * broadcasts the result. Those results are combined to make a
+ * collective decision; collective I/O will be performed only if all
+ * processes can perform collective I/O.\n
+ * If collective I/O was not used, the causes that prevented it are
+ * reported by individual process by means of an enumerated set. The
+ * causes may differ among processes, so H5Pget_mpio_no_collective_cause()
+ * returns two property values. The first value is the one produced
+ * by the local process to report local causes. This local information
+ * is encoded in an enumeration, the \ref H5D_mpio_no_collective_cause_t
+ * described above, with all individual causes combined into a single
+ * enumeration value by means of a bitwise OR operation. The second
+ * value reports global causes; this global value is the result of a
+ * bitwise-OR operation across the values returned by all the processes.
+ *
+ * \since 1.8.10
+ *
+ */
H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause,
uint32_t *global_no_collective_cause);
#endif /* H5_HAVE_PARALLEL */
/* Link creation property list (LCPL) routines */
-H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
+/**
+ * \ingroup ALCAPL
+ *
+ * \brief Determines whether property is set to enable creating missing
+ * intermediate groups
+ *
+ * \lcpl_id{plist_id}
+ * \param[out] crt_intmd Flag specifying whether to create intermediate
+ * groups upon creation of an object
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_create_intermediate_group() determines whether the link
+ * creation property list \p plist_id is set to allow functions
+ * that create objects in groups different from the current
+ * working group to create intermediate groups that may be
+ * missing in the path of a new or moved object.
+ *
+ * Functions that create objects in or move objects to a group
+ * other than the current working group make use of this
+ * property. H5Gcreate_anon() and H5Lmove() are examples of such
+ * functions.
+ *
+ * If \p crt_intmd is positive, missing intermediate groups will
+ * be created; if \p crt_intmd is non-positive, missing intermediate
+ * groups will not be created.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
+/**
+ * \ingroup ALCAPL
+ *
+ * \brief Specifies in property list whether to create missing
+ * intermediate groups
+ *
+ * \lcpl_id{plist_id}
+ * \param[in] crt_intmd Flag specifying whether to create intermediate
+ * groups upon the creation of an object
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_create_intermediate_group()
+ *
+ * \since
+ *
+ */
+H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
/* Group creation property list (GCPL) routines */
-H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint);
-H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/);
-H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
+
+/**
+ * \ingroup GCPL
+ *
+ * \brief Returns the estimated link count and average link name length in a group
+ *
+ * \gcpl_id{plist_id}
+ * \param[out] est_num_entries The estimated number of links in the group
+ * referenced by \p plist_id
+ * \param[out] est_name_len The estimated average length of line names in the group
+ * referenced by \p plist_id
+ * \return \herr_t
+ *
+ * \details H5Pget_est_link_info() retrieves two settings from the group creation
+ * property list \p plist_id: the estimated number of links that are
+ * expected to be inserted into a group created with the property list
+ * and the estimated average length of those link names.
+ *
+ * The estimated number of links is returned in \p est_num_entries. The
+ * limit for \p est_num_entries is 64 K.
+ *
+ * The estimated average length of the anticipated link names is returned
+ * in \p est_name_len. The limit for \p est_name_len is 64 K.
+ *
+ * See \ref_group_impls for a discussion of the available types of HDF5
+ * group structures.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */,
+ unsigned *est_name_len /* out */);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Queries whether link creation order is tracked and/or indexed in
+ * a group
+ *
+ * \param[in] plist_id Group or file creation property list
+ * identifier
+ * \param[out] crt_order_flags Creation order flag(s)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_link_creation_order() queries the group or file creation
+ * property list, \p plist_id, and returns a flag indicating whether
+ * link creation order is tracked and/or indexed in a group.
+ *
+ * See H5Pset_link_creation_order() for a list of valid creation
+ * order flags, as passed in \p crt_order_flags, and their
+ * meanings.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Queries the settings for conversion between compact and dense
+ * groups
+ *
+ * \gcpl_id{plist_id}
+ * \param[out] max_compact Maximum number of links for compact storage
+ * \param[out] min_dense Minimum number of links for dense storage
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_link_phase_change() queries the maximum number of
+ * entries for a compact group and the minimum number of links
+ * to require before converting a group to a dense form.
+ *
+ * In the compact format, links are stored as messages in the
+ * group’s header. In the dense format, links are stored in a
+ * fractal heap and indexed with a version 2 B-tree.
+ *
+ * \p max_compact is the maximum number of links to store as
+ * header messages in the group header before converting the
+ * group to the dense format. Groups that are in the compact
+ * format and exceed this number of links are automatically
+ * converted to the dense format.
+ *
+ * \p min_dense is the minimum number of links to store in the
+ * dense format. Groups which are in dense format and in which
+ * the number of links falls below this number are automatically
+ * converted back to the compact format.
+ *
+ * In the compact format, links are stored as messages in the
+ * group’s header. In the dense format, links are stored in a
+ * fractal heap and indexed with a version 2 B-tree.
+ *
+ * See H5Pset_link_phase_change() for a discussion of
+ * traditional, compact, and dense group storage.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/,
unsigned *min_dense /*out*/);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Retrieves the anticipated size of the local heap for original-style
+ * groups
+ *
+ * \gcpl_id{plist_id}
+ * \param[out] size_hint Anticipated size of local heap
+ * \return \herr_t
+ *
+ * \details H5Pget_local_heap_size_hint() queries the group creation property
+ * list, \p plist_id, for the anticipated size of the local heap, \p
+ * size_hint, for original-style groups, i.e., for groups of the style
+ * used prior to HDF5 Release 1.8.0. See H5Pset_local_heap_size_hint()
+ * for further discussion.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Sets estimated number of links and length of link names in a group
+ *
+ * \gcpl_id{plist_id}
+ * \param[in] est_num_entries Estimated number of links to be inserted into group
+ * \param[in] est_name_len Estimated average length of link names
+ * \return \herr_t
+ *
+ * \details H5Pset_est_link_info() inserts two settings into the group creation
+ * property list plist_id: the estimated number of links that are
+ * expected to be inserted into a group created with the property list
+ * and the estimated average length of those link names.
+ *
+ * The estimated number of links is passed in \p est_num_entries. The
+ * limit for \p est_num_entries is 64 K.
+ *
+ * The estimated average length of the anticipated link names is passed
+ * in \p est_name_len. The limit for \p est_name_len is 64 K.
+ *
+ * The values for these two settings are multiplied to compute the
+ * initial local heap size (for old-style groups, if the local heap
+ * size hint is not set) or the initial object header size for
+ * (new-style compact groups; see \ref_group_impls). Accurately setting
+ * these parameters will help reduce wasted file space.
+ *
+ * If a group is expected to have many links and to be stored in dense
+ * format, set \p est_num_entries to 0 (zero) for maximum
+ * efficiency. This will prevent the group from being created in the
+ * compact format.
+ *
+ * See \ref_group_impls for a discussion of the available types of HDF5
+ * group structures.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len);
-H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */,
- unsigned *est_name_len /* out */);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Sets creation order tracking and indexing for links in a group
+ *
+ * \param[in] plist_id Group or file creation property list
+ * identifier
+ * \param[out] crt_order_flags Creation order flag(s)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_link_creation_order() sets flags for tracking and
+ * indexing links on creation order in groups created with the
+ * group (or file) creation property list \p plist_id.
+ *
+ * \p crt_order_flags contains flags with the following meanings:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_TRACKED</td>
+ * <td>Link creation order is tracked but not necessarily
+ * indexed</td>
+ * </tr>
+ * <tr>
+ * <td>#H5P_CRT_ORDER_INDEXED</td>
+ * <td>Link creation order is indexed (requires
+ * #H5P_CRT_ORDER_TRACKED)</td>
+ * </tr>
+ * </table>
+ *
+ * The default behavior is that links are tracked and indexed by
+ * name, and link creation order is neither tracked nor indexed.
+ * The name is always the primary index for links in a group.
+ *
+ * H5Pset_link_creation_order() can be used to set link creation
+ * order tracking, or to set link creation order tracking and
+ * indexing.
+ *
+ * If (#H5P_CRT_ORDER_TRACKED | #H5P_CRT_ORDER_INDEXED) is
+ * specified for \p crt_order_flags, then links will be tracked
+ * and indexed by creation order. The creation order is added as
+ * a secondary index and enables faster queries and iterations
+ * by creation order.
+ *
+ * If just #H5P_CRT_ORDER_TRACKED is specified for
+ * \p crt_order_flags, then links will be tracked by creation
+ * order, but not indexed by creation order. Queries and iterations
+ * by creation order will work but will be much slower for large
+ * groups than if #H5P_CRT_ORDER_INDEXED had been included.
+ *
+ * \note If a creation order index is to be built, it must be specified in
+ * the group creation property list. HDF5 currently provides no
+ * mechanism to turn on link creation order tracking at group
+ * creation time and to build the index later.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags);
-H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Sets the parameters for conversion between compact and dense
+ * groups
+ *
+ * \gcpl_id{plist_id}
+ * \param[in] max_compact Maximum number of links for compact storage
+ * (\a Default: 8)
+ * \param[in] min_dense Minimum number of links for dense storage
+ * (\a Default: 6)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_link_phase_change() sets the maximum number of entries
+ * for a compact group and the minimum number of links to allow
+ * before converting a dense group back to the compact format.
+ *
+ * \p max_compact is the maximum number of links to store as
+ * header messages in the group header before converting the
+ * group to the dense format. Groups that are in compact format
+ * and which exceed this number of links are automatically
+ * converted to dense format.
+ *
+ * \p min_dense is the minimum number of links to store in the
+ * dense format. Groups which are in dense format and in which
+ * the number of links falls below this threshold are
+ * automatically converted to compact format.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Specifies the anticipated maximum size of a local heap
+ *
+ * \gcpl_id{plist_id}
+ * \param[in] size_hint Anticipated maximum size in bytes of local heap
+ * \return \herr_t
+ *
+ * \details H5Pset_local_heap_size_hint() is used with original-style HDF5
+ * groups (see “Motivation” below) to specify the anticipated maximum
+ * local heap size, size_hint, for groups created with the group
+ * creation property list \p plist_id. The HDF5 library then uses \p
+ * size_hint to allocate contiguous local heap space in the file for
+ * each group created with \p plist_id.
+ *
+ * For groups with many members or very few members, an appropriate
+ * initial value of \p size_hint would be the anticipated number of
+ * group members times the average length of group member names, plus a
+ * small margin:
+ * \code
+ * size_hint = max_number_of_group_members *
+ * (average_length_of_group_member_link_names + 2)
+ * \endcode
+ * If it is known that there will be groups with zero members, the use
+ * of a group creation property list with \p size_hint set to to 1 (one)
+ * will guarantee the smallest possible local heap for each of those groups.
+ *
+ * Setting \p size_hint to zero (0) causes the library to make a
+ * reasonable estimate for the default local heap size.
+ *
+ * \par Motivation:
+ * In situations where backward-compatibility is required, specifically, when
+ * libraries prior to HDF5 Release 1.8.0 may be used to read the file, groups
+ * must be created and maintained in the original style. This is HDF5’s default
+ * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern,
+ * greater efficiencies can be obtained with the new-format compact and indexed
+ * groups. See <a href="https://portal.hdfgroup.org/display/HDF5/Groups">Group
+ * implementations in HDF5</a> in the \ref H5G API introduction (at the bottom).\n
+ * H5Pset_local_heap_size_hint() is useful for tuning file size when files
+ * contain original-style groups with either zero members or very large
+ * numbers of members.\n
+ * The original style of HDF5 groups, the only style available prior to HDF5
+ * Release 1.8.0, was well-suited for moderate-sized groups but was not optimized
+ * for either very small or very large groups. This original style remains the
+ * default, but two new group implementations were introduced in HDF5 Release 1.8.0:
+ * compact groups to accommodate zero to small numbers of members and indexed groups
+ * for thousands or tens of thousands of members ... or millions, if that's what
+ * your application requires.\n
+ * The local heap size hint, \p size_hint, is a performance tuning parameter for
+ * original-style groups. As indicated above, an HDF5 group may have zero, a handful,
+ * or tens of thousands of members. Since the original style of HDF5 groups stores the
+ * metadata for all of these group members in a uniform format in a local heap, the size
+ * of that metadata (and hence, the size of the local heap) can vary wildly from group
+ * to group. To intelligently allocate space and to avoid unnecessary fragmentation of
+ * the local heap, it can be valuable to provide the library with a hint as to the local
+ * heap’s likely eventual size. This can be particularly valuable when it is known that
+ * a group will eventually have a great many members. It can also be useful in conserving
+ * space in a file when it is known that certain groups will never have any members.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint);
/* Map access property list (MAPL) routines */
#ifdef H5_HAVE_MAP_API
+/**
+ * \ingroup MAPL
+ *
+ * \brief Set map iteration hints
+ *
+ * \mapl_id
+ * \param[in] key_prefetch_size Number of keys to prefetch at a time during
+ * iteration
+ * \param[in] key_alloc_size The initial size of the buffer allocated to hold
+ * prefetched keys
+ * \return \herr_t
+ *
+ * \details H5Pset_map_iterate_hints() adjusts the behavior of H5Miterate() when
+ * prefetching keys for iteration. The \p key_prefetch_size parameter
+ * specifies the number of keys to prefetch at a time during
+ * iteration. The \p key_alloc_size parameter specifies the initial
+ * size of the buffer allocated to hold these prefetched keys. If this
+ * buffer is too small it will be reallocated to a larger size, though
+ * this may result in an additional I/O.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size);
+/**
+ * \ingroup MAPL
+ *
+ * \brief Set map iteration hints
+ *
+ * \mapl_id
+ * \param[out] key_prefetch_size Pointer to number of keys to prefetch at a time
+ * during iteration
+ * \param[out] key_alloc_size Pointer to the initial size of the buffer allocated
+ * to hold prefetched keys
+ * \return \herr_t
+ *
+ * \details H5Pget_map_iterate() returns the map iterate hints, \p key_prefetch_size
+ * and \p key_alloc_size, as set by H5Pset_map_iterate_hints().
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/,
size_t *key_alloc_size /*out*/);
#endif /* H5_HAVE_MAP_API */
/* String creation property list (STRCPL) routines */
-H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
+/**
+ * \ingroup ALCAPL
+ *
+ * \brief Retrieves the character encoding used to create a link or
+ * attribute name
+ *
+ * \param[in] plist_id Link creation or attribute creation property list
+ * identifier
+ * \param[out] encoding String encoding character set
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_char_encoding() retrieves the character encoding used
+ * to encode link or attribute names that are created with the
+ * property list \p plist_id.
+ *
+ * Valid values for \p encoding are defined in H5Tpublic.h and
+ * include the following:
+ *
+ * \csets
+ *
+ * \note H5Pget_char_encoding() retrieves the character set used for an
+ * HDF5 link or attribute name while H5Tget_cset() retrieves the
+ * character set used in a character or string datatype.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/);
+/**
+ * \ingroup ALCAPL
+ *
+ * \brief Sets the character encoding used to encode link and attribute
+ * names
+ *
+ * \param[in] plist_id Link creation or attribute creation property list
+ * identifier
+ * \param[in] encoding String encoding character set
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_char_encoding() sets the character encoding used for
+ * the names of links (which provide the names by which objects
+ * are referenced) or attributes created with the property list
+ * \p plist_id.
+ *
+ * Valid values for encoding include the following:
+ * \csets
+ * \details For example, if the character set for the property list
+ * \p plist_id is set to #H5T_CSET_UTF8, link names pointing to
+ * objects created with the link creation property list
+ * \p plist_id will be encoded using the UTF-8 character set.
+ * Similarly, names of attributes created with the attribute
+ * creation property list \p plist_id will be encoded as UTF-8.
+ *
+ * ASCII and UTF-8 Unicode are the only currently supported
+ * character encodings. Extended ASCII encodings (for example,
+ * ISO 8859) are not supported. This encoding policy is not
+ * enforced by the HDF5 library. Using encodings other than
+ * ASCII and UTF-8 can lead to compatibility and usability
+ * problems.
+ *
+ * \note H5Pset_char_encoding() sets the character set used for an
+ * HDF5 link or attribute name while H5Tset_cset() sets the
+ * character set used in a character or string datatype.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding);
/* Link access property list (LAPL) routines */
-H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
-H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);
-H5_DLL herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Retrieves the external link traversal file access flag from the
+ * specified link access property list
+ *
+ * \lapl_id
+ * \param[out] flags File access flag for link traversal
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_elink_acc_flags() retrieves the file access flag used
+ * to open an external link target file from the specified link
+ * access property list.
+ *
+ * Valid values for \p flags include:
+ * \li #H5F_ACC_RDWR - Files opened through external links will
+ * be opened with write access
+ * \li #H5F_ACC_RDONLY - Files opened through external links will
+ * be opened with read-only access
+ * \li #H5F_ACC_DEFAULT - Files opened through external links will
+ * be opened with the same access flag as
+ * the parent file
+ *
+ * The value returned, if it is not #H5F_ACC_DEFAULT, will
+ * override the default access flag, which is the access flag
+ * used to open the parent file.
+ *
+ * <b>Example Usage:</b>
+ * The following code retrieves the external link access flag
+ * settings on the link access property list \p lapl_id into a
+ * local variable:
+ * <pre>
+ * unsigned acc_flags;
+ * status = H5Pget_elink_acc_flags(lapl_id, &acc_flags);
+ * </pre>
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Retrieves the external link traversal callback function from the
+ * specified link access property list
+ *
+ * \lapl_id
+ * \param[out] func User-defined external link traversal callback
+ * function
+ * \param[out] op_data User-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_elink_cb() retrieves the user-defined external link
+ * traversal callback function defined in the specified link
+ * access property list.
+ *
+ * The callback function may adjust the file access property
+ * list and file access flag to use when opening a file through
+ * an external link. The callback will be executed by the HDF5
+ * library immediately before opening the target file.
+ *
+ * <b>Failure Modes:</b> H5Pget_elink_cb() will fail if the link
+ * access property list identifier, \p lapl_id, is invalid.
+ *
+ * An invalid function pointer or data pointer, \p func or
+ * \p op_data respectively, may cause a segmentation fault or an
+ * invalid memory access.
+ *
+ * <b>Example Usage:</b> The following code retrieves the external
+ * link callback settings on the link access property list
+ * \p lapl_id into local variables:
+ * <pre>
+ * H5L_elink_traverse_t elink_callback_func;
+ * void *elink_callback_udata;
+ * status = H5Pget_elink_cb (lapl_id, &elink_callback_func,
+ * &elink_callback_udata);
+ * </pre>
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Retrieves the file access property list identifier associated
+ * with the link access property list
+ *
+ * \lapl_id
+ *
+ * \return \hid_t{file access property list}
+ *
+ * \details H5Pget_elink_fapl() retrieves the file access property list
+ * identifier that is set for the link access property list
+ * identifier, \p lapl_id. The library uses this file access
+ * property list identifier to open the target file for the
+ * external link access. When no such identifier is set, this
+ * routine returns #H5P_DEFAULT.
+ *
+ * \see H5Pset_elink_fapl() and H5Lcreate_external().
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Pget_elink_fapl(hid_t lapl_id);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Retrieves prefix applied to external link paths
+ *
+ * \lapl_id{plist_id}
+ * \param[out] prefix Prefix applied to external link paths
+ * \param[in] size Size of prefix, including null terminator
+ *
+ * \return If successful, returns a non-negative value specifying the size
+ * in bytes of the prefix without the NULL terminator; otherwise
+ * returns a negative value.
+ *
+ * \details H5Pget_elink_prefix() retrieves the prefix applied to the
+ * path of any external links traversed.
+ *
+ * When an external link is traversed, the prefix is retrieved
+ * from the link access property list \p plist_id, returned in
+ * the user-allocated buffer pointed to by \p prefix, and
+ * prepended to the filename stored in the external link.
+ *
+ * The size in bytes of the prefix, including the NULL terminator,
+ * is specified in \p size. If size is unknown, a preliminary
+ * H5Pget_elink_prefix() call with the pointer \p prefix set to
+ * NULL will return the size of the prefix without the NULL
+ * terminator.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL ssize_t H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size);
-H5_DLL hid_t H5Pget_elink_fapl(hid_t lapl_id);
-H5_DLL herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id);
-H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags);
-H5_DLL herr_t H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags);
-H5_DLL herr_t H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data);
-H5_DLL herr_t H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Retrieves the maximum number of link traversals
+ *
+ * \lapl_id{plist_id}
+ * \param[out] nlinks Maximum number of links to traverse
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_nlinks() retrieves the maximum number of soft or
+ * user-defined link traversals allowed, \p nlinks, before the
+ * library assumes it has found a cycle and aborts the traversal.
+ * This value is retrieved from the link access property list
+ * \p plist_id.
+ *
+ * The limit on the number of soft or user-defined link traversals
+ * is designed to terminate link traversal if one or more links
+ * form a cycle. User control is provided because some files may
+ * have legitimate paths formed of large numbers of soft or
+ * user-defined links. This property can be used to allow
+ * traversal of as many links as desired.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Sets the external link traversal file access flag in a link
+ * access property list
+ *
+ * \lapl_id
+ * \param[in] flags The access flag for external link traversal
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_acc_flags() specifies the file access flag to use
+ * to open the target file of an external link. This allows
+ * read-only access of files reached through an external link in
+ * a file opened with write access, or vice-versa.
+ *
+ * Valid values for \p flags include:
+ * \li #H5F_ACC_RDWR - Causes files opened through external links
+ * to be opened with write access
+ * \li #H5F_ACC_RDONLY - Causes files opened through external
+ * links to be opened with read-only access
+ * \li #H5F_ACC_DEFAULT - Removes any external link file access
+ * flag setting from \p lapl_id, causing the file access flag
+ * setting to be taken from the parent file
+ *
+ * The library will normally use the file access flag used to
+ * open the parent file as the file access flag for the target
+ * file. This function provides a way to override that behavior.
+ * The external link traversal callback function set by
+ * H5Pset_elink_cb() can override the setting from
+ * H5Pset_elink_acc_flags().
+ *
+ * <b>Motivation:</b> H5Pset_elink_acc_flags() is used to adjust the
+ * file access flag used to open files reached through external links.
+ * This may be useful to, for example, prevent modifying files
+ * accessed through an external link. Otherwise, the target file is
+ * opened with whatever flag was used to open the parent.
+ *
+ * <b>Example Usage:</b> The following code sets the link access
+ * property list \p lapl_id to open external link target files with
+ * read-only access:
+ * <pre>
+ * status = H5Pset_elink_acc_flags(lapl_id, H5F_ACC_RDONLY);
+ * </pre>
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Sets the external link traversal callback function in a link
+ * access property list
+ *
+ * \lapl_id
+ * \param[in] func User-defined external link traversal callback
+ * function
+ * \param[in] op_data User-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_cb() sets a user-defined external link traversal
+ * callback function in the link access property list \p lapl_id.
+ * The callback function \p func must conform to the prototype
+ * specified in #H5L_elink_traverse_t.
+ *
+ * The callback function may adjust the file access property
+ * list and file access flags to use when opening a file through
+ * an external link. The callback will be executed by the HDF5
+ * library immediately before opening the target file.
+ *
+ * The callback will be made after the file access property list
+ * set by H5Pset_elink_fapl() and the file access flag set by
+ * H5Pset_elink_acc_flags() are applied, so changes made by this
+ * callback function will take precedence.
+ *
+ * \attention A file close degree property setting (H5Pset_fclose_degree())
+ * in this callback function or an associated property list will
+ * be ignored. A file opened by means of traversing an external
+ * link is always opened with the weak file close degree
+ * property setting, #H5F_CLOSE_WEAK.
+ *
+ * <b>Motivation:</b> H5Pset_elink_cb() is used to specify a
+ * callback function that is executed by the HDF5 library when
+ * traversing an external link. This provides a mechanism to set
+ * specific access permissions, modify the file access property
+ * list, modify the parent or target file, or take any other
+ * user-defined action. This callback function is used in
+ * situations where the HDF5 library's default behavior is not
+ * suitable.
+ *
+ * <b>Failure Modes:</b> H5Pset_elink_cb() will fail if the link
+ * access property list identifier, \p lapl_id, is invalid or if
+ * the function pointer, \p func, is NULL.
+ *
+ * An invalid function pointer, \p func, will cause a segmentation
+ * fault or other failure when an attempt is subsequently made to
+ * traverse an external link.
+ *
+ * <b>Example Usage:</b>
+ * This example defines a callback function that prints the name
+ * of the target file every time an external link is followed, and
+ * sets this callback function on \p lapl_id.
+ * <pre>
+ * herr_t elink_callback(const char *parent_file_name, const char
+ * *parent_group_name, const char *child_file_name, const char
+ * *child_object_name, unsigned *acc_flags, hid_t fapl_id, void *op_data) {
+ * puts(child_file_name);
+ * return 0;
+ * }
+ * int main(void) {
+ * hid_t lapl_id = H5Pcreate(H5P_LINK_ACCESS);
+ * H5Pset_elink_cb(lapl_id, elink_callback, NULL);
+ * ...
+ * }
+ * </pre>
+ *
+ *
+ * \since 1.8.3
+ *
+ */
+H5_DLL herr_t H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Sets a file access property list for use in accessing a file
+ * pointed to by an external link
+ *
+ * \lapl_id
+ * \fapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_fapl() sets the file access property list,
+ * \p fapl_id, to be used when accessing the target file of an
+ * external link associated with \p lapl_id.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Sets prefix to be applied to external link paths
+ *
+ * \lapl_id{plist_id}
+ * \param[in] prefix Prefix to be applied to external link paths
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_prefix() sets the prefix to be applied to the
+ * path of any external links traversed. The prefix is prepended
+ * to the filename stored in the external link.
+ *
+ * The prefix is specified in the user-allocated buffer \p prefix
+ * and set in the link access property list \p plist_id. The buffer
+ * should not be freed until the property list has been closed.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix);
+/**
+ * \ingroup LAPL
+ *
+ * \brief Sets maximum number of soft or user-defined link traversals
+ *
+ * \lapl_id{plist_id}
+ * \param[in] nlinks Maximum number of links to traverse
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_nlinks() sets the maximum number of soft or user-defined
+ * link traversals allowed, \p nlinks, before the library assumes
+ * it has found a cycle and aborts the traversal. This value is
+ * set in the link access property list \p plist_id.
+ *
+ * The limit on the number of soft or user-defined link traversals
+ * is designed to terminate link traversal if one or more links
+ * form a cycle. User control is provided because some files may
+ * have legitimate paths formed of large numbers of soft or
+ * user-defined links. This property can be used to allow
+ * traversal of as many links as desired.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
/* Object copy property list (OCPYPL) routines */
-H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned crt_intmd);
-H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *crt_intmd /*out*/);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Adds a path to the list of paths that will be searched in the
+ * destination file for a matching committed datatype
+ *
+ * \param[in] plist_id Object copy property list identifier
+ * \param[in] path The path to be added
+ *
+ * \return \herr_t
+ *
+ * \details H5Padd_merge_committed_dtype_path() adds a path, \p path,
+ * which points to a committed datatype, to the current list of
+ * suggested paths stored in the object copy property list
+ * \p plist_id. The search as described in the next paragraph is
+ * effective only if the #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG is
+ * enabled in the object copy property list via
+ * H5Pset_copy_object().
+ *
+ * When copying a committed datatype, a dataset with a committed
+ * datatype, or an object with an attribute of a committed
+ * datatype, the default behavior of H5Ocopy() is to search for
+ * a matching committed datatype:
+ * <ol>
+ * <li> First search the list of suggested paths in the object
+ * copy property list.</li>
+ * <li> Then, if no match has been found, search all the committed
+ * datatypes in the destination file.
+ * </ol>
+ * The default Step 2 in this search process can be changed by
+ * setting a callback function (see H5Pset_mcdt_search_cb()).
+ *
+ * Two datatypes are determined equal if their descriptions are
+ * identical, in a manner similar to H5Tequal(). If either
+ * committed datatype has one or more attributes, then all
+ * attributes must be present in both committed datatypes and they
+ * must be identical. Two attributes are considered identical if
+ * their datatype description, dataspace, and raw data values are
+ * the same. However, if an attribute uses a committed datatype,
+ * that committed datatype’s attributes will not be compared.
+ *
+ * If a match is found, H5Ocopy() will perform the following in
+ * the destination file:
+ * \li For a committed datatype, the library will create a hard
+ * link to the found datatype.
+ * \li For a dataset that uses a committed datatype, the library
+ * will modify the copied dataset to use the found committed
+ * datatype as its datatype.
+ * \li For an object with an attribute of a committed datatype,
+ * the library will modify the copied object’s attribute to
+ * use the found committed datatype as its datatype.
+ *
+ * If no match is found, H5Ocopy() will perform the following in
+ * the destination file:
+ * \li For a committed datatype, the library will copy it as it
+ * would any other object, creating a named committed
+ * datatype at the destination. That is, the library will
+ * create a committed datatype that is accessible in the
+ * file by a unique path.
+ * \li For a dataset that uses a committed datatype, the
+ * library will copy the datatype as an anonymous
+ * committed datatype and use that as the dataset’s
+ * datatype.
+ * \li For an object with an attribute of a committed datatype,
+ * the library will copy the datatype as an anonymous
+ * committed datatype and use that as the attribute’s
+ * datatype.
+ *
+ * \b Motivation: H5Padd_merge_committed_dtype_path() provides a
+ * means to override the default behavior of H5Ocopy() when
+ * #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG is set in an object
+ * copy property list.
+ * H5Padd_merge_committed_dtype_path() is the mechanism for
+ * suggesting search paths where H5Ocopy() will look for a
+ * matching committed datatype. This can be substantially
+ * faster than the default approach of searching the entire
+ * destination file for a match.
+ *
+ * \b Example \b Usage: This example adds two paths to the object
+ * copy property list. H5Ocopy() will search the two suggested
+ * paths for a match before searching all the committed datatypes
+ * in the destination file.
+ *
+ * <pre>
+ * int main(void) {
+ * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY);
+ *
+ * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG);
+ * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA");
+ * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group2/committed_dset");
+ * H5Ocopy(...ocpypl_id...);
+ * ...
+ * ...
+ * }
+ * </pre>
+ *
+ * \note H5Padd_merge_committed_dtype_path() will fail if the object
+ * copy property list is invalid.
+ * It will also fail if there is insufficient memory when
+ * duplicating \p path.
+ *
+ * \see
+ * \li H5Ocopy()
+ * \li #H5O_mcdt_search_cb_t
+ * \li H5Padd_merge_committed_dtype_path()
+ * \li H5Pfree_merge_committed_dtype_paths()
+ * \li H5Pget_mcdt_search_cb()
+ * \li H5Pset_copy_object()
+ * \li H5Pset_mcdt_search_cb()
+ * \li \ref_h5ocopy
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Clears the list of paths stored in the object copy property list
+ *
+ * \param[in] plist_id Object copy property list identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Pfree_merge_committed_dtype_paths() clears the suggested
+ * paths stored in the object copy property list \p plist_id.
+ * These are the suggested paths previously set with
+ * H5Padd_merge_committed_dtype_path().
+ *
+ * \b Example \b Usage: This example adds a suggested path to the
+ * object copy property list, does the copy, clears the list, and
+ * then adds a new suggested path to the list for another copy.
+ *
+ * <pre>
+ * int main(void) {
+ * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY);
+ *
+ * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG);
+ * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA");
+ * H5Ocopy(...ocpypl_id...);
+ * ...
+ * ...
+ * H5Pfree_merge_committed_dtype_paths(ocpypl_id);
+ * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group2/committed_dtypeB");
+ * H5Ocopy(...ocpypl_id...);
+ * ...
+ * ...
+ * }
+ * </pre>
+ *
+ * \note H5Pfree_merge_committed_dtype_paths() will fail if the
+ * object copy property list is invalid.
+ *
+ * \see
+ * \li H5Ocopy()
+ * \li #H5O_mcdt_search_cb_t
+ * \li H5Padd_merge_committed_dtype_path()
+ * \li H5Pfree_merge_committed_dtype_paths()
+ * \li H5Pget_mcdt_search_cb()
+ * \li H5Pset_copy_object()
+ * \li H5Pset_mcdt_search_cb()
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id);
-H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Retrieves the properties to be used when an object is copied
+ *
+ * \param[in] plist_id Object copy property list identifier
+ * \param[out] copy_options Copy option(s) set in the object copy property
+ * list
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_copy_object() retrieves the properties currently
+ * specified in the object copy property list \p plist_id, which
+ * will be invoked when a new copy is made of an existing object.
+ *
+ * \p copy_options is a bit map indicating the flags, or
+ * properties, governing object copying that are set in the
+ * property list \p plist_id.
+ *
+ * The available flags are described in H5Pset_copy_object().
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Retrieves the callback function from the specified object copy
+ * property list
+ *
+ * \param[in] plist_id Object copy property list identifier
+ * \param[out] func User-defined callback function
+ * \param[out] op_data User-defined data for the callback
+ * function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_mcdt_search_cb() retrieves the user-defined callback
+ * function and the user data that are set via
+ * H5Pset_mcdt_search_cb() in the object copy property list
+ * \p plist_id.
+ *
+ * The callback function will be returned in the parameter \p func
+ * and the user data will be returned in the parameter \p op_data.
+ *
+ * \note H5Pget_mcdt_search_cb() will fail if the object copy property
+ * list is invalid.
+ *
+ * \see
+ * \li H5Ocopy()
+ * \li #H5O_mcdt_search_cb_t
+ * \li H5Padd_merge_committed_dtype_path()
+ * \li H5Pfree_merge_committed_dtype_paths()
+ * \li H5Pget_mcdt_search_cb()
+ * \li H5Pset_copy_object()
+ * \li H5Pset_mcdt_search_cb()
+ * \li \ref_h5ocopy
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Sets properties to be used when an object is copied
+ *
+ * \param[in] plist_id Object copy property list identifier
+ * \param[out] copy_options Copy option(s) to be set
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_copy_object() sets properties in the object copy
+ * property list \p plist_id. When an existing object is copied,
+ * that property list will determine how the new copy is created.
+ *
+ * The following flags are available for use in an object copy
+ * property list:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5O_COPY_SHALLOW_HIERARCHY_FLAG</td>
+ * <td>Copy only immediate members of a group<br />
+ * <em>Default behavior, without flag:</em> Recursively
+ * copy all objects in and below the group.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_COPY_EXPAND_SOFT_LINK_FLAG</td>
+ * <td>Expand soft links into new objects<br />
+ * <em>Default behavior, without flag:</em> Copy soft
+ * links as they are.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_COPY_EXPAND_EXT_LINK_FLAG</td>
+ * <td>Expand external link into new objects<br />
+ * <em>Default behavior, without flag:</em> Copy external
+ * links as they are.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_COPY_EXPAND_REFERENCE_FLAG</td>
+ * <td>Copy objects that are pointed to by references and
+ * update reference values in destination file<br />
+ * <em>Default behavior, without flag:</em> Set reference
+ * values in destination file to zero (0)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_COPY_WITHOUT_ATTR_FLAG</td>
+ * <td>Copy object without copying attributes<br />
+ * <em>Default behavior, without flag:</em> Copy object
+ * with all its attributes</td>
+ * </tr>
+ * <tr>
+ * <td>#H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG</td>
+ * <td>Use a matching committed datatype in the destination
+ * file when copying a committed datatype, a dataset with
+ * a committed datatype, or an object with an attribute
+ * of committed datatype <br />
+ * <em>Default behavior without flag:</em>
+ *
+ * \li A committed datatype in the source will be copied to
+ * the destination as a committed datatype.
+ * \li If a dataset in the source uses a committed
+ * datatype or an object in the source has an attribute
+ * of a committed datatype, that committed datatype will
+ * be written to the destination as an anonymous
+ * committed datatype.
+ * If copied in a single H5Ocopy() operation, objects
+ * that share a committed datatype in the source will
+ * share an anonymous committed dataype in the
+ * destination copy. Subsequent H5Ocopy() operations,
+ * however, will be unaware of prior anonymous committed
+ * dataypes and will create new ones.
+ *
+ * See the “See Also” section immediately below for
+ * functions related to the use of this flag.</td>
+ * </tr>
+ * </table>
+ *
+ * \see
+ * Functions and a callback function used to tune committed datatype
+ * copying behavior:
+ * \li #H5O_mcdt_search_cb_t
+ * \li H5Padd_merge_committed_dtype_path()
+ * \li H5Pfree_merge_committed_dtype_paths()
+ * \li H5Pget_mcdt_search_cb()
+ * \li H5Pset_copy_object()
+ * \li H5Pset_mcdt_search_cb()
+ * \li \ref_h5ocopy
+ *
+ * \version 1.8.9 #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG added in this release.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned copy_options);
+/**
+ * \ingroup OCPPL
+ *
+ * \brief Sets the callback function that H5Ocopy() will invoke before
+ * searching the entire destination file for a matching committed
+ * datatype
+ *
+ * \param[in] plist_id Object copy property list identifier
+ * \param[in] func User-defined callback function
+ * \param[in] op_data User-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_mcdt_search_cb() allows an application to set a
+ * callback function, \p func, that will be invoked before
+ * searching the destination file for a matching committed
+ * datatype. The default, global search process is described in
+ * H5Padd_merge_committed_dtype_path().
+ *
+ * The callback function must conform to the #H5O_mcdt_search_cb_t
+ * prototype and will return an instruction for one of the
+ * following actions:
+ *
+ * \li Continue the search for a matching committed datatype in
+ * the destination file.
+ * \li Discontinue the search for a matching committed datatype.
+ * H5Ocopy() will then apply the default behavior of creating
+ * an anonymous committed datatype.
+ * \li Abort the copy operation and exit H5Ocopy().
+ *
+ * \b Motivation: H5Pset_mcdt_search_cb() provides the means to
+ * define a callback function. An application can then use that
+ * callback to take an additional action before the default search
+ * of all committed datatypes in the destination file or to take an
+ * action that replaces the default search. This mechanism is
+ * intended to improve performance when the global search might
+ * take a long time.
+ *
+ * \b Example \b Usage: This example defines a callback function in
+ * the object copy property list.
+ *
+ * <pre>
+ * static H5O_mcdt_search_ret_t
+ * mcdt_search_cb(void *_udata)
+ * {
+ * H5O_mcdt_search_ret_t action = *((H5O_mcdt_search_ret_t *)_udata);
+ *
+ * return(action);
+ * }
+ *
+ * int main(void) {
+ * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY);
+ *
+ * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG);
+ * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA");
+ *
+ * action = H5O_MCDT_SEARCH_STOP;
+ * H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cb, &action);
+ * H5Ocopy(...ocpypl_id...);
+ * ...
+ * ...
+ * }
+ * </pre>
+ *
+ * \note H5Pset_mcdt_search_cb() will fail if the
+ * object copy property list is invalid.
+ *
+ * \warning If the callback function return value causes H5Ocopy() to
+ * abort, the destination file may be left in an inconsistent or
+ * corrupted state.
+ *
+ * \see
+ * \li H5Ocopy()
+ * \li #H5O_mcdt_search_cb_t
+ * \li H5Padd_merge_committed_dtype_path()
+ * \li H5Pfree_merge_committed_dtype_paths()
+ * \li H5Pget_mcdt_search_cb()
+ * \li H5Pset_copy_object()
+ * \li H5Pset_mcdt_search_cb()
+ * \li \ref_h5ocopy
+ *
+ * \since 1.8.9
+ *
+ */
+H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -513,30 +9265,474 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func,
#define H5P_NO_CLASS H5P_ROOT
/* Typedefs */
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a permanent property with a property list class
+ *
+ * \plistcls_id{cls_id}
+ * \param[in] name Name of property to register
+ * \param[in] size Size of property in bytes
+ * \param[in] def_value Default value for property in newly created
+ * property lists
+ * \param[in] prp_create Callback routine called when a property list is
+ * being created and the property value will be
+ * initialized
+ * \param[in] prp_set Callback routine called before a new value is
+ * copied into the property's value
+ * \param[in] prp_get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_del Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] prp_copy Callback routine called when a property is copied
+ * from a property list
+ * \param[in] prp_close Callback routine called when a property list is
+ * being closed and the property value will be
+ * disposed of
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pregister2() or the macro H5Pregister().
+ *
+ * \details H5Pregister1() registers a new property with a property list
+ * class. The property will exist in all property list objects
+ * of that class after this routine is finished. The name of
+ * the property must not already exist. The default property
+ * value must be provided and all new property lists created
+ * with this property will have the property value set to the
+ * default provided. Any of the callback routines may be set
+ * to NULL if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data in
+ * the property list. These may be used as flags to indicate the
+ * presence or absence of a particular piece of information. The
+ * default pointer for a zero-sized property may be set to NULL.
+ * The property \p prp_create and \p prp_close callbacks are called for
+ * zero-sized properties, but the \p prp_set and \p prp_get callbacks
+ * are never called.
+ *
+ * The \p prp_create routine is called when a new property list with
+ * this property is being created. The #H5P_prp_create_func_t
+ * callback function is defined as #H5P_prp_cb1_t.
+ *
+ * The \p prp_create routine may modify the value to be set and those
+ * changes will be stored as the initial value of the property.
+ * If the \p prp_create routine returns a negative value, the new
+ * property value is not copied into the property and the
+ * \p prp_create routine returns an error value.
+ *
+ * The \p prp_set routine is called before a new value is copied into
+ * the property. The #H5P_prp_set_func_t callback function is defined
+ * as #H5P_prp_cb2_t.
+ *
+ * The \p prp_set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p prp_set routine returns a negative value, the new property
+ * value is not copied into the property and the \p prp_set routine
+ * returns an error value. The \p prp_set routine will not be called
+ * for the initial value; only the \p prp_create routine will be
+ * called.
+ *
+ * \b Note: The \p prp_set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p prp_get
+ * callback would then reverse the transformation or translation.
+ * A single \p prp_get or \p prp_set callback could handle multiple
+ * properties by performing different actions based on the property
+ * name or other properties in the property list.
+ *
+ * The \p prp_get routine is called when a value is retrieved from a
+ * property value. The #H5P_prp_get_func_t callback function is
+ * defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_get routine may modify the value to be returned from the
+ * query and those changes will be returned to the calling routine.
+ * If the \p prp_set routine returns a negative value, the query
+ * routine returns an error value.
+ *
+ * The \p prp_del routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_del routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_del routine
+ * returns. If the \p prp_del routine returns a negative value,
+ * the property list deletion routine returns an error value but
+ * the property is still deleted.
+ *
+ * The \p prp_copy routine is called when a new property list with
+ * this property is being created through a \p prp_copy operation.
+ * The #H5P_prp_copy_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If
+ * the \p prp_copy routine returns a negative value, the new
+ * property value is not copied into the property and the \p prp_copy
+ * routine returns an error value.
+ *
+ * The \p prp_close routine is called when a property list with this
+ * property is being closed. The #H5P_prp_close_func_t callback
+ * function is defined as #H5P_prp_cb1_t.
+ *
+ * The \p prp_close routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_close routine
+ * returns. If the \p prp_close routine returns a negative value, the
+ * property list close routine returns an error value but the property
+ * list is still closed.
+ *
+ * The #H5P_prp_cb1_t is as follows:
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The #H5P_prp_cb2_t is as follows:
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ *
+ * \cpp_c_api_note
+ *
+ */
/* Function prototypes */
-H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
- H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
- H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del,
- H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
- H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
- H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
- H5P_prp_close_func_t prp_close);
-H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
+H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
+ H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
+ H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del,
+ H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a temporary property with a property list
+ *
+ * \plist_id
+ * \param[in] name Name of property to create
+ * \param[in] size Size of property in bytes
+ * \param[in] value Initial value for the property
+ * \param[in] prp_set Callback routine called before a new value is copied
+ * into the property's value
+ * \param[in] prp_get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_delete Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] prp_copy Callback routine called when a property is copied
+ * from an existing property list
+ * \param[in] prp_close Callback routine called when a property list is
+ * being closed and the property value will be disposed
+ * of
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pinsert2() or the macro H5Pinsert().
+ *
+ * \details H5Pinsert1() creates a new property in a property
+ * list. The property will exist only in this property list and
+ * copies made from it.
+ *
+ * The initial property value must be provided in \p value and
+ * the property value will be set accordingly.
+ *
+ * The name of the property must not already exist in this list,
+ * or this routine will fail.
+ *
+ * The \p prp_set and \p prp_get callback routines may be set to NULL
+ * if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data
+ * in the property list. The default value of a zero-size
+ * property may be set to NULL. They may be used to indicate the
+ * presence or absence of a particular piece of information.
+ *
+ * The \p prp_set routine is called before a new value is copied
+ * into the property. The #H5P_prp_set_func_t callback function
+ * is defined as #H5P_prp_cb2_t.
+ * The \p prp_set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p prp_set routine returns a negative value, the new property
+ * value is not copied into the property and the \p set routine
+ * returns an error value. The \p prp_set routine will be called for
+ * the initial value.
+ *
+ * \b Note: The \p prp_set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p prp_get
+ * callback would then reverse the transformation or translation.
+ * A single \p prp_get or \p prp_set callback could handle multiple
+ * properties by performing different actions based on the
+ * property name or other properties in the property list.
+ *
+ * The \p prp_get routine is called when a value is retrieved from
+ * a property value. The #H5P_prp_get_func_t callback function
+ * is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_get routine may modify the value to be returned from
+ * the query and those changes will be preserved. If the \p prp_get
+ * routine returns a negative value, the query routine returns
+ * an error value.
+ *
+ * The \p prp_delete routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_copy routine is called when a new property list with
+ * this property is being created through a \p prp_copy operation.
+ * The #H5P_prp_copy_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If the
+ * \p prp_copy routine returns a negative value, the new property value
+ * is not copied into the property and the prp_copy routine returns an
+ * error value.
+ *
+ * The \p prp_close routine is called when a property list with this
+ * property is being closed.
+ * The #H5P_prp_close_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_close routine may modify the value passed in, the
+ * value is not used by the library when the close routine
+ * returns. If the \p prp_close routine returns a negative value,
+ * the property list \p prp_close routine returns an error value
+ * but the property list is still closed.
+ *
+ * \b Note: There is no \p prp_create callback routine for temporary
+ * property list objects; the initial value is assumed to
+ * have any necessary setup already performed on it.
+ *
+ * The #H5P_prp_cb1_t is as follows:
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The #H5P_prp_cb2_t is as follows:
+ * \snippet this H5P_prp_cb2_t_snip
+
+ * \cpp_c_api_note
+ */
+H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
+ H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
+ H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
+ H5P_prp_close_func_t prp_close);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Encodes the property values in a property list into a binary
+ * buffer
+ *
+ * \plist_id
+ * \param[out] buf Buffer into which the property list will be encoded.
+ * If the provided buffer is NULL, the size of the
+ * buffer required is returned through \p nalloc; the
+ * function does nothing more.
+ * \param[out] nalloc The size of the required buffer
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * H5Pencode2() or the macro H5Pencode().
+ *
+ * \details H5Pencode1() encodes the property list \p plist_id into the
+ * binary buffer \p buf.
+ *
+ * If the required buffer size is unknown, \p buf can be passed
+ * in as NULL and the function will set the required buffer size
+ * in \p nalloc. The buffer can then be created and the property
+ * list encoded with a subsequent H5Pencode1() call.
+ *
+ * If the buffer passed in is not big enough to hold the encoded
+ * properties, the H5Pencode1() call can be expected to fail with
+ * a segmentation fault.
+ *
+ * Properties that do not have encode callbacks will be skipped.
+ * There is currently no mechanism to register an encode callback for
+ * a user-defined property, so user-defined properties cannot currently
+ * be encoded.
+ *
+ * Some properties cannot be encoded, particularly properties that are
+ * reliant on local context.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns information about a filter in a pipeline (DEPRECATED)
+ *
+ *
+ *
+ * \plist_id{plist_id}
+ * \param[in] filter Sequence number within the filter pipeline of
+ * the filter for which information is sought
+ * \param[out] flags Bit vector specifying certain general properties
+ * of the filter
+ * \param[in,out] cd_nelmts Number of elements in \p cd_values
+ * \param[out] cd_values Auxiliary data for the filter
+ * \param[in] namelen Anticipated number of characters in \p name
+ * \param[out] name Name of the filter
+ *
+ * \return Returns the filter identifier if successful; Otherwise returns
+ * a negative value. See: #H5Z_filter_t
+ *
+ * \deprecated When was this function deprecated?
+ *
+ * \details H5Pget_filter1() returns information about a filter, specified
+ * by its filter number, in a filter pipeline, specified by the
+ * property list with which it is associated.
+ *
+ * \p plist_id must be a dataset or group creation property list.
+ *
+ * \p filter is a value between zero and N-1, as described in
+ * H5Pget_nfilters(). The function will return a negative value
+ * if the filter number is out of range.
+ *
+ * The structure of the \p flags argument is discussed in
+ * H5Pset_filter().
+ *
+ * On input, \p cd_nelmts indicates the number of entries in the
+ * \p cd_values array, as allocated by the caller; on return,
+ * \p cd_nelmts contains the number of values defined by the filter.
+ *
+ * If \p name is a pointer to an array of at least \p namelen
+ * bytes, the filter name will be copied into that array. The name
+ * will be null terminated if \p namelen is large enough. The
+ * filter name returned will be the name appearing in the file, the
+ * name registered for the filter, or an empty string.
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \version 1.8.0 N-bit and scale-offset filters added.
+ * \version 1.8.0 Function H5Pget_filter() renamed to H5Pget_filter1() and
+ * deprecated in this release.
+ * \version 1.6.4 \p filter parameter type changed to unsigned.
+ *
+ */
H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter, unsigned int *flags /*out*/,
size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
char name[]);
-H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
- size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
- char name[] /*out*/);
-H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/,
- unsigned *stab /*out*/, unsigned *shhdr /*out*/);
-H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
-H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns information about the specified filter
+ *
+ * \plist_id{plist_id}
+ * \param[in] id Filter identifier
+ * \param[out] flags Bit vector specifying certain general properties
+ * of the filter
+ * \param[in,out] cd_nelmts Number of elements in \p cd_values
+ * \param[out] cd_values Auxiliary data for the filter
+ * \param[in] namelen Anticipated number of characters in \p name
+ * \param[out] name Name of the filter
+ *
+ *
+ * \return Returns a non-negative value if successful; Otherwise returns
+ * a negative value.
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pget_filter_by_id2() or the macro H5Pget_filter_by_id().
+ *
+ * \details H5Pget_filter_by_id1() returns information about a filter, specified
+ * in \p id, a filter identifier.
+ *
+ * \p plist_id must be a dataset or group creation property list and
+ * \p id must be in the associated filter pipeline.
+ *
+ * The \p id and \p flags parameters are used in the same
+ * manner as described in the discussion of H5Pset_filter().
+ *
+ * Aside from the fact that they are used for output, the parameters
+ * \p cd_nelmts and \p cd_values[] are used in the same manner as
+ * described in the discussion of H5Pset_filter().
+ * On input, the \p cd_nelmts parameter indicates the number of entries
+ * in the \p cd_values[] array allocated by the calling program;
+ * on exit it contains the number of values defined by the filter.
+ *
+ * On input, the \p namelen parameter indicates the number of
+ * characters allocated for the filter name by the calling program
+ * in the array \p name[]. On exit \p name[] contains the name of the
+ * filter with one character of the name in each element of the array.
+ *
+ * If the filter specified in \p id is not set for the property
+ * list, an error will be returned and this function will fail.
+ *
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \version 1.8.0 Function H5Pget_filter_by_id() renamed to
+ * H5Pget_filter_by_id1() and deprecated in this release.
+ * \version 1.6.0 Function introduced in this release.
+ */
+H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
+ size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
+ char name[] /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the version information of various objects
+ * for a file creation property list(deprecated)
+ *
+ * \plist_id
+ * \param[out] boot Pointer to location to return super block version number
+ * \param[out] freelist Pointer to location to return global freelist version number
+ * \param[out] stab Pointer to location to return symbol table version number
+ * \param[out] shhdr Pointer to location to return shared object header version
+ * number
+ *
+ * \return \herr_t
+ *
+ * \deprecated Deprecated in favor of the function H5Fget_info()
+ *
+ * \details H5Pget_version() retrieves the version information of various objects
+ * for a file creation property list. Any pointer parameters which are
+ * passed as NULL are not queried.
+ *
+ * \version 1.6.4 \p boot, \p freelist, \p stab, \p shhdr parameter types
+ * changed to unsigned.
+ *
+ */
+H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/,
+ unsigned *stab /*out*/, unsigned *shhdr /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the file space handling strategy and the free-space section
+ * size threshold.
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] strategy The file space handling strategy to be used. See:
+ * #H5F_fspace_strategy_t
+ * \param[in] threshold The smallest free-space section size that the free
+ * space manager will track
+ *
+ * \return \herr_t
+ *
+ * \deprecated When was this function deprecated?
+ *
+ * \details Maps to the function H5Pset_file_space_strategy().
+ *
+ */
+H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the file space handling strategy, and threshold value for
+ * a file creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] strategy Pointer to the file space handling strategy
+ * \param[out] threshold Pointer to the free-space section size threshold value
+ *
+ * \return \herr_t
+ *
+ * \deprecated When was this function deprecated?
+ *
+ * \details Maps to the function H5Pget_file_space_strategy()
+ *
+ *
+ */
+H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
#endif
-#endif /* _H5Ppublic_H */
+#endif /* H5Ppublic_H */
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 69ac1a5..7e5ea46 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Pstrcpl.c
* October 26 2005
- * James Laird <jlaird@ncsa.uiuc.edu>
+ * James Laird
*
* Purpose: String creation property list class routines
*
diff --git a/src/H5Ptest.c b/src/H5Ptest.c
index 5c3e907..f22c30e 100644
--- a/src/H5Ptest.c
+++ b/src/H5Ptest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Saturday May 31, 2003
*
* Purpose: Generic Property Testing Functions
@@ -79,7 +79,7 @@ done:
PURPOSE
Routine to open a [copy of] a class with its full path name
USAGE
- hid_t H5P__open_class_name_test(path)
+ hid_t H5P__open_class_path_test(path)
const char *path; IN: Full path name of class to open [copy of]
RETURNS
Success: ID of generic property class
diff --git a/src/H5R.c b/src/H5R.c
index dda82eb..e08e451 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -175,7 +175,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if ((space_id == H5I_BADID) || (space_id == H5S_ALL))
+ if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
diff --git a/src/H5RS.c b/src/H5RS.c
index 0e05370..141ea2e 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,9 +18,21 @@
*
*/
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5RSprivate.h" /* Reference-counted strings */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5RSprivate.h" /* Reference-counted strings */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
/* Private typedefs & structs */
struct H5RS_str_t {
@@ -29,6 +41,25 @@ struct H5RS_str_t {
unsigned n; /* Reference count of number of pointers sharing string */
};
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Declare a free list to manage the H5RS_str_t struct */
H5FL_DEFINE_STATIC(H5RS_str_t);
@@ -37,11 +68,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
@@ -55,11 +86,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;
@@ -72,7 +103,7 @@ H5RS_xstrdup(const char *s)
ret_value = NULL;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5RS_xstrdup() */
+} /* end H5RS__xstrdup() */
/*--------------------------------------------------------------------------
NAME
@@ -105,7 +136,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;
@@ -135,13 +166,13 @@ done:
H5RS_str_t *
H5RS_wrap(const char *s)
{
- H5RS_str_t *ret_value; /* Return value */
+ H5RS_str_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Allocate ref-counted string structure */
if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
- HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Set the internal fields */
ret_value->s = (char *)s;
@@ -263,7 +294,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/H5RSprivate.h b/src/H5RSprivate.h
index d1f24cf..32e1dc6 100644
--- a/src/H5RSprivate.h
+++ b/src/H5RSprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5RS module
*/
-#ifndef _H5RSprivate_H
-#define _H5RSprivate_H
+#ifndef H5RSprivate_H
+#define H5RSprivate_H
/**************************************/
/* Public headers needed by this file */
@@ -55,4 +55,4 @@ H5_DLL ssize_t H5RS_len(const H5RS_str_t *rs);
H5_DLL char * H5RS_get_str(const H5RS_str_t *rs);
H5_DLL unsigned H5RS_get_count(const H5RS_str_t *rs);
-#endif /* _H5RSprivate_H */
+#endif /* H5RSprivate_H */
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index c29adcc..f78460d 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -61,6 +61,10 @@
/********************/
/* 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);
/*********************/
/* Package Variables */
@@ -74,8 +78,155 @@
/* 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
*
@@ -298,7 +449,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
/* Retrieve space */
- if (space_id == H5I_BADID)
+ if (space_id == H5I_INVALID_HID)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 7eaa6ed..cb56a84 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -89,7 +89,6 @@
} while (0)
/* Debug */
-//#define H5R_DEBUG
#ifdef H5R_DEBUG
#define H5R_LOG_DEBUG(...) \
do { \
@@ -413,6 +412,9 @@ 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;
@@ -744,8 +746,10 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref)
dst_ref->info.obj.filename = NULL;
/* Set location ID and hold reference to it */
- if (H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE, TRUE) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "cannot set reference location ID")
+ dst_ref->loc_id = src_ref->loc_id;
+ if (H5I_inc_ref(dst_ref->loc_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed")
+ dst_ref->app_ref = TRUE;
}
done:
@@ -804,7 +808,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t tok
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;
@@ -1009,6 +1013,9 @@ 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:
@@ -1034,12 +1041,13 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref)
FUNC_ENTER_PACKAGE
+ /* Sanity checks */
HDassert(buf);
HDassert(nbytes);
HDassert(ref);
- buf_size = *nbytes;
/* Don't decode if buffer size isn't big enough */
+ buf_size = *nbytes;
if (buf_size < H5R_ENCODE_HEADER_SIZE)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
@@ -1100,6 +1108,7 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref)
H5R_LOG_DEBUG("Decoded reference, filename=%s, obj_addr=%s, encode size=%u", ref->info.obj.filename,
H5R__print_token(ref->info.obj.token), ref->encode_size);
+ /* Set output info */
*nbytes = decode_size;
done:
@@ -1459,122 +1468,6 @@ done:
} /* end H5R__decode_heap() */
/*-------------------------------------------------------------------------
- * 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)
@@ -1639,82 +1532,6 @@ done:
} /* H5R__decode_token_obj_compat() */
/*-------------------------------------------------------------------------
- * 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
@@ -1732,6 +1549,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt
H5O_token_t token = {0};
size_t data_size;
const uint8_t *p;
+ H5S_t * space = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -1752,7 +1570,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt
if (space_ptr) {
H5O_loc_t oloc; /* Object location */
- H5S_t * space = NULL;
/* Initialize the object location */
H5O_loc_reset(&oloc);
@@ -1777,5 +1594,11 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt
done:
H5MM_free(data);
+
+ if (ret_value < 0) {
+ if (space && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ }
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_token_region_compat() */
diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h
index e4f5313..2a34d56 100644
--- a/src/H5Rmodule.h
+++ b/src/H5Rmodule.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* H5R package. Including this header means that the source file
* is part of the H5R package.
*/
-#ifndef _H5Rmodule_H
-#define _H5Rmodule_H
+#ifndef H5Rmodule_H
+#define H5Rmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -25,4 +25,11 @@
#define H5_MY_PKG_ERR H5E_REFERENCE
#define H5_MY_PKG_INIT YES
-#endif /* _H5Rmodule_H */
+/**
+ * \defgroup H5R H5R
+ * \brief Reference Interface
+ * \details The HDF5 Reference Interface, H5R, provides a mechanism for managing
+ * HDF5 referenced objects.
+ */
+
+#endif /* H5Rmodule_H */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index a132873..ee5fb71 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,8 +19,8 @@
#error "Do not include this file outside the H5R package!"
#endif
-#ifndef _H5Rpkg_H
-#define _H5Rpkg_H
+#ifndef H5Rpkg_H
+#define H5Rpkg_H
/* Get package's private header */
#include "H5Rprivate.h"
@@ -119,19 +119,13 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, con
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 */
+#endif /* H5Rpkg_H */
diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h
index 98a8352..6d6fcd5 100644
--- a/src/H5Rprivate.h
+++ b/src/H5Rprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5R module
*/
-#ifndef _H5Rprivate_H
-#define _H5Rprivate_H
+#ifndef H5Rprivate_H
+#define H5Rprivate_H
#include "H5Rpublic.h"
@@ -39,4 +39,4 @@
/* Library Private Prototypes */
/******************************/
-#endif /* _H5Rprivate_H */
+#endif /* H5Rprivate_H */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 6b30b85..e26a72c 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5R module.
*/
-#ifndef _H5Rpublic_H
-#define _H5Rpublic_H
+#ifndef H5Rpublic_H
+#define H5Rpublic_H
/* Public headers needed by this file */
#include "H5public.h"
@@ -40,40 +40,54 @@
/* Public Typedefs */
/*******************/
-/*
+//! <!-- [H5R_type_t_snip] -->
+/**
* Reference types allowed.
- * DO NOT CHANGE THE ORDER or VALUES as reference type values are encoded into
- * the datatype message header.
+ *
+ * \internal DO NOT CHANGE THE ORDER or VALUES as reference type values are
+ * encoded into the datatype message header.
*/
typedef enum {
- H5R_BADTYPE = (-1), /* Invalid reference type */
- H5R_OBJECT1 = 0, /* Backward compatibility (object) */
- H5R_DATASET_REGION1 = 1, /* Backward compatibility (region) */
- H5R_OBJECT2 = 2, /* Object reference */
- H5R_DATASET_REGION2 = 3, /* Region reference */
- H5R_ATTR = 4, /* Attribute Reference */
- H5R_MAXTYPE = 5 /* Highest type (invalid) */
+ H5R_BADTYPE = (-1), /**< Invalid reference type */
+ H5R_OBJECT1 = 0, /**< Backward compatibility (object) */
+ H5R_DATASET_REGION1 = 1, /**< Backward compatibility (region) */
+ H5R_OBJECT2 = 2, /**< Object reference */
+ H5R_DATASET_REGION2 = 3, /**< Region reference */
+ H5R_ATTR = 4, /**< Attribute Reference */
+ H5R_MAXTYPE = 5 /**< Highest type (invalid) */
} H5R_type_t;
+//! <!-- [H5R_type_t_snip] -->
/* Deprecated types are kept for backward compatibility with previous versions */
+//! <!-- [hobj_ref_t_snip] -->
/**
- * Deprecated object reference type that is used with deprecated reference APIs.
- * Note! This type can only be used with the "native" HDF5 VOL connector.
+ * \deprecated Deprecated object reference type that is used with deprecated
+ * reference APIs.
+ *
+ * \note This type can only be used with the "native" HDF5 VOL connector.
*/
typedef haddr_t hobj_ref_t;
+//! <!-- [hobj_ref_t_snip] -->
+//! <!-- [hdset_reg_ref_t_snip] -->
/**
- * Dataset region reference type that is used with deprecated reference APIs.
- * (Buffer to store heap ID and index)
- * This needs to be large enough to store largest haddr_t in a worst case
+ * Buffer to store heap ID and index
+ *
+ * This needs to be large enough to store largest #haddr_t in a worst case
* machine (8 bytes currently) plus an int.
- * Note! This type can only be used with the "native" HDF5 VOL connector.
+ *
+ * \deprecated Dataset region reference type that is used with deprecated
+ * reference APIs.
+ *
+ * \note This type can only be used with the "native" HDF5 VOL connector.
*/
typedef struct {
uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE];
} hdset_reg_ref_t;
+//! <!-- [hdset_reg_ref_t_snip] -->
+//! <!-- [H5R_ref_t_snip] -->
/**
* Opaque reference type. The same reference type is used for object,
* dataset region and attribute references. This is the type that
@@ -81,10 +95,11 @@ typedef struct {
*/
typedef struct {
union {
- uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */
- int64_t align; /* ensures alignment */
+ uint8_t __data[H5R_REF_BUF_SIZE]; /**< opaque data */
+ int64_t align; /**< ensures alignment */
} u;
} H5R_ref_t;
+//! <!-- [H5R_ref_t_snip] -->
/********************/
/* Public Variables */
@@ -99,30 +114,427 @@ extern "C" {
#endif
/* Constructors */
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Creates an object reference
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of object
+ * \oapl_id
+ * \param[out] ref_ptr Pointer to reference
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcreate_object() creates a reference pointing to the
+ * object named \p name located at \p loc_id. The parameters \p
+ * loc_id and \p name are used to locate the object.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the referenced object. The access property list
+ * must be of the same type as the object being referenced, that is
+ * a group, dataset or committed datatype property list.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ * H5Rdestroy() should be used to release the resource from the
+ * reference.
+ *
+ */
H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Creates a region reference
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of object
+ * \space_id
+ * \oapl_id
+ * \param[out] ref_ptr Pointer to reference
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcreate_region() creates the reference, \p ref_ptr,
+ * pointing to the region represented by \p space_id within the
+ * object named name located at \p loc_id.
+ *
+ * The parameters \p loc_id and \p name are used to locate the
+ * object. The parameter \p space_id identifies the dataset region
+ * that a dataset region reference points to.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the referenced object. The access property list
+ * must be of the same type as the object being referenced, that is
+ * a dataset property list in this case.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ * H5Rdestroy() should be used to release the resource from the
+ * reference.
+ *
+ */
H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
H5R_ref_t *ref_ptr);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Creates an attribute reference
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of object
+ * \param[in] attr_name Name of attribute
+ * \oapl_id
+ * \param[out] ref_ptr Pointer to reference
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcreate_attr() creates the reference, \p ref_ptr, pointing
+ * to the attribute named \p attr_name and attached to the object
+ * named \p name located at \p loc_id.
+ *
+ * The parameters \p loc_id and \p name locate the object. The
+ * parameter \p attr_name specifies the attribute within the object.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the object that the referenced attribute is
+ * attached to. The access property list must be of the same type
+ * as that object, that is a group, dataset or committed datatype
+ * property list.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ * H5Rdestroy() should be used to release the resource from the
+ * reference.
+ *
+ */
H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id,
H5R_ref_t *ref_ptr);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Closes a reference
+ *
+ * \param[in] ref_ptr Pointer to reference
+ *
+ * \return \herr_t
+ *
+ * \details Given a reference, \p ref_ptr, to an object, region or attribute
+ * attached to an object, H5Rdestroy() releases allocated resources
+ * from a previous create call.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ */
H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
/* Info */
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of a reference
+ *
+ * \param[in] ref_ptr Pointer to reference
+ *
+ * \return Returns a valid reference type if successful; otherwise returns #H5R_BADTYPE .
+ *
+ * \details Given a reference, \p ref_ptr, H5Rget_type() returns the
+ * type of the reference.
+ *
+ * Valid returned reference types are:
+ * \snippet this H5R_type_t_snip
+ *
+ * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be
+ * associated to an \ref H5R_ref_t reference and can therefore never be
+ * returned through that function.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ */
H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
-H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
-H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Determines whether two references are equal
+ *
+ * \param[in] ref1_ptr Pointer to reference to compare
+ * \param[in] ref2_ptr Pointer to reference to compare
+ *
+ * \return Returns a positive value if the references are equal. Returns
+ * 0 if the references are not equal. Returns a negative value when the
+ * function fails.
+ *
+ * \details H5Requal() determines whether two references point to the
+ * same object, region or attribute.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ */
+H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Copies an existing reference
+ *
+ * \param[in] src_ref_ptr Pointer to reference to copy
+ * \param[out] dst_ref_ptr Pointer to output reference
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcopy() creates a copy of an existing reference.
+ * \p src_ref_ptr points to the reference to copy and \p dst_ref_ptr is the
+ * pointer to the destination reference.
+ *
+ */
+H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
/* Dereference */
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 object referenced
+ *
+ * \param[in] ref_ptr Pointer to reference to open
+ * \rapl_id
+ * \oapl_id
+ *
+ * \return \hid_t{object}
+ *
+ * \details Given a reference, \p ref_ptr, to an object, a region in
+ * an object, or an attribute attached to an object, H5Ropen_object()
+ * opens that object and returns an identifier.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the referenced object. The access property list
+ * must be of the same type as the object being referenced, that is
+ * a group or dataset property list.
+ *
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
+ *
+ * The object opened with this function should be closed when it
+ * is no longer needed so that resource leaks will not develop. Use
+ * the appropriate close function such as H5Oclose() or H5Dclose()
+ * for datasets.
+ *
+ */
H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Sets up a dataspace and selection as specified by a region reference.
+ *
+ * \param[in] ref_ptr Pointer to reference to open
+ * \rapl_id
+ * \oapl_id
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details H5Ropen_region() creates a copy of the dataspace of the
+ * dataset pointed to by a region reference, \p ref_ptr, and defines
+ * a selection matching the selection pointed to by \p ref_ptr within
+ * the dataspace copy.
+ *
+ * The parameter \p rapl id is a reference access property list
+ * identifier for the reference. The access property list can
+ * be used to access external files that the reference points to
+ * (through a file access property list).
+ *
+ * The parameter \p oapl id is an object access property list
+ * identifier for the referenced object. The access property list
+ * must be of the same type as the object being referenced, that is
+ * a dataset property list in that case.
+ *
+ * Use H5Sclose() to release the dataspace identifier returned by
+ * this function when the identifier is no longer needed.
+ *
+ */
H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 attribute referenced
+ *
+ * \param[in] ref_ptr Pointer to reference to open
+ * \rapl_id
+ * \aapl_id
+ *
+ * \return \hid_t{attribute}
+ *
+ * \details Given a reference, \p ref_ptr, to an attribute attached to
+ * an object, H5Ropen_attr() opens the attribute attached to that
+ * object and returns an identifier.
+ *
+ * The parameter \p rapl id is a reference access property list
+ * identifier for the reference. The access property list can
+ * be used to access external files that the reference points to
+ * (through a file access property list).
+ *
+ * The parameter \p aapl_id is an attribute access property list
+ * identifier for the referenced attribute.
+ *
+ * The attribute opened with this function should be closed with
+ * H5Aclose() when it is no longer needed.
+ *
+ */
H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id);
/* Get type */
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of object that an object reference points to
+ *
+ * \param[in] ref_ptr Pointer to reference to query
+ * \rapl_id
+ * \param[out] obj_type Type of referenced object
+ *
+ * \return \herr_t
+ *
+ * \details Given a reference, \p ref_ptr, H5Rget_obj_type3() retrieves
+ * the type of the referenced object in \p obj_type.
+ *
+ * The parameter \p rapl id is a reference access property list
+ * identifier for the reference. The access property list can
+ * be used to access external files that the reference points to
+ * (through a file access property list).
+ *
+ * Upon success, the function returns in \p obj_type the type of
+ * the object that the reference points to. Valid values for this
+ * referenced object type are as followed (defined in H5Opublic.h):
+ * \snippet H5Opublic.h H5O_type_t_snip
+ *
+ */
H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type);
/* Get name */
-H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size);
-H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size);
-H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the file name for a referenced object
+ *
+ * \param[in] ref_ptr Pointer to reference to query
+ * \param[in,out] name Buffer to place the file name of the reference
+ * \param[in] size Size of the \p name buffer
+ *
+ * \return Returns the length of the name if successful, otherwise, a negative value.
+ *
+ * \details H5Rget_file_name() retrieves the file name for the object,
+ * region or attribute reference pointed to by \p ref_ptr.
+ *
+ * Up to \p size characters of the name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application. If the length of the name, which determines
+ * the required value of size, is unknown, a preliminary
+ * H5Rget_file_name() call can be made. The return value of this
+ * call will be the size of the file name. That value can then be
+ * passed in for size in the second call to H5Rget_file_name(),
+ * which will retrieve the actual name.
+ *
+ */
+H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the object name for a referenced object
+ *
+ * \param[in] ref_ptr Pointer to reference to query
+ * \rapl_id
+ * \param[in,out] name Buffer to place the file name of the reference
+ * \param[in] size Size of the \p name buffer
+ *
+ * \return Returns the length of the name if successful, returning
+ * 0 (zero) if no name is associated with the identifier. Otherwise
+ * returns a negative value.
+ *
+ * \details H5Rget_obj_name() retrieves the object name for the object,
+ * region or attribute reference pointed to by \p ref_ptr.
+ *
+ * The parameter \p rapl_id is a reference access property list
+ * identifier for the reference. The access property list can
+ * be used to access external files that the reference points to
+ * (through a file access property list).
+ *
+ * Up to size characters of the name are returned in \p name; additional
+ * characters, if any, are not returned to the user application. If
+ * the length of the name, which determines the required value of
+ * \p size, is unknown, a preliminary call to H5Rget_obj_name() call
+ * can be made. The return value of this call will be the size of the
+ * object name. That value can then be passed in for \p size in the
+ * second call to H5Rget_obj_name(), which will retrieve the actual
+ * name. If there is no name associated with the object identifier
+ * or if the name is NULL, H5Rget_obj_name() returns the size of
+ * the name buffer (the size does not include the \c \0 terminator).
+ *
+ * If \p ref_ptr is an object reference, \p name will be returned with
+ * a name for the referenced object. If \p ref_ptr is a dataset region
+ * reference, \p name will contain a name for the object containing
+ * the referenced region. If \p ref_ptr is an attribute reference, \p
+ * name will contain a name for the object the attribute is attached
+ * to. Note that an object in an HDF5 file may have multiple paths
+ * if there are multiple links pointing to it. This function may
+ * return any one of these paths.
+ *
+ */
+H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, size_t size);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the attribute name for a referenced object
+ *
+ * \param[in] ref_ptr Pointer to reference to query
+ * \param[in,out] name Buffer to place the attribute name of the reference
+ * \param[in] size Size of the \p name buffer
+ *
+ * \return Returns the length of the name if successful, otherwise, a negative value.
+ *
+ * \details H5Rget_attr_name() retrieves the attribute name for the
+ * attribute reference pointed to by \p ref_ptr.
+ *
+ * Up to size characters of the name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application. If the length of the name, which determines
+ * the required value of \p size, is unknown, a preliminary
+ * H5Rget_attr_name() call can be made. The return value of this
+ * call will be the size of the attribute name. That value can then
+ * be passed in for size in the second call to H5Rget_attr_name(),
+ * which will retrieve the actual name.
+ *
+ */
+H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -138,19 +550,338 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size
/* Function prototypes */
#ifndef H5_NO_DEPRECATED_SYMBOLS
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of object that an object reference points to
+ *
+ * \param[in] id The dataset containing the reference object or the group
+ * containing that dataset
+ * \param[in] ref_type Type of reference to query
+ * \param[in] ref Reference to query
+ *
+ * \return Returns a valid object type if successful; otherwise returns a
+ * negative value (#H5G_UNKNOWN).
+ *
+ * \deprecated This function has been renamed from H5Rget_obj_type() and is
+ * deprecated in favor of the macro H5Rget_obj_type() or the
+ * function H5Rget_obj_type2().
+ *
+ * \details Given an object reference, \p ref, H5Rget_obj_type1() returns the
+ * type of the referenced object.
+ *
+ * A \Emph{reference type} is the type of reference, either an object
+ * reference or a dataset region reference. An \Emph{object reference}
+ * points to an HDF5 object while a \Emph{dataset region reference}
+ * points to a defined region within a dataset.
+ *
+ * The \Emph{referenced object} is the object the reference points
+ * to. The \Emph{referenced object type}, or the type of the referenced
+ * object, is the type of the object that the reference points to.
+ *
+ * The location identifier, \p id, is the identifier for either the
+ * dataset containing the object reference or the group containing that
+ * dataset.
+ *
+ * Valid reference types, to pass in as \p ref_type, include the
+ * following:
+ * \snippet this H5R_type_t_snip
+ *
+ * If the application does not already know the object reference type,
+ * that can be determined with three preliminary calls:
+ *
+ * \li Call H5Dget_type() on the dataset containing the reference to
+ * get a datatype identifier for the dataset’s datatype.
+ * \li Using that datatype identifier, H5Tget_class() returns a datatype
+ * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
+ * then be used to determine whether the reference’s datatype is
+ * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
+ * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
+ * is #H5R_OBJECT.
+ * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
+ * type is #H5R_DATASET_REGION.
+ *
+ * When the function completes successfully, it returns one of the
+ * following valid object type values (defined in H5Gpublic.h):
+ * \snippet H5Gpublic.h H5G_obj_t_snip
+ *
+ * \version 1.8.0 Function H5Rget_obj_type() renamed to H5Rget_obj_type1() and
+ * deprecated in this release.
+ * \since 1.6.0
+ *
+ */
H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref);
-H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 object referenced
+ *
+ * \obj_id
+ * \param[in] ref_type The reference type of \p ref
+ * \param[in] ref Reference to open
+ *
+ * \return Returns identifier of referenced object if successful; otherwise
+ * returns a negative value.
+ *
+ * \deprecated This function has been renamed from H5Rdereference() and is
+ * deprecated in favor of the macro H5Rdereference() or the function
+ * H5Rdereference2().
+ *
+ * \details Given a reference, \p ref, to an object or a region in an object,
+ * H5Rdereference1() opens that object and returns an identifier.
+ *
+ * The parameter \p obj_id must be a valid identifier for an object in
+ * the HDF5 file containing the referenced object, including the file
+ * identifier.
+ *
+ * The parameter \p ref_type specifies the reference type of the
+ * reference \p ref. \p ref_type may contain either of the following
+ * values:
+ * - #H5R_OBJECT
+ * - #H5R_DATASET_REGION
+ *
+ * The object opened with this function should be closed when it is no
+ * longer needed so that resource leaks will not develop. Use the
+ * appropriate close function such as H5Oclose() or H5Dclose() for
+ * datasets.
+ *
+ * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and
+ * deprecated in this release.
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
-H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
-H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
-H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Creates a reference
+ *
+ * \param[out] ref Reference created by the function call
+ * \param[in] loc_id Location identifier used to locate the object being pointed to
+ * \param[in] name Name of object at location \p loc_id
+ * \param[in] ref_type Type of reference
+ * \param[in] space_id Dataspace identifier with selection. Used only for
+ * dataset region references; pass as -1 if reference is
+ * an object reference, i.e., of type #H5R_OBJECT
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcreate() creates the reference, \p ref, of the type specified in
+ * \p ref_type, pointing to the object \p name located at \p loc_id.
+ *
+ * The HDF5 library maps the void type specified above for \p ref to
+ * the type specified in \p ref_type, which will be one of the following:
+ * \snippet this H5R_type_t_snip
+ *
+ * The parameters \p loc_id and \p name are used to locate the object.
+ *
+ * The parameter \p space_id identifies the dataset region that a
+ * dataset region reference points to. This parameter is used only with
+ * dataset region references and should be set to -1 if the reference
+ * is an object reference, #H5R_OBJECT.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of object that an object reference points to
+ *
+ * \param[in] id The dataset containing the reference object or the group
+ * containing that dataset
+ * \param[in] ref_type Type of reference to query
+ * \param[in] ref Reference to query
+ * \param[out] obj_type Type of referenced object
+ *
+ * \return \herr_t
+ *
+ * \details Given an object reference, \p ref, H5Rget_obj_type2() returns the
+ * type of the referenced object in \p obj_type.
+ *
+ * A \Emph{reference type} is the type of reference, either an object
+ * reference or a dataset region reference. An \Emph{object reference}
+ * points to an HDF5 object while a \Emph{dataset region reference}
+ * points to a defined region within a dataset.
+ *
+ * The \Emph{referenced object} is the object the reference points
+ * to. The \Emph{referenced object type}, or the type of the referenced
+ * object, is the type of the object that the reference points to.
+ *
+ * The location identifier, \p id, is the identifier for either the
+ * dataset containing the object reference or the group containing that
+ * dataset.
+ *
+ * Valid reference types, to pass in as \p ref_type, include the
+ * following:
+ * \snippet this H5R_type_t_snip
+ *
+ * If the application does not already know the object reference type,
+ * that can be determined with three preliminary calls:
+ *
+ * \li Call H5Dget_type() on the dataset containing the reference to
+ * get a datatype identifier for the dataset’s datatype.
+ * \li Using that datatype identifier, H5Tget_class() returns a datatype
+ * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
+ * then be used to determine whether the reference’s datatype is
+ * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
+ * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
+ * is #H5R_OBJECT.
+ * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
+ * type is #H5R_DATASET_REGION.
+ *
+ * When the function completes successfully, it returns one of the
+ * following valid object type values (defined in H5Opublic.h):
+ * \snippet H5Opublic.h H5O_type_t_snip
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 object referenced
+ *
+ * \obj_id
+ * \oapl_id
+ * \param[in] ref_type The reference type of \p ref
+ * \param[in] ref Reference to open
+ *
+ * \return Returns identifier of referenced object if successful; otherwise
+ * returns a negative value.
+ *
+ * \details Given a reference, \p ref, to an object or a region in an object,
+ * H5Rdereference2() opens that object and returns an identifier.
+ *
+ * The parameter \p obj_id must be a valid identifier for the HDF5 file
+ * containing the referenced object or for any object in that HDF5
+ * file.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the referenced object. The access property list must
+ * be of the same type as the object being referenced, that is a group,
+ * dataset, or datatype property list.
+ *
+ * The parameter \p ref_type specifies the reference type of the
+ * reference \p ref. \p ref_type may contain either of the following
+ * values:
+ * - #H5R_OBJECT
+ * - #H5R_DATASET_REGION
+ *
+ * The object opened with this function should be closed when it is no
+ * longer needed so that resource leaks will not develop. Use the
+ * appropriate close function such as H5Oclose() or H5Dclose() for
+ * datasets.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Sets up a dataspace and selection as specified by a region reference
+ *
+ * \param[in] dataset File identifier or identifier for any object in the file
+ * containing the referenced region
+ * \param[in] ref_type Reference type of \p ref, which must be #H5R_DATASET_REGION
+ * \param[in] ref Region reference to open
+ *
+ * \return Returns a valid dataspace identifier if successful; otherwise returns
+ * a negative value.
+ *
+ * \details H5Rget_region() creates a copy of the dataspace of the dataset
+ * pointed to by a region reference, \p ref, and defines a selection
+ * matching the selection pointed to by ref within the dataspace copy.
+ *
+ * \p dataset is used to identify the file containing the referenced
+ * region; it can be a file identifier or an identifier for any object
+ * in the file.
+ *
+ * The parameter \p ref_type specifies the reference type of \p ref and
+ * must contain the value #H5R_DATASET_REGION.
+ *
+ * Use H5Sclose() to release the dataspace identifier returned by this
+ * function when the identifier is no longer needed.
+ *
+ */
+H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves a name for a referenced object
+ *
+ * \param[in] loc_id Identifier for the file containing the reference or for
+ * any object in that file
+ * \param[in] ref_type Type of reference
+ * \param[in] ref An object or dataset region reference
+ * \param[out] name A buffer to place the name of the referenced object or
+ * dataset region. If \c NULL, then this call will return the
+ * size in bytes of the name.
+ * \param[in] size The size of the \p name buffer. When the size is passed in,
+ * the \c NULL terminator needs to be included.
+ *
+ * \return Returns the length of the name if successful, returning 0 (zero) if
+ * no name is associated with the identifier. Otherwise returns a
+ * negative value.
+ *
+ * \details H5Rget_name() retrieves a name for the object identified by \p ref.\n
+ * \p loc_id is used to identify the file containing the reference. It
+ * can be the file identifier for the file containing the reference or
+ * an identifier for any object in that file.
+ *
+ * \ref H5R_type_t is the reference type of \p ref. Valid values
+ * include the following:
+ * \snippet this H5R_type_t_snip
+ *
+ * \p ref is the reference for which the target object’s name is
+ * sought.
+ *
+ * If \p ref is an object reference, \p name will be returned with a
+ * name for the referenced object. If \p ref is a dataset region
+ * reference, \p name will contain a name for the object containing the
+ * referenced region.
+ *
+ * Up to \p size characters of the name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application.
+ *
+ * If the length of the name, which determines the required value of \p
+ * size, is unknown, a preliminary H5Rget_name() call can be made. The
+ * return value of this call will be the size of the object name. That
+ * value can then be assigned to \p size for a second H5Rget_name()
+ * call, which will retrieve the actual name.
+ *
+ * If there is no name associated with the object identifier or if the
+ * \p name is \c NULL, H5Rget_name() returns the size of the \p name
+ * buffer (the size does not include the \p NULL terminator).
+ *
+ * Note that an object in an HDF5 file may have multiple paths if there
+ * are multiple links pointing to it. This function may return any one
+ * of these paths.
+ *
+ * \since 1.8.0
+ */
H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size);
#ifdef __cplusplus
}
#endif
-#endif /* _H5Rpublic_H */
+#endif /* H5Rpublic_H */
diff --git a/src/H5S.c b/src/H5S.c
index 1cdfed6..d45a6f1 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -264,7 +264,7 @@ 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)
@@ -396,12 +396,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -420,18 +420,21 @@ 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
*
*-------------------------------------------------------------------------
*/
@@ -466,12 +469,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -498,42 +501,43 @@ done:
/*-------------------------------------------------------------------------
* 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() */
@@ -541,12 +545,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -613,12 +617,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -681,18 +685,19 @@ done:
/*-------------------------------------------------------------------------
* 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
- * Failure: NULL
+ * Return: Success: A pointer to a new copy of SRC
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
*
*-------------------------------------------------------------------------
*/
@@ -729,13 +734,14 @@ done:
/*-------------------------------------------------------------------------
* 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.
*
- * Return: Success: Number of data points in the dataset extent.
- * Failure: negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * 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
@@ -763,13 +769,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -795,18 +801,18 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -836,11 +842,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];
@@ -850,7 +856,7 @@ 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)
@@ -859,13 +865,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -873,14 +879,14 @@ int
H5Sget_simple_extent_ndims(hid_t space_id)
{
H5S_t *ds;
- int ret_value; /* Return value */
+ 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);
@@ -891,14 +897,15 @@ done:
/*-------------------------------------------------------------------------
* 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.
- * Failure: Negative
+ * Return: Success: Non-negative number of dimensions.
+ * Zero implies a scalar.
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
+ * Failure: Negative
+ *
+ * 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
@@ -936,15 +943,16 @@ done:
/*-------------------------------------------------------------------------
* 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().
*
- * Return: Success: Number of dimensions, the same value as
- * returned by H5Sget_simple_extent_ndims().
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
+ * Programmer: Robb Matzke
+ * Thursday, December 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -952,14 +960,14 @@ int
H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[] /*out*/, hsize_t maxdims[] /*out*/)
{
H5S_t *ds;
- int ret_value; /* Return value */
+ 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);
@@ -970,14 +978,14 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1025,14 +1033,14 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1057,13 +1065,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1090,13 +1098,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
@@ -1123,13 +1130,14 @@ done:
/*-------------------------------------------------------------------------
* 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.
- * Failure: NULL
+ * Return: Success: Pointer to a new dataspace.
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
@@ -1203,7 +1211,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
@@ -1236,11 +1244,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
@@ -1284,7 +1292,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con
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)
@@ -1297,12 +1305,11 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -1371,20 +1378,21 @@ done:
/*-------------------------------------------------------------------------
* 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.
- * Failure: Negative
+ * Return: Success: The ID for the new simple dataspace object.
*
- * Programmer: Quincey Koziol
- * Tuesday, January 27, 1998
+ * Failure: H5I_INVALID_HID
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 1998
*
*-------------------------------------------------------------------------
*/
@@ -1393,44 +1401,44 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/
{
H5S_t *space = NULL;
int i;
- hid_t ret_value; /* Return value */
+ 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,
+ 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] < dims[i])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "maxdims is smaller than dims")
} /* end for */
/* Create the space and set the extent */
if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace")
/* Atomize */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0)
if (space && H5S_close(space) < 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 H5Screate_simple() */
@@ -1438,13 +1446,13 @@ done:
/*-------------------------------------------------------------------------
* Function: H5S_create_simple
*
- * Purpose: Internal function to create simple dataspace
+ * Purpose: Internal function to create simple dataspace
*
- * Return: Success: The ID for the new simple dataspace object.
- * Failure: Negative
+ * Return: Success: A pointer to a dataspace object
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * Thursday, April 3, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, April 3, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1471,16 +1479,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Sencode2
*
- * Purpose: Given a dataspace ID, converts the object description
+ * Purpose: Given a dataspace ID, converts the object description
* (including selection) into binary in a buffer.
- * The selection will be encoded according to the file
- * format setting in fapl.
+ * The selection will be encoded according to the file
+ * format setting in the fapl.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1507,20 +1514,18 @@ H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl_id)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sencode2() */
+} /* end H5Sencode2() */
/*-------------------------------------------------------------------------
* Function: H5S_encode
*
- * Purpose: Private function for H5Sencode. Converts an object
+ * Purpose: Private function for H5Sencode. Converts an object
* description for dataspace and its selection into binary
* in a buffer.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1590,14 +1595,14 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Sdecode
*
- * Purpose: Decode a binary object description of dataspace and
+ * Purpose: Decode a binary object description of dataspace and
* return a new object handle.
*
- * Return: Success: dataspace ID(non-negative)
- * Failure: negative
+ * Return: Success: dataspace ID(non-negative)
+ *
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1608,18 +1613,18 @@ H5Sdecode(const void *buf)
H5S_t *ds;
hid_t ret_value;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*x", buf);
if (buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer")
if ((ds = H5S_decode((const unsigned char **)&buf)) == NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object")
/* Register the type and return the ID */
if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace")
done:
FUNC_LEAVE_API(ret_value)
@@ -1628,14 +1633,14 @@ done:
/*-------------------------------------------------------------------------
* Function: H5S_decode
*
- * Purpose: Private function for H5Sdecode. Reconstructs a binary
+ * Purpose: Private function for H5Sdecode. Reconstructs a binary
* description of dataspace and returns a new object handle.
*
- * Return: Success: dataspace ID(non-negative)
- * Failure: negative
+ * Return: Success: Pointer to a dataspace buffer
+ *
+ * Failure: NULL
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1710,13 +1715,14 @@ done:
/*-------------------------------------------------------------------------
* 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
- * Failure: N5S_NO_CLASS
+ * Return: Success: The class of the dataspace object
*
- * Programmer: Quincey Koziol
- * Thursday, September 28, 2000
+ * Failure: N5S_NO_CLASS
+ *
+ * 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
@@ -1742,13 +1748,14 @@ done:
/*-------------------------------------------------------------------------
* 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
*
- * Return: Success: The class of the dataspace object
- * Failure: N5S_NO_CLASS
+ * Failure: N5S_NO_CLASS
*
- * Programmer: Quincey Koziol
- * Thursday, July 23, 1998
+ * Programmer: Quincey Koziol
+ * Thursday, July 23, 1998
*
*-------------------------------------------------------------------------
*/
@@ -1778,11 +1785,11 @@ 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
@@ -1802,7 +1809,7 @@ 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)
@@ -1813,10 +1820,9 @@ done:
*
* 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
*
*-------------------------------------------------------------------------
@@ -1895,7 +1901,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
*
*-------------------------------------------------------------------------
@@ -1936,21 +1942,23 @@ done:
/*-------------------------------------------------------------------------
* 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);
@@ -2030,13 +2038,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5SL.c b/src/H5SL.c
index f35cb3b..9d3f5b3 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -563,10 +563,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;
@@ -675,11 +675,11 @@ 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
@@ -696,11 +696,11 @@ 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)))
@@ -720,15 +720,15 @@ 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
@@ -744,14 +744,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 */
+ 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 = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(slist);
@@ -813,7 +813,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 */
@@ -835,15 +835,15 @@ 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
@@ -862,12 +862,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);
@@ -908,15 +908,15 @@ 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
@@ -934,11 +934,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);
@@ -947,7 +947,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 */
@@ -960,7 +960,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() */
/*--------------------------------------------------------------------------
NAME
@@ -1006,7 +1006,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 */
@@ -1106,7 +1106,7 @@ 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)
+ if (NULL == H5SL__insert_common(slist, item, key))
HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't create new skip list node")
done:
@@ -1155,7 +1155,7 @@ 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)
+ 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:
@@ -1378,9 +1378,9 @@ done:
void *
H5SL_search(H5SL_t *slist, const void *key)
{
- H5SL_node_t *x; /* Current node to examine */
- uint32_t hashval = 0; /* Hash value for key */
- void * ret_value; /* Return value */
+ H5SL_node_t *x; /* Current node to examine */
+ uint32_t hashval = 0; /* Hash value for key */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1676,9 +1676,9 @@ done:
H5SL_node_t *
H5SL_find(H5SL_t *slist, const void *key)
{
- H5SL_node_t *x; /* Current node to examine */
- uint32_t hashval = 0; /* Hash value for key */
- H5SL_node_t *ret_value; /* Return value */
+ H5SL_node_t *x; /* Current node to examine */
+ uint32_t hashval = 0; /* Hash value for key */
+ H5SL_node_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2215,7 +2215,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);
@@ -2227,8 +2229,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() */
@@ -2263,7 +2267,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);
@@ -2275,9 +2281,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() */
/*--------------------------------------------------------------------------
@@ -2491,7 +2499,7 @@ H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT
/* Check args */
HDassert(slist);
@@ -2500,8 +2508,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() */
@@ -2527,7 +2537,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);
@@ -2536,7 +2548,9 @@ 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 cc13614..2614f92 100644
--- a/src/H5SLmodule.h
+++ b/src/H5SLmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5SL package. Including this header means that the source file
* is part of the H5SL package.
*/
-#ifndef _H5SLmodule_H
-#define _H5SLmodule_H
+#ifndef H5SLmodule_H
+#define H5SLmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_SLIST
#define H5_MY_PKG_INIT YES
-#endif /* _H5SLmodule_H */
+#endif /* H5SLmodule_H */
diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h
index 8a75d3e..c9e1147 100644
--- a/src/H5SLprivate.h
+++ b/src/H5SLprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5SL module
*/
-#ifndef _H5SLprivate_H
-#define _H5SLprivate_H
+#ifndef H5SLprivate_H
+#define H5SLprivate_H
/**************************************/
/* Public headers needed by this file */
@@ -91,4 +91,4 @@ H5_DLL herr_t H5SL_close(H5SL_t *slist);
H5_DLL herr_t H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL int H5SL_term_interface(void);
-#endif /* _H5SLprivate_H */
+#endif /* H5SLprivate_H */
diff --git a/src/H5SM.c b/src/H5SM.c
index 20f6cdd..fa446cf 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -56,6 +56,7 @@ static herr_t H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t
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, hbool_t defer,
@@ -265,7 +266,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag)
switch (type_id) {
case H5O_FILL_ID:
type_id = H5O_FILL_NEW_ID;
- /* Fall through... */
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case H5O_SDSPACE_ID:
@@ -285,7 +286,7 @@ done:
} /* end H5SM__type_to_flag() */
/*-------------------------------------------------------------------------
- * Function: H5SM_get_index
+ * Function: H5SM__get_index
*
* Purpose: Get the index number for a given message type.
*
@@ -301,13 +302,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)
@@ -325,7 +326,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() */
/*-------------------------------------------------------------------------
* Function: H5SM_type_shared
@@ -419,7 +420,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 */
@@ -628,7 +629,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);
@@ -670,7 +671,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 */
/*-------------------------------------------------------------------------
@@ -788,6 +789,47 @@ done:
} /* H5SM__convert_list_to_btree() */
/*-------------------------------------------------------------------------
+ * 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
@@ -809,7 +851,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..
@@ -835,7 +877,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:
@@ -843,11 +885,11 @@ 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.
*
@@ -865,11 +907,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 */
@@ -888,7 +930,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() */
/*-------------------------------------------------------------------------
* Function: H5SM_can_share
@@ -920,7 +962,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un
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)
@@ -943,7 +985,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un
/* 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 */
@@ -1059,7 +1101,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id,
/* "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)
@@ -1220,19 +1262,19 @@ static herr_t
H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t defer, unsigned type_id,
void *mesg, unsigned *cache_flags_ptr)
{
- H5SM_list_t * list = NULL; /* List index */
- H5SM_mesg_key_t key; /* Key used to search the index */
- H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- H5O_shared_t shared; /* Shared H5O message */
- hbool_t found = FALSE; /* Was the message in the index? */
- H5HF_t * fheap = NULL; /* Fractal heap handle */
- H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
- size_t buf_size; /* Size of the encoded message */
- void * encoding_buf = NULL; /* Buffer for encoded message */
- size_t empty_pos = UFAIL; /* Empty entry in list */
+ H5SM_list_t * list = NULL; /* List index */
+ H5SM_mesg_key_t key; /* Key used to search the index */
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5O_shared_t shared; /* Shared H5O message */
+ hbool_t found = FALSE; /* Was the message in the index? */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ size_t buf_size; /* Size of the encoded message */
+ void * encoding_buf = NULL; /* Buffer for encoded message */
+ size_t empty_pos = SIZE_MAX; /* Empty entry in list */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG)
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(header);
@@ -1283,11 +1325,11 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
if (defer) {
- if (list_pos != UFAIL)
+ if (list_pos != SIZE_MAX)
found = TRUE;
} /* end if */
else {
- if (list_pos != UFAIL) {
+ if (list_pos != SIZE_MAX) {
/* If the message was previously shared in an object header, share
* it in the heap now.
*/
@@ -1442,13 +1484,13 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
/* Insert the new message into the SOHM index */
if (header->index_type == H5SM_LIST) {
/* Index is a list. Find an empty spot if we haven't already */
- if (empty_pos == UFAIL) {
+ if (empty_pos == SIZE_MAX) {
size_t pos;
if (H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
- if (pos == UFAIL || empty_pos == UFAIL)
+ if (pos == SIZE_MAX || empty_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
}
/* Insert message into list */
@@ -1499,7 +1541,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() */
/*-------------------------------------------------------------------------
@@ -1551,7 +1593,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
@@ -1608,9 +1650,14 @@ done:
*
* If EMPTY_POS is NULL, don't store anything in it.
*
- * Return: Message's position in the list on success
- * UFAIL if message couldn't be found
- * empty_pos set to position of empty message or UFAIL.
+ * Return: Success: SUCCEED
+ * pos = position (if found)
+ * pos = SIZE_MAX (if not found)
+ * empty_pos = indeterminate (if found)
+ * empty_pos = 1st empty position (if not found)
+ *
+ * Failure: FAIL
+ * pos & empty_pos indeterminate
*
* Programmer: James Laird
* Tuesday, May 2, 2006
@@ -1631,7 +1678,7 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Initialize empty_pos to an invalid value */
if (empty_pos)
- *empty_pos = UFAIL;
+ *empty_pos = SIZE_MAX;
/* Find the first (only) message equal to the key passed in.
* Also record the first empty position we find.
@@ -1654,44 +1701,17 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Found earlier position possible, don't check any more */
empty_pos = NULL;
- } /* end if */
- } /* end for */
+ }
+ }
/* If we reached this point, we didn't find the message */
- *pos = UFAIL;
+ *pos = SIZE_MAX;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM__find_in_list */
/*-------------------------------------------------------------------------
- * 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
@@ -1755,7 +1775,7 @@ H5SM__decr_ref(void *record, void *op_data, hbool_t *changed)
*/
static herr_t
H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, const H5O_shared_t *mesg,
- unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg)
+ unsigned *cache_flags, size_t *mesg_size /*out*/, void **encoded_mesg /*out*/)
{
H5SM_list_t * list = NULL;
H5SM_mesg_key_t key;
@@ -1768,7 +1788,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c
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);
@@ -1827,7 +1847,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
if (list->messages[list_pos].location == H5SM_IN_HEAP)
@@ -1934,7 +1954,7 @@ done:
*mesg_size = 0;
}
- FUNC_LEAVE_NOAPI_TAG(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM__delete_from_index() */
/*-------------------------------------------------------------------------
@@ -2093,7 +2113,7 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, H5O_fhe
} /* end H5SM_reconstitute() */
/*-------------------------------------------------------------------------
- * 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
*
@@ -2105,12 +2125,12 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, H5O_fhe
*-------------------------------------------------------------------------
*/
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.
@@ -2122,7 +2142,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() */
/*-------------------------------------------------------------------------
* Function: H5SM_get_refcount
@@ -2168,7 +2188,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize
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]);
@@ -2209,7 +2229,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Copy the message */
@@ -2226,7 +2246,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize
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")
@@ -2369,7 +2389,7 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh
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);
@@ -2443,11 +2463,11 @@ 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.
*
@@ -2459,9 +2479,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);
@@ -2472,10 +2492,10 @@ 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.
*
@@ -2487,9 +2507,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);
@@ -2499,14 +2519,14 @@ 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() */
/*-------------------------------------------------------------------------
* Function: H5SM_table_debug
*
* Purpose: Print debugging information for the master table.
*
- * If table_vers and num_indexes are not UFAIL, they are used
+ * If table_vers and num_indexes are not UINT_MAX, they are used
* instead of the values in the superblock.
*
* Return: Non-negative on success/Negative on failure
@@ -2533,14 +2553,14 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- /* If table_vers and num_indexes are UFAIL, replace them with values from
+ /* If table_vers and num_indexes are UINT_MAX, replace them with values from
* userblock
*/
- if (table_vers == UFAIL)
+ if (table_vers == UINT_MAX)
table_vers = H5F_SOHM_VERS(f);
else if (table_vers != H5F_SOHM_VERS(f))
HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n");
- if (num_indexes == UFAIL)
+ if (num_indexes == UINT_MAX)
num_indexes = H5F_SOHM_NINDEXES(f);
else if (num_indexes != H5F_SOHM_NINDEXES(f))
HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n");
@@ -2568,19 +2588,19 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi
? "List"
: (table->indexes[x].index_type == H5SM_BTREE ? "B-Tree" : "Unknown")));
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth,
"Address of index:", table->indexes[x].index_addr);
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth,
"Address of index's heap:", table->indexes[x].heap_addr);
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent + 3, "", fwidth,
"Message type flags:", table->indexes[x].mesg_types);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth,
"Minimum size of messages:", table->indexes[x].min_mesg_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth,
"Number of messages:", table->indexes[x].num_messages);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth,
"Maximum list size:", table->indexes[x].list_max);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth,
"Minimum B-tree size:", table->indexes[x].btree_min);
} /* end for */
@@ -2668,16 +2688,16 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt
HDassert(fh);
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap");
- HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth,
- "Heap ID:", list->messages[x].u.heap_loc.fheap_id);
- HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth,
+ "Heap ID:", list->messages[x].u.heap_loc.fheap_id.val);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", fwidth,
"Reference count:", list->messages[x].u.heap_loc.ref_count);
} /* end if */
else if (list->messages[x].location == H5SM_IN_OH) {
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in object header");
- HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth,
"Object header address:", list->messages[x].u.mesg_loc.oh_addr);
- HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth,
"Message creation index:", list->messages[x].u.mesg_loc.oh_addr);
HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth,
"Message type ID:", list->messages[x].msg_type_id);
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 9b9e407..2dca9fd 100644
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -187,56 +187,15 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, const void *record, const
FUNC_ENTER_STATIC_NOERR
if (sohm->location == H5SM_IN_HEAP)
- HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth,
- "Shared Message in heap:", sohm->u.heap_loc.fheap_id, sohm->hash,
+ HDfprintf(stream, "%*s%-*s {%" PRIu64 ", %" PRIo32 ", %" PRIxHSIZE "}\n", indent, "", fwidth,
+ "Shared Message in heap:", sohm->u.heap_loc.fheap_id.val, sohm->hash,
sohm->u.heap_loc.ref_count);
else {
HDassert(sohm->location == H5SM_IN_OH);
- HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx, %Hx}\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIo32 ", %x, %" PRIx32 "}\n", indent, "", fwidth,
"Shared Message in OH:", sohm->u.mesg_loc.oh_addr, sohm->hash, sohm->msg_type_id,
sohm->u.mesg_loc.index);
} /* end else */
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 6efd6c8..2ad467f 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5SMcache.c
* Nov 13 2006
- * James Laird <jlaird@hdfgroup.org>
+ * James Laird
*
* Purpose: Implement shared message metadata cache methods.
*
@@ -238,7 +238,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l
HDassert(table->table_size == len);
/* Check magic number */
- if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature")
image += H5_SIZEOF_MAGIC;
@@ -294,7 +294,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)
@@ -450,7 +450,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:
@@ -580,7 +580,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le
list->header = udata->header;
/* Check magic number */
- if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature")
image += H5_SIZEOF_MAGIC;
@@ -754,7 +754,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 606bd47..4499b0c 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -35,7 +35,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 */
@@ -45,9 +45,9 @@ 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, unsigned *oh_modified,
- void *udata);
+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);
/*********************/
/* Package Variables */
@@ -62,7 +62,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
@@ -78,11 +78,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)
@@ -94,10 +94,10 @@ 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
@@ -113,13 +113,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,
- unsigned H5_ATTR_UNUSED *oh_modified, void *_udata /*in,out*/)
+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.
@@ -156,7 +156,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() */
/*-------------------------------------------------------------------------
* Function: H5SM__message_compare
@@ -227,7 +227,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 {
@@ -251,7 +251,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 4961720..6d2abf1 100644
--- a/src/H5SMmodule.h
+++ b/src/H5SMmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5SM package. Including this header means that the source file
* is part of the H5SM package.
*/
-#ifndef _H5SMmodule_H
-#define _H5SMmodule_H
+#ifndef H5SMmodule_H
+#define H5SMmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,4 @@
#define H5_MY_PKG_ERR H5E_SOHM
#define H5_MY_PKG_INIT NO
-#endif /* _H5SMmodule_H */
+#endif /* H5SMmodule_H */
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 296dd5a..ae9a5f6 100644
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: James Laird <jlaird@ncsa.uiuc.edu>
+ * Programmer: James Laird
* Thursday, March 30, 2006
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5SM package!"
#endif
-#ifndef _H5SMpkg_H
-#define _H5SMpkg_H
+#ifndef H5SMpkg_H
+#define H5SMpkg_H
/* Get package's private header */
#include "H5SMprivate.h" /* Shared Object Header Messages */
@@ -255,26 +255,20 @@ 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
H5_DLL herr_t H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count);
#endif /* H5SM_TESTING */
-#endif /* _H5SMpkg_H */
+#endif /* H5SMpkg_H */
diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h
index 3d5162f..efe9355 100644
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -6,20 +6,20 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: James Laird <jlaird@ncsa.uiuc.edu>
+ * Programmer: James Laird
* Thursday, March 2, 2006
*
* Purpose: This file contains private declarations for the H5SM
* shared object header messages module.
*/
-#ifndef _H5SMprivate_H
-#define _H5SMprivate_H
+#ifndef H5SMprivate_H
+#define H5SMprivate_H
#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
@@ -66,4 +66,4 @@ H5_DLL herr_t H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int i
H5_DLL herr_t H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidth,
haddr_t table_addr);
-#endif /*_H5SMprivate_H*/
+#endif /*H5SMprivate_H*/
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 51a3290..d6f96be 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -91,7 +91,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
deleted file mode 100644
index 266b276..0000000
--- a/src/H5ST.c
+++ /dev/null
@@ -1,779 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* TERNARY SEARCH TREE ALGS
- This code is described in "Ternary Search Trees" by Jon
-Bentley and Robert Sedgewick in the April, 1998, Dr. Dobb's Journal.
-*/
-
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5STprivate.h" /* Ternary search trees */
-
-#ifdef H5ST_DEBUG
-static herr_t H5ST__dump_internal(H5ST_ptr_t p);
-#endif /* H5ST_DEBUG */
-
-/* Declare a free list to manage the H5ST_node_t struct */
-H5FL_DEFINE_STATIC(H5ST_node_t);
-
-/* Declare a free list to manage the H5ST_tree_t struct */
-H5FL_DEFINE_STATIC(H5ST_tree_t);
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_create
- PURPOSE
- Create a TST
- USAGE
- H5ST_ptr_t H5ST_create()
-
- RETURNS
- Returns a pointer to the new TST tree on success, NULL on failure.
- DESCRIPTION
- Create a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_tree_t *
-H5ST_create(void)
-{
- H5ST_tree_t *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Allocate wrapper for TST */
- if (NULL == (ret_value = H5FL_MALLOC(H5ST_tree_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Set the internal fields */
- ret_value->root = NULL;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_create() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_close_internal
- PURPOSE
- Close a TST, deallocating it.
- USAGE
- herr_t H5ST_close(p)
- H5ST_ptr_t p; IN/OUT: Root of TST to free
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Close a TST, freeing all nodes.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5ST_close_internal(H5ST_ptr_t p)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Recursively free TST */
- if (p) {
- H5ST_close_internal(p->lokid);
- if (p->splitchar)
- 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() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_close
- PURPOSE
- Close a TST, deallocating it.
- USAGE
- herr_t H5ST_close(tree)
- H5ST_tree_t *tree; IN/OUT: TST tree to free
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Close a TST, freeing all nodes.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_close(H5ST_tree_t *tree)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (NULL == tree)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid TST")
-
- /* Free the TST itself */
- if (H5ST_close_internal(tree->root) < 0)
- HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST")
-
- /* Free root node itself */
- tree = H5FL_FREE(H5ST_tree_t, tree);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_close() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_insert
- PURPOSE
- Insert a string/object pair into a TST
- USAGE
- herr_t H5ST_insert(tree,s,obj)
- H5ST_tree_t *tree; IN/OUT: TST to insert string into
- const char *s; IN: String to use as key for object
- void *obj; IN: Pointer to object to insert
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Insert a key (string)/object pair into a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj)
-{
- int d; /* Comparison value */
- H5ST_ptr_t pp, *p; /* Pointer to current node and pointer to that */
- H5ST_ptr_t parent = NULL; /* Pointer to parent node */
- H5ST_ptr_t up = NULL; /* Pointer to up node */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Find the correct location to insert object */
- p = &tree->root;
- while ((pp = *p)) {
- /* If this node matches the character in the key, then drop down to the lower tree */
- if (0 == (d = *s - pp->splitchar)) {
- if (*s++ == 0)
- HGOTO_ERROR(H5E_TST, H5E_EXISTS, FAIL, "key already in tree")
- up = pp;
- p = &(pp->eqkid);
- } /* end if */
- else {
- /* Walk through the current tree, searching for the matching character */
- parent = pp;
- if (d < 0)
- p = &(pp->lokid);
- else
- p = &(pp->hikid);
- } /* end else */
- } /* end while */
-
- /* Finish walking through the key string, adding nodes until the end */
- for (;;) {
- if (NULL == (*p = H5FL_MALLOC(H5ST_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- pp = *p;
- pp->splitchar = *s;
- pp->up = up;
- pp->parent = parent;
- pp->lokid = pp->eqkid = pp->hikid = NULL;
-
- /* If this is the end of the key string, break out */
- if (*s++ == 0) {
- pp->eqkid = (H5ST_ptr_t)obj;
- break;
- } /* end if */
-
- /* Continue to next character */
- parent = NULL;
- up = pp;
- p = &(pp->eqkid);
- } /* end for */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_insert() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_search
- PURPOSE
- Determine if a key is in the TST
- USAGE
- hbool_t H5ST_search(tree,s)
- H5ST_tree_t *tree; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: TRUE if key string in TST, FALSE if not
- Failure: negative
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-htri_t
-H5ST_search(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t p; /* Temporary pointer to TST node */
- htri_t ret_value = FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- p = tree->root;
- while (p) {
- if (*s < p->splitchar)
- p = p->lokid;
- else if (*s == p->splitchar) {
- if (*s++ == 0)
- HGOTO_DONE(TRUE);
- p = p->eqkid;
- }
- else
- p = p->hikid;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_search() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_find_internal
- PURPOSE
- Find the node matching a particular key string
- USAGE
- H5ST_ptr_t H5ST_find(p,s)
- H5ST_ptr_t p; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST_find_internal(H5ST_ptr_t p, const char *s)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- while (p) {
- if (*s < p->splitchar)
- p = p->lokid;
- else if (*s == p->splitchar) {
- if (*s++ == 0)
- HGOTO_DONE(p);
- p = p->eqkid;
- }
- else
- p = p->hikid;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_find_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_find
- PURPOSE
- Find the node matching a particular key string
- USAGE
- H5ST_ptr_t H5ST_find(tree,s)
- H5ST_tree_t *tree; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_find(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- if (NULL == (ret_value = H5ST_find_internal(tree->root, s)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_find() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_locate
- PURPOSE
- Find an object in a TST
- USAGE
- void *H5ST_locate(tree,s)
- H5ST_tree_t *tree; IN: TST to locate object within
- const char *s; IN: String of key for object to locate
- RETURNS
- Success: Non-NULL, pointer to object stored for key
- Failure: Negative
- DESCRIPTION
- Locate a node in a TST, returning the object from the node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-void *
-H5ST_locate(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t node; /* Pointer to node located */
- void * ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Locate the node to remove */
- 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;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5ST_locate() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_findfirst_internal
- PURPOSE
- Find the first node in a TST
- USAGE
- H5ST_ptr_t H5ST_findfirst_internal(p)
- H5ST_ptr_t p; IN: TST to locate first node within
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the first (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST_findfirst_internal(H5ST_ptr_t p)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- while (p) {
- /* Find least node in current tree */
- while (p->lokid)
- p = p->lokid;
-
- /* Is least node '\0'? */
- if (p->splitchar == '\0') {
- /* Return it */
- HGOTO_DONE(p);
- } /* end if */
- else {
- /* Go down to next level of tree */
- p = p->eqkid;
- } /* end else */
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_findfirst_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_findfirst
- PURPOSE
- Find the first node in a TST
- USAGE
- H5ST_ptr_t H5ST_findfirst(tree)
- H5ST_tree_t *tree; IN: TST to locate first node within
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the first (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_findfirst(H5ST_tree_t *tree)
-{
- H5ST_ptr_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- if (NULL == (ret_value = H5ST_findfirst_internal(tree->root)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "no nodes in TST");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_findfirst() */
-
-/*--------------------------------------------------------------------------
- NAME
- 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 *p; IN: Pointer to node to find next node from
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the next (lexicographically) node in the current level of a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST_getnext(H5ST_ptr_t p)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* If the node to continue from has higher-valued nodes attached */
- if (p->hikid) {
- /* Go to first higher-valued node */
- p = p->hikid;
-
- /* Find least node from here */
- while (p->lokid)
- p = p->lokid;
- HGOTO_DONE(p);
- } /* end if */
- else {
- H5ST_ptr_t q; /* Temporary TST node pointer */
-
- /* Go up one level in current tree */
- q = p->parent;
- if (q == NULL)
- HGOTO_DONE(NULL);
-
- /* While the previous node was the higher-valued node, keep backing up the tree */
- while (q->hikid == p) {
- p = q;
- q = p->parent;
- if (NULL == q)
- HGOTO_DONE(NULL);
- } /* end while */
- HGOTO_DONE(q);
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_getnext() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_findnext
- PURPOSE
- Find the next node from a node in a TST
- USAGE
- H5ST_ptr_t H5ST_findnext(p)
- H5ST_ptr_t p; IN: Current node to continue from
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the next (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_findnext(H5ST_ptr_t p)
-{
- H5ST_ptr_t q; /* Temporary pointer to TST node */
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Find the next node at the current level, or go back up the tree */
- do {
- q = H5ST_getnext(p);
- if (q) {
- HGOTO_DONE(H5ST_findfirst_internal(q->eqkid));
- } /* end if */
- else
- p = p->up;
- } while (p);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_findnext() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_delete_internal
- PURPOSE
- Delete a node from a TST
- USAGE
- 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
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Delete a node from a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This should be the final node for a string.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-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
-
- /* Find node to replace one being deleted */
- if (p->lokid) {
- /* If the deleted node has lo & hi kids, attach them together */
- if (p->hikid) {
- q = p->lokid;
- while (q->hikid)
- q = q->hikid;
- q->hikid = p->hikid;
- p->hikid->parent = q;
- } /* end if */
- newp = p->lokid;
- } /* end if */
- else if (p->hikid) {
- newp = p->hikid;
- } /* end if */
- else {
- newp = NULL;
- } /* end else */
-
- /* Deleted node is in middle of tree */
- if (p->parent) {
- /* Attach new node to correct side of parent */
- if (p == p->parent->lokid)
- p->parent->lokid = newp;
- else
- p->parent->hikid = newp;
- if (newp)
- newp->parent = p->parent;
- } /* end if */
- else {
- if (newp)
- newp->parent = p->parent;
- if (p->up) {
- p->up->eqkid = newp;
-
- /* If we deleted the last node in the TST, delete the upper node also */
- if (NULL == newp)
- H5ST_delete_internal(root, p->up);
- } /* end if */
- else /* Deleted last node at top level of tree */
- *root = newp;
- } /* end else */
-
- p = H5FL_FREE(H5ST_node_t, p);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST_delete_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_delete
- PURPOSE
- Delete a node from a TST
- USAGE
- herr_t H5ST_delete(tree,p)
- H5ST_tree_t *tree; IN/OUT: TST to delete node from
- H5ST_ptr_t p; IN: Node to delete
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Delete a node from a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This should be the final node for a string.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_delete(H5ST_tree_t *tree, H5ST_ptr_t p)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if (H5ST_delete_internal(&tree->root, p) < 0)
- HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, FAIL, "can't delete node from TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_delete() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_remove
- PURPOSE
- Remove a node from a TST
- USAGE
- void *H5ST_remove(tree,s)
- H5ST_tree_t *tree; IN/OUT: TST to remove node from
- const char *s; IN: String of key for node to remove
- RETURNS
- Success: Non-NULL, pointer to object stored for key
- Failure: Negative
- DESCRIPTION
- Remove a node from a TST, returning the object from the node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-void *
-H5ST_remove(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t node; /* Pointer to node to remove */
- void * ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Locate the node to remove */
- 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)
- HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, NULL, "can't delete node from TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5ST_remove() */
-
-#ifdef H5ST_DEBUG
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__dump_internal
- PURPOSE
- Dump all the nodes of a TST
- USAGE
- herr_t H5ST_dump(p)
- H5ST_ptr_t p; IN: Root of TST to dump
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Dump information for a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5ST__dump_internal(H5ST_ptr_t p)
-{
- FUNC_ENTER_STATIC_NOERR
-
- if (p) {
- HDprintf("p=%p\n", (void *)p);
- HDprintf("\tp->up=%p\n", (void *)p->up);
- HDprintf("\tp->parent=%p\n", (void *)p->parent);
- HDprintf("\tp->lokid=%p\n", (void *)p->lokid);
- HDprintf("\tp->hikid=%p\n", (void *)p->hikid);
- HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid);
- HDprintf("\tp->splitchar=%c\n", p->splitchar);
-
- H5ST__dump_internal(p->lokid);
- if (p->splitchar)
- H5ST__dump_internal(p->eqkid);
- else
- HDprintf("%s\n", (char *)p->eqkid);
- H5ST__dump_internal(p->hikid);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST__dump_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_dump
- PURPOSE
- Dump all the nodes of a TST
- USAGE
- herr_t H5ST_dump(tree)
- H5ST_tree_t *tree; IN: TST to dump
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Dump information for a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_dump(H5ST_tree_t *tree)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Dump the tree */
- H5ST__dump_internal(tree->root);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST_dump() */
-#endif /* H5ST_DEBUG */
diff --git a/src/H5STprivate.h b/src/H5STprivate.h
deleted file mode 100644
index 52f8d1f..0000000
--- a/src/H5STprivate.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * This file contains private information about the H5ST module
- */
-#ifndef _H5STprivate_H
-#define _H5STprivate_H
-
-#ifdef LATER
-#include "H5STpublic.h"
-#endif /* LATER */
-
-/* Private headers needed by this file */
-#include "H5private.h"
-
-/* Typedefs */
-
-/* Internal nodes for TST */
-typedef struct H5ST_node *H5ST_ptr_t;
-typedef struct H5ST_node {
- char splitchar; /* Character represented at node */
- H5ST_ptr_t up; /* Pointer to the node in the tree above (before) this node */
- H5ST_ptr_t parent; /* Pointer to the next higher tree node in this tree */
- H5ST_ptr_t lokid; /* Pointer to the lower node from this one, in this tree */
- H5ST_ptr_t eqkid; /* Pointer to the parent node in the next tree down (after) this node */
- H5ST_ptr_t hikid; /* Pointer to the higher node from this one, in this tree */
-} H5ST_node_t;
-
-/* Wrapper about TST */
-typedef struct {
- H5ST_ptr_t root; /* Pointer to actual TST */
-} H5ST_tree_t;
-
-/* Macro to access "data" pointer in H5ST_node_t's returned from functions */
-#define H5ST_NODE_DATA(p) ((void *)(p->eqkid))
-
-/* Private routines */
-H5_DLL H5ST_tree_t *H5ST_create(void);
-H5_DLL herr_t H5ST_close(H5ST_tree_t *p);
-H5_DLL herr_t H5ST_insert(H5ST_tree_t *root, const char *s, void *obj);
-H5_DLL htri_t H5ST_search(H5ST_tree_t *root, const char *s);
-H5_DLL H5ST_ptr_t H5ST_find(H5ST_tree_t *root, const char *s);
-H5_DLL void * H5ST_locate(H5ST_tree_t *root, const char *s);
-H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p);
-H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p);
-H5_DLL void * H5ST_remove(H5ST_tree_t *root, const char *s);
-H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p);
-#ifdef H5ST_DEBUG
-H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree);
-#endif /* H5ST_DEBUG */
-
-#endif /* _H5STprivate_H */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 1d210e9..35ddf3d 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
* Purpose: "All" selection dataspace I/O functions.
@@ -28,7 +28,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 */
@@ -576,7 +576,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
@@ -666,6 +666,9 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(*p, version);
+ if (version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection")
+
/* Skip over the remainder of the header */
*p += 8;
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index 89620a4..d20916b 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5Sdbg.c
- * Jul 24 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Sdbg.c
+ * Quincey Koziol
+ * Jul 24 2007
*
- * Purpose: Dump debugging information about a dataspace
+ * Purpose: Dump debugging information about a dataspace
*
*-------------------------------------------------------------------------
*/
@@ -31,9 +31,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 */
/****************/
/* Local Macros */
@@ -64,13 +64,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
*
*-------------------------------------------------------------------------
diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c
index a3a32fc..d050102 100644
--- a/src/H5Sdeprec.c
+++ b/src/H5Sdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -78,7 +78,6 @@
* Failure: negative
*
* Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
* July 14, 2004
*
*-------------------------------------------------------------------------
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index dea5bbd..029adad 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -6,16 +6,16 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, June 18, 1998
*
- * Purpose: Hyperslab selection dataspace I/O functions.
+ * Purpose: Hyperslab selection dataspace I/O functions.
*/
/****************/
@@ -29,8 +29,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 */
@@ -286,7 +286,7 @@ H5FL_EXTERN(H5S_sel_iter_t);
/* (Start with '1' to avoid clashing with '0' value in newly allocated structs) */
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
@@ -543,11 +543,11 @@ H5S__hyper_get_op_gen(void)
/*-------------------------------------------------------------------------
* 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
@@ -784,12 +784,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -869,12 +869,12 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *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
@@ -902,15 +902,15 @@ 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 */
+ }
+ } /* 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 */
+ }
+ } /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__hyper_iter_block() */
@@ -918,11 +918,11 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -996,13 +996,13 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -1103,10 +1103,10 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end if */
/* Must be an irregular hyperslab selection */
else {
- H5S_hyper_span_t * curr_span; /* Current hyperslab span node */
- H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hsize_t * abs_arr; /* Absolute hyperslab span position */
- int curr_dim; /* Temporary rank holder */
+ H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */
+ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
+ hsize_t * abs_arr; /* Absolute hyperslab span position */
+ int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
ndims = iter->rank;
@@ -1205,13 +1205,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -1295,10 +1295,10 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end if */
/* Must be an irregular hyperslab selection */
else {
- H5S_hyper_span_t * curr_span; /* Current hyperslab span node */
- H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hsize_t * abs_arr; /* Absolute hyperslab span position */
- int curr_dim; /* Temporary rank holder */
+ H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */
+ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
+ hsize_t * abs_arr; /* Absolute hyperslab span position */
+ int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
ndims = iter->rank;
@@ -1395,7 +1395,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
@@ -2137,24 +2137,31 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max
case 0:
do {
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 7:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 6:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 5:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 4:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 3:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 2:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 1:
DUFF_GUTS
@@ -2569,7 +2576,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
@@ -3695,7 +3701,7 @@ 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)
@@ -3725,13 +3731,14 @@ 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);
+ /* 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);
@@ -3773,7 +3780,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);
@@ -3919,7 +3926,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start,
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
@@ -3942,18 +3949,18 @@ 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 */
uint8_t flags = 0; /* Flags for message */
hsize_t block_count = 0; /* block counter for regular hyperslabs */
- unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned ndims; /* Rank of the dataspace */
- 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;
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Rank of the dataspace */
+ 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; /* Encoded size */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
@@ -3968,6 +3975,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
ndims = space->extent.rank;
diminfo = space->select.sel_info.hslab->diminfo.opt;
+ /* Calculate the # of blocks */
if (space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
block_count = H5S__get_select_hyper_nblocks(space, FALSE);
@@ -4268,7 +4276,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;
@@ -4284,7 +4292,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 */
@@ -4300,7 +4308,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) {
@@ -4368,7 +4376,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);
@@ -4744,7 +4752,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblo
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
@@ -5386,7 +5394,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);
@@ -6472,7 +6480,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) {
@@ -7002,9 +7010,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);
@@ -7049,10 +7056,9 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset)
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() */
/*--------------------------------------------------------------------------
@@ -7185,7 +7191,7 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_
FUNC_ENTER_STATIC
- /* Sanity check */
+ /* Sanity checks */
HDassert(span_tree);
/* Check for adding first node to merged spans */
@@ -9457,11 +9463,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
*
*-------------------------------------------------------------------------
@@ -9664,7 +9670,7 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -9874,11 +9880,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
*
*-------------------------------------------------------------------------
@@ -10101,7 +10107,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons
case H5S_SEL_POINTS: /* Can't combine hyperslab operations and point selections currently */
if (op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */
break;
- /* Else fall through to error */
+ /* FALLTHROUGH (to error) */
H5_ATTR_FALLTHROUGH
case H5S_SEL_ERROR:
@@ -10585,11 +10591,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
*
*-------------------------------------------------------------------------
@@ -10727,11 +10733,11 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -12246,7 +12252,7 @@ hsize_t
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 bf6e2cc..bb33eb8 100644
--- a/src/H5Smodule.h
+++ b/src/H5Smodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5S package. Including this header means that the source file
* is part of the H5S package.
*/
-#ifndef _H5Smodule_H
-#define _H5Smodule_H
+#ifndef H5Smodule_H
+#define H5Smodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,31 @@
#define H5_MY_PKG_ERR H5E_DATASPACE
#define H5_MY_PKG_INIT YES
-#endif /* _H5Smodule_H */
+/**\defgroup H5S H5S
+ * \brief Dataspace Interface
+ *
+ * \details The Dataspace Interface provides functions for creating and
+ * working with dataspaces.
+ *
+ * A dataspace has two roles:
+ *
+ * \li It contains the spatial information (logical layout) of a
+ * dataset stored in a file.
+ * \li It describes an application’s data buffers and data elements
+ * participating in I/O. In other words, it can be used to
+ * select a portion or subset of a dataset.
+ *
+ * The spatial information of a dataset in a file includes the
+ * rank and dimensions of the dataset, which are a permanent part
+ * of the dataset definition. It can have dimensions that are fixed
+ * (unchanging) or unlimited, which means they can grow in size
+ * (or are extendible).
+ *
+ * A dataspace can consist of:
+ * \li no elements (NULL)
+ * \li a single element (scalar), or
+ * \li a simple array.
+ *
+ */
+
+#endif /* H5Smodule_H */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 5d82bef..7b85209 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,7 +14,7 @@
/*
* Programmer: rky 980813
*
- * Purpose: Create MPI data types for HDF5 selections.
+ * Purpose: Create MPI data types for HDF5 selections.
*
*/
@@ -140,7 +140,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
*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)
@@ -148,7 +148,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
"couldn't create a large datatype from the all selection")
*count = 1;
*is_derived_type = TRUE;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -245,7 +245,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
/* 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
@@ -288,7 +288,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
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],
@@ -304,7 +304,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
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],
@@ -313,11 +313,12 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
#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]);
@@ -485,7 +486,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.
@@ -696,8 +697,10 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
- HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC,
- d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ HDfprintf(H5DEBUG(S),
+ "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE
+ " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE,
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
if (u == 0)
HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
else
@@ -728,8 +731,10 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
- HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC,
- d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ HDfprintf(H5DEBUG(S),
+ "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE
+ " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE,
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
if (u == 0)
HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
else
@@ -753,7 +758,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
i = ((int)rank) - 1;
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, offset[i], i,
+ max_xtent[i]);
}
#endif
for (i = ((int)rank) - 2; i >= 0; --i) {
@@ -761,7 +767,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
max_xtent[i] = max_xtent[i + 1] * d[i].xtent;
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i,
+ offset[i], i, max_xtent[i]);
#endif
} /* end for */
@@ -776,9 +783,9 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
*******************************************************/
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
- HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size);
+ HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", FUNC, elmt_size);
for (i = ((int)rank) - 1; i >= 0; --i)
- HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent);
+ HDfprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent);
}
#endif
@@ -792,7 +799,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
/* 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)
@@ -808,7 +815,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
if (H5DEBUG(S))
HDfprintf(H5DEBUG(S),
"%s: Dimension i=%d \n"
- "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
+ "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE
+ ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n",
FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
#endif
@@ -830,7 +838,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
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:
@@ -853,7 +861,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
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)
@@ -875,7 +883,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
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 */
1, /* blocklength */
@@ -949,7 +957,8 @@ done:
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type);
+ HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", FUNC, *count,
+ (*is_derived_type) ? "TRUE" : "FALSE");
#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__mpio_reg_hyper_type() */
@@ -998,15 +1007,14 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne
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")
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
- if (H5VM_array_down(space->extent.rank, space->extent.size, down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
+ H5VM_array_down(space->extent.rank, space->extent.size, down);
/* Acquire an operation generation value for creating MPI datatypes */
op_gen = H5S__hyper_get_op_gen();
@@ -1104,18 +1112,17 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e
const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen)
{
- 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;
- hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
- int * blocklen = NULL;
- MPI_Aint * disp = NULL;
- size_t u; /* Local index variable */
- int mpi_code; /* MPI return status code */
- herr_t ret_value = SUCCEED; /* Return value */
+ 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;
+ hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */
+ int * blocklen = NULL;
+ MPI_Aint * disp = NULL;
+ size_t u; /* Local index variable */
+ int mpi_code; /* MPI return status code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
diff --git a/src/H5Snone.c b/src/H5Snone.c
index dec9f38..82e513e 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, November 10, 1998
*
* Purpose: "None" selection dataspace I/O functions.
@@ -28,7 +28,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 */
@@ -132,13 +132,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
*
*-------------------------------------------------------------------------
@@ -159,14 +159,14 @@ H5S__none_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
} /* end H5S__none_iter_init() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -184,14 +184,14 @@ H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR
} /* end H5S__none_iter_coords() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -211,13 +211,13 @@ H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_
} /* end H5S__none_iter_block() */
/*-------------------------------------------------------------------------
- * 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
*
*-------------------------------------------------------------------------
@@ -621,6 +621,9 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(*p, version);
+ if (version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection")
+
/* Skip over the remainder of the header */
*p += 8;
@@ -677,7 +680,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() */
/*--------------------------------------------------------------------------
NAME
@@ -949,11 +952,11 @@ H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *o
} /* end H5S__none_adjust_s() */
/*-------------------------------------------------------------------------
- * 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
@@ -973,14 +976,14 @@ H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUS
} /* end H5S__none_project_scalar() */
/*-------------------------------------------------------------------------
- * 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 bcf8b0a..496cab6 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -6,25 +6,25 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thursday, September 28, 2000
+ * Programmer: Quincey Koziol
+ * Thursday, September 28, 2000
*
- * Purpose: This file contains declarations which are visible only within
- * the H5S package. Source files outside the H5S package should
- * include H5Sprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5S package. Source files outside the H5S package should
+ * include H5Sprivate.h instead.
*/
#if !(defined H5S_FRIEND || defined H5S_MODULE)
#error "Do not include this file outside the H5S package!"
#endif
-#ifndef _H5Spkg_H
-#define _H5Spkg_H
+#ifndef H5Spkg_H
+#define H5Spkg_H
/* Get package's private header */
#include "H5Sprivate.h"
@@ -47,14 +47,17 @@
#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3
/* Versions for H5S_SEL_POINTS selection info */
-#define H5S_POINT_VERSION_1 1
-#define H5S_POINT_VERSION_2 2
+#define H5S_POINT_VERSION_1 1
+#define H5S_POINT_VERSION_2 2
+#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_2
/* Versions for H5S_SEL_NONE selection info */
-#define H5S_NONE_VERSION_1 1
+#define H5S_NONE_VERSION_1 1
+#define H5S_NONE_VERSION_LATEST H5S_NONE_VERSION_1
/* Versions for H5S_SEL_ALL selection info */
-#define H5S_ALL_VERSION_1 1
+#define H5S_ALL_VERSION_1 1
+#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1
/* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */
#define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */
@@ -134,6 +137,11 @@ struct H5S_pnt_list_t {
H5S_pnt_node_t *head; /* Pointer to head of point list */
H5S_pnt_node_t *tail; /* Pointer to tail of point list */
+
+ hsize_t last_idx; /* Index of the point after the last returned from H5S__get_select_elem_pointlist() */
+ H5S_pnt_node_t *last_idx_pnt; /* Point after the last returned from H5S__get_select_elem_pointlist().
+ * If we ever add a way to remove points or add points in the middle of
+ * the pointlist we will need to invalidate these fields. */
};
/* Information about hyperslab spans */
@@ -409,4 +417,4 @@ H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *
H5_DLL htri_t H5S__internal_consistency_test(hid_t space_id);
#endif /* H5S_TESTING */
-#endif /*_H5Spkg_H*/
+#endif /*H5Spkg_H*/
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 0853ca2..929499f 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -6,16 +6,16 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Purpose: Point selection dataspace I/O functions.
+ * Purpose: Point selection dataspace I/O functions.
*/
/****************/
@@ -29,8 +29,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 */
@@ -72,7 +72,7 @@ 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 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_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);
@@ -159,11 +159,11 @@ 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
*
*-------------------------------------------------------------------------
@@ -211,12 +211,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -239,12 +239,12 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -269,11 +269,11 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -764,7 +764,7 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize
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)
@@ -842,6 +842,10 @@ H5S__copy_pnt_list(const H5S_pnt_list_t *src, unsigned rank)
H5MM_memcpy(dst->high_bounds, src->high_bounds, (rank * sizeof(hsize_t)));
H5MM_memcpy(dst->low_bounds, src->low_bounds, (rank * sizeof(hsize_t)));
+ /* Clear cached iteration point */
+ dst->last_idx = 0;
+ dst->last_idx_pnt = NULL;
+
/* Set return value */
ret_value = dst;
@@ -920,7 +924,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);
@@ -1021,7 +1025,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
@@ -1166,7 +1170,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)
@@ -1217,7 +1221,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 */
@@ -1235,7 +1239,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 */
@@ -1383,6 +1387,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p)
/* Decode version */
UINT32DECODE(pp, version);
+ if (version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection")
+
if (version >= (uint32_t)H5S_POINT_VERSION_2)
/* Decode size of point info */
enc_size = *(pp)++;
@@ -1507,8 +1514,9 @@ done:
static herr_t
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 */
+ const hsize_t endpoint = startpoint + numpoints; /* Index of last point in iteration */
+ H5S_pnt_node_t *node; /* Point node */
+ unsigned rank; /* Dataspace rank */
FUNC_ENTER_STATIC_NOERR
@@ -1518,14 +1526,20 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, hsize_t n
/* Get the dataspace extent rank */
rank = space->extent.rank;
- /* Get the head of the point list */
- node = space->select.sel_info.pnt_lst->head;
+ /* Check for cached point at the correct index */
+ if (space->select.sel_info.pnt_lst->last_idx_pnt &&
+ startpoint == space->select.sel_info.pnt_lst->last_idx)
+ node = space->select.sel_info.pnt_lst->last_idx_pnt;
+ else {
+ /* Get the head of the point list */
+ node = space->select.sel_info.pnt_lst->head;
- /* Iterate to the first point to return */
- while (node != NULL && startpoint > 0) {
- startpoint--;
- node = node->next;
- } /* end while */
+ /* Iterate to the first point to return */
+ while (node != NULL && startpoint > 0) {
+ startpoint--;
+ node = node->next;
+ } /* end while */
+ } /* end else */
/* Iterate through the node, copying each point's information */
while (node != NULL && numpoints > 0) {
@@ -1535,6 +1549,10 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, hsize_t n
node = node->next;
} /* end while */
+ /* Cached next point in iteration */
+ space->select.sel_info.pnt_lst->last_idx = endpoint;
+ space->select.sel_info.pnt_lst->last_idx_pnt = node;
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__get_select_elem_pointlist() */
@@ -2054,7 +2072,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) {
@@ -2158,12 +2176,12 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset)
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -2198,12 +2216,12 @@ done:
/*-------------------------------------------------------------------------
* 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
*
*-------------------------------------------------------------------------
@@ -2326,6 +2344,10 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of
} /* end for */
} /* end else */
+ /* Clear cached iteration point */
+ new_space->select.sel_info.pnt_lst->last_idx = 0;
+ new_space->select.sel_info.pnt_lst->last_idx_pnt = NULL;
+
/* Number of elements selected will be the same */
new_space->select.num_elem = base_space->select.num_elem;
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 653dd16..76ed237 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5S module
*/
-#ifndef _H5Sprivate_H
-#define _H5Sprivate_H
+#ifndef H5Sprivate_H
+#define H5Sprivate_H
/* Include package's public header */
#include "H5Spublic.h"
@@ -185,6 +185,7 @@ typedef struct H5S_sel_iter_op_t {
(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))
@@ -305,4 +306,4 @@ H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted);
#endif /* H5_HAVE_PARALLEL */
-#endif /* _H5Sprivate_H */
+#endif /* H5Sprivate_H */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index ad0bbd5..331e5ee 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5S module.
*/
-#ifndef _H5Spublic_H
-#define _H5Spublic_H
+#ifndef H5Spublic_H
+#define H5Spublic_H
/* Public headers needed by this file */
#include "H5public.h"
@@ -70,7 +70,7 @@ typedef enum H5S_class_t {
/* Different ways of combining selections */
typedef enum H5S_seloper_t {
H5S_SELECT_NOOP = -1, /* error */
- H5S_SELECT_SET = 0, /* Select "set" operation */
+ H5S_SELECT_SET = 0, /* Select "set" operation */
H5S_SELECT_OR, /* Binary "or" operation for hyperslabs
* (add new selection to existing selection)
* Original region: AAAAAAAAAA
@@ -108,71 +108,1232 @@ typedef enum H5S_seloper_t {
/* Enumerated type for the type of selection */
typedef enum {
- H5S_SEL_ERROR = -1, /* Error */
- H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Points / elements selected */
+ H5S_SEL_ERROR = -1, /* Error */
+ H5S_SEL_NONE = 0, /* Nothing selected */
+ H5S_SEL_POINTS = 1, /* Points / elements selected */
H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
- H5S_SEL_ALL = 3, /* Entire extent selected */
- H5S_SEL_N /*THIS MUST BE LAST */
+ H5S_SEL_ALL = 3, /* Entire extent selected */
+ H5S_SEL_N /*THIS MUST BE LAST */
} H5S_sel_type;
#ifdef __cplusplus
extern "C" {
#endif
-/* Operations on dataspaces */
-H5_DLL hid_t H5Screate(H5S_class_t type);
-H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[]);
-H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[]);
-H5_DLL hid_t H5Scopy(hid_t space_id);
-H5_DLL herr_t H5Sclose(hid_t space_id);
-H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl);
-H5_DLL hid_t H5Sdecode(const void *buf);
-H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
-H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
-H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]);
-H5_DLL htri_t H5Sis_simple(hid_t space_id);
-H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
-H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
-H5_DLL herr_t H5Sextent_copy(hid_t dst_id, hid_t src_id);
-H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
+/* Operations on dataspaces, dataspace selections and selection iterators */
-/* Operations on dataspace selections */
-H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
-H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
-H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
-H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
-H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset);
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]);
-H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
-H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end);
-H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
-H5_DLL herr_t H5Sselect_all(hid_t spaceid);
-H5_DLL herr_t H5Sselect_none(hid_t spaceid);
-H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord);
+/**
+ * \ingroup H5S
+ *
+ * \brief Releases and terminates access to a dataspace
+ *
+ * \space_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Sclose() releases a dataspace. Further access through the
+ * dataspace identifier is illegal. Failure to release a dataspace with this
+ * call will result in resource leaks.
+ *
+ * \version 1.4.0 Fortran subroutine introduced in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sclose(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Performs an operation on a hyperslab and an existing selection and
+ * returns the resulting selection
+ *
+ * \space_id
+ * \param[in] op Operation to perform on the current selection
+ * \param[in] start Offset of the start of of the hyperslab
+ * \param[in] stride Hyperslab stride
+ * \param[in] count Number of blocks included in the hyperslab
+ * \param[in] block Size of a block in the hyperslab
+ *
+ * \return \hid_tv{dataspace}
+ *
+ * \details H5Scombine_hyperslab() combines a hyperslab selection specified
+ * by \p start, \p stride, \p count and \p block with the current
+ * selection for the dataspace \p space_id, creating a new dataspace
+ * to return the generated selection. If the current selection is
+ * not a hyperslab, it is freed and the hyperslab parameters passed
+ * in are combined with the #H5S_SEL_ALL hyperslab (ie. a selection
+ * composing the entire current extent). If either \p stride or
+ * \p block is NULL, then it will be set to \p 1.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL 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[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Combine two hyperslab selections with an operation, returning a
+ * dataspace with the resulting selection
+ *
+ * \space_id{space1_id}
+ * \param[in] op Selection operator
+ * \space_id{space2_id}
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details H5Scombine_select() combines two hyperslab selections
+ * \p space1_id and \p space2_id with an operation, returning a
+ * new dataspace with the resulting selection. The dataspace extent
+ * from \p space1_id is copied for the dataspace extent of the
+ * newly created dataspace.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Creates an exact copy of a dataspace
+ *
+ * \space_id
+ *
+ * \return \hid_tv{dataspace}
+ *
+ * \details H5Scopy() creates a new dataspace which is an exact copy of the
+ * dataspace identified by \p space_id. The dataspace identifier
+ * returned from this function should be released with H5Sclose()
+ * or resource leaks will occur.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Scopy(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Creates a new dataspace of a specified type
+ *
+ * \param[in] type Type of dataspace to be created
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details H5Screate() creates a new dataspace of a particular type. Currently
+ * supported types are #H5S_SCALAR, #H5S_SIMPLE, and #H5S_NULL.
+ *
+ * Further dataspace types may be added later.
+ *
+ * A scalar dataspace, #H5S_SCALAR, has a single element, though that
+ * element may be of a complex datatype, such as a compound or array
+ * datatype. By convention, the rank of a scalar dataspace is always \p 0
+ * (zero); think of it geometrically as a single, dimensionless point,
+ * though that point can be complex.
+ *
+ * A simple dataspace, #H5S_SIMPLE, consists of a regular array of elements.
+ *
+ * A null dataspace, #H5S_NULL, has no data elements.
+ *
+ * The dataspace identifier returned by this function can be released with
+ * H5Sclose() so that resource leaks will not occur.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Screate(H5S_class_t type);
+/**
+ * \ingroup H5S
+ * \brief Creates a new simple dataspace and opens it for access
+ *
+ * \param[in] rank Number of dimensions of dataspace
+ * \param[in] dims Array specifying the size of each dimension
+ * \param[in] maxdims Array specifying the maximum size of each dimension
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details H5Screate_simple() creates a new simple dataspace and opens it
+ * for access, returning a dataspace identifier.
+ *
+ * \p rank is the number of dimensions used in the dataspace.
+ *
+ * \p dims is a one-dimensional array of size rank specifying the
+ * size of each dimension of the dataset. \p maxdims is an array of
+ * the same size specifying the upper limit on the size of each
+ * dimension.
+ *
+ * Any element of \p dims can be \p 0 (zero). Note that no data can
+ * be written to a dataset if the size of any dimension of its current
+ * dataspace is \p 0. This is sometimes a useful initial state for
+ * a dataset.
+ *
+ * \p maxdims may be the null pointer, in which case the upper limit
+ * is the same as \p dims. Otherwise, no element of \p maxdims
+ * should be smaller than the corresponding element of \p dims.
+ *
+ * If an element of \p maxdims is #H5S_UNLIMITED, the maximum size of
+ * the corresponding dimension is unlimited.
+ *
+ * Any dataset with an unlimited dimension must also be chunked; see
+ * H5Pset_chunk(). Similarly, a dataset must be chunked if \p dims
+ * does not equal \p maxdims.
+ *
+ * The dataspace identifier returned from this function must be
+ * released with H5Sclose() or resource leaks will occur.
+ *
+ * \note Once a dataspace has been created, specific regions or elements in
+ * the dataspace can be selected and selections can be removed, as well.
+ * For example, H5Sselect_hyperslab() selects a region in a dataspace and
+ * H5Sselect_elements() selects array elements in a dataspace. These
+ * functions are used for subsetting. H5Sselect_none() removes all
+ * selections from a dataspace and is used in Parallel HDF5 when a process
+ * does not have or need to write data.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Decodes a binary object description of data space and returns a
+ * new object handle
+ *
+ * \param[in] buf Buffer for the data space object to be decoded
+ *
+ * \return \hid_t{dataspace}
+ *
+ * \details Given an object description of a dataspace in binary in a
+ * buffer, H5Sdecode() reconstructs the HDF5 data type object and
+ * returns a new object handle for it. The binary description of the
+ * object is encoded by H5Sencode(). The user is responsible for
+ * passing in the right buffer. The types of dataspace addressed
+ * in this function are null, scalar, and simple space. For a
+ * simple dataspace, the selection information (for example,
+ * hyperslab selection) is also encoded and decoded. A complex
+ * dataspace has not been implemented in the library.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Sdecode(const void *buf);
+/**
+ * \ingroup H5S
+ *
+ * \brief Encodes a data space object description into a binary buffer
+ *
+ * \space_id{obj_id}
+ * \param[in,out] buf Buffer for the object to be encoded into;
+ * If the provided buffer is NULL, only the size
+ * of buffer needed is returned through \p nalloc.
+ * \param[in,out] nalloc The size of the allocated buffer
+ * \fapl_id{fapl}
+ *
+ * \return \herr_t
+ *
+ * \details Given the data space identifier \p obj_id, H5Sencode2() converts
+ * a data space description into binary form in a buffer. Using this
+ * binary form in the buffer, a data space object can be
+ * reconstructed with H5Sdecode() to return a new object handle
+ * (#hid_t) for this data space.
+ *
+ * A preliminary H5Sencode2() call can be made to determine the
+ * size of the buffer needed. This value is returned in \p nalloc.
+ * That value can then be assigned to \p nalloc for a second
+ * H5Sencode2() call, which will retrieve the actual encoded object.
+ *
+ * If the library determines that \p nalloc is not big enough for the
+ * object, it simply returns the size of the buffer needed through
+ * \p nalloc without encoding the provided buffer.
+ *
+ * The file access property list \p fapl_id is used to control the
+ * encoding via the \a libver_bounds property (see
+ * H5Pset_libver_bounds()). If the \a libver_bounds property is missing,
+ * H5Sencode2() proceeds as if the \a libver_bounds property were set to
+ * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST). (Functionally,
+ * H5Sencode1() is identical to H5Sencode2() with \a libver_bounds set to
+ * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST).)
+ *
+ * The types of data space that are addressed in this function are
+ * null, scalar, and simple space. For a simple data space, the
+ * information on the selection, for example, hyperslab selection,
+ * is also encoded and decoded. A complex data space has not been
+ * implemented in the library.
+ *
+ * \note Motivation: This function was introduced in HDF5-1.12 as part of the
+ * H5Sencode() format change to enable 64-bit selection encodings and
+ * a dataspace selection that is tied to a file. See the \ref_news_112
+ * as well as the \ref_sencode_fmt_change.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl);
+/**
+ * \ingroup H5S
+ *
+ * \brief Copies the extent of a dataspace
+ *
+ * \space_id{dst_id}
+ * \space_id{src_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Sextent_copy() copies the extent from \p src_id to \p dst_id.
+ * This action may change the type of the dataspace.
+ *
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sextent_copy(hid_t dst_id, hid_t src_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines whether two dataspace extents are equal
+ *
+ * \space_id{space1_id}
+ * \space_id{space2_id}
+ *
+ * \return \htri_t
+ *
+ * \details H5Sextent_equal() determines whether the dataspace extents of
+ * two dataspaces, \p space1_id and \p space2_id, are equal.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Retrieves a regular hyperslab selection
+ *
+ * \space_id{spaceid}
+ * \param[out] start Offset of the start of the regular hyperslab
+ * \param[out] stride Stride of the regular hyperslab
+ * \param[out] count Number of blocks in the regular hyperslab
+ * \param[out] block Size of a block in the regular hyperslab
+ *
+ * \return \herr_t
+ *
+ * \details H5Sget_regular_hyperslab() takes the dataspace identifier,
+ * \p spaceid, and retrieves the values of \p start, \p stride,
+ * \p count, and \p block for the regular hyperslab selection.
+ *
+ * A regular hyperslab selection is a hyperslab selection
+ * described by setting the \p offset, \p stride, \p count, and
+ * \p block parameters to the H5Sselect_hyperslab() call. If
+ * several calls to H5Sselect_hyperslab() are needed, the
+ * hyperslab selection is irregular.
+ *
+ * See H5Sselect_hyperslab() for descriptions of \p offset,
+ * \p stride, \p count, and \p block.
+ *
+ * \note If a hyperslab selection is originally regular, then becomes
+ * irregular through selection operations, and then becomes regular
+ * again, the final regular selection may be equivalent but not
+ * identical to the original regular selection.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[],
+ hsize_t block[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Gets the bounding box containing the current selection
+ *
+ * \space_id{spaceid}
+ * \param[out] start Starting coordinates of the bounding box
+ * \param[out] end Ending coordinates of the bounding box, i.e., the
+ * coordinates of the diagonally opposite corner
+ *
+ * \return \herr_t
+ *
+ * \details H5Sget_select_bounds() retrieves the coordinates of the bounding
+ * box containing the current selection and places them into
+ * user-supplied buffers.
+ *
+ * The \p start and \p end buffers must be large enough to hold
+ * the dataspace rank number of coordinates.
+ *
+ * The bounding box exactly contains the selection. I.e., if a
+ * 2-dimensional element selection is currently defined as containing
+ * the points (4,5), (6,8), and (10,7), then the bounding box
+ * will be (4, 5), (10, 8).
+ *
+ * The bounding box calculation includes the current offset of the
+ * selection within the dataspace extent.
+ *
+ * Calling this function on a \a none selection will fail.
+ *
+ * \version 1.6.0 The \p start and \p end parameters have changed from type
+ * \p hsize_t * to \p hssize_t *.
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Gets the number of element points in the current selection
+ *
+ * \space_id{spaceid}
+ *
+ * \return Returns the number of element points in the current dataspace
+ * selection if successful. Otherwise returns a negative value.
+ *
+ * \details H5Sget_select_elem_npoints() returns the number of element
+ * points in the current dataspace selection, so that the element
+ * points can be retrieved with H5Sget_select_elem_pointlist().
+ * (This is similar to the way that H5Sget_select_hyper_nblocks()
+ * and H5Sget_select_hyper_blocklist() work with hyperslab
+ * selections.)
+ *
+ * Coincidentally, H5Sget_select_npoints() and
+ * H5Sget_select_elem_npoints() will always return the same value
+ * when an element selection is queried, but
+ * H5Sget_select_elem_npoints() does not work with other selection
+ * types.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
-H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints,
- hsize_t buf[/*numpoints*/]);
-H5_DLL herr_t H5Sselect_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[]);
-H5_DLL 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[]);
-H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
-H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
-H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
-H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[],
- hsize_t block[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Gets the list of element points currently selected
+ *
+ * \space_id{spaceid}
+ * \param[in] startpoint Element point to start with
+ * \param[in] numpoints Number of element points to get
+ * \param[out] buf List of element points selected
+ *
+ * \details H5Sget_select_elem_pointlist() returns the list of element
+ * points in the current dataspace selection \p space_id. Starting
+ * with the \p startpoint in the list of points, \p numpoints
+ * points are put into the user's buffer. If the user's buffer
+ * fills up before \p numpoints points are inserted, the buffer
+ * will contain only as many points as fit.
+ *
+ * The element point coordinates have the same dimensionality
+ * (rank) as the dataspace they are located within. The list of
+ * element points is formatted as follows:\n
+ * \<coordinate\>, followed by\n
+ * the next coordinate,\n
+ * etc.\n
+ * until all of the selected element points have been listed.
+ *
+ * The points are returned in the order they will be iterated
+ * through when the selection is read/written from/to disk.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints,
+ hsize_t buf[/*numpoints*/]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Gets the list of hyperslab blocks currently selected
+ *
+ * \space_id{spaceid}
+ * \param[in] startblock Hyperslab block to start with
+ * \param[in] numblocks Number of hyperslab blocks to get
+ * \param[out] buf List of hyperslab blocks selected
+ *
+ * \return \herr_t
+ *
+ * \details H5Sget_select_hyper_blocklist() returns a list of the hyperslab
+ * blocks currently selected. Starting with the \p startblock-th block
+ * in the list of blocks, \p numblocks blocks are put into the
+ * user's buffer. If the user's buffer fills up before \p numblocks
+ * blocks are inserted, the buffer will contain only as many blocks
+ * as fit.
+ *
+ * The block coordinates have the same dimensionality (rank) as the
+ * dataspace they are located within. The list of blocks is
+ * formatted as follows:\n
+ * \<"start" coordinate\>, immediately followed by\n
+ * \<"opposite" corner coordinate\>, followed by\n
+ * the next "start" and "opposite" coordinates,\n
+ * etc. until all of the selected blocks have been listed.\n
+ * No guarantee of any order of the blocks is implied.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks,
+ hsize_t buf[/*numblocks*/]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Get number of hyperslab blocks
+ *
+ * \space_id{spaceid}
+ *
+ * \return Returns the number of hyperslab blocks in the current dataspace
+ * selection if successful. Otherwise returns a negative value.
+ *
+ * \details H5Sget_select_hyper_nblocks() returns the number of hyperslab
+ * blocks in the current dataspace selection.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
-H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks,
- hsize_t buf[/*numblocks*/]);
-H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
- hid_t src_intersect_space_id);
-
-/* Operations on dataspace selection iterators */
-H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines the number of elements in a dataspace selection
+ *
+ * \space_id{spaceid}
+ *
+ * \return Returns the number of elements in the selection if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Sget_select_npoints() determines the number of elements in
+ * the current selection of a dataspace. It works with any
+ * selection type, and is the correct way to retrieve the number
+ * of elements in a selection.
+ *
+ * \version 1.4.0 Fortran subroutine introduced in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines the type of the dataspace selection
+ *
+ * \space_id{spaceid}
+ *
+ * \return Returns the dataspace selection type, a value of the enumerated
+ * datatype #H5S_sel_type, if successful.
+ *
+ * \details H5Sget_select_type() retrieves the type of dataspace selection
+ * currently defined for the dataspace \p space_id. Valid values
+ * for the dataspace selection type are:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5S_SEL_NONE</td>
+ * <td>No selection is defined</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SEL_POINTS</td>
+ * <td>A sequence of points is selected</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SEL_HYPERSLABS</td>
+ * <td>A hyperslab or compound hyperslab is selected</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SEL_ALL</td>
+ * <td>The entire dataset is selected</td>
+ * </tr>
+ * </table>
+ *
+ * Otherwise returns a negative value.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
+/**
+ * \ingroup H5S
+ *
+ * \brief Retrieves dataspace dimension size and maximum size
+ *
+ * \space_id
+ * \param[out] dims Pointer to array to store the size of each dimension
+ * \param[out] maxdims Pointer to array to store the maximum size of each
+ * dimension
+ *
+ * \return Returns the number of dimensions in the dataspace if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Sget_simple_extent_dims() returns the size and maximum sizes
+ * of each dimension of a dataspace \p space_id through the \p dims
+ * and \p maxdims parameters.
+ *
+ * Either or both of \p dims and \p maxdims may be NULL.
+ *
+ * If a value in the returned array \p maxdims is #H5S_UNLIMITED (-1),
+ * the maximum size of that dimension is unlimited.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines the dimensionality of a dataspace
+ *
+ * \space_id
+ *
+ * \return Returns the number of dimensions in the dataspace if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Sget_simple_extent_ndims() determines the dimensionality (or
+ * rank) of a dataspace.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines the number of elements in a dataspace
+ *
+ * \space_id
+ *
+ * \return Returns the number of elements in the dataspace if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Sget_simple_extent_npoints() determines the number of elements
+ * in a dataspace \p space_id. For example, a simple 3-dimensional
+ * dataspace with dimensions 2, 3, and 4 would have 24 elements.
+ *
+ * \version 1.4.0 Fortran subroutine introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines the current class of a dataspace
+ *
+ * \space_id
+ *
+ * \return Returns a dataspace class name if successful;
+ * otherwise #H5S_NO_CLASS (-1).
+ *
+ * \details H5Sget_simple_extent_type() determines the current class of a
+ * dataspace \p space_id.
+ *
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines if a hyperslab selection is regular
+ *
+ * \space_id{spaceid}
+ *
+ * \return \htri_t
+ *
+ * \details H5Sis_regular_hyperslab() takes the dataspace identifier,
+ * \p spaceid, and queries the type of the hyperslab selection.
+ *
+ * A regular hyperslab selection is a hyperslab selection described
+ * by setting the offset, stride, count, and block parameters for
+ * a single H5Sselect_hyperslab() call. If several calls to
+ * H5Sselect_hyperslab() are needed, then the hyperslab selection
+ * is irregular.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
+/**
+ * \ingroup H5S
+ *
+ * \brief Determines whether a dataspace is a simple dataspace
+ *
+ * \space_id
+ *
+ * \return \htri_t
+ *
+ * \details H5Sis_simple() determines whether or not a dataspace is a simple
+ * dataspace.
+ *
+ * \note Currently, all dataspace objects are simple dataspaces; complex
+ * dataspace support will be added in the future.
+ *
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL htri_t H5Sis_simple(hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Refines a hyperslab selection with an operation, using a second
+ * hyperslab to modify it
+ *
+ * \space_id{space1_id}
+ * \param[in] op Selection operator
+ * \space_id{space2_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Smodify_select() refines an existing hyperslab selection
+ * \p space1_id with an operation \p op, using a second hyperslab
+ * \p space2_id. The first selection is modified to contain the
+ * result of \p space1_id operated on by \p space2_id.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Sets the offset of a simple dataspace
+ *
+ * \space_id
+ * \param[in] offset The offset at which to position the selection
+ *
+ * \return \herr_t
+ *
+ * \details H5Soffset_simple() sets the offset of a simple dataspace
+ * \p space_id. The offset array must be the same number of
+ * elements as the number of dimensions for the dataspace. If the
+ * \p offset array is set to NULL, the offset for the dataspace is
+ * reset to 0.
+ *
+ * This function allows the same shaped selection to be moved to
+ * different locations within a dataspace without requiring it to
+ * be redefined.
+ *
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
+/**
+ * \ingroup H5S
+ *
+ * \brief Closes a dataspace selection iterator
+ *
+ * \space_id{sel_iter_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Ssel_iter_close() closes a dataspace selection iterator
+ * specified by \p sel_iter_id, releasing its state.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
+/**\ingroup H5S
+ *
+ * \brief Creates a dataspace selection iterator for a dataspace's selection
+ *
+ * \space_id{spaceid}
+ * \param[in] elmt_size Size of element in the selection
+ * \param[in] flags Selection iterator flag
+ *
+ * \return \hid_t{valid dataspace selection iterator}
+ *
+ * \details H5Ssel_iter_create() creates a selection iterator and initializes
+ * it to start at the first element selected in the dataspace.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);
+/**
+ * \ingroup H5S
+ *
+ * \brief Retrieves a list of offset / length sequences for the elements in
+ * an iterator
+ *
+ * \space_id{sel_iter_id}
+ * \param[in] maxseq Maximum number of sequences to retrieve
+ * \param[in] maxbytes Maximum number of bytes to retrieve in sequences
+ * \param[out] nseq Number of sequences retrieved
+ * \param[out] nbytes Number of bytes retrieved, in all sequences
+ * \param[out] off Array of sequence offsets
+ * \param[out] len Array of sequence lengths
+ *
+ * \return \herr_t
+ *
+ * \details H5Ssel_iter_get_seq_list() retrieves a list of offset / length
+ * pairs (a list of "sequences") matching the selected elements for
+ * an iterator \p sel_iter_id, according to the iteration order for
+ * the iterator. The lengths returned are in bytes, not elements.
+ *
+ * Note that the iteration order for "all" and "hyperslab"
+ * selections is row-major (i.e. "C-ordered"), but the iteration
+ * order for "point" selections is "in order selected", unless the
+ * #H5S_SEL_ITER_GET_SEQ_LIST_SORTED flag is passed to
+ * H5Ssel_iter_create() for a point selection.
+ *
+ * \p maxseq and \p maxbytes specify the most sequences or bytes
+ * possible to place into the \p off and \p len arrays. \p nseq and
+ * \p nbytes return the actual number of sequences and bytes put
+ * into the arrays.
+ *
+ * Each call to H5Ssel_iter_get_seq_list() will retrieve the next
+ * set of sequences for the selection being iterated over.
+ *
+ * The total number of bytes possible to retrieve from a selection
+ * iterator is the \p elmt_size passed to H5Ssel_iter_create()
+ * multiplied by the number of elements selected in the dataspace
+ * the iterator was created from (which can be retrieved with
+ * H5Sget_select_npoints(). When there are no further sequences of
+ * elements to retrieve, calls to this routine will set \p nseq
+ * and \p nbytes to zero.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq,
size_t *nbytes, hsize_t *off, size_t *len);
-H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Resets a dataspace selection iterator back to an initial state
+ *
+ * \param[in] sel_iter_id Identifier of the dataspace selection iterator
+ * to reset
+ * \param[in] space_id Identifier of the dataspace with selection to
+ * iterate over
+ *
+ * \return \herr_t
+ *
+ * \details H5Ssel_iter_reset() resets a dataspace selection iterator back to
+ * an initial state so that the iterator may be used for iteration
+ * once again.
+ *
+ * \since 1.12.1
+ *
+ */
+H5_DLL herr_t H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Adjusts a selection by subtracting an offset
+ *
+ * \space_id{spaceid}
+ * \param[in] offset Offset to subtract
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_adjust() shifts a dataspace selection by a specified
+ * logical offset within the dataspace extent.
+ *
+ * \note This can be useful for VOL developers to implement chunked datasets.
+ *
+ * \since 1.10.6
+ */
+H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset);
+/**
+ * \ingroup H5S
+ *
+ * \brief Selects an entire dataspace
+ *
+ * \space_id{spaceid}
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_all() selects the entire extent of the dataspace
+ * \p dspace_id.
+ *
+ * More specifically, H5Sselect_all() sets the selection type to
+ * #H5S_SEL_ALL, which specifies the entire dataspace anywhere it
+ * is applied.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sselect_all(hid_t spaceid);
+/**
+ * \ingroup H5S
+ *
+ * \brief Copies a selection from one dataspace to another
+ *
+ * \space_id{dst_id}
+ * \space_id{src_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_copy() copies all selection information (including
+ * offset) from the source dataspace \p src_id to the destination
+ * dataspace \p dst_id.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
+/**
+ * \ingroup H5S
+ *
+ * \brief Selects array elements to be included in the selection for a
+ * dataspace
+ *
+ * \space_id
+ * \param[in] op Operator specifying how the new selection is to be
+ * combined with the existing selection for the dataspace
+ * \param[in] num_elem Number of elements to be selected
+ * \param[in] coord A pointer to a buffer containing a serialized copy of
+ * a 2-dimensional array of zero-based values specifying
+ * the coordinates of the elements in the point selection
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_elements() selects array elements to be included in
+ * the selection for the \p space_id dataspace. This is referred
+ * to as a point selection.
+ *
+ * The number of elements selected is set in the \p num_elements
+ * parameter.
+ *
+ * The \p coord parameter is a pointer to a buffer containing a
+ * serialized 2-dimensional array of size \p num_elements by the
+ * rank of the dataspace. The array lists dataset elements in the
+ * point selection; that is, it’s a list of of zero-based values
+ * specifying the coordinates in the dataset of the selected
+ * elements. The order of the element coordinates in the \p coord
+ * array specifies the order in which the array elements are
+ * iterated through when I/O is performed. Duplicate coordinate
+ * locations are not checked for. See below for examples of the
+ * mapping between the serialized contents of the buffer and the
+ * point selection array that it represents.
+ *
+ * The selection operator \p op determines how the new selection
+ * is to be combined with the previously existing selection for
+ * the dataspace. The following operators are supported:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5S_SELECT_SET</td>
+ * <td>Replaces the existing selection with the parameters from
+ * this call. Overlapping blocks are not supported with this
+ * operator. Adds the new selection to the existing selection.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_APPEND</td>
+ * <td>Adds the new selection following the last element of the
+ * existing selection.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_PREPEND</td>
+ * <td>Adds the new selection preceding the first element of the
+ * existing selection.</td>
+ * </tr>
+ * </table>
+ *
+ * <b>Mapping the serialized \p coord buffer to a 2-dimensional
+ * point selection array:</b>
+ * To illustrate the construction of the contents of the \p coord
+ * buffer, consider two simple examples: a selection of 5 points in
+ * a 1-dimensional array and a selection of 3 points in a
+ * 4-dimensional array.
+ *
+ * In the 1D case, we will be selecting five points and a 1D
+ * dataspace has rank 1, so the selection will be described in a
+ * 5-by-1 array. To select the 1st, 14th, 17th, 23rd, 8th elements
+ * of the dataset, the selection array would be as follows
+ * (remembering that point coordinates are zero-based):
+ * \n 0
+ * \n 13
+ * \n 16
+ * \n 22
+ * \n 7
+ *
+ * This point selection array will be serialized in the \p coord
+ * buffer as:
+ * \n 0 13 16 22 7
+ *
+ * In the 4D case, we will be selecting three points and a 4D
+ * dataspace has rank 4, so the selection will be described in a
+ * 3-by-4 array. To select the points (1,1,1,1), (14,6,12,18), and
+ * (8,22,30,22), the point selection array would be as follows:
+ * \n 0 0 0 0
+ * \n 13 5 11 17
+ * \n 7 21 29 21
+ *
+ * This point selection array will be serialized in the \p coord
+ * buffer as:
+ * \n 0 0 0 0 13 5 11 17 7 21 29 21
+ *
+ * \version 1.6.4 C coord parameter type changed to \p const hsize_t.
+ * \version 1.6.4 Fortran \p coord parameter type changed to \p INTEGER(HSIZE_T).
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord);
+/**
+ * \ingroup H5S
+ *
+ * \brief Selects a hyperslab region to add to the current selected region
+ *
+ * \space_id
+ * \param[in] op Operation to perform on current selection
+ * \param[in] start Offset of start of hyperslab
+ * \param[in] stride Hyperslab stride
+ * \param[in] count Number of blocks included in hyperslab
+ * \param[in] block Size of block in hyperslab
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_hyperslab() selects a hyperslab region to add to the
+ * current selected region for the dataspace specified by
+ * \p space_id.
+ *
+ * The \p start, \p stride, \p count, and \p block arrays must be the
+ * same size as the rank of the dataspace. For example, if the
+ * dataspace is 4-dimensional, each of these parameters must be a
+ * 1-dimensional array of size 4.
+ *
+ * The selection operator \p op determines how the new selection
+ * is to be combined with the already existing selection for the
+ * dataspace. The following operators are supported:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5S_SELECT_SET</td>
+ * <td>Replaces the existing selection with the
+ * parameters from this call. Overlapping blocks
+ * are not supported with this operator.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_OR</td>
+ * <td>Adds the new selection to the existing selection.
+ * (Binary OR)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_AND</td>
+ * <td>Retains only the overlapping portions of the
+ * new selection and the existing selection.
+ * (Binary AND)</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_XOR</td>
+ * <td>Retains only the elements that are members of
+ * the new selection or the existing selection,
+ * excluding elements that are members of both
+ * selections. (Binary exclusive-OR, XOR)
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_NOTB</td>
+ * <td>Retains only elements of the existing selection
+ * that are not in the new selection.</td>
+ * </tr>
+ * <tr>
+ * <td>#H5S_SELECT_NOTA</td>
+ * <td>Retains only elements of the new selection that
+ * are not in the existing selection.</td>
+ * </tr>
+ * </table>
+ *
+ * The \p start array specifies the offset of the starting element
+ * of the specified hyperslab.
+ *
+ * The \p stride array chooses array locations from the dataspace with
+ * each value in the \p stride array determining how many elements to
+ * move in each dimension. Setting a value in the \p stride array to
+ * \p 1 moves to each element in that dimension of the dataspace;
+ * setting a value of \p 2 in allocation in the \p stride array moves
+ * to every other element in that dimension of the dataspace. In
+ * other words, the \p stride determines the number of elements to
+ * move from the \p start location in each dimension. Stride values
+ * of \p 0 are not allowed. If the \p stride parameter is NULL, a
+ * contiguous hyperslab is selected (as if each value in the \p stride
+ * array were set to \p 1).
+ *
+ * The \p count array determines how many blocks to select from the
+ * dataspace, in each dimension.
+ *
+ * The \p block array determines the size of the element block
+ * selected from the dataspace. If the \p block parameter is set to
+ * NULL, the block size defaults to a single element in each dimension
+ * (as if each value in the \p block array were set to \p 1).
+ *
+ * For example, consider a 2-dimensional dataspace with hyperslab
+ * selection settings as follows: the \p start offset is specified as
+ * [1,1], \p stride is [4,4], \p count is [3,7], and \p block is [2,2].
+ * In C, these settings will specify a hyperslab consisting of 21
+ * 2x2 blocks of array elements starting with location (1,1) with the
+ * selected blocks at locations (1,1), (5,1), (9,1), (1,5), (5,5), etc.;
+ * in Fortran, they will specify a hyperslab consisting of 21 2x2
+ * blocks of array elements starting with location (2,2) with the
+ * selected blocks at locations (2,2), (6,2), (10,2), (2,6), (6,6), etc.
+ *
+ * Regions selected with this function call default to C order
+ * iteration when I/O is performed.
+ *
+ * \version 1.4.0 Fortran subroutine introduced in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sselect_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[]);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Checks if current selection intersects with a block
+ *
+ * \space_id
+ * \param[in] start Starting coordinate of block
+ * \param[in] end Opposite ("ending") coordinate of block
+ *
+ * \return \htri_t
+ *
+ * \details H5Sselect_intersect_block() checks to see if the current
+ * selection \p space_id in the dataspace intersects with the block
+ * specified by \p start and \p end.
+ *
+ * \note Assumes that \p start & \p end block bounds are inclusive, so
+ * \p start == \p end value is OK.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Resets the selection region to include no elements
+ *
+ * \space_id{spaceid}
+ *
+ * \return \herr_t
+ *
+ * \details H5Sselect_none() resets the selection region for the dataspace
+ * \p space_id to include no elements.
+ *
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sselect_none(hid_t spaceid);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Projects the intersection of two source selections to a
+ * destination selection
+ *
+ * \space_id{src_space_id}
+ * \space_id{dst_space_id}
+ * \space_id{src_intersect_space_id}
+ *
+ * \return Returns a dataspace with a selection equal to the intersection of
+ * \p src_intersect_space_id and \p src_space_id projected from
+ * \p src_space to \p dst_space on success, negative on failure.
+ *
+ * \details H5Sselect_project_intersection() computes the intersection
+ * between two dataspace selections and projects that intersection
+ * into a third selection.This can be useful for VOL developers to
+ * implement chunked or virtual datasets.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
+ hid_t src_intersect_space_id);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Checks if two selections are the same shape
+ *
+ * \space_id{space1_id}
+ * \space_id{space2_id}
+ *
+ * \return \htri_t
+ *
+ * \details H5Sselect_shape_same() checks to see if the current selection
+ * in the dataspaces are the same dimensionality and shape.
+ *
+ * This is primarily used for reading the entire selection in
+ * one swoop.
+ *
+ * \since 1.10.6
+ *
+ */
+H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Verifies that the selection is within the extent of the dataspace
+ *
+ * \space_id{spaceid}
+ *
+ * \return \htri_t
+ *
+ * \details H5Sselect_valid() verifies that the selection for the dataspace
+ * \p space_id is within the extent of the dataspace if the current
+ * offset for the dataspace is used.
+ *
+ * \version 1.4.0 Fortran subroutine introduced in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Resets the extent of a dataspace back to "none"
+ *
+ * \space_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Sset_extent_none() resets the type of a dataspace to
+ * #H5S_NULL with no extent information stored for the dataspace.
+ *
+ * \version 1.10.7, 1.12.1 The function behavior changed. The previous
+ * behavior was to set the class to #H5S_NO_CLASS.
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
+/*--------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Sets or resets the size of an existing dataspace
+ *
+ * \space_id
+ * \param[in] rank Rank, or dimensionality, of the dataspace
+ * \param[in] dims Array containing current size of dataspace
+ * \param[in] max Array containing maximum size of dataspace
+ *
+ * \return \herr_t
+ *
+ * \details H5Sset_extent_simple() sets or resets the size of an existing
+ * dataspace.
+ *
+ * \p rank is the dimensionality, or number of dimensions, of the
+ * dataspace.
+ *
+ * \p dims is an array of size \p rank which contains the new size
+ * of each dimension in the dataspace. \p max is an array of size
+ * \p rank which contains the maximum size of each dimension in
+ * the dataspace.
+ *
+ * Any previous extent is removed from the dataspace, the dataspace
+ * type is set to #H5S_SIMPLE, and the extent is set as specified.
+ *
+ * Note that a dataset must be chunked if \p dims does not equal
+ * \p max.
+ *
+ *
+ * \version 1.4.0 Fortran subroutine was introduced.
+ * \since 1.0.0
+ *
+ */
+H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[]);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -180,6 +1341,47 @@ H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id);
*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Function prototypes */
+/* --------------------------------------------------------------------------*/
+/**\ingroup H5S
+ *
+ * \brief Encodes a data space object description into a binary buffer
+ *
+ * \space_id{obj_id}
+ * \param[in,out] buf Buffer for the object to be encoded into;
+ * If the provided buffer is NULL, only the size of
+ * buffer needed is returned through \p nalloc.
+ * \param[in,out] nalloc The size of the allocated buffer
+ *
+ * \return \herr_t
+ *
+ * \deprecated Deprecated in favor of H5Sencode2()
+ *
+ * \details Given the data space identifier \p obj_id, H5Sencode1() converts
+ * a data space description into binary form in a buffer. Using
+ * this binary form in the buffer, a data space object can be
+ * reconstructed using H5Sdecode() to return a new object handle
+ * (\p hid_t) for this data space.
+ *
+ * A preliminary H5Sencode1() call can be made to find out the size
+ * of the buffer needed. This value is returned as \p nalloc. That
+ * value can then be assigned to \p nalloc for a second H5Sencode1()
+ * call, which will retrieve the actual encoded object.
+ *
+ * If the library finds out \p nalloc is not big enough for the
+ * object, it simply returns the size of the buffer needed through
+ * \p nalloc without encoding the provided buffer.
+ *
+ * The types of data space addressed in this function are null,
+ * scalar, and simple space. For a simple data space, the information
+ * on the selection, for example, hyperslab selection, is also
+ * encoded and decoded. A complex data space has not been
+ * implemented in the library.
+ *
+ * \version 1.12.0 The function H5Sencode() was renamed H5Sencode1() and
+ * deprecated.
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -187,4 +1389,4 @@ H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc);
#ifdef __cplusplus
}
#endif
-#endif /* _H5Spublic_H */
+#endif /* H5Spublic_H */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index a75fdc3..86e9043 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.ued>
+/* Programmer: Quincey Koziol
* Friday, May 29, 1998
*
* Purpose: Dataspace selection functions.
@@ -31,6 +31,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 */
@@ -50,9 +51,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 */
/*****************************/
@@ -133,7 +134,7 @@ 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 */
+ H5S_t *space; /* Dataspace to modify */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -561,7 +562,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")
@@ -1134,7 +1135,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
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;
@@ -1195,11 +1196,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
@@ -1217,11 +1218,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);
@@ -1232,7 +1233,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 */
/*--------------------------------------------------------------------------
@@ -1275,11 +1276,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.
@@ -1295,11 +1296,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);
@@ -1308,7 +1309,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 */
/*--------------------------------------------------------------------------
@@ -1357,11 +1358,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.
@@ -1379,11 +1380,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);
@@ -1392,7 +1393,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 */
/*-------------------------------------------------------------------------
@@ -1842,6 +1843,15 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_a_dim--;
} /* end while */
+
+ /* Check for a single block in each selection */
+ if (H5S_SELECT_IS_SINGLE(space_a) && H5S_SELECT_IS_SINGLE(space_b)) {
+ /* If both selections are a single block and their bounds are
+ * the same, then the selections are the same, even if the
+ * selection types are different.
+ */
+ HGOTO_DONE(TRUE)
+ } /* end if */
} /* end if */
/* If the dataspaces have the same selection type, use the selection's
@@ -2562,13 +2572,13 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
hbool_t share_selection)
{
- H5S_t * new_space = NULL; /* New dataspace constructed */
- H5S_t * tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
- H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */
- hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */
- H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */
- hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t * new_space = NULL; /* New dataspace constructed */
+ H5S_t * tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
+ H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */
+ hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */
+ H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */
+ hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2580,6 +2590,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
+ if (NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+ if (NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Create new space, using dst extent. Start with "all" selection. */
if (NULL == (new_space = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace")
@@ -2685,22 +2700,22 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Initialize iterators */
- if (H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ if (H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL,
"can't initialize source space selection iterator")
ss_iter_init = TRUE;
- if (H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ if (H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL,
"can't initialize destination space selection iterator")
ds_iter_init = TRUE;
/* Iterate over points */
do {
- HDassert(ss_iter.elmt_left > 0);
- HDassert(ss_iter.elmt_left > 0);
+ HDassert(ss_iter->elmt_left > 0);
+ HDassert(ss_iter->elmt_left > 0);
/* Get SS coords */
- if (H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0)
+ if (H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL,
"can't get source selection coordinates")
@@ -2711,7 +2726,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Add point if it intersects */
if (intersect) {
/* Get DS coords */
- if (H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0)
+ if (H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL,
"can't get destination selection coordinates")
@@ -2722,16 +2737,16 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
} /* end if */
/* Advance iterators */
- if (H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0)
+ if (H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL,
"can't advacne source selection iterator")
- ss_iter.elmt_left--;
- if (H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0)
+ ss_iter->elmt_left--;
+ if (H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL,
"can't advacne destination selection iterator")
- ds_iter.elmt_left--;
- } while (ss_iter.elmt_left > 0);
- HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0);
+ ds_iter->elmt_left--;
+ } while (ss_iter->elmt_left > 0);
+ HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0);
} /* end if */
else {
HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE);
@@ -2760,11 +2775,14 @@ done:
/* General cleanup */
if (tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace")
- if (ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0)
+ if (ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator")
- if (ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0)
+ if (ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator")
+ ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter);
+ ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_project_intersection() */
@@ -3071,6 +3089,56 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ssel_iter_get_seq_list() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5Ssel_iter_reset
+ PURPOSE
+ Resets a dataspace selection iterator back to an initial state.
+ USAGE
+ herr_t H5Ssel_iter_reset(sel_iter_id)
+ hid_t sel_iter_id; IN: ID of the dataspace selection iterator to
+ reset
+ hid_t space_id; IN: ID of the dataspace with selection to
+ iterate over
+ RETURNS
+ Non-negative on success / Negative on failure
+ DESCRIPTION
+ Resets a dataspace selection iterator back to an initial state so that
+ the iterator may be used for iteration once again.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id)
+{
+ H5S_sel_iter_t *sel_iter;
+ H5S_t * space;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ii", sel_iter_id, space_id);
+
+ /* Check args */
+ if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator")
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+
+ /* Call selection type-specific release routine */
+ if (H5S_SELECT_ITER_RELEASE(sel_iter) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL,
+ "problem releasing a selection iterator's type-specific info")
+
+ /* Simply re-initialize iterator */
+ if (H5S_select_iter_init(sel_iter, space, sel_iter->elmt_size, sel_iter->flags) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to re-initialize selection iterator")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ssel_iter_reset() */
+
/*-------------------------------------------------------------------------
* Function: H5S_sel_iter_close
*
diff --git a/src/H5Stest.c b/src/H5Stest.c
index d180d2c..a851549 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Saturday, May 31, 2003
*
* Purpose: Dataspace selection testing functions.
diff --git a/src/H5T.c b/src/H5T.c
index 901fd44..c3ca03b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -561,8 +561,8 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* (+/- Inf for all floating-point types) */
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
-double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f;
-double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
+double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
+double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
@@ -1477,6 +1477,8 @@ done:
if (copied_dtype)
(void)H5T_close_real(dt);
else {
+ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
} /* end else */
@@ -1881,14 +1883,15 @@ H5Tcopy(hid_t obj_id)
switch (H5I_get_type(obj_id)) {
case H5I_DATATYPE:
+ /* The argument is a datatype handle */
if (NULL == (dt = (H5T_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a datatype ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj_id is not a datatype ID")
break;
case H5I_DATASET: {
H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- /* Check args */
+ /* The argument is a dataset handle */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID")
@@ -1904,9 +1907,7 @@ H5Tcopy(hid_t obj_id)
if (NULL == (dt = (H5T_t *)H5I_object(dset_tid)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID,
"received invalid datatype from the dataset")
-
- break;
- }
+ } break;
case H5I_UNINIT:
case H5I_BADID:
@@ -1930,7 +1931,7 @@ H5Tcopy(hid_t obj_id)
/* Copy datatype */
if (NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy");
/* Get an ID for the copied datatype */
if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0)
@@ -2037,12 +2038,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
@@ -2113,9 +2108,6 @@ done:
* Programmer: Robb Matzke
* Monday, December 8, 1997
*
- * Modifications:
- * Broke out from H5Tget_class - QAK - 6/4/99
- *
*-------------------------------------------------------------------------
*/
H5T_class_t
@@ -2462,9 +2454,9 @@ H5T_get_super(const H5T_t *dt)
HDassert(dt);
if (!dt->shared->parent)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type");
if (NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2779,7 +2771,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c
for (i = H5T_g.nsoft - 1; i >= 0; --i) {
soft = H5T_g.soft + i;
HDassert(soft);
- if (name && *name && HDstrcmp(name, soft->name))
+ if (name && *name && HDstrcmp(name, soft->name) != 0)
continue;
if (src && src->shared->type != soft->src)
continue;
@@ -2801,7 +2793,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c
/* Not a match */
if (((H5T_PERS_SOFT == pers && path->is_hard) || (H5T_PERS_HARD == pers && !path->is_hard)) ||
- (name && *name && HDstrcmp(name, path->name)) || (src && H5T_cmp(src, path->src, FALSE)) ||
+ (name && *name && HDstrcmp(name, path->name) != 0) || (src && H5T_cmp(src, path->src, FALSE)) ||
(dst && H5T_cmp(dst, path->dst, FALSE)) || (func && func != path->conv.u.app_func)) {
/*
* Notify all other functions to recalculate private data since some
@@ -3134,10 +3126,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
@@ -3297,10 +3285,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 *
@@ -3323,7 +3307,7 @@ H5T__create(H5T_class_t type, size_t size)
/* Copy the default string datatype */
if (NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy");
/* Modify the datatype */
if (H5T__set_size(dt, size) < 0)
@@ -3402,6 +3386,8 @@ H5T__create(H5T_class_t type, size_t size)
done:
if (NULL == ret_value) {
if (dt) {
+ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
}
@@ -3422,8 +3408,8 @@ done:
* Note: Common code for both H5T_copy and H5T_copy_reopen, as part of
* the const-correct datatype copying routines.
*
- * Programmer: David Young
- * January 18, 2020
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
@@ -3444,9 +3430,12 @@ H5T__initiate_copy(const H5T_t *old_dt)
/* Copy shared information */
*(new_dt->shared) = *(old_dt->shared);
- /* Reset VOL fields */
- new_dt->vol_obj = NULL;
- new_dt->shared->owned_vol_obj = NULL;
+ /* Increment ref count on owned VOL object */
+ if (new_dt->shared->owned_vol_obj)
+ (void)H5VL_object_inc_rc(new_dt->shared->owned_vol_obj);
+
+ /* Reset vol_obj field */
+ new_dt->vol_obj = NULL;
/* Set return value */
ret_value = new_dt;
@@ -3454,8 +3443,11 @@ H5T__initiate_copy(const H5T_t *old_dt)
done:
if (ret_value == NULL)
if (new_dt) {
- if (new_dt->shared)
+ if (new_dt->shared) {
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ } /* end if */
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3470,8 +3462,8 @@ done:
* Return: Success: Pointer to a new copy of the OLD_DT argument.
* Failure: NULL
*
- * Programmer: David Young
- * January 18, 2020
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
@@ -3498,8 +3490,8 @@ done:
* Return: Success: Pointer to a new copy of the OLD_DT argument.
* Failure: NULL
*
- * Programmer: David Young
- * January 18, 2020
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
@@ -3529,8 +3521,8 @@ done:
*
* Note: Common code for both H5T_copy and H5T_copy_reopen.
*
- * Programmer: David Young
- * January 18, 2020
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
@@ -3784,6 +3776,8 @@ done:
if (ret_value == NULL)
if (new_dt) {
HDassert(new_dt->shared);
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3800,8 +3794,8 @@ done:
* Return: Success: Pointer to a new copy of the OLD_DT argument.
* Failure: NULL
*
- * Programmer: David Young
- * January 18, 2020
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
@@ -3851,6 +3845,8 @@ H5T_copy_reopen(H5T_t *old_dt)
/* The object is already open. Free the H5T_shared_t struct
* we had been using and use the one that already exists.
* Not terribly efficient. */
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt->shared = reopened_fo;
@@ -3887,6 +3883,8 @@ done:
if (ret_value == NULL)
if (new_dt) {
HDassert(new_dt->shared);
+ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
@@ -3981,8 +3979,10 @@ H5T__alloc(void)
done:
if (ret_value == NULL)
if (dt) {
- if (dt->shared)
+ if (dt->shared) {
+ HDassert(!dt->shared->owned_vol_obj);
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ } /* end if */
dt = H5FL_FREE(H5T_t, dt);
} /* end if */
@@ -4101,8 +4101,9 @@ H5T_close_real(H5T_t *dt)
/* Clean up resources, depending on shared state */
if (dt->shared->state != H5T_STATE_OPEN) {
if (H5T__free(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
+ HDassert(!dt->shared->owned_vol_obj);
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} /* end if */
else
@@ -4195,7 +4196,7 @@ H5T_close(H5T_t *dt)
/* Clean up resources */
if (H5T_close_real(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4237,13 +4238,14 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Check args */
HDassert(dt);
+ HDassert(dt->shared);
HDassert(size != 0);
HDassert(H5T_REFERENCE != dt->shared->type);
HDassert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs));
if (dt->shared->parent) {
if (H5T__set_size(dt->shared->parent, size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type");
/* Adjust size of datatype appropriately */
if (dt->shared->type == H5T_ARRAY)
@@ -4284,7 +4286,7 @@ H5T__set_size(H5T_t *dt, size_t size)
size_t max_size;
if ((num_membs = H5T_get_nmembers(dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members");
if (num_membs) {
for (i = 0; i < (unsigned)num_membs; i++) {
@@ -4299,7 +4301,7 @@ H5T__set_size(H5T_t *dt, size_t size)
if (size < (max_offset + max_size))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "size shrinking will cut off last member ")
+ "size shrinking will cut off last member ");
} /* end if */
/* Compound must not have been packed previously */
@@ -4319,7 +4321,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Get a copy of unsigned char type as the base/parent type */
if (NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype");
dt->shared->parent = H5T_copy(base, H5T_COPY_ALL);
/* change this datatype into a VL string */
@@ -4345,7 +4347,7 @@ H5T__set_size(H5T_t *dt, size_t size)
/* Set up VL information */
if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location");
} /* end if */
else {
prec = 8 * size;
@@ -4362,7 +4364,7 @@ H5T__set_size(H5T_t *dt, size_t size)
dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec + offset ||
dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec + offset) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "adjust sign, mantissa, and exponent fields first")
+ "adjust sign, mantissa, and exponent fields first");
}
break;
@@ -4424,11 +4426,38 @@ H5T_get_size(const H5T_t *dt)
/* check args */
HDassert(dt);
+ HDassert(dt->shared);
FUNC_LEAVE_NOAPI(dt->shared->size)
} /* end H5T_get_size() */
/*-------------------------------------------------------------------------
+ * Function: H5T_get_force_conv
+ *
+ * Purpose: Determines if the type has forced conversion. This will be
+ * true if and only if the type keeps a pointer to a file VOL
+ * object internally.
+ *
+ * Return: TRUE/FALSE (never fails)
+ *
+ * Programmer: Neil Fortner
+ * Thursday, January 21, 2021
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5T_get_force_conv(const H5T_t *dt)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* check args */
+ HDassert(dt);
+ HDassert(dt->shared);
+
+ FUNC_LEAVE_NOAPI(dt->shared->force_conv)
+} /* end H5T_get_force_conv() */
+
+/*-------------------------------------------------------------------------
* Function: H5T_cmp
*
* Purpose: Compares two data types.
@@ -4464,6 +4493,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
if (dt1 == dt2)
HGOTO_DONE(0);
+ HDassert(dt1->shared);
+ HDassert(dt2->shared);
+
/* compare */
if (dt1->shared->type < dt2->shared->type)
HGOTO_DONE(-1);
@@ -4500,7 +4532,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if (NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for (u = 0; u < dt1->shared->u.compnd.nmembs; u++)
idx1[u] = idx2[u] = u;
if (dt1->shared->u.enumer.nmembs > 1) {
@@ -4592,7 +4624,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if (NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for (u = 0; u < dt1->shared->u.enumer.nmembs; u++)
idx1[u] = u;
if (dt1->shared->u.enumer.nmembs > 1) {
@@ -4869,6 +4901,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
HGOTO_DONE(-1);
if (dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc)
HGOTO_DONE(1);
+ if (dt1->shared->u.atomic.u.r.file < dt2->shared->u.atomic.u.r.file)
+ HGOTO_DONE(-1);
+ if (dt1->shared->u.atomic.u.r.file > dt2->shared->u.atomic.u.r.file)
+ HGOTO_DONE(1);
break;
case H5T_NO_CLASS:
@@ -5234,7 +5270,10 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co
} /* end else-if */
/* Set the flag to indicate both source and destination types are compound types
- * for the optimization of data reading (in H5Dio.c). */
+ * for the optimization of data reading (in H5Dio.c).
+ * Make sure that path->are_compounds is only TRUE for compound types.
+ */
+ path->are_compounds = FALSE;
if (H5T_COMPOUND == H5T_get_class(src, TRUE) && H5T_COMPOUND == H5T_get_class(dst, TRUE))
path->are_compounds = TRUE;
@@ -5302,11 +5341,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 *
@@ -5398,16 +5432,21 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t
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,
@@ -5419,10 +5458,16 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t
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:
@@ -5782,7 +5827,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Range check against compound member's offset */
if ((accum_change < 0) && ((ssize_t)dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
/* Apply the accumulated size change to the offset of the field */
dt->shared->u.compnd.memb[i].offset += (size_t)accum_change;
@@ -5799,7 +5844,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Mark the VL, compound, enum or array type */
if ((changed = H5T_set_loc(memb_type, file, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if (changed > 0)
ret_value = changed;
@@ -5809,7 +5854,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Fail if the old_size is zero */
if (0 == old_size)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL,
- "old_size of zero would cause division by zero")
+ "old_size of zero would cause division by zero");
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size =
@@ -5823,7 +5868,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Range check against datatype size */
if ((accum_change < 0) && ((ssize_t)dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype");
/* Apply the accumulated size change to the datatype */
dt->shared->size += (size_t)accum_change;
@@ -5831,19 +5876,21 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
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)) {
+ 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")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if (changed > 0)
ret_value = changed;
} /* end if */
/* Mark this VL sequence */
if ((changed = H5T__vlen_set_loc(dt, file, loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
if (changed > 0)
ret_value = changed;
break;
@@ -6015,7 +6062,7 @@ done:
} /* end H5T_is_vl_storage() */
/*-------------------------------------------------------------------------
- * 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)
@@ -6032,9 +6079,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);
@@ -6069,7 +6116,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() */
/*-------------------------------------------------------------------------
* Function: H5T__upgrade_version
@@ -6096,7 +6143,8 @@ 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:
@@ -6238,6 +6286,7 @@ H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj)
/* Take ownership */
dt->shared->owned_vol_obj = vol_obj;
+ (void)H5VL_object_inc_rc(vol_obj);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5TS.c b/src/H5TS.c
index 02836e7..321a83d 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -6,81 +6,400 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* private headers */
-#include "H5private.h" /*library */
-#include "H5Eprivate.h" /*error handling */
-#include "H5MMprivate.h" /*memory management functions */
+/*
+ * Purpose: This file contains the framework for ensuring that the global
+ * library lock is held when an API routine is called. This
+ * framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API
+ * macros defined in H5private.h.
+ *
+ * Note: Because this threadsafety framework operates outside the library,
+ * it does not use the error stack.
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
#ifdef H5_HAVE_THREADSAFE
-/* Module specific data structures */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
-/* cancelability structure */
+/* Cancelability structure */
typedef struct H5TS_cancel_struct {
int previous_state;
unsigned int cancel_count;
} H5TS_cancel_t;
+#ifndef H5_HAVE_WIN_THREADS
+/* An H5TS_tid_t is a record of a thread identifier that is
+ * available for reuse.
+ */
+struct _tid;
+typedef struct _tid H5TS_tid_t;
+
+struct _tid {
+ H5TS_tid_t *next;
+ uint64_t id;
+};
+#endif
+
+/********************/
+/* Local Prototypes */
+/********************/
+static void H5TS__key_destructor(void *key_val);
+#ifndef H5_HAVE_WIN_THREADS
+static void H5TS_tid_destructor(void *_v);
+static void H5TS_tid_init(void);
+#endif
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
/* Global variable definitions */
#ifdef H5_HAVE_WIN_THREADS
H5TS_once_t H5TS_first_init_g;
-#else /* H5_HAVE_WIN_THREADS */
+#else
H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
-#endif /* H5_HAVE_WIN_THREADS */
+#endif
+
+/* Thread-local keys, used by other interfaces */
+
+/* Error stack */
H5TS_key_t H5TS_errstk_key_g;
+
+/* Function stack */
+#ifdef H5_HAVE_CODESTACK
H5TS_key_t H5TS_funcstk_key_g;
+#endif
+
+/* API context */
H5TS_key_t H5TS_apictx_key_g;
-H5TS_key_t H5TS_cancel_key_g;
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Thread-local keys, used in this module */
+static H5TS_key_t H5TS_cancel_key_s; /* Thread cancellation state */
+
+#ifndef H5_HAVE_WIN_THREADS
+
+/* Pointer to first free thread ID record or NULL. */
+static H5TS_tid_t *H5TS_tid_next_free = NULL;
+static uint64_t H5TS_tid_next_id = 0;
+
+/* Mutual exclusion for access to H5TS_tid_next_free and H5TS_tid_next_id. */
+static pthread_mutex_t H5TS_tid_mtx;
+
+/* Key for thread-local storage of the thread ID. */
+static H5TS_key_t H5TS_tid_key;
+
+#endif
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_key_destructor
+ * Function: H5TS__key_destructor
*
- * USAGE
- * H5TS_key_destructor()
- *
- * RETURNS
+ * Returns: void
*
- * DESCRIPTION
+ * Description:
* Frees the memory for a key. Called by each thread as it exits.
* Currently all the thread-specific information for all keys are simple
* structures allocated with malloc, so we can free them all uniformly.
*
- * PROGRAMMER: Quincey Koziol
- * February 7, 2003
- *
+ * Programmer: Quincey Koziol
+ * February 7, 2003
*--------------------------------------------------------------------------
*/
static void
-H5TS_key_destructor(void *key_val)
+H5TS__key_destructor(void *key_val)
{
/* Use HDfree here instead of H5MM_xfree(), to avoid calling the H5CS routines */
if (key_val != NULL)
HDfree(key_val);
+} /* end H5TS__key_destructor() */
+
+#ifndef H5_HAVE_WIN_THREADS
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_tid_destructor
+ *
+ * Returns: void
+ *
+ * Description:
+ * When a thread shuts down, put its ID record on the free list.
+ *--------------------------------------------------------------------------
+ */
+static void
+H5TS_tid_destructor(void *_v)
+{
+ H5TS_tid_t *tid = _v;
+
+ if (tid == NULL)
+ return;
+
+ /* TBD use an atomic CAS */
+ pthread_mutex_lock(&H5TS_tid_mtx);
+ tid->next = H5TS_tid_next_free;
+ H5TS_tid_next_free = tid;
+ pthread_mutex_unlock(&H5TS_tid_mtx);
+}
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_tid_init
+ *
+ * Returns: void
+ *
+ * Description:
+ * Initialization for integer thread identifiers.
+ *--------------------------------------------------------------------------
+ */
+static void
+H5TS_tid_init(void)
+{
+ pthread_mutex_init(&H5TS_tid_mtx, NULL);
+ pthread_key_create(&H5TS_tid_key, H5TS_tid_destructor);
}
+#endif
+
+#ifdef H5_HAVE_WIN_THREADS
+/*--------------------------------------------------------------------------
+ * Function: H5TS_win32_process_enter
+ *
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Description:
+ * Per-process setup on Windows when using Win32 threads.
+ *
+ *--------------------------------------------------------------------------
+ */
+H5_DLL BOOL CALLBACK
+H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
+{
+ BOOL ret_value = TRUE;
+
+ /* initialize global API mutex lock */
+ InitializeCriticalSection(&H5_g.init_lock.CriticalSection);
+
+ /* Set up thread local storage */
+ if (TLS_OUT_OF_INDEXES == (H5TS_errstk_key_g = TlsAlloc()))
+ ret_value = FALSE;
+
+#ifdef H5_HAVE_CODESTACK
+ if (TLS_OUT_OF_INDEXES == (H5TS_funcstk_key_g = TlsAlloc()))
+ ret_value = FALSE;
+#endif
+
+ if (TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc()))
+ ret_value = FALSE;
+
+ return ret_value;
+} /* H5TS_win32_process_enter() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_win32_thread_enter
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Per-thread setup on Windows when using Win32 threads.
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_win32_thread_enter(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ /* Currently a placeholder function. TLS setup is performed
+ * elsewhere in the library.
+ *
+ * WARNING: Do NOT use C standard library functions here.
+ * CRT functions are not allowed in DllMain, which is where this code
+ * is used.
+ */
+
+ return ret_value;
+} /* H5TS_win32_thread_enter() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_win32_process_exit
+ *
+ * Returns: void
+ *
+ * Description:
+ * Per-process cleanup on Windows when using Win32 threads.
+ *
+ *--------------------------------------------------------------------------
+ */
+void
+H5TS_win32_process_exit(void)
+{
+
+ /* Windows uses a different thread local storage mechanism which does
+ * not support auto-freeing like pthreads' keys.
+ *
+ * This function is currently registered via atexit() and is called
+ * AFTER H5_term_library().
+ */
+
+ /* Clean up critical section resources (can't fail) */
+ DeleteCriticalSection(&H5_g.init_lock.CriticalSection);
+
+ /* Clean up per-process thread local storage */
+ TlsFree(H5TS_errstk_key_g);
+#ifdef H5_HAVE_CODESTACK
+ TlsFree(H5TS_funcstk_key_g);
+#endif
+ TlsFree(H5TS_apictx_key_g);
+
+ return;
+} /* end H5TS_win32_process_exit() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_win32_thread_exit
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Per-thread cleanup on Windows when using Win32 threads.
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_win32_thread_exit(void)
+{
+ LPVOID lpvData;
+ herr_t ret_value = SUCCEED;
+
+ /* Windows uses a different thread local storage mechanism which does
+ * not support auto-freeing like pthreads' keys.
+ *
+ * WARNING: Do NOT use C standard library functions here.
+ * CRT functions are not allowed in DllMain, which is where this code
+ * is used.
+ */
+
+ /* Clean up per-thread thread local storage */
+ lpvData = TlsGetValue(H5TS_errstk_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+
+#ifdef H5_HAVE_CODESTACK
+ lpvData = TlsGetValue(H5TS_funcstk_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+#endif
+
+ lpvData = TlsGetValue(H5TS_apictx_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+
+ return ret_value;
+} /* end H5TS_win32_thread_exit() */
+
+#endif /* H5_HAVE_WIN_THREADS */
+
#ifndef H5_HAVE_WIN_THREADS
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_pthread_first_thread_init
+ * Function: H5TS_thread_id
*
- * USAGE
- * H5TS_pthread_first_thread_init()
+ * Returns: An integer identifier for the current thread
*
- * RETURNS
+ * Description:
+ * The ID satisfies the following properties:
*
- * DESCRIPTION
+ * 1 1 <= ID <= UINT64_MAX
+ * 2 ID is constant over the thread's lifetime.
+ * 3 No two threads share an ID during their lifetimes.
+ * 4 A thread's ID is available for reuse as soon as it is joined.
+ *
+ * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not
+ * built with thread safety or if an error prevents it from assigning an
+ * ID.
+ *
+ *--------------------------------------------------------------------------
+ */
+uint64_t
+H5TS_thread_id(void)
+{
+ H5TS_tid_t *tid = pthread_getspecific(H5TS_tid_key);
+ H5TS_tid_t proto_tid;
+
+ /* An ID is already assigned. */
+ if (tid != NULL)
+ return tid->id;
+
+ /* An ID is *not* already assigned: reuse an ID that's on the
+ * free list, or else generate a new ID.
+ *
+ * Allocating memory while holding a mutex is bad form, so
+ * point `tid` at `proto_tid` if we need to allocate some
+ * memory.
+ */
+ pthread_mutex_lock(&H5TS_tid_mtx);
+ if ((tid = H5TS_tid_next_free) != NULL)
+ H5TS_tid_next_free = tid->next;
+ else if (H5TS_tid_next_id != UINT64_MAX) {
+ tid = &proto_tid;
+ tid->id = ++H5TS_tid_next_id;
+ }
+ pthread_mutex_unlock(&H5TS_tid_mtx);
+
+ /* If a prototype ID record was established, copy it to the heap. */
+ if (tid == &proto_tid)
+ if ((tid = HDmalloc(sizeof(*tid))) != NULL)
+ *tid = proto_tid;
+
+ if (tid == NULL)
+ return 0;
+
+ /* Finish initializing the ID record and set a thread-local pointer
+ * to it.
+ */
+ tid->next = NULL;
+ if (pthread_setspecific(H5TS_tid_key, tid) != 0) {
+ H5TS_tid_destructor(tid);
+ return 0;
+ }
+
+ return tid->id;
+}
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_pthread_first_thread_init
+ *
+ * Returns: void
+ *
+ * Description:
* Initialization of global API lock, keys for per-thread error stacks and
* cancallability information. Called by the first thread that enters the
* library.
*
- * PROGRAMMER: Chee Wai LEE
+ * Programmer: Chee Wai LEE
* May 2, 2000
*
*--------------------------------------------------------------------------
@@ -98,40 +417,47 @@ H5TS_pthread_first_thread_init(void)
#endif
/* initialize global API mutex lock */
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+ H5TS_rw_lock_init(&H5_g.init_rw_lock, H5TS_RW_LOCK_POLICY_FAVOR_WRITERS);
+#else
pthread_mutex_init(&H5_g.init_lock.atomic_lock, NULL);
pthread_cond_init(&H5_g.init_lock.cond_var, NULL);
H5_g.init_lock.lock_count = 0;
+#endif
+
+ /* Initialize integer thread identifiers. */
+ H5TS_tid_init();
/* initialize key for thread-specific error stacks */
- pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
+ pthread_key_create(&H5TS_errstk_key_g, H5TS__key_destructor);
+#ifdef H5_HAVE_CODESTACK
/* initialize key for thread-specific function stacks */
- pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor);
+ pthread_key_create(&H5TS_funcstk_key_g, H5TS__key_destructor);
+#endif
/* initialize key for thread-specific API contexts */
- pthread_key_create(&H5TS_apictx_key_g, H5TS_key_destructor);
+ pthread_key_create(&H5TS_apictx_key_g, H5TS__key_destructor);
/* initialize key for thread cancellability mechanism */
- pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor);
-}
+ pthread_key_create(&H5TS_cancel_key_s, H5TS__key_destructor);
+
+} /* end H5TS_pthread_first_thread_init() */
+
#endif /* H5_HAVE_WIN_THREADS */
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_mutex_lock
+ * Function: H5TS_mutex_lock
*
- * USAGE
- * H5TS_mutex_lock(&mutex_var)
*
- * RETURNS
- * 0 on success and non-zero on error.
+ * Returns: SUCCEED/FAIL
*
- * DESCRIPTION
+ * Description:
* Recursive lock semantics for HDF5 (locking) -
* Multiple acquisition of a lock by a thread is permitted with a
* corresponding unlock operation required.
*
- * PROGRAMMER: Chee Wai LEE
+ * Programmer: Chee Wai LEE
* May 2, 2000
*
*--------------------------------------------------------------------------
@@ -139,49 +465,48 @@ H5TS_pthread_first_thread_init(void)
herr_t
H5TS_mutex_lock(H5TS_mutex_t *mutex)
{
+ herr_t ret_value = SUCCEED;
+
#ifdef H5_HAVE_WIN_THREADS
EnterCriticalSection(&mutex->CriticalSection);
- return 0;
-#else /* H5_HAVE_WIN_THREADS */
- herr_t ret_value = pthread_mutex_lock(&mutex->atomic_lock);
+#else
+ /* Acquire the library lock */
+ if (pthread_mutex_lock(&mutex->atomic_lock) != 0)
+ return FAIL;
- if (ret_value)
- return ret_value;
-
- if (mutex->lock_count && pthread_equal(HDpthread_self(), mutex->owner_thread)) {
+ /* Check if this thread already owns the lock */
+ if (mutex->lock_count && pthread_equal(pthread_self(), mutex->owner_thread))
/* already owned by self - increment count */
mutex->lock_count++;
- }
else {
- /* if owned by other thread, wait for condition signal */
+ /* Wait until the lock is released by current owner thread */
while (mutex->lock_count)
pthread_cond_wait(&mutex->cond_var, &mutex->atomic_lock);
/* After we've received the signal, take ownership of the mutex */
- mutex->owner_thread = HDpthread_self();
+ mutex->owner_thread = pthread_self();
mutex->lock_count = 1;
- }
+ } /* end else */
- return pthread_mutex_unlock(&mutex->atomic_lock);
-#endif /* H5_HAVE_WIN_THREADS */
-}
+ /* Release the library lock */
+ if (pthread_mutex_unlock(&mutex->atomic_lock) != 0)
+ ret_value = FAIL;
+#endif
+
+ return ret_value;
+} /* end H5TS_mutex_lock() */
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_mutex_unlock
+ * Function: H5TS_mutex_unlock
*
- * USAGE
- * H5TS_mutex_unlock(&mutex_var)
- *
- * RETURNS
- * 0 on success and non-zero on error.
+ * Returns: SUCCEED/FAIL
*
- * DESCRIPTION
+ * Description:
* Recursive lock semantics for HDF5 (unlocking) -
* Multiple acquisition of a lock by a thread is permitted with a
* corresponding unlock operation required.
*
- * PROGRAMMER: Chee Wai LEE
+ * Programmer: Chee Wai LEE
* May 2, 2000
*
*--------------------------------------------------------------------------
@@ -189,52 +514,47 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex)
herr_t
H5TS_mutex_unlock(H5TS_mutex_t *mutex)
{
+ herr_t ret_value = SUCCEED;
+
#ifdef H5_HAVE_WIN_THREADS
/* Releases ownership of the specified critical section object. */
LeaveCriticalSection(&mutex->CriticalSection);
- return 0;
-#else /* H5_HAVE_WIN_THREADS */
- herr_t ret_value = pthread_mutex_lock(&mutex->atomic_lock);
-
- if (ret_value)
- return ret_value;
+#else
+ /* Decrement the lock count for this thread */
+ if (pthread_mutex_lock(&mutex->atomic_lock) != 0)
+ return FAIL;
mutex->lock_count--;
+ if (pthread_mutex_unlock(&mutex->atomic_lock) != 0)
+ ret_value = FAIL;
- ret_value = pthread_mutex_unlock(&mutex->atomic_lock);
-
- if (mutex->lock_count == 0) {
- int err;
-
- err = pthread_cond_signal(&mutex->cond_var);
- if (err != 0)
- ret_value = err;
- } /* end if */
+ /* If the lock count drops to zero, signal the condition variable, to
+ * wake another thread.
+ */
+ if (mutex->lock_count == 0)
+ if (pthread_cond_signal(&mutex->cond_var) != 0)
+ ret_value = FAIL;
+#endif /* H5_HAVE_WIN_THREADS */
return ret_value;
-#endif /* H5_HAVE_WIN_THREADS */
} /* H5TS_mutex_unlock */
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_cancel_count_inc
+ * Function: H5TS_cancel_count_inc
*
- * USAGE
- * H5TS_cancel_count_inc()
+ * Returns: SUCCEED/FAIL
*
- * RETURNS
- * 0 on success non-zero error code on error.
- *
- * DESCRIPTION
- * Creates a cancelation counter for a thread if it is the first time
+ * Description:
+ * Creates a cancellation counter for a thread if it is the first time
* the thread is entering the library.
*
* if counter value is zero, then set cancelability type of the thread
* to PTHREAD_CANCEL_DISABLE as thread is entering the library and store
- * the previous cancelability type into cancelation counter.
+ * the previous cancelability type into cancellation counter.
+ *
* Increase the counter value by 1.
*
- * PROGRAMMER: Chee Wai LEE
+ * Programmer: Chee Wai LEE
* May 2, 2000
*
*--------------------------------------------------------------------------
@@ -242,15 +562,15 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex)
herr_t
H5TS_cancel_count_inc(void)
{
-#ifdef H5_HAVE_WIN_THREADS
- /* unsupported; just return 0 */
- return SUCCEED;
-#else /* H5_HAVE_WIN_THREADS */
+ herr_t ret_value = SUCCEED;
+
+#ifndef H5_HAVE_WIN_THREADS
H5TS_cancel_t *cancel_counter;
- herr_t ret_value = SUCCEED;
- cancel_counter = (H5TS_cancel_t *)H5TS_get_thread_local_value(H5TS_cancel_key_g);
+ /* Acquire the thread's cancellation counter */
+ cancel_counter = (H5TS_cancel_t *)H5TS_get_thread_local_value(H5TS_cancel_key_s);
+ /* Check if it's created yet */
if (!cancel_counter) {
/*
* First time thread calls library - create new counter and associate
@@ -259,44 +579,47 @@ H5TS_cancel_count_inc(void)
* Don't use H5MM calls here since the destructor has to use HDfree in
* order to avoid codestack calls.
*/
- cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t));
-
- if (!cancel_counter) {
+ cancel_counter = HDcalloc(1, sizeof(*cancel_counter));
+ if (NULL == cancel_counter) {
HERROR(H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
return FAIL;
}
- ret_value = pthread_setspecific(H5TS_cancel_key_g, (void *)cancel_counter);
+ /* Set the thread's cancellation counter with the new object */
+ if (pthread_setspecific(H5TS_cancel_key_s, (void *)cancel_counter) != 0) {
+ HDfree(cancel_counter);
+ return FAIL;
+ }
}
+ /* Check if thread entering library */
if (cancel_counter->cancel_count == 0)
- /* thread entering library */
- ret_value = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cancel_counter->previous_state);
+ /* Set cancellation state to 'disable', and remember previous state */
+ if (pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cancel_counter->previous_state) != 0)
+ ret_value = FAIL;
+ /* Increment # of times the library API was re-entered, to avoid resetting
+ * previous cancellation state until the final API routine is returning.
+ */
++cancel_counter->cancel_count;
+#endif /* H5_HAVE_WIN_THREADS */
return ret_value;
-#endif /* H5_HAVE_WIN_THREADS */
-}
+} /* end H5TS_cancel_count_inc() */
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_cancel_count_dec
+ * Function: H5TS_cancel_count_dec
*
- * USAGE
- * H5TS_cancel_count_dec()
+ * Returns: SUCCEED/FAIL
*
- * RETURNS
- * 0 on success and a non-zero error code on error.
- *
- * DESCRIPTION
+ * Description:
* If counter value is one, then set cancelability type of the thread
- * to the previous cancelability type stored in the cancelation counter.
+ * to the previous cancelability type stored in the cancellation counter.
* (the thread is leaving the library).
*
* Decrement the counter value by 1.
*
- * PROGRAMMER: Chee Wai LEE
+ * Programmer: Chee Wai LEE
* May 2, 2000
*
*--------------------------------------------------------------------------
@@ -304,174 +627,813 @@ H5TS_cancel_count_inc(void)
herr_t
H5TS_cancel_count_dec(void)
{
-#ifdef H5_HAVE_WIN_THREADS
- /* unsupported; will just return 0 */
- return SUCCEED;
-#else /* H5_HAVE_WIN_THREADS */
- register H5TS_cancel_t *cancel_counter;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
+
+#ifndef H5_HAVE_WIN_THREADS
+ H5TS_cancel_t *cancel_counter;
- cancel_counter = (H5TS_cancel_t *)H5TS_get_thread_local_value(H5TS_cancel_key_g);
+ /* Acquire the thread's cancellation counter */
+ cancel_counter = (H5TS_cancel_t *)H5TS_get_thread_local_value(H5TS_cancel_key_s);
+ /* Check for leaving last API routine */
if (cancel_counter->cancel_count == 1)
- ret_value = pthread_setcancelstate(cancel_counter->previous_state, NULL);
+ /* Reset to previous thread cancellation state, if last API */
+ if (pthread_setcancelstate(cancel_counter->previous_state, NULL) != 0)
+ ret_value = FAIL;
+ /* Decrement cancellation counter */
--cancel_counter->cancel_count;
+#endif /* H5_HAVE_WIN_THREADS */
return ret_value;
-#endif /* H5_HAVE_WIN_THREADS */
-}
+} /* end H5TS_cancel_count_dec() */
+
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
-#ifdef H5_HAVE_WIN_THREADS
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_win32_process_enter
+ * Function: H5TS_alloc_rec_entry_count
*
- * RETURNS
- * SUCCEED/FAIL
+ * Returns:
+ * Pointer to allocated and initialized instance of
+ * H5TS_rec_entry_count, or NULL on failure.
*
- * DESCRIPTION
- * Per-process setup on Windows when using Win32 threads.
+ * Description:
+ * Allocate and initalize an instance of H5TS_rec_entry_count.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
*
*--------------------------------------------------------------------------
*/
-H5_DLL BOOL CALLBACK
-H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
+H5TS_rec_entry_count *
+H5TS_alloc_rec_entry_count(hbool_t write_lock)
{
- BOOL ret_value = TRUE;
+ H5TS_rec_entry_count *ret_value = NULL;
- /* Initialize the critical section (can't fail) */
- InitializeCriticalSection(&H5_g.init_lock.CriticalSection);
+ ret_value = HDmalloc(sizeof(*ret_value));
- /* Set up thread local storage */
- if (TLS_OUT_OF_INDEXES == (H5TS_errstk_key_g = TlsAlloc()))
- ret_value = FALSE;
+ if (ret_value) {
-#ifdef H5_HAVE_CODESTACK
- if (TLS_OUT_OF_INDEXES == (H5TS_funcstk_key_g = TlsAlloc()))
- ret_value = FALSE;
-#endif /* H5_HAVE_CODESTACK */
+ ret_value->magic = H5TS_RW_ENTRY_COUNT_MAGIC;
+ ret_value->write_lock = write_lock;
+ ret_value->rec_lock_count = 1;
+ }
- if (TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc()))
- ret_value = FALSE;
+ return ret_value;
+
+} /* end H5TS_alloc_rec_entry_count() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_free_rec_entry_count
+ *
+ * Returns: void
+ *
+ * Description:
+ * Frees the supplied instance of H5TS_rec_entry_count.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+void
+H5TS_free_rec_entry_count(void *target)
+{
+ H5TS_rec_entry_count *count;
+
+ count = (H5TS_rec_entry_count *)target;
+
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+
+ count->magic = 0;
+
+ HDfree(count);
+
+ return;
+
+} /* end H5TS_free_rec_entry_count() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_rw_lock_init
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Initialize the supplied instance of H5TS_rw_lock_t.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_rw_lock_init(H5TS_rw_lock_t *rw_lock, int policy)
+{
+ herr_t ret_value = SUCCEED;
+
+ /* Sanity checks -- until other policies are implemented,
+ * policy must equal H5TS_RW_LOCK_POLICY_FAVOR_WRITERS.
+ */
+ if ((rw_lock == NULL) || (policy != H5TS_RW_LOCK_POLICY_FAVOR_WRITERS)) {
+
+ ret_value = FAIL;
+ }
+
+ /* NOTE: Win32 thread init functions tend to have a return type of void while
+ * Pthreads return an int. We've gone with the lowest common denominator
+ * here, but we're going to have to better abstract this in the future.
+ */
+
+ /* Initialize the mutex */
+ if (ret_value == SUCCEED)
+ if (H5TS_mutex_init(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+
+ /* Initialize the waiting readers cv */
+ if (ret_value == SUCCEED)
+ if (H5TS_cond_init(&(rw_lock->readers_cv)) != 0)
+ ret_value = FAIL;
+
+ /* Initialize the waiting writers cv */
+ if (ret_value == SUCCEED)
+ if (H5TS_cond_init(&(rw_lock->writers_cv)) != 0)
+ ret_value = FAIL;
+
+ /* Initialize the counts key */
+ if (ret_value == SUCCEED)
+ if (pthread_key_create(&(rw_lock->rec_entry_count_key), H5TS_free_rec_entry_count) != 0)
+ ret_value = FAIL;
+
+ if (ret_value == SUCCEED) {
+
+ /* Initialize scalar fields */
+
+ rw_lock->magic = H5TS_RW_LOCK_MAGIC;
+ rw_lock->policy = policy;
+ rw_lock->waiting_readers_count = 0;
+ rw_lock->waiting_writers_count = 0;
+ rw_lock->active_readers = 0;
+ rw_lock->active_writers = 0;
+ rw_lock->stats.read_locks_granted = 0;
+ rw_lock->stats.read_locks_released = 0;
+ rw_lock->stats.real_read_locks_granted = 0;
+ rw_lock->stats.real_read_locks_released = 0;
+ rw_lock->stats.max_read_locks = 0;
+ rw_lock->stats.max_read_lock_recursion_depth = 0;
+ rw_lock->stats.read_locks_delayed = 0;
+ rw_lock->stats.max_read_locks_pending = 0;
+ rw_lock->stats.write_locks_granted = 0;
+ rw_lock->stats.write_locks_released = 0;
+ rw_lock->stats.real_write_locks_granted = 0;
+ rw_lock->stats.real_write_locks_released = 0;
+ rw_lock->stats.max_write_locks = 0;
+ rw_lock->stats.max_write_lock_recursion_depth = 0;
+ rw_lock->stats.write_locks_delayed = 0;
+ rw_lock->stats.max_write_locks_pending = 0;
+ }
return ret_value;
-} /* H5TS_win32_process_enter() */
-#endif /* H5_HAVE_WIN_THREADS */
-#ifdef H5_HAVE_WIN_THREADS
+} /* end H5TS_rw_lock_init() */
+
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_win32_thread_enter
+ * Function: H5TS_rw_lock_destroy
*
- * RETURNS
- * SUCCEED/FAIL
+ * Returns: SUCCEED/FAIL
*
- * DESCRIPTION
- * Per-thread setup on Windows when using Win32 threads.
+ * Description:
+ * Take down an instance of H5TS_rw_lock_t. All mutex, condition
+ * variables, and keys are destroyed, and magic is set to an invalid
+ * value. However, the instance of H5TS_rw_lock_t is not
+ * freed.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
*
*--------------------------------------------------------------------------
*/
herr_t
-H5TS_win32_thread_enter(void)
+H5TS_rw_lock_destroy(H5TS_rw_lock_t *rw_lock)
{
herr_t ret_value = SUCCEED;
- /* Currently a placeholder function. TLS setup is performed
- * elsewhere in the library.
- *
- * WARNING: Do NOT use C standard library functions here.
- * CRT functions are not allowed in DllMain, which is where this code
- * is used.
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ /* We are commited to the destroy at this point. Set magic
+ * to an invalid value, and call the appropriate pthread
+ * destroy routines. Call them all, even if one fails along
+ * the way.
+ */
+ rw_lock->magic = 0;
+
+ if (H5TS_mutex_destroy(&(rw_lock->mutex)) < 0)
+ ret_value = FAIL;
+
+ if (H5TS_cond_destroy(&(rw_lock->readers_cv)) < 0)
+ ret_value = FAIL;
+
+ if (H5TS_cond_destroy(&(rw_lock->writers_cv)) < 0)
+ ret_value = FAIL;
+
+ if (pthread_key_delete(rw_lock->rec_entry_count_key) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+
+} /* end H5TS_rw_lock_destroy() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_rw_rdlock
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Attempt to obtain a read lock on the associated recursive read / write
+ * lock.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_rw_rdlock(H5TS_rw_lock_t *rw_lock)
+{
+ hbool_t have_mutex = FALSE;
+ int result;
+ H5TS_rec_entry_count *count;
+ herr_t ret_value = SUCCEED;
+
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC)) {
+
+ ret_value = FAIL;
+ }
+
+ /* Obtain the mutex */
+ if (ret_value == SUCCEED) {
+ if (H5TS_mutex_lock_simple(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+ else
+ have_mutex = TRUE;
+ }
+
+ /* If there is no specific data for this thread, this is an
+ * initial read lock request.
*/
+ if (ret_value == SUCCEED) {
+
+ count = (H5TS_rec_entry_count *)H5TS_get_thread_local_value(rw_lock->rec_entry_count_key);
+
+ if (count) { /* This is a recursive lock */
+
+ if ((count->write_lock) || (rw_lock->active_readers == 0) || (rw_lock->active_writers != 0)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ count->rec_lock_count++;
+
+ H5TS_update_stats_rd_lock(rw_lock, count);
+ }
+ }
+ else { /* This is an initial read lock request */
+
+ switch (rw_lock->policy) {
+
+ case H5TS_RW_LOCK_POLICY_FAVOR_WRITERS:
+ if ((rw_lock->active_writers != 0) || (rw_lock->waiting_writers_count != 0)) {
+
+ int delayed = rw_lock->waiting_readers_count + 1;
+
+ H5TS_update_stats_rd_lock_delay(rw_lock, delayed);
+ }
+
+ while ((rw_lock->active_writers != 0) || (rw_lock->waiting_writers_count != 0)) {
+
+ rw_lock->waiting_readers_count++;
+
+ result = H5TS_cond_wait(&(rw_lock->readers_cv), &(rw_lock->mutex));
+
+ rw_lock->waiting_readers_count--;
+
+ if (result != 0) {
+
+ ret_value = FAIL;
+ break;
+ }
+ }
+ break;
+
+ default:
+ ret_value = FAIL;
+ break;
+ }
+
+ if ((ret_value == SUCCEED) && (NULL == (count = H5TS_alloc_rec_entry_count(FALSE)))) {
+
+ ret_value = FAIL;
+ }
+
+ if ((ret_value == SUCCEED) &&
+ (H5TS_set_thread_local_value(rw_lock->rec_entry_count_key, (void *)count) != 0)) {
+
+ ret_value = FAIL;
+ }
+
+ if (ret_value == SUCCEED) {
+
+ rw_lock->active_readers++;
+
+ HDassert(count->rec_lock_count == 1);
+
+ H5TS_update_stats_rd_lock(rw_lock, count);
+ }
+ }
+ }
+
+ if (have_mutex) {
+
+ H5TS_mutex_unlock_simple(&(rw_lock->mutex));
+ }
return ret_value;
-} /* H5TS_win32_thread_enter() */
-#endif /* H5_HAVE_WIN_THREADS */
-#ifdef H5_HAVE_WIN_THREADS
+} /* end H5TS_rw_rdlock() */
+
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_win32_process_exit
+ * Function: H5TS_rw_wrlock
*
- * RETURNS
- * SUCCEED/FAIL
+ * Returns: SUCCEED/FAIL
*
- * DESCRIPTION
- * Per-process cleanup on Windows when using Win32 threads.
+ * Description:
+ * Attempt to obtain a write lock on the associated recursive read / write
+ * lock.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
*
*--------------------------------------------------------------------------
*/
-void
-H5TS_win32_process_exit(void)
+herr_t
+H5TS_rw_wrlock(H5TS_rw_lock_t *rw_lock)
{
+ hbool_t have_mutex = FALSE;
+ int result;
+ H5TS_rec_entry_count *count;
+ herr_t ret_value = SUCCEED;
- /* Windows uses a different thread local storage mechanism which does
- * not support auto-freeing like pthreads' keys.
- *
- * This function is currently registered via atexit() and is called
- * AFTER H5_term_library().
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC)) {
+
+ ret_value = FAIL;
+ }
+
+ /* Obtain the mutex */
+ if (ret_value == SUCCEED) {
+ if (H5TS_mutex_lock_simple(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+ else
+ have_mutex = TRUE;
+ }
+
+ /* If there is no specific data for this thread, this is an
+ * initial write lock request.
*/
+ if (ret_value == SUCCEED) {
- /* Clean up critical section resources (can't fail) */
- DeleteCriticalSection(&H5_g.init_lock.CriticalSection);
+ count = (H5TS_rec_entry_count *)H5TS_get_thread_local_value(rw_lock->rec_entry_count_key);
- /* Clean up per-process thread local storage */
- TlsFree(H5TS_errstk_key_g);
-#ifdef H5_HAVE_CODESTACK
- TlsFree(H5TS_funcstk_key_g);
-#endif /* H5_HAVE_CODESTACK */
- TlsFree(H5TS_apictx_key_g);
+ if (count) { /* this is a recursive lock */
- return;
-} /* H5TS_win32_process_exit() */
-#endif /* H5_HAVE_WIN_THREADS */
+ if ((!(count->write_lock)) || (rw_lock->active_readers != 0) || (rw_lock->active_writers != 1)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ count->rec_lock_count++;
+
+ H5TS_update_stats_wr_lock(rw_lock, count);
+ }
+ }
+ else { /* This is an initial write lock request */
+
+ switch (rw_lock->policy) {
+
+ case H5TS_RW_LOCK_POLICY_FAVOR_WRITERS:
+ if ((rw_lock->active_readers > 0) || (rw_lock->active_writers > 0)) {
+
+ int delayed = rw_lock->waiting_writers_count + 1;
+
+ H5TS_update_stats_wr_lock_delay(rw_lock, delayed);
+ }
+
+ while ((rw_lock->active_readers > 0) || (rw_lock->active_writers > 0)) {
+
+ rw_lock->waiting_writers_count++;
+
+ result = H5TS_cond_wait(&(rw_lock->writers_cv), &(rw_lock->mutex));
+
+ rw_lock->waiting_writers_count--;
+
+ if (result != 0) {
+
+ ret_value = FAIL;
+ break;
+ }
+ }
+ break;
+
+ default:
+ ret_value = FAIL;
+ break;
+ }
+
+ if ((ret_value == SUCCEED) && (NULL == (count = H5TS_alloc_rec_entry_count(TRUE)))) {
+
+ ret_value = FAIL;
+ }
+
+ if ((ret_value == SUCCEED) &&
+ (H5TS_set_thread_local_value(rw_lock->rec_entry_count_key, (void *)count) != 0)) {
+
+ ret_value = FAIL;
+ }
+
+ if (ret_value == SUCCEED) {
+
+ rw_lock->active_writers++;
+
+ HDassert(count->rec_lock_count == 1);
+
+ H5TS_update_stats_wr_lock(rw_lock, count);
+ }
+ }
+ }
+
+ if (have_mutex) {
+
+ H5TS_mutex_unlock_simple(&(rw_lock->mutex));
+ }
+
+ return ret_value;
+
+} /* end H5TS_rw_wrlock() */
-#ifdef H5_HAVE_WIN_THREADS
/*--------------------------------------------------------------------------
- * NAME
- * H5TS_win32_thread_exit
+ * Function: H5TS_rw_unlock
*
- * RETURNS
- * SUCCEED/FAIL
+ * Returns: SUCCEED/FAIL
*
- * DESCRIPTION
- * Per-thread cleanup on Windows when using Win32 threads.
+ * Description:
+ * Attempt to unlock either a read or a write lock on the supplied
+ * recursive read / write lock.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
*
*--------------------------------------------------------------------------
*/
herr_t
-H5TS_win32_thread_exit(void)
+H5TS_rw_unlock(H5TS_rw_lock_t *rw_lock)
{
- LPVOID lpvData;
- herr_t ret_value = SUCCEED;
+ hbool_t have_mutex = FALSE;
+ hbool_t discard_rec_count = FALSE;
+ H5TS_rec_entry_count *count;
+ herr_t ret_value = SUCCEED;
- /* Windows uses a different thread local storage mechanism which does
- * not support auto-freeing like pthreads' keys.
- *
- * WARNING: Do NOT use C standard library functions here.
- * CRT functions are not allowed in DllMain, which is where this code
- * is used.
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC)) {
+
+ ret_value = FAIL;
+ }
+
+ /* Obtain the mutex */
+ if (ret_value == SUCCEED) {
+ if (H5TS_mutex_lock_simple(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+ else
+ have_mutex = TRUE;
+ }
+
+ /* If there is no specific data for this thread, no lock was held,
+ * and thus the unlock call must fail.
*/
+ if (ret_value == SUCCEED) {
- /* Clean up per-thread thread local storage */
- lpvData = TlsGetValue(H5TS_errstk_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
+ count = (H5TS_rec_entry_count *)H5TS_get_thread_local_value(rw_lock->rec_entry_count_key);
-#ifdef H5_HAVE_CODESTACK
- lpvData = TlsGetValue(H5TS_funcstk_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
-#endif /* H5_HAVE_CODESTACK */
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+ HDassert(count->rec_lock_count > 0);
- lpvData = TlsGetValue(H5TS_apictx_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
+ if (NULL == count) {
+
+ ret_value = FAIL;
+ }
+ else if (count->magic != H5TS_RW_ENTRY_COUNT_MAGIC) {
+
+ ret_value = FAIL;
+ }
+ else if (count->rec_lock_count <= 0) { /* Corrupt count? */
+
+ ret_value = FAIL;
+ }
+ else if (count->write_lock) { /* Drop a write lock */
+
+ HDassert((rw_lock->active_readers == 0) && (rw_lock->active_writers == 1));
+
+ if ((rw_lock->active_readers != 0) || (rw_lock->active_writers != 1)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ count->rec_lock_count--;
+
+ HDassert(count->rec_lock_count >= 0);
+
+ if (count->rec_lock_count == 0) {
+
+ /* Make note that we must discard the
+ * recursive entry counter so it will not
+ * confuse us on the next lock request.
+ */
+ discard_rec_count = TRUE;
+
+ /* Drop the write lock -- will signal later if needed */
+ rw_lock->active_writers--;
+
+ HDassert(rw_lock->active_writers == 0);
+ }
+ }
+
+ H5TS_update_stats_wr_unlock(rw_lock, count);
+ }
+ else { /* drop a read lock */
+
+ HDassert((rw_lock->active_readers > 0) && (rw_lock->active_writers == 0));
+
+ if ((rw_lock->active_readers <= 0) || (rw_lock->active_writers != 0)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ count->rec_lock_count--;
+
+ HDassert(count->rec_lock_count >= 0);
+
+ if (count->rec_lock_count == 0) {
+
+ /* Make note that we must discard the
+ * recursive entry counter so it will not
+ * confuse us on the next lock request.
+ */
+ discard_rec_count = TRUE;
+
+ /* Drop the read lock -- will signal later if needed */
+ rw_lock->active_readers--;
+ }
+ }
+
+ H5TS_update_stats_rd_unlock(rw_lock, count);
+ }
+
+ if ((ret_value == SUCCEED) && (rw_lock->active_readers == 0) && (rw_lock->active_writers == 0)) {
+
+ /* No locks held -- signal condition variables if required */
+
+ switch (rw_lock->policy) {
+
+ case H5TS_RW_LOCK_POLICY_FAVOR_WRITERS:
+#ifdef H5_HAVE_WIN_THREADS
+ if (rw_lock->waiting_writers_count > 0)
+ H5TS_cond_signal(&(rw_lock->writers_cv));
+ else if (rw_lock->waiting_readers_count > 0)
+ H5TS_cond_broadcast(&(rw_lock->readers_cv));
+#else
+ if (rw_lock->waiting_writers_count > 0) {
+
+ if (H5TS_cond_signal(&(rw_lock->writers_cv)) != 0)
+ ret_value = FAIL;
+ }
+ else if (rw_lock->waiting_readers_count > 0) {
+
+ if (H5TS_cond_broadcast(&(rw_lock->readers_cv)) != 0)
+ ret_value = FAIL;
+ }
+#endif
+ break;
+ default:
+ ret_value = FAIL;
+ break;
+ }
+ }
+ }
+
+ /* If we are really dropping the lock, must set the value of
+ * rec_entry_count_key for this thread to NULL, so that
+ * when this thread next requests a lock, it will appear
+ * as an initial lock, not a recursive lock.
+ */
+ if (discard_rec_count) {
+
+ HDassert(count);
+
+ if (H5TS_set_thread_local_value(rw_lock->rec_entry_count_key, (void *)NULL) != 0) {
+
+ ret_value = FAIL;
+ }
+
+ H5TS_free_rec_entry_count((void *)count);
+ count = NULL;
+ }
+
+ if (have_mutex) {
+
+ H5TS_mutex_unlock_simple(&(rw_lock->mutex));
+ }
return ret_value;
-} /* H5TS_win32_thread_exit() */
-#endif /* H5_HAVE_WIN_THREADS */
+
+} /* end H5TS_rw_unlock() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_rw_lock_get_stats
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Obtain a copy of the current statistics on the supplied
+ * recursive read / write lock. Note that to obtain a consistent
+ * set of statistics, the function must obtain the lock mutex.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_rw_lock_get_stats(H5TS_rw_lock_t *rw_lock, H5TS_rw_lock_stats_t *stats)
+{
+ hbool_t have_mutex = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC) || (stats == NULL)) {
+
+ ret_value = FAIL;
+ }
+
+ /* Obtain the mutex */
+ if (ret_value == SUCCEED) {
+ if (H5TS_mutex_lock_simple(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+ else
+ have_mutex = TRUE;
+ }
+
+ if (ret_value == SUCCEED) {
+
+ *stats = rw_lock->stats;
+ }
+
+ if (have_mutex) {
+
+ H5TS_mutex_unlock_simple(&(rw_lock->mutex));
+ }
+
+ return ret_value;
+
+} /* end H5TS_rw_lock_get_stats() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_rw_lock_reset_stats
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Reset the statistics for the supplied recursive read / write lock.
+ * Note that to reset the statistics consistently, the function must
+ * obtain the lock mutex.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_rw_lock_reset_stats(H5TS_rw_lock_t *rw_lock)
+{
+ hbool_t have_mutex = FALSE;
+ /* NOTE: Update this initializer if you modify H5TS_rw_lock_stats_t */
+ static const H5TS_rw_lock_stats_t reset_stats = {/* read_locks_granted = */ 0,
+ /* read_locks_released = */ 0,
+ /* real_read_locks_granted = */ 0,
+ /* real_read_locks_released = */ 0,
+ /* max_read_locks = */ 0,
+ /* max_read_lock_recursion_depth = */ 0,
+ /* read_locks_delayed = */ 0,
+ /* max_read_locks_pending = */ 0,
+ /* write_locks_granted = */ 0,
+ /* write_locks_released = */ 0,
+ /* real_write_locks_granted = */ 0,
+ /* real_write_locks_released = */ 0,
+ /* max_write_locks = */ 0,
+ /* max_write_lock_recursion_depth = */ 0,
+ /* write_locks_delayed = */ 0,
+ /* max_write_locks_pending = */ 0};
+ herr_t ret_value = SUCCEED;
+
+ if ((rw_lock == NULL) || (rw_lock->magic != H5TS_RW_LOCK_MAGIC)) {
+
+ ret_value = FAIL;
+ }
+
+ /* Obtain the mutex */
+ if (ret_value == SUCCEED) {
+ if (H5TS_mutex_lock_simple(&(rw_lock->mutex)) != 0)
+ ret_value = FAIL;
+ else
+ have_mutex = TRUE;
+ }
+
+ if (ret_value == SUCCEED) {
+
+ rw_lock->stats = reset_stats;
+ }
+
+ if (have_mutex) {
+
+ H5TS_mutex_unlock_simple(&(rw_lock->mutex));
+ }
+
+ return ret_value;
+
+} /* end H5TS_rw_lock_reset_stats() */
+
+/*--------------------------------------------------------------------------
+ * Function: H5TS_rw_lock_print_stats
+ *
+ * Returns: SUCCEED/FAIL
+ *
+ * Description:
+ * Print the supplied pthresds recursive R/W lock statistics to
+ * standard out.
+ *
+ * UPDATE THIS FUNCTION IF YOU MODIFY H5TS_rw_lock_stats_t.
+ *
+ * Programmer: John Mainzer
+ * August 28, 2020
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5TS_rw_lock_print_stats(const char *header_str, H5TS_rw_lock_stats_t *stats)
+{
+ herr_t ret_value = SUCCEED;
+
+ if ((header_str == NULL) || (stats == NULL)) {
+
+ ret_value = FAIL;
+ }
+ else {
+
+ HDfprintf(stdout, "\n\n%s\n\n", header_str);
+ HDfprintf(stdout, " read_locks_granted = %" PRId64 "\n", stats->read_locks_granted);
+ HDfprintf(stdout, " read_locks_released = %" PRId64 "\n", stats->read_locks_released);
+ HDfprintf(stdout, " real_read_locks_granted = %" PRId64 "\n", stats->real_read_locks_granted);
+ HDfprintf(stdout, " real_read_locks_released = %" PRId64 "\n",
+ stats->real_read_locks_released);
+ HDfprintf(stdout, " max_read_locks = %" PRId64 "\n", stats->max_read_locks);
+ HDfprintf(stdout, " max_read_lock_recursion_depth = %" PRId64 "\n",
+ stats->max_read_lock_recursion_depth);
+ HDfprintf(stdout, " read_locks_delayed = %" PRId64 "\n", stats->read_locks_delayed);
+ HDfprintf(stdout, " max_read_locks_pending = %" PRId64 "\n", stats->max_read_locks_pending);
+ HDfprintf(stdout, " write_locks_granted = %" PRId64 "\n", stats->write_locks_granted);
+ HDfprintf(stdout, " write_locks_released = %" PRId64 "\n", stats->write_locks_released);
+ HDfprintf(stdout, " real_write_locks_granted = %" PRId64 "\n",
+ stats->real_write_locks_granted);
+ HDfprintf(stdout, " real_write_locks_released = %" PRId64 "\n",
+ stats->real_write_locks_released);
+ HDfprintf(stdout, " max_write_locks = %" PRId64 "\n", stats->max_write_locks);
+ HDfprintf(stdout, " max_write_lock_recursion_depth = %" PRId64 "\n",
+ stats->max_write_lock_recursion_depth);
+ HDfprintf(stdout, " write_locks_delayed = %" PRId64 "\n", stats->write_locks_delayed);
+ HDfprintf(stdout, " max_write_locks_pending = %" PRId64 "\n\n",
+ stats->max_write_locks_pending);
+ }
+
+ return ret_value;
+
+} /* end H5TS_rw_lock_print_stats() */
+
+#endif /* H5_USE_RECURSIVE_WRITER_LOCKS */
/*--------------------------------------------------------------------------
* NAME
@@ -494,7 +1456,6 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata)
H5TS_thread_t ret_value;
#ifdef H5_HAVE_WIN_THREADS
-
/* When calling C runtime functions, you should use _beginthread or
* _beginthreadex instead of CreateThread. Threads created with
* CreateThread risk being killed in low-memory situations. Since we
@@ -514,7 +1475,6 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata)
#endif /* H5_HAVE_WIN_THREADS */
return ret_value;
-
-} /* H5TS_create_thread */
+} /* end H5TS_create_thread() */
#endif /* H5_HAVE_THREADSAFE */
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index bb51030..e324b38 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -6,122 +6,586 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5TSprivate.h
- * May 2 2000
- * Chee Wai LEE
+ * Created: H5TSprivate.h
*
- * Purpose: Private non-prototype header.
- *
- * Modifications:
+ * Purpose: Thread-safety abstractions used by the library
*
*-------------------------------------------------------------------------
*/
#ifndef H5TSprivate_H_
#define H5TSprivate_H_
+#ifdef H5_HAVE_THREADSAFE
+
/* Public headers needed by this file */
#ifdef LATER
-#include "H5TSpublic.h" /*Public API prototypes */
+#include "H5TSpublic.h" /* Public API prototypes */
#endif /* LATER */
-#ifdef H5_HAVE_WIN_THREADS
+/**************************/
+/* Library Private Macros */
+/**************************/
-/* Library level data structures */
+/* Defines */
-/* Mutexes, Threads, and Attributes */
-typedef struct H5TS_mutex_struct {
- CRITICAL_SECTION CriticalSection;
-} H5TS_mutex_t;
-typedef CRITICAL_SECTION H5TS_mutex_simple_t;
-typedef HANDLE H5TS_thread_t;
-typedef HANDLE H5TS_attr_t;
-typedef DWORD H5TS_key_t;
-typedef INIT_ONCE H5TS_once_t;
+#ifdef H5_HAVE_WIN_THREADS
-/* Defines */
-/* not used on windows side, but need to be defined to something */
+/* Scope Definitions (Pthreads only) */
#define H5TS_SCOPE_SYSTEM 0
#define H5TS_SCOPE_PROCESS 0
-#define H5TS_CALL_CONV WINAPI
-/* Functions */
+/* Calling convention (Windows only) */
+#define H5TS_CALL_CONV WINAPI
+
+/* Portability function aliases */
#define H5TS_get_thread_local_value(key) TlsGetValue(key)
#define H5TS_set_thread_local_value(key, value) TlsSetValue(key, value)
-#define H5TS_attr_init(attr_ptr) 0
-#define H5TS_attr_setscope(attr_ptr, scope) 0
-#define H5TS_attr_destroy(attr_ptr) 0
+#define H5TS_attr_init(attr) 0
+#define H5TS_attr_setscope(attr, scope) 0
+#define H5TS_attr_destroy(attr) 0
#define H5TS_wait_for_thread(thread) WaitForSingleObject(thread, INFINITE)
#define H5TS_mutex_init(mutex) InitializeCriticalSection(mutex)
#define H5TS_mutex_lock_simple(mutex) EnterCriticalSection(mutex)
#define H5TS_mutex_unlock_simple(mutex) LeaveCriticalSection(mutex)
-/* Functions called from DllMain */
-H5_DLL BOOL CALLBACK H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex);
-H5_DLL void H5TS_win32_process_exit(void);
-H5_DLL herr_t H5TS_win32_thread_enter(void);
-H5_DLL herr_t H5TS_win32_thread_exit(void);
+/* No Pthreads equivalent - we use a custom H5TS call with that thread library */
+#define H5TS_thread_id() ((uint64_t)GetCurrentThreadId())
-#else /* H5_HAVE_WIN_THREADS */
+#else
+
+/* Scope Definitions (Pthreads only) */
+#define H5TS_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
+#define H5TS_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
-/* Library level data structures */
+/* Calling convention (Windows only) */
+#define H5TS_CALL_CONV /* N/A */
+
+/* Portability function aliases */
+#define H5TS_get_thread_local_value(key) pthread_getspecific(key)
+#define H5TS_set_thread_local_value(key, value) pthread_setspecific(key, value)
+#define H5TS_attr_init(attr) pthread_attr_init((attr))
+#define H5TS_attr_setscope(attr, scope) pthread_attr_setscope(attr, scope)
+#define H5TS_attr_destroy(attr) pthread_attr_destroy(attr)
+#define H5TS_wait_for_thread(thread) pthread_join(thread, NULL)
+#define H5TS_mutex_init(mutex) pthread_mutex_init(mutex, NULL)
+#define H5TS_mutex_lock_simple(mutex) pthread_mutex_lock(mutex)
+#define H5TS_mutex_unlock_simple(mutex) pthread_mutex_unlock(mutex)
+
+/* No Win32 thread equivalent - only needed for RW locks which are not supported
+ * under Windows threads.
+ */
+#define H5TS_mutex_destroy(mutex) pthread_mutex_destroy(mutex)
+#define H5TS_cond_init(cond) pthread_cond_init(cond, NULL)
+#define H5TS_cond_destroy(cond) pthread_cond_destroy(cond)
+#define H5TS_cond_wait(cond, mutex) pthread_cond_wait(cond, mutex)
+#define H5TS_cond_signal(cond) pthread_cond_signal(cond)
+#define H5TS_cond_broadcast(cond) pthread_cond_broadcast(cond)
+
+#endif /* H5_HAVE_WIN_THREADS */
+
+/******************************************************************************
+ * Macros to maintain statistics on the Pthreads recursive R/W lock.
+ ******************************************************************************/
+
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+
+/* Magic values for struct sanity checking */
+
+/* RW lock */
+#define H5TS_RW_LOCK_MAGIC 0XABCD
+
+/* RW lock entry counts */
+#define H5TS_RW_ENTRY_COUNT_MAGIC 0XABBA
+
+/* Flag for favoring writers */
+/* THIS SHOULD BE AN ENUM */
+#define H5TS_RW_LOCK_POLICY_FAVOR_WRITERS 0
+
+#endif /* H5_USE_RECURSIVE_WRITER_LOCKS */
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
/* Mutexes, Threads, and Attributes */
+
+#ifdef H5_HAVE_WIN_THREADS
+
+typedef struct H5TS_mutex_struct {
+ CRITICAL_SECTION CriticalSection;
+} H5TS_mutex_t;
+
+#else
+
typedef struct H5TS_mutex_struct {
pthread_t owner_thread; /* current lock owner */
pthread_mutex_t atomic_lock; /* lock for atomicity of new mechanism */
pthread_cond_t cond_var; /* condition variable */
unsigned int lock_count;
} H5TS_mutex_t;
+
+#endif /* H5_HAVE_WIN_THREADS */
+
+/* Portability wrappers */
+
+#ifdef H5_HAVE_WIN_THREADS
+
+typedef HANDLE H5TS_thread_t;
+typedef HANDLE H5TS_attr_t;
+typedef CRITICAL_SECTION H5TS_mutex_simple_t;
+typedef DWORD H5TS_key_t;
+typedef INIT_ONCE H5TS_once_t;
+typedef CONDITION_VARIABLE H5TS_cond_t;
+
+#else
+
typedef pthread_t H5TS_thread_t;
typedef pthread_attr_t H5TS_attr_t;
typedef pthread_mutex_t H5TS_mutex_simple_t;
typedef pthread_key_t H5TS_key_t;
typedef pthread_once_t H5TS_once_t;
+typedef pthread_cond_t H5TS_cond_t;
-/* Scope Definitions */
-#define H5TS_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
-#define H5TS_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
-#define H5TS_CALL_CONV /* unused - Windows only */
+#endif /* H5_HAVE_WIN_THREADS */
-/* Functions */
-#define H5TS_get_thread_local_value(key) pthread_getspecific(key)
-#define H5TS_set_thread_local_value(key, value) pthread_setspecific(key, value)
-#define H5TS_attr_init(attr_ptr) pthread_attr_init((attr_ptr))
-#define H5TS_attr_setscope(attr_ptr, scope) pthread_attr_setscope(attr_ptr, scope)
-#define H5TS_attr_destroy(attr_ptr) pthread_attr_destroy(attr_ptr)
-#define H5TS_wait_for_thread(thread) pthread_join(thread, NULL)
-#define H5TS_mutex_init(mutex) pthread_mutex_init(mutex, NULL)
-#define H5TS_mutex_lock_simple(mutex) pthread_mutex_lock(mutex)
-#define H5TS_mutex_unlock_simple(mutex) pthread_mutex_unlock(mutex)
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
-#endif /* H5_HAVE_WIN_THREADS */
+/******************************************************************************
+ *
+ * Structure H5TS_rw_lock_stats_t
+ *
+ * Catchall structure for statistics on the recursive p-threads based
+ * recursive R/W lock (see declaration of H5TS_rw_lock_t below).
+ *
+ * Since the mutex must be held when reading a consistent set of statistics
+ * from the recursibe R/W lock, it simplifies matters to bundle them into
+ * a single structure. This structure exists for that purpose.
+ *
+ * If you modify this structure, be sure to make equivalent changes to
+ * the reset_stats initializer in H5TS_rw_lock_reset_stats().
+ *
+ * Individual fields are discussed below.
+ *
+ * JRM -- 8/28/20
+ *
+ * Read lock stats:
+ *
+ * read_locks_granted: 64 bit integer used to count the total number of read
+ * locks granted. Note that this includes recursive lock
+ * requests.
+ *
+ * read_locks_released: 64 bit integer used to count the total number of read
+ * locks released. Note that this includes recursive lock
+ * release requests.
+ *
+ * real_read_locks_granted: 64 bit integer used to count the total number of
+ * read locks granted, less any recursive lock requests.
+ *
+ * real_read_locks_released: 64 bit integer used to count the total number of
+ * read locks released, less any recursive lock releases.
+ *
+ * max_read_locks; 64 bit integer used to track the maximum number of read
+ * locks active at any point in time.
+ *
+ * max_read_lock_recursion_depth; 64 bit integer used to track the maximum
+ * recursion depth observed for any read lock.
+ *
+ * read_locks_delayed: 64 bit integer used to track the number of read locks
+ * that were not granted immediately.
+ *
+ * max_read_locks_delayed; 64 bit integer used to track the maximum number of
+ * pending read locks at any point in time.
+ *
+ *
+ * Write lock stats:
+ *
+ * write_locks_granted: 64 bit integer used to count the total number of write
+ * locks granted. Note that this includes recursive lock
+ * requests.
+ *
+ * write_locks_released: 64 bit integer used to count the total number of write
+ * locks released. Note that this includes recursive lock
+ * release requests.
+ *
+ * real_write_locks_granted: 64 bit integer used to count the total number of
+ * write locks granted, less any recursive lock requests.
+ *
+ * real_write_locks_released: 64 bit integer used to count the total number of
+ * write locks released, less any recursive lock releases.
+ *
+ * max_write_locks; 64 bit integer used to track the maximum number of write
+ * locks active at any point in time. Must be either zero or one.
+ *
+ * max_write_lock_recursion_depth; 64 bit integer used to track the maximum
+ * recursion depth observed for any write lock.
+ *
+ * write_locks_delayed: 64 bit integer used to track the number of write locks
+ * that were not granted immediately.
+ *
+ * max_write_locks_delayed; 64 bit integer used to track the maximum number of
+ * pending write locks at any point in time.
+ *
+ ******************************************************************************/
+
+typedef struct H5TS_rw_lock_stats_t {
-/* External global variables */
+ int64_t read_locks_granted;
+ int64_t read_locks_released;
+ int64_t real_read_locks_granted;
+ int64_t real_read_locks_released;
+ int64_t max_read_locks;
+ int64_t max_read_lock_recursion_depth;
+ int64_t read_locks_delayed;
+ int64_t max_read_locks_pending;
+ int64_t write_locks_granted;
+ int64_t write_locks_released;
+ int64_t real_write_locks_granted;
+ int64_t real_write_locks_released;
+ int64_t max_write_locks;
+ int64_t max_write_lock_recursion_depth;
+ int64_t write_locks_delayed;
+ int64_t max_write_locks_pending;
+
+} H5TS_rw_lock_stats_t;
+
+/******************************************************************************
+ *
+ * Structure H5TS_rw_lock_t
+ *
+ * A read / write lock, is a lock that allows either an arbitrary number
+ * of readers, or a single writer into a critical region. A recurssive
+ * lock is one that allows a thread that already has a lock (be it read or
+ * write) to successfully request the lock again, only dropping the lock
+ * when the number of un-lock calls equals the number of lock calls.
+ *
+ * Note that we can't use the Pthreads or Win32 R/W locks, as while they
+ * permit recursive read locks, they disallow recursive write locks.
+ *
+ * This structure is a catchall for the fields needed to implement a
+ * recursive R/W lock that allows recursive write locks, and for the
+ * associate statistics collection fields.
+ *
+ * This recursive R/W lock implementation is an extension of the R/W lock
+ * implementation given in "UNIX network programming" Volume 2, Chapter 8
+ * by w. Richard Stevens, 2nd edition.
+ *
+ * Individual fields are discussed below.
+ *
+ * JRM -- 8/28/20
+ *
+ * magic: Unsigned 32 bit integer field used for sanity checking. This
+ * fields must always be set to H5TS_RW_LOCK_MAGIC.
+ * If this structure is allocated dynamically, remember to set
+ * it to some invalid value before discarding the structure.
+ *
+ * policy Integer containing a code indicating the precidence policy
+ * used by the R/W lock. The supported policies are listed
+ * below:
+ *
+ * H5TS__RW_LOCK_POLICY__FAVOR_WRITERS:
+ *
+ * If selected, the R/W lock will grant access to a pending
+ * writer if there are both pending readers and writers.
+ *
+ *
+ * --- Define other policies here ---
+ *
+ *
+ * mutex: Mutex used to maintain mutual exclusion on the fields of
+ * of this structure.
+ *
+ * readers_cv: Condition variable used for waiting readers.
+ *
+ * writers_cv: Condition variable used for waiting writers.
+ *
+ * waiting_readers_count: 32 bit integer used to maintain a count of
+ * waiting readers. This value should always be non-negative.
+ *
+ * waiting_writers_count: 32 bit integer used to maintain a count of
+ * waiting writers. This value should always be non-negative.
+ *
+ * The following two fields could be combined into a single field, with
+ * the count of active readers being represented by a positive value, and
+ * the number of writers by a negative value. Two fields are used to
+ * facilitate sanity checking.
+ *
+ * active_readers: 32 bit integer used to maintain a count of
+ * readers that currently hold a read lock. This value
+ * must be zero if active_writers is positive. It should
+ * never be negative.
+ *
+ * active_writers: 32 bit integer used to maintain a count of
+ * writers that currently hold a write lock. This value
+ * must always be either 0 or 1, and must be zero if
+ * active_readers is positive. It should never be negative.
+ *
+ * rec_entry_count_key: Instance of thread-local key used to maintain
+ * a thread specific lock type and recursive entry count
+ * for all threads holding a lock.
+ *
+ * stats: Instance of H5TS_rw_lock_stats_t used to track
+ * statistics on the recursive R/W lock. See the declaration
+ * of the structure for discussion of its fields.
+ *
+ * Note that the stats are gathered into a structure because
+ * we must obtain the mutex when reading the statistics to
+ * avoid changes while the statistics are being read. Collecting
+ * them into a structure facilitates this.
+ *
+ ******************************************************************************/
+
+typedef struct H5TS_rw_lock_t {
+
+ uint32_t magic;
+ int32_t policy;
+ H5TS_mutex_simple_t mutex;
+ H5TS_cond_t readers_cv;
+ H5TS_cond_t writers_cv;
+ int32_t waiting_readers_count;
+ int32_t waiting_writers_count;
+ int32_t active_readers;
+ int32_t active_writers;
+ H5TS_key_t rec_entry_count_key;
+ int32_t writer_rec_entry_count;
+ struct H5TS_rw_lock_stats_t stats;
+
+} H5TS_rw_lock_t;
+
+/******************************************************************************
+ *
+ * Structure H5TS_rec_entry_count
+ *
+ * Strucure associated with the reader_rec_entry_count_key defined in
+ * H5TS_rw_lock_t.
+ *
+ * The primary purpose of this structure is to maintain a count of recursive
+ * locks so that the lock can be dropped when the count drops to zero.
+ *
+ * Aditional fields are included for purposes of sanity checking.
+ *
+ * Individual fields are discussed below.
+ *
+ * JRM -- 8/28/20
+ *
+ * magic: Unsigned 32 bit integer field used for sanity checking. This
+ * field must always be set to H5TS_RW_ENTRY_COUNT_MAGIC, and
+ * should be set to some invalid value just before the structure
+ * is freed.
+ *
+ * write_lock: Boolean field that is set to TRUE if the count is for a write
+ * lock, and to FALSE if it is for a read lock.
+ *
+ * rec_lock_count: Count of the number of recursive lock calls, less
+ * the number of recursive unlock calls. The lock in question
+ * is dropped when the count drops to zero.
+ *
+ ******************************************************************************/
+
+typedef struct H5TS_rec_entry_count {
+
+ uint32_t magic;
+ hbool_t write_lock;
+ int64_t rec_lock_count;
+
+} H5TS_rec_entry_count;
+
+#endif /* H5_USE_RECURSIVE_WRITER_LOCKS */
+
+/*****************************/
+/* Library-private Variables */
+/*****************************/
+
+/* Library-scope global variables */
+
+/* Library initialization */
extern H5TS_once_t H5TS_first_init_g;
-extern H5TS_key_t H5TS_errstk_key_g;
-extern H5TS_key_t H5TS_funcstk_key_g;
-extern H5TS_key_t H5TS_apictx_key_g;
-
-#if defined c_plusplus || defined __cplusplus
-extern "C" {
-#endif /* c_plusplus || __cplusplus */
-
-H5_DLL void H5TS_pthread_first_thread_init(void);
-H5_DLL herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex);
-H5_DLL herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex);
-H5_DLL herr_t H5TS_cancel_count_inc(void);
-H5_DLL herr_t H5TS_cancel_count_dec(void);
+
+/* Error stacks */
+extern H5TS_key_t H5TS_errstk_key_g;
+
+/* Function stacks */
+#ifdef H5_HAVE_CODESTACK
+extern H5TS_key_t H5TS_funcstk_key_g;
+#endif
+
+/* API contexts */
+extern H5TS_key_t H5TS_apictx_key_g;
+
+/***********************************/
+/* Private static inline functions */
+/***********************************/
+
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+
+static inline void
+H5TS_update_stats_rd_lock(H5TS_rw_lock_t *rw_lock, H5TS_rec_entry_count *count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+ HDassert(count->rec_lock_count >= 1);
+ HDassert(!count->write_lock);
+
+ rw_lock->stats.read_locks_granted++;
+
+ if (count->rec_lock_count == 1) {
+
+ rw_lock->stats.real_read_locks_granted++;
+
+ if (rw_lock->active_readers > rw_lock->stats.max_read_locks)
+ rw_lock->stats.max_read_locks = rw_lock->active_readers;
+ }
+
+ if (count->rec_lock_count > rw_lock->stats.max_read_lock_recursion_depth)
+ rw_lock->stats.max_read_lock_recursion_depth = count->rec_lock_count;
+
+} /* end H5TS_update_stats_rd_lock() */
+
+static inline void
+H5TS_update_stats_rd_lock_delay(H5TS_rw_lock_t *rw_lock, int waiting_count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert((waiting_count) > 0);
+
+ rw_lock->stats.read_locks_delayed++;
+
+ if (rw_lock->stats.max_read_locks_pending < waiting_count)
+ rw_lock->stats.max_read_locks_pending = (waiting_count);
+
+} /* end H5TS_update_stats_rd_lock_delay() */
+
+static inline void
+H5TS_update_stats_rd_unlock(H5TS_rw_lock_t *rw_lock, H5TS_rec_entry_count *count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+ HDassert(count->rec_lock_count >= 0);
+ HDassert(!count->write_lock);
+
+ rw_lock->stats.read_locks_released++;
+
+ if (count->rec_lock_count == 0)
+ rw_lock->stats.real_read_locks_released++;
+
+} /* end H5TS_update_stats_rd_unlock() */
+
+static inline void
+H5TS_update_stats_wr_lock(H5TS_rw_lock_t *rw_lock, H5TS_rec_entry_count *count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+ HDassert(count->rec_lock_count >= 1);
+ HDassert(count->write_lock);
+
+ rw_lock->stats.write_locks_granted++;
+
+ if (count->rec_lock_count == 1) {
+
+ rw_lock->stats.real_write_locks_granted++;
+
+ if (rw_lock->active_writers > rw_lock->stats.max_write_locks)
+ rw_lock->stats.max_write_locks = rw_lock->active_writers;
+ }
+
+ if (count->rec_lock_count > rw_lock->stats.max_write_lock_recursion_depth)
+ rw_lock->stats.max_write_lock_recursion_depth = count->rec_lock_count;
+
+} /* end H5TS_update_stats_wr_lock() */
+
+static inline void
+H5TS_update_stats_wr_lock_delay(H5TS_rw_lock_t *rw_lock, int waiting_count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert(waiting_count > 0);
+
+ rw_lock->stats.write_locks_delayed++;
+
+ if (rw_lock->stats.max_write_locks_pending < waiting_count)
+ rw_lock->stats.max_write_locks_pending = waiting_count;
+
+} /* end H5TS_update_stats_wr_lock_delay() */
+
+static inline void
+H5TS_update_stats_wr_unlock(H5TS_rw_lock_t *rw_lock, H5TS_rec_entry_count *count)
+{
+ HDassert(rw_lock);
+ HDassert(rw_lock->magic == H5TS_RW_LOCK_MAGIC);
+ HDassert(count);
+ HDassert(count->magic == H5TS_RW_ENTRY_COUNT_MAGIC);
+ HDassert(count->rec_lock_count >= 0);
+ HDassert(count->write_lock);
+
+ rw_lock->stats.write_locks_released++;
+
+ if (count->rec_lock_count == 0)
+ rw_lock->stats.real_write_locks_released++;
+
+} /* end H5TS_update_stats_wr_unlock() */
+#endif
+
+/***************************************/
+/* Library-private Function Prototypes */
+/***************************************/
+
+/* Platform-specific functions */
+#ifdef H5_HAVE_WIN_THREADS
+
+/* Functions called from DllMain */
+H5_DLL BOOL CALLBACK H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex);
+H5_DLL void H5TS_win32_process_exit(void);
+H5_DLL herr_t H5TS_win32_thread_enter(void);
+H5_DLL herr_t H5TS_win32_thread_exit(void);
+
+#else
+
+H5_DLL uint64_t H5TS_thread_id(void);
+H5_DLL void H5TS_pthread_first_thread_init(void);
+
+#endif /* H5_HAVE_WIN_THREADS */
+
+/* Library-scope routines */
+/* (Only used within H5private.h macros) */
+H5_DLL herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex);
+H5_DLL herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex);
+H5_DLL herr_t H5TS_cancel_count_inc(void);
+H5_DLL herr_t H5TS_cancel_count_dec(void);
+
+/* Fully recursive R/W lock related function declarations */
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+H5_DLL H5TS_rec_entry_count *H5TS_alloc_rec_entry_count(hbool_t write_lock);
+H5_DLL void H5TS_free_rec_entry_count(void *target);
+H5_DLL herr_t H5TS_rw_lock_init(H5TS_rw_lock_t *rw_lock, int policy);
+H5_DLL herr_t H5TS_rw_lock_destroy(H5TS_rw_lock_t *rw_lock);
+H5_DLL herr_t H5TS_rw_rdlock(H5TS_rw_lock_t *rw_lock);
+H5_DLL herr_t H5TS_rw_wrlock(H5TS_rw_lock_t *rw_lock);
+H5_DLL herr_t H5TS_rw_unlock(H5TS_rw_lock_t *rw_lock);
+H5_DLL herr_t H5TS_rw_lock_get_stats(H5TS_rw_lock_t *rw_lock, H5TS_rw_lock_stats_t *stats);
+H5_DLL herr_t H5TS_rw_lock_reset_stats(H5TS_rw_lock_t *rw_lock);
+H5_DLL herr_t H5TS_rw_lock_print_stats(const char *header_str, H5TS_rw_lock_stats_t *stats);
+#endif
+
+/* Testing routines */
H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata);
-#if defined c_plusplus || defined __cplusplus
-}
-#endif /* c_plusplus || __cplusplus */
+#else /* H5_HAVE_THREADSAFE */
+
+/* Non-threadsafe code needs this */
+#define H5TS_thread_id() ((uint64_t)0)
+
+#endif /* H5_HAVE_THREADSAFE */
#endif /* H5TSprivate_H_ */
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index 5afe74c..e2f3f01 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index 0d8103a..9f0c061 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -228,10 +228,7 @@ done:
* Purpose: Return a small bit sequence as a number. Bit vector starts
* at OFFSET and is SIZE bits long.
*
- * Return: Success: The bit sequence interpretted as an unsigned
- * integer.
- *
- * Failure: 0
+ * Return: The bit sequence interpretted as an unsigned integer
*
*-------------------------------------------------------------------------
*/
@@ -264,8 +261,8 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size)
case H5T_ORDER_NONE:
case H5T_ORDER_MIXED:
default:
- /* Unknown endianness. Bail out. */
- HGOTO_DONE(UFAIL)
+ /* This function can't return errors */
+ HDassert(0 && "unknown byte order");
}
/* Set return value */
@@ -388,7 +385,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value)
*-------------------------------------------------------------------------
*/
ssize_t
-H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
+H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
{
ssize_t base = (ssize_t)offset;
ssize_t idx, i;
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 08948b2..4ee070e 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -84,7 +84,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
*
*-------------------------------------------------------------------------
*/
@@ -144,11 +147,8 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t t
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* Set up VOL object */
- if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
- new_obj->connector = vol_obj->connector;
- new_obj->connector->nrefs++;
- new_obj->data = data;
+ if (NULL == (new_obj = H5VL_create_object(data, vol_obj->connector)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype")
/* Set the committed type object to the VOL connector pointer in the H5T_t struct */
dt->vol_obj = new_obj;
@@ -248,7 +248,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
*
*-------------------------------------------------------------------------
*/
@@ -295,11 +298,8 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* Setup VOL object */
- if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate top object structure")
- new_obj->connector = vol_obj->connector;
- new_obj->connector->nrefs++;
- new_obj->data = dt;
+ if (NULL == (new_obj = H5VL_create_object(dt, vol_obj->connector)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype")
/* Set the committed type object to the VOL connector pointer in the H5T_t struct */
type->vol_obj = new_obj;
@@ -479,7 +479,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
*
*-------------------------------------------------------------------------
*/
@@ -510,7 +513,7 @@ done:
* ADJUST to the link count.
*
* Return: Success: New link count
- * Failure: Negative
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -545,6 +548,9 @@ done:
*
* Failure: H5I_INVALID_HID
*
+ * Programmer: James Laird
+ * Thursday July 27, 2006
+ *
*-------------------------------------------------------------------------
*/
hid_t
@@ -608,6 +614,9 @@ done:
*
* Failure: H5I_INVALID_HID
*
+ * Programmer: Quincey Koziol
+ * Tuesday, November 28, 2006
+ *
*-------------------------------------------------------------------------
*/
hid_t
@@ -961,8 +970,11 @@ H5T_open(const H5G_loc_t *loc)
done:
if (ret_value == NULL) {
if (dt) {
- if (shared_fo == NULL) /* Need to free shared fo */
+ if (shared_fo == NULL) { /* Need to free shared fo */
+ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object")
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ } /* end if */
H5O_loc_free(&(dt->oloc));
H5G_name_free(&(dt->path));
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index c616001..e6a0e4e 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -83,8 +83,6 @@ static H5T_t *H5T__reopen_member_type(const H5T_t *dt, unsigned membno);
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
@@ -151,8 +149,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno)
* Programmer: Quincey Koziol
* Thursday, November 9, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5T_class_t
@@ -232,7 +228,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
@@ -344,8 +340,6 @@ H5T__get_member_size(const H5T_t *dt, unsigned membno)
* Programmer: Robb Matzke
* Monday, December 8, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -390,8 +384,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -572,7 +564,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);
@@ -597,8 +589,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, September 11, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static htri_t
@@ -634,8 +624,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 209615c..0c98633 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Module Info: Datatype conversions for the H5T interface.
+ * Module Info: Datatype conversions for the H5T interface.
*/
/****************/
@@ -24,15 +24,15 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tpkg.h" /* Datatypes */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
/****************/
/* Local Macros */
@@ -54,57 +54,57 @@
* source value has a magnitude that cannot be represented by the destination
* type.
*
- * Suffix Description
- * ------ -----------
- * sS: Signed integers to signed integers where the destination is
- * at least as wide as the source. This case cannot generate
- * overflows.
+ * Suffix Description
+ * ------ -----------
+ * sS: Signed integers to signed integers where the destination is
+ * at least as wide as the source. This case cannot generate
+ * overflows.
*
- * sU: Signed integers to unsigned integers where the destination is
- * at least as wide as the source. This case experiences
- * overflows when the source value is negative.
+ * sU: Signed integers to unsigned integers where the destination is
+ * at least as wide as the source. This case experiences
+ * overflows when the source value is negative.
*
- * uS: Unsigned integers to signed integers where the destination is
- * at least as wide as the source. This case can experience
- * overflows when the source and destination are the same size.
+ * uS: Unsigned integers to signed integers where the destination is
+ * at least as wide as the source. This case can experience
+ * overflows when the source and destination are the same size.
*
- * uU: Unsigned integers to unsigned integers where the destination
- * is at least as wide as the source. Overflows are not
- * possible in this case.
+ * uU: Unsigned integers to unsigned integers where the destination
+ * is at least as wide as the source. Overflows are not
+ * possible in this case.
*
- * Ss: Signed integers to signed integers where the source is at
- * least as large as the destination. Overflows can occur when
- * the destination is narrower than the source.
+ * Ss: Signed integers to signed integers where the source is at
+ * least as large as the destination. Overflows can occur when
+ * the destination is narrower than the source.
*
- * Su: Signed integers to unsigned integers where the source is at
- * least as large as the destination. Overflows occur when the
- * source value is negative and can also occur if the
- * destination is narrower than the source.
+ * Su: Signed integers to unsigned integers where the source is at
+ * least as large as the destination. Overflows occur when the
+ * source value is negative and can also occur if the
+ * destination is narrower than the source.
*
- * Us: Unsigned integers to signed integers where the source is at
- * least as large as the destination. Overflows can occur for
- * all sizes.
+ * Us: Unsigned integers to signed integers where the source is at
+ * least as large as the destination. Overflows can occur for
+ * all sizes.
*
- * Uu: Unsigned integers to unsigned integers where the source is at
- * least as large as the destination. Overflows can occur if the
- * destination is narrower than the source.
+ * Uu: Unsigned integers to unsigned integers where the source is at
+ * least as large as the destination. Overflows can occur if the
+ * destination is narrower than the source.
*
- * su: Conversion from signed integers to unsigned integers where
- * the source and destination are the same size. Overflow occurs
- * when the source value is negative.
+ * su: Conversion from signed integers to unsigned integers where
+ * the source and destination are the same size. Overflow occurs
+ * when the source value is negative.
*
- * us: Conversion from unsigned integers to signed integers where
- * the source and destination are the same size. Overflow
- * occurs when the source magnitude is too large for the
- * destination.
+ * us: Conversion from unsigned integers to signed integers where
+ * the source and destination are the same size. Overflow
+ * occurs when the source magnitude is too large for the
+ * destination.
*
- * fF: Floating-point values to floating-point values where the
- * destination is at least as wide as the source. This case
+ * fF: Floating-point values to floating-point values where the
+ * destination is at least as wide as the source. This case
* cannot generate overflows.
*
- * Ff: Floating-point values to floating-point values the source is at
- * least as large as the destination. Overflows can occur when
- * the destination is narrower than the source.
+ * Ff: Floating-point values to floating-point values the source is at
+ * least as large as the destination. Overflows can occur when
+ * the destination is narrower than the source.
*
* xF: Integers to float-point(float or double) values where the destination
* is at least as wide as the source. This case cannot generate
@@ -116,29 +116,29 @@
*
* The macros take a subset of these arguments in the order listed here:
*
- * CDATA: A pointer to the H5T_cdata_t structure that was passed to the
- * conversion function.
+ * CDATA: A pointer to the H5T_cdata_t structure that was passed to the
+ * conversion function.
*
- * STYPE: The hid_t value for the source datatype.
+ * STYPE: The hid_t value for the source datatype.
*
- * DTYPE: The hid_t value for the destination datatype.
+ * DTYPE: The hid_t value for the destination datatype.
*
- * BUF: A pointer to the conversion buffer.
+ * BUF: A pointer to the conversion buffer.
*
- * NELMTS: The number of values to be converted.
+ * NELMTS: The number of values to be converted.
*
- * ST: The C name for source datatype (e.g., int)
+ * ST: The C name for source datatype (e.g., int)
*
- * DT: The C name for the destination datatype (e.g., signed char)
+ * DT: The C name for the destination datatype (e.g., signed char)
*
- * D_MIN: The minimum possible destination value. For unsigned
- * destination types this should be zero. For signed
- * destination types it's a negative value with a magnitude that
- * is usually one greater than D_MAX. Source values which are
- * smaller than D_MIN generate overflows.
+ * D_MIN: The minimum possible destination value. For unsigned
+ * destination types this should be zero. For signed
+ * destination types it's a negative value with a magnitude that
+ * is usually one greater than D_MAX. Source values which are
+ * smaller than D_MIN generate overflows.
*
- * D_MAX: The maximum possible destination value. Source values which
- * are larger than D_MAX generate overflows.
+ * D_MAX: The maximum possible destination value. Source values which
+ * are larger than D_MAX generate overflows.
*
* The macros are implemented with a generic programming technique, similar
* to templates in C++. The macro which defines the "core" part of the
@@ -153,18 +153,18 @@
*
* The generic "core" macros are: (others are specific to particular conversion)
*
- * Suffix Description
- * ------ -----------
- * xX: Generic Conversion where the destination is at least as
+ * Suffix Description
+ * ------ -----------
+ * xX: Generic Conversion where the destination is at least as
* wide as the source. This case cannot generate overflows.
*
- * Xx: Generic signed conversion where the source is at least as large
+ * Xx: Generic signed conversion where the source is at least as large
* as the destination. Overflows can occur when the destination is
* narrower than the source.
*
- * Ux: Generic conversion for the `Us', `Uu' & `us' cases
- * Overflow occurs when the source magnitude is too large for the
- * destination.
+ * Ux: Generic conversion for the `Us', `Uu' & `us' cases
+ * Overflow occurs when the source magnitude is too large for the
+ * destination.
*
*/
#define H5T_CONV_xX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
@@ -710,17 +710,17 @@
FUNC_ENTER_PACKAGE \
\
{ \
- size_t elmtno; /*element number */ \
+ size_t elmtno; /*element number */ \
H5T_CONV_DECL_PREC(PREC) /*declare precision variables, or not */ \
- void * src_buf; /*'raw' source buffer */ \
- void * dst_buf; /*'raw' destination buffer */ \
- ST * src, *s; /*source buffer */ \
- DT * dst, *d; /*destination buffer */ \
- H5T_t * st, *dt; /*datatype descriptors */ \
- ST src_aligned; /*source aligned type */ \
- DT dst_aligned; /*destination aligned type */ \
- hbool_t s_mv, d_mv; /*move data to align it? */ \
- ssize_t s_stride, d_stride; /*src and dst strides */ \
+ void * src_buf; /*'raw' source buffer */ \
+ void * dst_buf; /*'raw' destination buffer */ \
+ ST * src, *s; /*source buffer */ \
+ DT * dst, *d; /*destination buffer */ \
+ H5T_t * st, *dt; /*datatype descriptors */ \
+ ST src_aligned; /*source aligned type */ \
+ DT dst_aligned; /*destination aligned type */ \
+ hbool_t s_mv, d_mv; /*move data to align it? */ \
+ ssize_t s_stride, d_stride; /*src and dst strides */ \
size_t safe; /*how many elements are safe to process in each pass */ \
H5T_conv_cb_t cb_struct; /*conversion callback structure */ \
\
@@ -859,9 +859,9 @@ done:
#define H5T_CONV_DECL_PREC(PREC) H5_GLUE(H5T_CONV_DECL_PREC_, PREC)
#define H5T_CONV_DECL_PREC_Y \
- size_t sprec; /*source precision */ \
- size_t dprec; /*destination precision */ \
- H5T_class_t tclass; /*datatype's class */
+ size_t sprec; /*source precision */ \
+ size_t dprec; /*destination precision */ \
+ H5T_class_t tclass; /*datatype's class */
#define H5T_CONV_DECL_PREC_N /*no precision variables */
@@ -983,14 +983,12 @@ done:
#define CI_PRINT_STATS(STYPE, DTYPE) \
{ \
if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->s_aligned) { \
- HDfprintf(H5DEBUG(T), " %Hu src elements aligned on %lu-byte boundaries\n", \
- ((H5T_conv_hw_t *)cdata->priv)->s_aligned, \
- (unsigned long)H5T_NATIVE_##STYPE##_ALIGN_g); \
+ HDfprintf(H5DEBUG(T), " %zu src elements aligned on %zu-byte boundaries\n", \
+ ((H5T_conv_hw_t *)cdata->priv)->s_aligned, H5T_NATIVE_##STYPE##_ALIGN_g); \
} \
if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->d_aligned) { \
- HDfprintf(H5DEBUG(T), " %Hu dst elements aligned on %lu-byte boundaries\n", \
- ((H5T_conv_hw_t *)cdata->priv)->d_aligned, \
- (unsigned long)H5T_NATIVE_##DTYPE##_ALIGN_g); \
+ HDfprintf(H5DEBUG(T), " %zu dst elements aligned on %zu-byte boundaries\n", \
+ ((H5T_conv_hw_t *)cdata->priv)->d_aligned, H5T_NATIVE_##DTYPE##_ALIGN_g); \
} \
}
@@ -1041,8 +1039,8 @@ done:
/* Conversion data for H5T__conv_struct() */
typedef struct H5T_conv_struct_t {
int * src2dst; /*mapping from src to dst member num */
- hid_t * src_memb_id; /*source member type ID's */
- hid_t * dst_memb_id; /*destination member type ID's */
+ hid_t * src_memb_id; /*source member type ID's */
+ hid_t * dst_memb_id; /*destination member type ID's */
H5T_path_t ** memb_path; /*conversion path for each member */
H5T_subset_info_t subset_info; /*info related to compound subsets */
unsigned src_nmembs; /*needed by free function */
@@ -1050,9 +1048,9 @@ typedef struct H5T_conv_struct_t {
/* Conversion data for H5T__conv_enum() */
typedef struct H5T_enum_struct_t {
- int base; /*lowest `in' value */
- unsigned length; /*num elements in arrays */
- int * src2dst; /*map from src to dst index */
+ int base; /*lowest `in' value */
+ unsigned length; /*num elements in arrays */
+ int * src2dst; /*map from src to dst index */
} H5T_enum_struct_t;
/* Conversion data for the hardware conversion functions */
@@ -1069,7 +1067,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);
/*********************/
/* Public Variables */
@@ -1097,15 +1095,15 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
H5FL_BLK_DEFINE_STATIC(ref_seq);
/*-------------------------------------------------------------------------
- * Function: H5T__conv_noop
+ * Function: H5T__conv_noop
*
- * Purpose: The no-op conversion. The library knows about this
- * conversion without it being registered.
+ * Purpose: The no-op conversion. The library knows about this
+ * conversion without it being registered.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Wednesday, January 14, 1998
+ * Programmer: Robb Matzke
+ * Wednesday, January 14, 1998
*
*-------------------------------------------------------------------------
*/
@@ -1139,18 +1137,18 @@ done:
} /* end H5T__conv_noop() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_order_opt
+ * Function: H5T__conv_order_opt
*
- * Purpose: Convert one type to another when byte order is the only
- * difference. This is the optimized version of H5T__conv_order()
+ * Purpose: Convert one type to another when byte order is the only
+ * difference. This is the optimized version of H5T__conv_order()
* for a handful of different sizes.
*
- * Note: This is a soft conversion function.
+ * Note: This is a soft conversion function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, January 25, 2002
+ * Programmer: Robb Matzke
+ * Friday, January 25, 2002
*
*-------------------------------------------------------------------------
*/
@@ -1549,17 +1547,17 @@ done:
} /* end H5T__conv_order_opt() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_order
+ * Function: H5T__conv_order
*
- * Purpose: Convert one type to another when byte order is the only
- * difference.
+ * Purpose: Convert one type to another when byte order is the only
+ * difference.
*
- * Note: This is a soft conversion function.
+ * Note: This is a soft conversion function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, January 13, 1998
+ * Programmer: Robb Matzke
+ * Tuesday, January 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -1648,14 +1646,14 @@ done:
} /* end H5T__conv_order() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_b_b
+ * Function: H5T__conv_b_b
*
- * Purpose: Convert from one bitfield to any other bitfield.
+ * Purpose: Convert from one bitfield to any other bitfield.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, May 20, 1999
+ * Programmer: Robb Matzke
+ * Thursday, May 20, 1999
*
*-------------------------------------------------------------------------
*/
@@ -1664,14 +1662,14 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t H5_ATTR_UNUSED bkg_stride, void *_buf, void H5_ATTR_UNUSED *background)
{
uint8_t * buf = (uint8_t *)_buf;
- H5T_t * src = NULL, *dst = NULL; /*source and dest datatypes */
- ssize_t direction; /*direction of traversal */
- size_t elmtno; /*element number */
- size_t olap; /*num overlapping elements */
+ H5T_t * src = NULL, *dst = NULL; /*source and dest datatypes */
+ ssize_t direction; /*direction of traversal */
+ size_t elmtno; /*element number */
+ size_t olap; /*num overlapping elements */
size_t half_size; /*1/2 of total size for swapping*/
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t dbuf[256]; /*temp destination buffer */
- size_t msb_pad_offset; /*offset for dest MSB padding */
+ uint8_t dbuf[256] = {0}; /*temp destination buffer */
+ size_t msb_pad_offset; /*offset for dest MSB padding */
size_t i;
uint8_t * src_rev = NULL; /*order-reversed source buffer */
H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */
@@ -1789,8 +1787,8 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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 */
@@ -1895,26 +1893,26 @@ done:
} /* end H5T__conv_b_b() */
/*-------------------------------------------------------------------------
- * Function: H5T_conv_struct_free
+ * Function: H5T__conv_struct_free
*
- * Purpose: Free the private data structure used by the compound
+ * Purpose: Free the private data structure used by the compound
* conversion functions.
*
- * Return: The result of H5MM_xfree(priv) (NULL)
+ * Return: The result of H5MM_xfree(priv) (NULL)
*
- * Programmer: Neil Fortner
- * Wednesday, October 1, 2008
+ * Programmer: Neil Fortner
+ * Wednesday, October 1, 2008
*
*-------------------------------------------------------------------------
*/
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) {
@@ -1932,25 +1930,25 @@ 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
- * already initialized then the member conversion functions
- * are recalculated.
+ * Purpose: Initialize the `priv' field of `cdata' with conversion
+ * information that is relatively constant. If `priv' is
+ * already initialized then the member conversion functions
+ * are recalculated.
*
- * Priv fields are indexed by source member number or
- * destination member number depending on whether the field
- * contains information about the source datatype or the
- * destination datatype (fields that contains the same
- * information for both source and destination are indexed by
- * source member number). The src2dst[] priv array maps source
- * member numbers to destination member numbers, but if the
- * source member doesn't have a corresponding destination member
- * then the src2dst[i]=-1.
+ * Priv fields are indexed by source member number or
+ * destination member number depending on whether the field
+ * contains information about the source datatype or the
+ * destination datatype (fields that contains the same
+ * information for both source and destination are indexed by
+ * source member number). The src2dst[] priv array maps source
+ * member numbers to destination member numbers, but if the
+ * source member doesn't have a corresponding destination member
+ * then the src2dst[i]=-1.
*
* Special optimization case when the source and destination
* members are a subset of each other, and the order is the same,
@@ -1973,15 +1971,15 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv)
* The optimization is simply moving data to the appropriate
* places in the buffer.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Monday, January 26, 1998
+ * Programmer: Robb Matzke
+ * Monday, January 26, 1998
*
*-------------------------------------------------------------------------
*/
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;
@@ -1989,7 +1987,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;
@@ -2012,7 +2010,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
priv->subset_info.copy_size = 0;
/*
- * Insure that members are sorted.
+ * Ensure that members are sorted.
*/
H5T__sort_value(src, NULL);
H5T__sort_value(dst, NULL);
@@ -2071,7 +2069,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
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 */
@@ -2132,10 +2130,10 @@ 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() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_struct_subset
+ * Function: H5T__conv_struct_subset
*
* Purpose: A quick way to return a field in a struct private in this
* file. The flag SMEMBS_SUBSET indicates whether the source
@@ -2153,8 +2151,8 @@ done:
* Return: A pointer to the subset info struct in p. Points directly
* into the structure.
*
- * Programmer: Raymond Lu
- * 8 June 2007
+ * Programmer: Raymond Lu
+ * 8 June 2007
*
*-------------------------------------------------------------------------
*/
@@ -2174,28 +2172,28 @@ H5T__conv_struct_subset(const H5T_cdata_t *cdata)
} /* end H5T__conv_struct_subset() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_struct
+ * Function: H5T__conv_struct
*
- * Purpose: Converts between compound datatypes. This is a soft
- * conversion function. The algorithm is basically:
+ * Purpose: Converts between compound datatypes. This is a soft
+ * conversion function. The algorithm is basically:
*
- * For each element do
- * For I=1..NELMTS do
- * If sizeof destination type <= sizeof source type then
- * Convert member to destination type;
- * Move member as far left as possible;
+ * For each element do
+ * For I=1..NELMTS do
+ * If sizeof destination type <= sizeof source type then
+ * Convert member to destination type;
+ * Move member as far left as possible;
*
- * For I=NELMTS..1 do
- * If not destination type then
- * Convert member to destination type;
- * Move member to correct position in BKG
+ * For I=NELMTS..1 do
+ * If not destination type then
+ * Convert member to destination type;
+ * Move member to correct position in BKG
*
- * Copy BKG to BUF
+ * Copy BKG to BUF
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, January 22, 1998
+ * Programmer: Robb Matzke
+ * Thursday, January 22, 1998
*
*-------------------------------------------------------------------------
*/
@@ -2203,20 +2201,20 @@ herr_t
H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *_bkg)
{
- uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
- uint8_t * bkg = (uint8_t *)_bkg; /*background pointer arithmetic */
+ uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
+ uint8_t * bkg = (uint8_t *)_bkg; /*background pointer arithmetic */
uint8_t * xbuf = buf, *xbkg = bkg; /*temp pointers into buf and bkg*/
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
- int * src2dst = NULL; /*maps src member to dst member */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
+ int * src2dst = NULL; /*maps src member to dst member */
H5T_cmemb_t * src_memb = NULL; /*source struct member descript.*/
- H5T_cmemb_t * dst_memb = NULL; /*destination struct memb desc. */
- size_t offset; /*byte offset wrt struct */
- ssize_t src_delta; /*source stride */
- ssize_t bkg_delta; /*background stride */
+ H5T_cmemb_t * dst_memb = NULL; /*destination struct memb desc. */
+ size_t offset; /*byte offset wrt struct */
+ ssize_t src_delta; /*source stride */
+ ssize_t bkg_delta; /*background stride */
size_t elmtno;
- unsigned u; /*counters */
- int i; /*counters */
+ unsigned u; /*counters */
+ int i; /*counters */
H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv);
herr_t ret_value = SUCCEED; /* Return value */
@@ -2237,7 +2235,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;
@@ -2245,7 +2243,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:
@@ -2257,7 +2255,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")
/*
@@ -2384,27 +2382,27 @@ done:
} /* end H5T__conv_struct() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_struct_opt
+ * Function: H5T__conv_struct_opt
*
- * Purpose: Converts between compound datatypes in a manner more
- * efficient than the general-purpose H5T__conv_struct()
- * function. This function isn't applicable if the destination
- * is larger than the source type. This is a soft conversion
- * function. The algorithm is basically:
+ * Purpose: Converts between compound datatypes in a manner more
+ * efficient than the general-purpose H5T__conv_struct()
+ * function. This function isn't applicable if the destination
+ * is larger than the source type. This is a soft conversion
+ * function. The algorithm is basically:
*
- * For each member of the struct
- * If sizeof destination type <= sizeof source type then
- * Convert member to destination type for all elements
- * Move memb to BKG buffer for all elements
- * Else
- * Move member as far left as possible for all elements
+ * For each member of the struct
+ * If sizeof destination type <= sizeof source type then
+ * Convert member to destination type for all elements
+ * Move memb to BKG buffer for all elements
+ * Else
+ * Move member as far left as possible for all elements
*
- * For each member of the struct (in reverse order)
- * If not destination type then
- * Convert member to destination type for all elements
- * Move member to correct position in BKG for all elements
+ * For each member of the struct (in reverse order)
+ * If not destination type then
+ * Convert member to destination type for all elements
+ * Move member to correct position in BKG for all elements
*
- * Copy BKG to BUF for all elements
+ * Copy BKG to BUF for all elements
*
* Special case when the source and destination members
* are a subset of each other, and the order is the same, and no
@@ -2419,10 +2417,10 @@ done:
* The optimization is simply moving data to the appropriate
* places in the buffer.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, January 22, 1998
+ * Programmer: Robb Matzke
+ * Thursday, January 22, 1998
*
*-------------------------------------------------------------------------
*/
@@ -2430,22 +2428,22 @@ herr_t
H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *_bkg)
{
- uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
- uint8_t * bkg = (uint8_t *)_bkg; /*background pointer arithmetic */
- uint8_t * xbuf = NULL; /*temporary pointer into `buf' */
- uint8_t * xbkg = NULL; /*temporary pointer into `bkg' */
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
- int * src2dst = NULL; /*maps src member to dst member */
+ uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
+ uint8_t * bkg = (uint8_t *)_bkg; /*background pointer arithmetic */
+ uint8_t * xbuf = NULL; /*temporary pointer into `buf' */
+ uint8_t * xbkg = NULL; /*temporary pointer into `bkg' */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
+ int * src2dst = NULL; /*maps src member to dst member */
H5T_cmemb_t * src_memb = NULL; /*source struct member descript.*/
- H5T_cmemb_t * dst_memb = NULL; /*destination struct memb desc. */
- size_t offset; /*byte offset wrt struct */
- size_t elmtno; /*element counter */
+ H5T_cmemb_t * dst_memb = NULL; /*destination struct memb desc. */
+ size_t offset; /*byte offset wrt struct */
+ size_t elmtno; /*element counter */
size_t copy_size; /*size of element for copying */
- H5T_conv_struct_t *priv = NULL; /*private data */
+ H5T_conv_struct_t *priv = NULL; /*private data */
hbool_t no_stride = FALSE; /*flag to indicate no stride */
- unsigned u; /*counters */
- int i; /*counters */
+ unsigned u; /*counters */
+ int i; /*counters */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2466,7 +2464,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
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;
@@ -2499,7 +2497,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
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 */
@@ -2512,7 +2510,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
/*
* 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:
@@ -2523,7 +2521,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
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);
@@ -2658,31 +2656,31 @@ done:
} /* end H5T__conv_struct_opt() */
/*-------------------------------------------------------------------------
- * Function: H5T_conv_enum_init
+ * Function: H5T__conv_enum_init
*
- * Purpose: Initialize information for H5T__conv_enum().
+ * Purpose: Initialize information for H5T__conv_enum().
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, January 4, 1999
*
*-------------------------------------------------------------------------
*/
static herr_t
-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 */
- int domain[2] = {0, 0}; /*min and max source values */
- int * map = NULL; /*map from src value to dst idx */
- unsigned length; /*nelmts in map array */
- unsigned i, j; /*counters */
+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 */
+ int domain[2] = {0, 0}; /*min and max source values */
+ int * map = NULL; /*map from src value to dst idx */
+ unsigned length; /*nelmts in map array */
+ 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)))))
@@ -2701,7 +2699,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for (i = 0, j = 0; i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) {
while (j < dst->shared->u.enumer.nmembs &&
- HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]))
+ HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0)
j++;
if (j >= dst->shared->u.enumer.nmembs)
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
@@ -2714,12 +2712,12 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* value converted. However, if all of the following constraints are met
* then we can build a perfect hash table and use an O(1) lookup method.
*
- * A: The source datatype size matches one of our native datatype
- * sizes.
+ * A: The source datatype size matches one of our native datatype
+ * sizes.
*
- * B: After casting the source value bit pattern to a native type
- * the size of the range of values is less than 20% larger than
- * the number of values.
+ * B: After casting the source value bit pattern to a native type
+ * the size of the range of values is less than 20% larger than
+ * the number of values.
*
* If this special case is met then we use the source bit pattern cast as
* a native integer type as an index into the `val2dst'. The values of
@@ -2801,15 +2799,15 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_enum
+ * Function: H5T__conv_enum
*
- * Purpose: Converts one type of enumerated data to another.
+ * Purpose: Converts one type of enumerated data to another.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, January 4, 1999
*-------------------------------------------------------------------------
*/
@@ -2817,15 +2815,15 @@ herr_t
H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *_buf, void H5_ATTR_UNUSED *bkg)
{
- uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
- H5T_t * src = NULL, *dst = NULL; /*src and dst datatypes */
- uint8_t * s = NULL, *d = NULL; /*src and dst BUF pointers */
- ssize_t src_delta, dst_delta; /*conversion strides */
- int n; /*src value cast as native int */
+ uint8_t * buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
+ H5T_t * src = NULL, *dst = NULL; /*src and dst datatypes */
+ uint8_t * s = NULL, *d = NULL; /*src and dst BUF pointers */
+ ssize_t src_delta, dst_delta; /*conversion strides */
+ int n; /*src value cast as native int */
H5T_enum_struct_t *priv = (H5T_enum_struct_t *)(cdata->priv);
H5T_conv_cb_t cb_struct; /*conversion callback structure */
H5T_conv_ret_t except_ret; /*return of callback function */
- size_t i; /*counters */
+ size_t i; /*counters */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2845,7 +2843,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
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;
@@ -2873,7 +2871,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
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);
@@ -2912,7 +2910,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
/* (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)
@@ -2995,18 +2993,18 @@ done:
} /* end H5T__conv_enum() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_enum_numeric
+ * Function: H5T__conv_enum_numeric
*
- * Purpose: Converts enumerated data to a numeric type (integer or
+ * Purpose: Converts enumerated data to a numeric type (integer or
* floating-point number). This function is registered into
* the conversion table twice in H5T_init_interface in H5T.c.
* Once for enum-integer conversion. Once for enum-float conversion.
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 12 October 2012
*-------------------------------------------------------------------------
*/
@@ -3015,7 +3013,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
size_t H5_ATTR_UNUSED buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *_buf,
void H5_ATTR_UNUSED *bkg)
{
- H5T_t * src, *dst; /*src and dst datatypes */
+ H5T_t * src, *dst; /*src and dst datatypes */
H5T_t * src_parent; /*parent type for src */
hid_t src_parent_id = -1; /*ID for parent of the source */
H5T_path_t *tpath; /* Conversion information */
@@ -3078,26 +3076,26 @@ done:
} /* end H5T__conv_enum_numeric() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_vlen
+ * Function: H5T__conv_vlen
*
- * Purpose: Converts between VL datatypes in memory and on disk.
- * This is a soft conversion function. The algorithm is
- * basically:
+ * Purpose: Converts between VL datatypes in memory and on disk.
+ * This is a soft conversion function. The algorithm is
+ * basically:
*
- * For every VL struct in the main buffer:
- * 1. Allocate space for temporary dst VL data (reuse buffer
- * if possible)
+ * For every VL struct in the main buffer:
+ * 1. Allocate space for temporary dst VL data (reuse buffer
+ * if possible)
* 2. Copy VL data from src buffer into dst buffer
* 3. Convert VL data into dst representation
* 4. Allocate buffer in dst heap
- * 5. Free heap objects storing old data
+ * 5. Free heap objects storing old data
* 6. Write dst VL data into dst heap
* 7. Store (heap ID or pointer) and length in main dst buffer
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Wednesday, May 26, 1999
+ * Programmer: Quincey Koziol
+ * Wednesday, May 26, 1999
*
*-------------------------------------------------------------------------
*/
@@ -3106,27 +3104,27 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
size_t bkg_stride, void *buf, void *bkg)
{
H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
- H5T_path_t * tpath = NULL; /* Type conversion path */
+ H5T_path_t * tpath = NULL; /* Type conversion path */
hbool_t noop_conv = FALSE; /* Flag to indicate a noop conversion */
hbool_t write_to_file = FALSE; /* Flag to indicate writing to file */
htri_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
size_t bg_seq_len = 0; /* The number of elements in the background sequence */
- hid_t tsrc_id = -1, tdst_id = -1; /*temporary type atoms */
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
- uint8_t * s = NULL; /*source buffer */
- uint8_t * d = NULL; /*destination buffer */
- uint8_t * b = NULL; /*background buffer */
- ssize_t s_stride, d_stride; /*src and dst strides */
- ssize_t b_stride; /*bkg stride */
+ hid_t tsrc_id = -1, tdst_id = -1; /*temporary type atoms */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
+ uint8_t * s = NULL; /*source buffer */
+ uint8_t * d = NULL; /*destination buffer */
+ uint8_t * b = NULL; /*background buffer */
+ ssize_t s_stride, d_stride; /*src and dst strides */
+ ssize_t b_stride; /*bkg stride */
size_t safe; /*how many elements are safe to process in each pass */
size_t src_base_size, dst_base_size; /*source & destination base size*/
- void * conv_buf = NULL; /*temporary conversion buffer */
+ void * conv_buf = NULL; /*temporary conversion buffer */
size_t conv_buf_size = 0; /*size of conversion buffer in bytes */
- void * tmp_buf = NULL; /*temporary background buffer */
- size_t tmp_buf_size = 0; /*size of temporary bkg buffer */
+ void * tmp_buf = NULL; /*temporary background buffer */
+ size_t tmp_buf_size = 0; /*size of temporary bkg buffer */
hbool_t nested = FALSE; /*flag of nested VL case */
- size_t elmtno; /*element number counter */
+ size_t elmtno; /*element number counter */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3201,10 +3199,24 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
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 */
@@ -3311,8 +3323,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
* necessary. If the SEQ_LEN is 0, allocate a minimal size buffer.
*/
if (!seq_len && !conv_buf) {
- conv_buf_size =
- ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
+ conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE;
if (NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for type conversion")
@@ -3448,15 +3459,15 @@ done:
} /* end H5T__conv_vlen() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_array
+ * Function: H5T__conv_array
*
- * Purpose: Converts between array datatypes in memory and on disk.
- * This is a soft conversion function.
+ * Purpose: Converts between array datatypes in memory and on disk.
+ * This is a soft conversion function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Monday, November 6, 2000
+ * Programmer: Quincey Koziol
+ * Monday, November 6, 2000
*
*-------------------------------------------------------------------------
*/
@@ -3464,16 +3475,16 @@ herr_t
H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void H5_ATTR_UNUSED *_bkg)
{
- H5T_path_t *tpath; /* Type conversion path */
- hid_t tsrc_id = -1, tdst_id = -1; /*temporary type atoms */
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
+ H5T_path_t *tpath; /* Type conversion path */
+ hid_t tsrc_id = -1, tdst_id = -1; /*temporary type atoms */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
uint8_t * sp, *dp; /*source and dest traversal ptrs */
- ssize_t src_delta, dst_delta; /*source & destination stride */
- int direction; /*direction of traversal */
- size_t elmtno; /*element number counter */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
+ int direction; /*direction of traversal */
+ size_t elmtno; /*element number counter */
unsigned u; /* local index variable */
- void * bkg_buf = NULL; /*temporary background buffer */
+ void * bkg_buf = NULL; /*temporary background buffer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3749,7 +3760,7 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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) {
@@ -3807,16 +3818,16 @@ done:
} /* end H5T__conv_ref() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_i_i
+ * Function: H5T__conv_i_i
*
- * Purpose: Convert one integer type to another. This is the catch-all
- * function for integer conversions and is probably not
- * particularly fast.
+ * Purpose: Convert one integer type to another. This is the catch-all
+ * function for integer conversions and is probably not
+ * particularly fast.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Wednesday, June 10, 1998
+ * Programmer: Robb Matzke
+ * Wednesday, June 10, 1998
*
*-------------------------------------------------------------------------
*/
@@ -3824,18 +3835,18 @@ herr_t
H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
- ssize_t src_delta, dst_delta; /*source & destination stride */
- int direction; /*direction of traversal */
- size_t elmtno; /*element number */
- size_t half_size; /*half the type size */
- size_t olap; /*num overlapping elements */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
+ int direction; /*direction of traversal */
+ size_t elmtno; /*element number */
+ size_t half_size; /*half the type size */
+ size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
size_t first;
- ssize_t sfirst; /*a signed version of `first' */
+ ssize_t sfirst; /*a signed version of `first' */
size_t i; /*Local index variables */
H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */
H5T_conv_ret_t except_ret; /*return of callback function */
@@ -3985,8 +3996,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4018,8 +4029,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4043,8 +4054,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4073,8 +4084,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4118,8 +4129,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4158,8 +4169,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -4245,16 +4256,16 @@ done:
} /* end H5T__conv_i_i() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_f_f
+ * Function: H5T__conv_f_f
*
- * Purpose: Convert one floating point type to another. This is a catch
- * all for floating point conversions and is probably not
- * particularly fast!
+ * Purpose: Convert one floating point type to another. This is a catch
+ * all for floating point conversions and is probably not
+ * particularly fast!
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, June 23, 1998
+ * Programmer: Robb Matzke
+ * Tuesday, June 23, 1998
*
*-------------------------------------------------------------------------
*/
@@ -4263,32 +4274,32 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
/* Traversal-related variables */
- H5T_t * src_p; /*source datatype */
- H5T_t * dst_p; /*destination datatype */
- H5T_atomic_t src; /*atomic source info */
- H5T_atomic_t dst; /*atomic destination info */
- ssize_t src_delta, dst_delta; /*source & destination stride */
- int direction; /*forward or backward traversal */
- size_t elmtno; /*element number */
- size_t half_size; /*half the type size */
+ H5T_t * src_p; /*source datatype */
+ H5T_t * dst_p; /*destination datatype */
+ H5T_atomic_t src; /*atomic source info */
+ H5T_atomic_t dst; /*atomic destination info */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
+ int direction; /*forward or backward traversal */
+ size_t elmtno; /*element number */
+ size_t half_size; /*half the type size */
size_t tsize; /*type size for swapping bytes */
- size_t olap; /*num overlapping elements */
- ssize_t bitno = 0; /*bit number */
+ size_t olap; /*num overlapping elements */
+ ssize_t bitno = 0; /*bit number */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
- int64_t expo; /*exponent */
- hssize_t expo_max; /*maximum possible dst exponent */
+ int64_t expo; /*exponent */
+ hssize_t expo_max; /*maximum possible dst exponent */
size_t msize = 0; /*useful size of mantissa in src*/
- size_t mpos; /*offset to useful mant is src */
+ size_t mpos; /*offset to useful mant is src */
uint64_t sign; /*source sign bit value */
size_t mrsh; /*amount to right shift mantissa*/
- hbool_t carry = FALSE; /*carry after rounding mantissa */
- size_t i; /*miscellaneous counters */
- size_t implied; /*destination implied bits */
+ hbool_t carry = FALSE; /*carry after rounding mantissa */
+ size_t i; /*miscellaneous counters */
+ size_t implied; /*destination implied bits */
hbool_t denormalized = FALSE; /*is either source or destination denormalized?*/
H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */
H5T_conv_ret_t except_ret; /*return of callback function */
@@ -4448,7 +4459,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* +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);
@@ -4488,7 +4500,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* +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);
@@ -4526,7 +4538,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* 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);
}
@@ -4551,7 +4563,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/*
* Get the exponent as an unsigned quantity from the section of
- * the source bit field where it's located. Don't worry about
+ * the source bit field where it's located. Don't worry about
* the exponent bias yet.
*/
expo = (int64_t)H5T__bit_get_d(s, src.u.f.epos, src.u.f.esize);
@@ -4639,7 +4651,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
else if (expo >= expo_max) {
/*
* The exponent is too large to fit in the available region
- * or it results in the maximum possible value. Use positive
+ * or it results in the maximum possible value. Use positive
* or negative infinity instead unless the application
* specifies something else. Before calling the overflow
* handler make sure the source buffer we hand it is in the
@@ -4647,7 +4659,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
*/
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);
}
@@ -4737,7 +4749,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
*/
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);
}
@@ -4831,14 +4844,14 @@ done:
} /* end H5T__conv_f_f() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_s_s
+ * Function: H5T__conv_s_s
*
- * Purpose: Convert one fixed-length string type to another.
+ * Purpose: Convert one fixed-length string type to another.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, August 7, 1998
+ * Programmer: Robb Matzke
+ * Friday, August 7, 1998
*
*-------------------------------------------------------------------------
*/
@@ -4846,15 +4859,15 @@ herr_t
H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5T_t * src = NULL; /*source datatype */
- H5T_t * dst = NULL; /*destination datatype */
- ssize_t src_delta, dst_delta; /*source & destination stride */
- int direction; /*direction of traversal */
- size_t elmtno; /*element number */
- size_t olap; /*num overlapping elements */
- size_t nchars = 0; /*number of characters copied */
+ H5T_t * src = NULL; /*source datatype */
+ H5T_t * dst = NULL; /*destination datatype */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
+ int direction; /*direction of traversal */
+ size_t elmtno; /*element number */
+ size_t olap; /*num overlapping elements */
+ size_t nchars = 0; /*number of characters copied */
uint8_t *s, *sp, *d, *dp; /*src and dst traversal pointers*/
- uint8_t *dbuf = NULL; /*temp buf for overlap convers. */
+ uint8_t *dbuf = NULL; /*temp buf for overlap convers. */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4934,7 +4947,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size);
/* Allocate the overlap buffer */
- if (NULL == (dbuf = (uint8_t *)H5MM_malloc(dst->shared->size)))
+ if (NULL == (dbuf = (uint8_t *)H5MM_calloc(dst->shared->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion")
/* The conversion loop. */
@@ -5074,16 +5087,16 @@ done:
} /* end H5T__conv_s_s() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_uchar
+ * Function: H5T__conv_schar_uchar
*
- * Purpose: Converts `signed char' to `unsigned char'
+ * Purpose: Converts `signed char' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5095,16 +5108,16 @@ H5T__conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_schar
+ * Function: H5T__conv_uchar_schar
*
- * Purpose: Converts `unsigned char' to `signed char'
+ * Purpose: Converts `unsigned char' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5116,16 +5129,16 @@ H5T__conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_short
+ * Function: H5T__conv_schar_short
*
- * Purpose: Converts `signed char' to `short'
+ * Purpose: Converts `signed char' to `short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5137,16 +5150,16 @@ H5T__conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_ushort
+ * Function: H5T__conv_schar_ushort
*
- * Purpose: Converts `signed char' to `unsigned short'
+ * Purpose: Converts `signed char' to `unsigned short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5158,16 +5171,16 @@ H5T__conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_short
+ * Function: H5T__conv_uchar_short
*
- * Purpose: Converts `unsigned char' to `short'
+ * Purpose: Converts `unsigned char' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5179,16 +5192,16 @@ H5T__conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_ushort
+ * Function: H5T__conv_uchar_ushort
*
- * Purpose: Converts `unsigned char' to `unsigned short'
+ * Purpose: Converts `unsigned char' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5200,16 +5213,16 @@ H5T__conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_int
+ * Function: H5T__conv_schar_int
*
- * Purpose: Converts `signed char' to `int'
+ * Purpose: Converts `signed char' to `int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5221,16 +5234,16 @@ H5T__conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_uint
+ * Function: H5T__conv_schar_uint
*
- * Purpose: Converts `signed char' to `unsigned int'
+ * Purpose: Converts `signed char' to `unsigned int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5242,16 +5255,16 @@ H5T__conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_int
+ * Function: H5T__conv_uchar_int
*
- * Purpose: Converts `unsigned char' to `int'
+ * Purpose: Converts `unsigned char' to `int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5263,16 +5276,16 @@ H5T__conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_uint
+ * Function: H5T__conv_uchar_uint
*
- * Purpose: Converts `unsigned char' to `unsigned int'
+ * Purpose: Converts `unsigned char' to `unsigned int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5284,16 +5297,16 @@ H5T__conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_long
+ * Function: H5T__conv_schar_long
*
- * Purpose: Converts `signed char' to `long'
+ * Purpose: Converts `signed char' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5305,16 +5318,16 @@ H5T__conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_ulong
+ * Function: H5T__conv_schar_ulong
*
- * Purpose: Converts `signed char' to `unsigned long'
+ * Purpose: Converts `signed char' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5326,16 +5339,16 @@ H5T__conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_long
+ * Function: H5T__conv_uchar_long
*
- * Purpose: Converts `unsigned char' to `long'
+ * Purpose: Converts `unsigned char' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5347,16 +5360,16 @@ H5T__conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_ulong
+ * Function: H5T__conv_uchar_ulong
*
- * Purpose: Converts `unsigned char' to `unsigned long'
+ * Purpose: Converts `unsigned char' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5368,16 +5381,16 @@ H5T__conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_llong
+ * Function: H5T__conv_schar_llong
*
- * Purpose: Converts `signed char' to `long long'
+ * Purpose: Converts `signed char' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5389,16 +5402,16 @@ H5T__conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_ullong
+ * Function: H5T__conv_schar_ullong
*
- * Purpose: Converts `signed char' to `unsigned long long'
+ * Purpose: Converts `signed char' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5410,16 +5423,16 @@ H5T__conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_llong
+ * Function: H5T__conv_uchar_llong
*
- * Purpose: Converts `unsigned char' to `long long'
+ * Purpose: Converts `unsigned char' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5431,16 +5444,16 @@ H5T__conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_ullong
+ * Function: H5T__conv_uchar_ullong
*
- * Purpose: Converts `unsigned char' to `unsigned long long'
+ * Purpose: Converts `unsigned char' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5452,16 +5465,16 @@ H5T__conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_schar
+ * Function: H5T__conv_short_schar
*
- * Purpose: Converts `short' to `signed char'
+ * Purpose: Converts `short' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5473,16 +5486,16 @@ H5T__conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_uchar
+ * Function: H5T__conv_short_uchar
*
- * Purpose: Converts `short' to `unsigned char'
+ * Purpose: Converts `short' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5494,16 +5507,16 @@ H5T__conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_schar
+ * Function: H5T__conv_ushort_schar
*
- * Purpose: Converts `unsigned short' to `signed char'
+ * Purpose: Converts `unsigned short' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5515,16 +5528,16 @@ H5T__conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_uchar
+ * Function: H5T__conv_ushort_uchar
*
- * Purpose: Converts `unsigned short' to `unsigned char'
+ * Purpose: Converts `unsigned short' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5536,16 +5549,16 @@ H5T__conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_ushort
+ * Function: H5T__conv_short_ushort
*
- * Purpose: Converts `short' to `unsigned short'
+ * Purpose: Converts `short' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5557,16 +5570,16 @@ H5T__conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_short
+ * Function: H5T__conv_ushort_short
*
- * Purpose: Converts `unsigned short' to `short'
+ * Purpose: Converts `unsigned short' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5578,16 +5591,16 @@ H5T__conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_int
+ * Function: H5T__conv_short_int
*
- * Purpose: Converts `short' to `int'
+ * Purpose: Converts `short' to `int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5599,16 +5612,16 @@ H5T__conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_uint
+ * Function: H5T__conv_short_uint
*
- * Purpose: Converts `short' to `unsigned int'
+ * Purpose: Converts `short' to `unsigned int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5620,16 +5633,16 @@ H5T__conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_int
+ * Function: H5T__conv_ushort_int
*
- * Purpose: Converts `unsigned short' to `int'
+ * Purpose: Converts `unsigned short' to `int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5641,16 +5654,16 @@ H5T__conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_uint
+ * Function: H5T__conv_ushort_uint
*
- * Purpose: Converts `unsigned short' to `unsigned int'
+ * Purpose: Converts `unsigned short' to `unsigned int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5662,16 +5675,16 @@ H5T__conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_long
+ * Function: H5T__conv_short_long
*
- * Purpose: Converts `short' to `long'
+ * Purpose: Converts `short' to `long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5683,16 +5696,16 @@ H5T__conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_ulong
+ * Function: H5T__conv_short_ulong
*
- * Purpose: Converts `short' to `unsigned long'
+ * Purpose: Converts `short' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5704,16 +5717,16 @@ H5T__conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_long
+ * Function: H5T__conv_ushort_long
*
- * Purpose: Converts `unsigned short' to `long'
+ * Purpose: Converts `unsigned short' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5725,16 +5738,16 @@ H5T__conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_ulong
+ * Function: H5T__conv_ushort_ulong
*
- * Purpose: Converts `unsigned short' to `unsigned long'
+ * Purpose: Converts `unsigned short' to `unsigned long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5746,16 +5759,16 @@ H5T__conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_llong
+ * Function: H5T__conv_short_llong
*
- * Purpose: Converts `short' to `long long'
+ * Purpose: Converts `short' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5767,16 +5780,16 @@ H5T__conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_ullong
+ * Function: H5T__conv_short_ullong
*
- * Purpose: Converts `short' to `unsigned long long'
+ * Purpose: Converts `short' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5788,16 +5801,16 @@ H5T__conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_llong
+ * Function: H5T__conv_ushort_llong
*
- * Purpose: Converts `unsigned short' to `long long'
+ * Purpose: Converts `unsigned short' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5809,16 +5822,16 @@ H5T__conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_ullong
+ * Function: H5T__conv_ushort_ullong
*
- * Purpose: Converts `unsigned short' to `unsigned long long'
+ * Purpose: Converts `unsigned short' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5830,16 +5843,16 @@ H5T__conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_schar
+ * Function: H5T__conv_int_schar
*
- * Purpose: Converts `int' to `signed char'
+ * Purpose: Converts `int' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5851,16 +5864,16 @@ H5T__conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_uchar
+ * Function: H5T__conv_int_uchar
*
- * Purpose: Converts `int' to `unsigned char'
+ * Purpose: Converts `int' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5872,16 +5885,16 @@ H5T__conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_schar
+ * Function: H5T__conv_uint_schar
*
- * Purpose: Converts `unsigned int' to `signed char'
+ * Purpose: Converts `unsigned int' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5893,16 +5906,16 @@ H5T__conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_uchar
+ * Function: H5T__conv_uint_uchar
*
- * Purpose: Converts `unsigned int' to `unsigned char'
+ * Purpose: Converts `unsigned int' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5914,16 +5927,16 @@ H5T__conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_short
+ * Function: H5T__conv_int_short
*
- * Purpose: Converts `int' to `short'
+ * Purpose: Converts `int' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5935,16 +5948,16 @@ H5T__conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_ushort
+ * Function: H5T__conv_int_ushort
*
- * Purpose: Converts `int' to `unsigned short'
+ * Purpose: Converts `int' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5956,16 +5969,16 @@ H5T__conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_short
+ * Function: H5T__conv_uint_short
*
- * Purpose: Converts `unsigned int' to `short'
+ * Purpose: Converts `unsigned int' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5977,16 +5990,16 @@ H5T__conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_ushort
+ * Function: H5T__conv_uint_ushort
*
- * Purpose: Converts `unsigned int' to `unsigned short'
+ * Purpose: Converts `unsigned int' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -5998,16 +6011,16 @@ H5T__conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_uint
+ * Function: H5T__conv_int_uint
*
- * Purpose: Converts `int' to `unsigned int'
+ * Purpose: Converts `int' to `unsigned int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6019,16 +6032,16 @@ H5T__conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_int
+ * Function: H5T__conv_uint_int
*
- * Purpose: Converts `unsigned int' to `int'
+ * Purpose: Converts `unsigned int' to `int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6040,16 +6053,16 @@ H5T__conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_long
+ * Function: H5T__conv_int_long
*
- * Purpose: Converts `int' to `long'
+ * Purpose: Converts `int' to `long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6061,16 +6074,16 @@ H5T__conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_ulong
+ * Function: H5T__conv_int_ulong
*
- * Purpose: Converts `int' to `unsigned long'
+ * Purpose: Converts `int' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6082,16 +6095,16 @@ H5T__conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_long
+ * Function: H5T__conv_uint_long
*
- * Purpose: Converts `unsigned int' to `long'
+ * Purpose: Converts `unsigned int' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6103,16 +6116,16 @@ H5T__conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_ulong
+ * Function: H5T__conv_uint_ulong
*
- * Purpose: Converts `unsigned int' to `unsigned long'
+ * Purpose: Converts `unsigned int' to `unsigned long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6124,16 +6137,16 @@ H5T__conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_llong
+ * Function: H5T__conv_int_llong
*
- * Purpose: Converts `int' to `long long'
+ * Purpose: Converts `int' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6145,16 +6158,16 @@ H5T__conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_ullong
+ * Function: H5T__conv_int_ullong
*
- * Purpose: Converts `int' to `unsigned long long'
+ * Purpose: Converts `int' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6166,16 +6179,16 @@ H5T__conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_llong
+ * Function: H5T__conv_uint_llong
*
- * Purpose: Converts `unsigned int' to `long long'
+ * Purpose: Converts `unsigned int' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6187,16 +6200,16 @@ H5T__conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_ullong
+ * Function: H5T__conv_uint_ullong
*
- * Purpose: Converts `unsigned int' to `unsigned long long'
+ * Purpose: Converts `unsigned int' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6208,16 +6221,16 @@ H5T__conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_schar
+ * Function: H5T__conv_long_schar
*
- * Purpose: Converts `long' to `signed char'
+ * Purpose: Converts `long' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6229,16 +6242,16 @@ H5T__conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_uchar
+ * Function: H5T__conv_long_uchar
*
- * Purpose: Converts `long' to `unsigned char'
+ * Purpose: Converts `long' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6250,16 +6263,16 @@ H5T__conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_schar
+ * Function: H5T__conv_ulong_schar
*
- * Purpose: Converts `unsigned long' to `signed char'
+ * Purpose: Converts `unsigned long' to `signed char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6271,16 +6284,16 @@ H5T__conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_uchar
+ * Function: H5T__conv_ulong_uchar
*
- * Purpose: Converts `unsigned long' to `unsigned char'
+ * Purpose: Converts `unsigned long' to `unsigned char'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6292,16 +6305,16 @@ H5T__conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_short
+ * Function: H5T__conv_long_short
*
- * Purpose: Converts `long' to `short'
+ * Purpose: Converts `long' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6313,16 +6326,16 @@ H5T__conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_ushort
+ * Function: H5T__conv_long_ushort
*
- * Purpose: Converts `long' to `unsigned short'
+ * Purpose: Converts `long' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6334,16 +6347,16 @@ H5T__conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_short
+ * Function: H5T__conv_ulong_short
*
- * Purpose: Converts `unsigned long' to `short'
+ * Purpose: Converts `unsigned long' to `short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6355,16 +6368,16 @@ H5T__conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_ushort
+ * Function: H5T__conv_ulong_ushort
*
- * Purpose: Converts `unsigned long' to `unsigned short'
+ * Purpose: Converts `unsigned long' to `unsigned short'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6376,16 +6389,16 @@ H5T__conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_int
+ * Function: H5T__conv_long_int
*
- * Purpose: Converts `long' to `int'
+ * Purpose: Converts `long' to `int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6397,16 +6410,16 @@ H5T__conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_uint
+ * Function: H5T__conv_long_uint
*
- * Purpose: Converts `long' to `unsigned int'
+ * Purpose: Converts `long' to `unsigned int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6418,16 +6431,16 @@ H5T__conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_int
+ * Function: H5T__conv_ulong_int
*
- * Purpose: Converts `unsigned long' to `int'
+ * Purpose: Converts `unsigned long' to `int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6439,16 +6452,16 @@ H5T__conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_uint
+ * Function: H5T__conv_ulong_uint
*
- * Purpose: Converts `unsigned long' to `unsigned int'
+ * Purpose: Converts `unsigned long' to `unsigned int'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6460,16 +6473,16 @@ H5T__conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_ulong
+ * Function: H5T__conv_long_ulong
*
- * Purpose: Converts `long' to `unsigned long'
+ * Purpose: Converts `long' to `unsigned long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6481,16 +6494,16 @@ H5T__conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_long
+ * Function: H5T__conv_ulong_long
*
- * Purpose: Converts `unsigned long' to `long'
+ * Purpose: Converts `unsigned long' to `long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6502,16 +6515,16 @@ H5T__conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_llong
+ * Function: H5T__conv_long_llong
*
- * Purpose: Converts `long' to `long long'
+ * Purpose: Converts `long' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6523,16 +6536,16 @@ H5T__conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_ullong
+ * Function: H5T__conv_long_ullong
*
- * Purpose: Converts `long' to `unsigned long long'
+ * Purpose: Converts `long' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6544,16 +6557,16 @@ H5T__conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_llong
+ * Function: H5T__conv_ulong_llong
*
- * Purpose: Converts `unsigned long' to `long long'
+ * Purpose: Converts `unsigned long' to `long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6565,16 +6578,16 @@ H5T__conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_ullong
+ * Function: H5T__conv_ulong_ullong
*
- * Purpose: Converts `unsigned long' to `unsigned long long'
+ * Purpose: Converts `unsigned long' to `unsigned long long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6586,16 +6599,16 @@ H5T__conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_schar
+ * Function: H5T__conv_llong_schar
*
- * Purpose: Converts `long long' to `signed char'
+ * Purpose: Converts `long long' to `signed char'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6607,16 +6620,16 @@ H5T__conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_uchar
+ * Function: H5T__conv_llong_uchar
*
- * Purpose: Converts `long long' to `unsigned char'
+ * Purpose: Converts `long long' to `unsigned char'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6628,16 +6641,16 @@ H5T__conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_schar
+ * Function: H5T__conv_ullong_schar
*
- * Purpose: Converts `unsigned long long' to `signed char'
+ * Purpose: Converts `unsigned long long' to `signed char'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6649,16 +6662,16 @@ H5T__conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_uchar
+ * Function: H5T__conv_ullong_uchar
*
- * Purpose: Converts `unsigned long long' to `unsigned char'
+ * Purpose: Converts `unsigned long long' to `unsigned char'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6670,16 +6683,16 @@ H5T__conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_short
+ * Function: H5T__conv_llong_short
*
- * Purpose: Converts `long long' to `short'
+ * Purpose: Converts `long long' to `short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6691,16 +6704,16 @@ H5T__conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_ushort
+ * Function: H5T__conv_llong_ushort
*
- * Purpose: Converts `long long' to `unsigned short'
+ * Purpose: Converts `long long' to `unsigned short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6712,16 +6725,16 @@ H5T__conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_short
+ * Function: H5T__conv_ullong_short
*
- * Purpose: Converts `unsigned long long' to `short'
+ * Purpose: Converts `unsigned long long' to `short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6733,16 +6746,16 @@ H5T__conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_ushort
+ * Function: H5T__conv_ullong_ushort
*
- * Purpose: Converts `unsigned long long' to `unsigned short'
+ * Purpose: Converts `unsigned long long' to `unsigned short'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6754,16 +6767,16 @@ H5T__conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_int
+ * Function: H5T__conv_llong_int
*
- * Purpose: Converts `long long' to `int'
+ * Purpose: Converts `long long' to `int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6775,16 +6788,16 @@ H5T__conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_uint
+ * Function: H5T__conv_llong_uint
*
- * Purpose: Converts `long long' to `unsigned int'
+ * Purpose: Converts `long long' to `unsigned int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6796,16 +6809,16 @@ H5T__conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_int
+ * Function: H5T__conv_ullong_int
*
- * Purpose: Converts `unsigned long long' to `int'
+ * Purpose: Converts `unsigned long long' to `int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6817,16 +6830,16 @@ H5T__conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_uint
+ * Function: H5T__conv_ullong_uint
*
- * Purpose: Converts `unsigned long long' to `unsigned int'
+ * Purpose: Converts `unsigned long long' to `unsigned int'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6838,16 +6851,16 @@ H5T__conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_long
+ * Function: H5T__conv_llong_long
*
- * Purpose: Converts `long long' to `long'
+ * Purpose: Converts `long long' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6859,16 +6872,16 @@ H5T__conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_ulong
+ * Function: H5T__conv_llong_ulong
*
- * Purpose: Converts `long long' to `unsigned long'
+ * Purpose: Converts `long long' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6880,16 +6893,16 @@ H5T__conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_long
+ * Function: H5T__conv_ullong_long
*
- * Purpose: Converts `unsigned long long' to `long'
+ * Purpose: Converts `unsigned long long' to `long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6901,16 +6914,16 @@ H5T__conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_ulong
+ * Function: H5T__conv_ullong_ulong
*
- * Purpose: Converts `unsigned long long' to `unsigned long'
+ * Purpose: Converts `unsigned long long' to `unsigned long'
*
- * Return: Success: Non-negative
+ * Return: Success: Non-negative
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Friday, November 13, 1998
+ * Programmer: Robb Matzke
+ * Friday, November 13, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6922,16 +6935,16 @@ H5T__conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_ullong
+ * Function: H5T__conv_llong_ullong
*
- * Purpose: Converts `long long' to `unsigned long long'
+ * Purpose: Converts `long long' to `unsigned long long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6943,16 +6956,16 @@ H5T__conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_llong
+ * Function: H5T__conv_ullong_llong
*
- * Purpose: Converts `unsigned long long' to `long long'
+ * Purpose: Converts `unsigned long long' to `long long'
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
- * Programmer: Robb Matzke
- * Monday, November 16, 1998
+ * Programmer: Robb Matzke
+ * Monday, November 16, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6964,15 +6977,15 @@ H5T__conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_double
+ * Function: H5T__conv_float_double
*
- * Purpose: Convert native `float' to native `double' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `float' to native `double' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, June 23, 1998
+ * Programmer: Robb Matzke
+ * Tuesday, June 23, 1998
*
*-------------------------------------------------------------------------
*/
@@ -6984,15 +6997,15 @@ H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_ldouble
+ * Function: H5T__conv_float_ldouble
*
- * Purpose: Convert native `float' to native `long double' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `float' to native `long double' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, Feb 25, 2005
+ * Programmer: Raymond Lu
+ * Friday, Feb 25, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7006,15 +7019,15 @@ H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_float
+ * Function: H5T__conv_double_float
*
- * Purpose: Convert native `double' to native `float' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `double' to native `float' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, June 23, 1998
+ * Programmer: Robb Matzke
+ * Tuesday, June 23, 1998
*
*-------------------------------------------------------------------------
*/
@@ -7026,15 +7039,15 @@ H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_ldouble
+ * Function: H5T__conv_double_ldouble
*
- * Purpose: Convert native `double' to native `long double' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `double' to native `long double' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, Feb 25, 2005
+ * Programmer: Raymond Lu
+ * Friday, Feb 25, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7048,15 +7061,15 @@ H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_float
+ * Function: H5T__conv_ldouble_float
*
- * Purpose: Convert native `long double' to native `float' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `long double' to native `float' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, Feb 25, 2005
+ * Programmer: Raymond Lu
+ * Friday, Feb 25, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7070,15 +7083,15 @@ H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_double
+ * Function: H5T__conv_ldouble_double
*
- * Purpose: Convert native `long double' to native `double' using hardware.
- * This is a fast special case.
+ * Purpose: Convert native `long double' to native `double' using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, Feb 25, 2005
+ * Programmer: Raymond Lu
+ * Friday, Feb 25, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7092,15 +7105,15 @@ H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_float
+ * Function: H5T__conv_schar_float
*
- * Purpose: Convert native signed char to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native signed char to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7112,15 +7125,15 @@ H5T__conv_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_double
+ * Function: H5T__conv_schar_double
*
- * Purpose: Convert native signed char to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native signed char to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7132,15 +7145,15 @@ H5T__conv_schar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_schar_ldouble
+ * Function: H5T__conv_schar_ldouble
*
- * Purpose: Convert native signed char to native long double using
+ * Purpose: Convert native signed char to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7152,15 +7165,15 @@ H5T__conv_schar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_float
+ * Function: H5T__conv_uchar_float
*
- * Purpose: Convert native unsigned char to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned char to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7172,15 +7185,15 @@ H5T__conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_double
+ * Function: H5T__conv_uchar_double
*
- * Purpose: Convert native unsigned char to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned char to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7192,15 +7205,15 @@ H5T__conv_uchar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uchar_ldouble
+ * Function: H5T__conv_uchar_ldouble
*
- * Purpose: Convert native unsigned char to native long double using
+ * Purpose: Convert native unsigned char to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7212,15 +7225,15 @@ H5T__conv_uchar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_float
+ * Function: H5T__conv_short_float
*
- * Purpose: Convert native short to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native short to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7232,15 +7245,15 @@ H5T__conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_double
+ * Function: H5T__conv_short_double
*
- * Purpose: Convert native short to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native short to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7252,15 +7265,15 @@ H5T__conv_short_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_short_ldouble
+ * Function: H5T__conv_short_ldouble
*
- * Purpose: Convert native short to native long double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native short to native long double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7272,15 +7285,15 @@ H5T__conv_short_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_float
+ * Function: H5T__conv_ushort_float
*
- * Purpose: Convert native unsigned short to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned short to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7292,15 +7305,15 @@ H5T__conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_double
+ * Function: H5T__conv_ushort_double
*
- * Purpose: Convert native unsigned short to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned short to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7312,15 +7325,15 @@ H5T__conv_ushort_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ushort_ldouble
+ * Function: H5T__conv_ushort_ldouble
*
- * Purpose: Convert native unsigned short to native long double using
+ * Purpose: Convert native unsigned short to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7332,15 +7345,15 @@ H5T__conv_ushort_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_float
+ * Function: H5T__conv_int_float
*
- * Purpose: Convert native integer to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native integer to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7352,15 +7365,15 @@ H5T__conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_double
+ * Function: H5T__conv_int_double
*
- * Purpose: Convert native integer to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native integer to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7372,15 +7385,15 @@ H5T__conv_int_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_int_ldouble
+ * Function: H5T__conv_int_ldouble
*
- * Purpose: Convert native integer to native long double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native integer to native long double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7392,15 +7405,15 @@ H5T__conv_int_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_float
+ * Function: H5T__conv_uint_float
*
- * Purpose: Convert native unsigned integer to native float using
+ * Purpose: Convert native unsigned integer to native float using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7412,15 +7425,15 @@ H5T__conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_double
+ * Function: H5T__conv_uint_double
*
- * Purpose: Convert native unsigned integer to native double using
+ * Purpose: Convert native unsigned integer to native double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7432,15 +7445,15 @@ H5T__conv_uint_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_uint_ldouble
+ * Function: H5T__conv_uint_ldouble
*
- * Purpose: Convert native unsigned integer to native long double using
+ * Purpose: Convert native unsigned integer to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7452,15 +7465,15 @@ H5T__conv_uint_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_float
+ * Function: H5T__conv_long_float
*
- * Purpose: Convert native long to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native long to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7472,15 +7485,15 @@ H5T__conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_double
+ * Function: H5T__conv_long_double
*
- * Purpose: Convert native long to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native long to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7492,15 +7505,15 @@ H5T__conv_long_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_long_ldouble
+ * Function: H5T__conv_long_ldouble
*
- * Purpose: Convert native long to native long double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native long to native long double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7512,15 +7525,15 @@ H5T__conv_long_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_float
+ * Function: H5T__conv_ulong_float
*
- * Purpose: Convert native unsigned long to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned long to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7532,15 +7545,15 @@ H5T__conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_double
+ * Function: H5T__conv_ulong_double
*
- * Purpose: Convert native unsigned long to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native unsigned long to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7552,15 +7565,15 @@ H5T__conv_ulong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ulong_ldouble
+ * Function: H5T__conv_ulong_ldouble
*
- * Purpose: Convert native unsigned long to native long double using
+ * Purpose: Convert native unsigned long to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7572,15 +7585,15 @@ H5T__conv_ulong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_float
+ * Function: H5T__conv_llong_float
*
- * Purpose: Convert native long long to native float using hardware.
- * This is a fast special case.
+ * Purpose: Convert native long long to native float using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7592,15 +7605,15 @@ H5T__conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_double
+ * Function: H5T__conv_llong_double
*
- * Purpose: Convert native long long to native double using hardware.
- * This is a fast special case.
+ * Purpose: Convert native long long to native double using hardware.
+ * This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7612,15 +7625,15 @@ H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_llong_ldouble
+ * Function: H5T__conv_llong_ldouble
*
- * Purpose: Convert native long long to native long double using
+ * Purpose: Convert native long long to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7634,15 +7647,15 @@ H5T__conv_llong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_float
+ * Function: H5T__conv_ullong_float
*
- * Purpose: Convert native unsigned long long to native float using
+ * Purpose: Convert native unsigned long long to native float using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7654,15 +7667,15 @@ H5T__conv_ullong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_double
+ * Function: H5T__conv_ullong_double
*
- * Purpose: Convert native unsigned long long to native double using
+ * Purpose: Convert native unsigned long long to native double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7674,15 +7687,15 @@ H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ullong_ldouble
+ * Function: H5T__conv_ullong_ldouble
*
- * Purpose: Convert native unsigned long long to native long double using
+ * Purpose: Convert native unsigned long long to native long double using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7696,15 +7709,15 @@ H5T__conv_ullong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
#endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_schar
+ * Function: H5T__conv_float_schar
*
- * Purpose: Convert native float to native signed char using
+ * Purpose: Convert native float to native signed char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7712,21 +7725,21 @@ herr_t
H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_uchar
+ * Function: H5T__conv_float_uchar
*
- * Purpose: Convert native float to native unsigned char using
+ * Purpose: Convert native float to native unsigned char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7734,21 +7747,21 @@ herr_t
H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_schar
+ * Function: H5T__conv_double_schar
*
- * Purpose: Convert native double to native signed char using
+ * Purpose: Convert native double to native signed char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7756,21 +7769,21 @@ herr_t
H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_uchar
+ * Function: H5T__conv_double_uchar
*
- * Purpose: Convert native double to native unsigned char using
+ * Purpose: Convert native double to native unsigned char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7778,21 +7791,21 @@ herr_t
H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_schar
+ * Function: H5T__conv_ldouble_schar
*
- * Purpose: Convert native long double to native signed char using
+ * Purpose: Convert native long double to native signed char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7800,21 +7813,21 @@ herr_t
H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_uchar
+ * Function: H5T__conv_ldouble_uchar
*
- * Purpose: Convert native long double to native unsigned char using
+ * Purpose: Convert native long double to native unsigned char using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7822,21 +7835,21 @@ herr_t
H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_short
+ * Function: H5T__conv_float_short
*
- * Purpose: Convert native float to native short using
+ * Purpose: Convert native float to native short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7844,21 +7857,21 @@ herr_t
H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_ushort
+ * Function: H5T__conv_float_ushort
*
- * Purpose: Convert native float to native unsigned short using
+ * Purpose: Convert native float to native unsigned short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7866,21 +7879,21 @@ herr_t
H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_short
+ * Function: H5T__conv_double_short
*
- * Purpose: Convert native double to native short using
+ * Purpose: Convert native double to native short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7888,21 +7901,21 @@ herr_t
H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_ushort
+ * Function: H5T__conv_double_ushort
*
- * Purpose: Convert native double to native unsigned short using
+ * Purpose: Convert native double to native unsigned short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7910,21 +7923,21 @@ herr_t
H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_short
+ * Function: H5T__conv_ldouble_short
*
- * Purpose: Convert native long double to native short using
+ * Purpose: Convert native long double to native short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7932,21 +7945,21 @@ herr_t
H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_ushort
+ * Function: H5T__conv_ldouble_ushort
*
- * Purpose: Convert native long double to native unsigned short using
+ * Purpose: Convert native long double to native unsigned short using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -7954,21 +7967,21 @@ herr_t
H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_int
+ * Function: H5T__conv_float_int
*
- * Purpose: Convert native float to native int using
+ * Purpose: Convert native float to native int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7976,21 +7989,21 @@ herr_t
H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_uint
+ * Function: H5T__conv_float_uint
*
- * Purpose: Convert native float to native unsigned int using
+ * Purpose: Convert native float to native unsigned int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -7998,21 +8011,21 @@ herr_t
H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_int
+ * Function: H5T__conv_double_int
*
- * Purpose: Convert native double to native int using
+ * Purpose: Convert native double to native int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8020,21 +8033,21 @@ herr_t
H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_uint
+ * Function: H5T__conv_double_uint
*
- * Purpose: Convert native double to native unsigned int using
+ * Purpose: Convert native double to native unsigned int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8042,21 +8055,21 @@ herr_t
H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_int
+ * Function: H5T__conv_ldouble_int
*
- * Purpose: Convert native long double to native int using
+ * Purpose: Convert native long double to native int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8064,21 +8077,21 @@ herr_t
H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_uint
+ * Function: H5T__conv_ldouble_uint
*
- * Purpose: Convert native long double to native unsigned int using
+ * Purpose: Convert native long double to native unsigned int using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8086,21 +8099,21 @@ herr_t
H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_long
+ * Function: H5T__conv_float_long
*
- * Purpose: Convert native float to native long using
+ * Purpose: Convert native float to native long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8108,21 +8121,21 @@ herr_t
H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_ulong
+ * Function: H5T__conv_float_ulong
*
- * Purpose: Convert native float to native unsigned long using
+ * Purpose: Convert native float to native unsigned long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8130,21 +8143,21 @@ herr_t
H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_long
+ * Function: H5T__conv_double_long
*
- * Purpose: Convert native double to native long using
+ * Purpose: Convert native double to native long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8152,21 +8165,21 @@ herr_t
H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_ulong
+ * Function: H5T__conv_double_ulong
*
- * Purpose: Convert native double to native unsigned long using
+ * Purpose: Convert native double to native unsigned long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8174,21 +8187,21 @@ herr_t
H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_long
+ * Function: H5T__conv_ldouble_long
*
- * Purpose: Convert native long double to native long using
+ * Purpose: Convert native long double to native long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8196,21 +8209,21 @@ herr_t
H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_ulong
+ * Function: H5T__conv_ldouble_ulong
*
- * Purpose: Convert native long double to native unsigned long using
+ * Purpose: Convert native long double to native unsigned long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8218,21 +8231,21 @@ herr_t
H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_llong
+ * Function: H5T__conv_float_llong
*
- * Purpose: Convert native float to native long long using
+ * Purpose: Convert native float to native long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8240,21 +8253,21 @@ herr_t
H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_float_ullong
+ * Function: H5T__conv_float_ullong
*
- * Purpose: Convert native float to native unsigned long long using
+ * Purpose: Convert native float to native unsigned long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8262,21 +8275,21 @@ herr_t
H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_llong
+ * Function: H5T__conv_double_llong
*
- * Purpose: Convert native double to native long long using
+ * Purpose: Convert native double to native long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8284,21 +8297,21 @@ herr_t
H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_double_ullong
+ * Function: H5T__conv_double_ullong
*
- * Purpose: Convert native double to native unsigned long long using
+ * Purpose: Convert native double to native unsigned long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, November 7, 2003
+ * Programmer: Raymond Lu
+ * Friday, November 7, 2003
*
*-------------------------------------------------------------------------
*/
@@ -8306,21 +8319,21 @@ herr_t
H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_llong
+ * Function: H5T__conv_ldouble_llong
*
- * Purpose: Convert native long double to native long long using
+ * Purpose: Convert native long double to native long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8329,22 +8342,22 @@ herr_t
H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
/*-------------------------------------------------------------------------
- * Function: H5T__conv_ldouble_ullong
+ * Function: H5T__conv_ldouble_ullong
*
- * Purpose: Convert native long double to native unsigned long long using
+ * Purpose: Convert native long double to native unsigned long long using
* hardware. This is a fast special case.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Tuesday, Febuary 1, 2005
+ * Programmer: Raymond Lu
+ * Tuesday, Febuary 1, 2005
*
*-------------------------------------------------------------------------
*/
@@ -8353,23 +8366,23 @@ herr_t
H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF(float - equal)
+ H5_GCC_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON(float - equal)
+ H5_GCC_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/
/*-------------------------------------------------------------------------
- * Function: H5T__conv_f_i
+ * Function: H5T__conv_f_i
*
- * Purpose: Convert one floating-point type to an integer. This is
+ * Purpose: Convert one floating-point type to an integer. This is
* the catch-all function for float-integer conversions and
* is probably not particularly fast.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Wednesday, Jan 21, 2004
+ * Programmer: Raymond Lu
+ * Wednesday, Jan 21, 2004
*
*-------------------------------------------------------------------------
*/
@@ -8378,28 +8391,28 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
/* Traversal-related variables */
- H5T_t * src_p; /*source datatype */
- H5T_t * dst_p; /*destination datatype */
- H5T_atomic_t src; /*atomic source info */
- H5T_atomic_t dst; /*atomic destination info */
- int direction; /*forward or backward traversal */
- size_t elmtno; /*element number */
- size_t half_size; /*half the type size */
+ H5T_t * src_p; /*source datatype */
+ H5T_t * dst_p; /*destination datatype */
+ H5T_atomic_t src; /*atomic source info */
+ H5T_atomic_t dst; /*atomic destination info */
+ int direction; /*forward or backward traversal */
+ size_t elmtno; /*element number */
+ size_t half_size; /*half the type size */
size_t tsize; /*type size for swapping bytes */
- size_t olap; /*num overlapping elements */
+ size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
- hssize_t expo; /*source exponent */
+ hssize_t expo; /*source exponent */
hssize_t sign; /*source sign bit value */
uint8_t * int_buf = NULL; /*buffer for temporary value */
size_t buf_size; /*buffer size for temporary value */
- size_t i; /*miscellaneous counters */
+ size_t i; /*miscellaneous counters */
size_t first; /*first bit(MSB) in an integer */
- ssize_t sfirst; /*a signed version of `first' */
+ ssize_t sfirst; /*a signed version of `first' */
H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */
hbool_t truncated; /*if fraction value is dropped */
hbool_t reverse; /*if reverse order of destination at the end */
@@ -8464,7 +8477,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* Allocate enough space for the buffer holding temporary
* converted value
*/
- buf_size = (size_t)(HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1);
+ buf_size = (size_t)(HDpow(2.0, (double)src.u.f.esize) / 8 + 1);
int_buf = (uint8_t *)H5MM_calloc(buf_size);
/* Get conversion exception callback property */
@@ -8555,8 +8568,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8577,8 +8590,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8611,7 +8624,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8632,7 +8646,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8658,7 +8673,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* 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);
}
@@ -8760,7 +8775,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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)
@@ -8778,8 +8794,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/*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);
}
@@ -8799,8 +8815,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8825,8 +8841,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8855,8 +8871,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
*/
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);
}
@@ -8878,8 +8894,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/*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);
}
@@ -8899,8 +8915,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
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);
}
@@ -8983,16 +8999,16 @@ done:
} /* end H5T__conv_f_i() */
/*-------------------------------------------------------------------------
- * Function: H5T__conv_i_f
+ * Function: H5T__conv_i_f
*
- * Purpose: Convert one integer type to a floating-point type. This is
+ * Purpose: Convert one integer type to a floating-point type. This is
* the catch-all function for integer-float conversions and
* is probably not particularly fast.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
- * Friday, Feb 6, 2004
+ * Programmer: Raymond Lu
+ * Friday, Feb 6, 2004
*
*-------------------------------------------------------------------------
*/
@@ -9001,31 +9017,31 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
/* Traversal-related variables */
- H5T_t * src_p; /*source datatype */
- H5T_t * dst_p; /*destination datatype */
- H5T_atomic_t src; /*atomic source info */
- H5T_atomic_t dst; /*atomic destination info */
- int direction; /*forward or backward traversal */
- size_t elmtno; /*element number */
- size_t half_size; /*half the type size */
+ H5T_t * src_p; /*source datatype */
+ H5T_t * dst_p; /*destination datatype */
+ H5T_atomic_t src; /*atomic source info */
+ H5T_atomic_t dst; /*atomic destination info */
+ int direction; /*forward or backward traversal */
+ size_t elmtno; /*element number */
+ size_t half_size; /*half the type size */
size_t tsize; /*type size for swapping bytes */
- size_t olap; /*num overlapping elements */
+ size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
- hsize_t expo; /*destination exponent */
+ hsize_t expo; /*destination exponent */
hsize_t expo_max; /*maximal possible exponent value */
size_t sign; /*source sign bit value */
hbool_t is_max_neg; /*source is maximal negative value*/
hbool_t do_round; /*whether there is roundup */
uint8_t * int_buf = NULL; /*buffer for temporary value */
size_t buf_size; /*buffer size for temporary value */
- size_t i; /*miscellaneous counters */
+ size_t i; /*miscellaneous counters */
size_t first; /*first bit(MSB) in an integer */
- ssize_t sfirst; /*a signed version of `first' */
+ ssize_t sfirst; /*a signed version of `first' */
H5T_conv_cb_t cb_struct = {NULL, NULL}; /*conversion callback structure */
H5T_conv_ret_t except_ret; /*return of callback function */
hbool_t reverse; /*if reverse the order of destination */
@@ -9232,8 +9248,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
* 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);
}
@@ -9299,12 +9315,12 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
}
/* Check if the exponent is too big */
- expo_max = (hsize_t)(HDpow((double)2.0f, (double)dst.u.f.esize) - 1);
+ expo_max = (hsize_t)(HDpow(2.0, (double)dst.u.f.esize) - 1);
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);
@@ -9409,9 +9425,9 @@ done:
} /* end H5T__conv_i_f() */
/*-------------------------------------------------------------------------
- * Function: H5T_reverse_order
+ * Function: H5T__reverse_order
*
- * Purpose: Internal assisting function to reverse the order of
+ * Purpose: Internal assisting function to reverse the order of
* a sequence of byte when it's big endian or VAX order.
* The byte sequence simulates the endian order.
*
@@ -9419,17 +9435,17 @@ done:
*
* Failure: Null
*
- * Programmer: Raymond Lu
- * April 26, 2004
+ * Programmer: Raymond Lu
+ * April 26, 2004
*
*-------------------------------------------------------------------------
*/
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);
@@ -9518,14 +9534,14 @@ H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned H5_ATTR_UNUSED ndim, const
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 43f85e6..dd145c9 100644
--- a/src/H5Tcset.c
+++ b/src/H5Tcset.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -37,10 +37,6 @@
* Programmer: Robb Matzke
* Friday, January 9, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived data types.
- *
*-------------------------------------------------------------------------
*/
H5T_cset_t
@@ -83,10 +79,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 c5ac549..613aa60 100644
--- a/src/H5Tdbg.c
+++ b/src/H5Tdbg.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5Tdbg.c
- * Jul 19 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Tdbg.c
+ * Jul 19 2007
+ * Quincey Koziol
*
- * Purpose: Dump debugging information about a datatype
+ * Purpose: Dump debugging information about a datatype
*
*-------------------------------------------------------------------------
*/
@@ -85,22 +85,28 @@
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) {
+ hsize_t nbytes;
+ char bandwidth[32];
+ struct {
+ char *user;
+ char *system;
+ char *elapsed;
+ } timestrs = {H5_timer_get_time_string(path->stats.times.user),
+ H5_timer_get_time_string(path->stats.times.system),
+ H5_timer_get_time_string(path->stats.times.elapsed)};
+
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)
@@ -110,12 +116,16 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i
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);
+ H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed);
+ HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name,
+ path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed,
+ bandwidth);
+ HDfree(timestrs.user);
+ HDfree(timestrs.system);
+ HDfree(timestrs.elapsed);
}
#endif
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T__print_stats() */
@@ -393,8 +403,8 @@ H5T_debug(const H5T_t *dt, FILE *stream)
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, "%02" PRIx8,
+ *((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 69714a9..116d34c 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5Tdeprec.c
* April 5 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Deprecated functions from the H5T interface. These
* functions are here for compatibility purposes and may be
@@ -134,11 +134,8 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
/* Set up VOL object */
- if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure")
- new_obj->connector = vol_obj->connector;
- new_obj->connector->nrefs++;
- new_obj->data = data;
+ if (NULL == (new_obj = H5VL_create_object(data, vol_obj->connector)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype")
/* Set the committed type object to the VOL connector pointer in the H5T_t struct */
dt->vol_obj = new_obj;
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index f2247bf..2843ac5 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,8 +25,8 @@
#include "H5Tpkg.h" /*data-type functions */
/* Static local functions */
-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, void *value /*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, void *value /*out*/);
/*-------------------------------------------------------------------------
* Function: H5Tenum_create
@@ -84,8 +84,6 @@ done:
* Programmer: Raymond Lu
* October 9, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5T_t *
@@ -126,8 +124,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, December 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -172,8 +168,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, December 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -195,7 +189,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value)
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) {
@@ -211,7 +205,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;
@@ -236,8 +230,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, December 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -278,8 +270,6 @@ done:
* Programmer: Raymond Lu
* October 9, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -313,8 +303,6 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value /*out*/)
* Programmer: Robb Matzke
* Monday, January 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -336,7 +324,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:
@@ -344,7 +332,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
@@ -364,15 +352,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 */
@@ -380,7 +363,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t s
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);
@@ -440,7 +423,7 @@ done:
H5MM_free(name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_enum_nameof() */
+} /* end H5T__enum_nameof() */
/*-------------------------------------------------------------------------
* Function: H5Tenum_valueof
@@ -457,11 +440,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
@@ -483,7 +461,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:
@@ -491,7 +469,7 @@ done:
} /* H5Tenum_valueof() */
/*-------------------------------------------------------------------------
- * 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
@@ -505,22 +483,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 37e3941..baeae6d 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -39,9 +39,6 @@
* Programmer: Robb Matzke
* Monday, December 8, 1997
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
int
@@ -80,8 +77,6 @@ done:
* Programmer: Raymond Lu
* October 8, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -120,9 +115,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
char *
@@ -161,7 +153,6 @@ done:
* Programmer: Raymond Lu
* October 9, 2002
*
- * Modifications:
*-------------------------------------------------------------------------
*/
char *
@@ -219,8 +210,6 @@ done:
* Programmer: Raymond Lu
* Thursday, April 4, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -389,8 +378,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 9d2de91..9527a5a 100644
--- a/src/H5Tfixed.c
+++ b/src/H5Tfixed.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -35,9 +35,6 @@
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works with derived datatypes.
*-------------------------------------------------------------------------
*/
H5T_sign_t
@@ -72,8 +69,6 @@ done:
* Programmer: Raymond Lu
* October 8, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5T_sign_t
@@ -110,10 +105,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 bb9a177..b3fa724 100644
--- a/src/H5Tfloat.c
+++ b/src/H5Tfloat.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -187,10 +187,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 071e026..c489edc 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5T package. Including this header means that the source file
* is part of the H5T package.
*/
-#ifndef _H5Tmodule_H
-#define _H5Tmodule_H
+#ifndef H5Tmodule_H
+#define H5Tmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,76 @@
#define H5_MY_PKG_ERR H5E_DATATYPE
#define H5_MY_PKG_INIT YES
-#endif /* _H5Tmodule_H */
+/**
+ * \defgroup H5T H5T
+ * \brief Datatype Interface
+ * \todo Describe concisely what the functions in this module are about.
+ *
+ * \defgroup ARRAY Array Datatypes
+ * \ingroup H5T
+ * \defgroup ATOM Atomic Datatypes
+ * \ingroup H5T
+ * \defgroup COMPOUND Compound Datatypes
+ * \ingroup H5T
+ * \defgroup CONV Conversion Function
+ * \ingroup H5T
+ * \defgroup ENUM Enumeration Datatypes
+ * \ingroup H5T
+ * \defgroup OPAQUE Opaque Datatypes
+ * \ingroup H5T
+ * \defgroup VLEN Variable-length Sequence Datatypes
+ * \ingroup H5T
+ *
+ * \defgroup PDT Predefined Datatypes
+ * \ingroup H5T
+ * \details What is a predefined HDF5 datatype?
+ * \todo Fill in the blanks!
+ *
+ * \defgroup PDTCPU By CPU
+ * \ingroup PDT
+ * \details CPU-specific datatypes
+ * \defgroup PDTALPHA DEC Alpha
+ * \ingroup PDTCPU
+ * \defgroup PDTX86 AMD & INTEL
+ * \ingroup PDTCPU
+ * \defgroup PDTMIPS SGI MIPS
+ * \ingroup PDTCPU
+ *
+ * \defgroup PDTIEEE IEEE
+ * \ingroup PDT
+ * \details The IEEE floating point types in big- and little-endian byte orders.
+ *
+ * \defgroup PDTSTD Standard Datatypes
+ * \ingroup PDT
+ * \details These are "standard" types. For instance, signed (2's complement)
+ * and unsigned integers of various sizes in big- and little-endian
+ * byte orders.
+ *
+ * \defgroup PDTUNIX UNIX-specific Datatypes
+ * \ingroup PDT
+ * \details Types which are particular to Unix.
+ * \todo Fill in the blanks!
+ *
+ * \defgroup PDTNAT Native Datatypes
+ * \ingroup PDT
+ * \details These are the datatypes detected during library \Emph{compilation}
+ * by \c H5detect(). Their names differ from other HDF5 datatype names
+ * as follows:
+ * \li Instead of a class name, precision and byte order as the last
+ * component, they have a C-like type name.
+ * \li If the type begins with \c U then it is the unsigned version of
+ * the integer type; other integer types are signed.
+ * \li The datatype \c LLONG corresponds C's \Code{long long} and
+ * \c LDOUBLE is \Code{long double}. These types might be the same
+ * as \c LONG and \c DOUBLE, respectively.
+ * \defgroup PDTC9x C9x Integer Datatypes
+ * \ingroup PDTNAT
+ * \details C9x integer types
+ * \todo Fill in the blanks!
+ *
+ * \defgroup PDTS Strings
+ * \ingroup PDT
+ *
+ */
+
+#endif /* H5Tmodule_H */
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index da917fe..2688b23 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,13 +18,13 @@
#include "H5Tmodule.h" /* This source code file is part of the H5T module */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Tpkg.h" /* Datatypes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
static H5T_t *H5T__get_native_type(H5T_t *dt, H5T_direction_t direction, size_t *struct_align, size_t *offset,
@@ -338,7 +338,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
break;
case H5T_ENUM: {
- H5T_path_t *tpath; /* Type conversion info */
+ H5T_path_t *tpath; /* Type conversion info */
hid_t super_type_id, nat_super_type_id;
/* Don't need to do anything special for alignment, offset since the ENUM type usually is integer.
@@ -532,7 +532,7 @@ done:
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(duplicated - branches)
+H5_GCC_DIAG_OFF("duplicated-branches")
/*-------------------------------------------------------------------------
* Function: H5T__get_native_integer
@@ -683,7 +683,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_integer() */
-H5_GCC_DIAG_ON(duplicated - branches)
+H5_GCC_DIAG_ON("duplicated-branches")
/* Disable warning for intentional identical branches here -QAK */
/*
@@ -691,7 +691,7 @@ H5_GCC_DIAG_ON(duplicated - branches)
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(duplicated - branches)
+H5_GCC_DIAG_OFF("duplicated-branches")
/*-------------------------------------------------------------------------
* Function: H5T__get_native_float
@@ -817,7 +817,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_float() */
-H5_GCC_DIAG_ON(duplicated - branches)
+H5_GCC_DIAG_ON("duplicated-branches")
/* Disable warning for intentional identical branches here -QAK */
/*
@@ -825,7 +825,7 @@ H5_GCC_DIAG_ON(duplicated - branches)
* the code below, but early (4.4.7, at least) gcc only allows
* diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF(duplicated - branches)
+H5_GCC_DIAG_OFF("duplicated-branches")
/*-------------------------------------------------------------------------
* Function: H5T__get_native_bitfield
@@ -919,21 +919,21 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_native_bitfield() */
-H5_GCC_DIAG_ON(duplicated - branches)
+H5_GCC_DIAG_ON("duplicated-branches")
/*-------------------------------------------------------------------------
- * Function: H5T__cmp_offset
+ * Function: H5T__cmp_offset
*
- * Purpose: This function is only for convenience. It computes the
+ * Purpose: This function is only for convenience. It computes the
* compound type size, offset of the member being considered
* and the alignment for the whole compound type.
*
- * Return: Success: Non-negative value.
+ * Return: Success: Non-negative value.
*
- * Failure: Negative value.
+ * Failure: Negative value.
*
- * Programmer: Raymond Lu
- * December 10, 2002
+ * Programmer: Raymond Lu
+ * December 10, 2002
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index cff7857..b206dca 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,7 +24,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);
/*-------------------------------------------------------------------------
* Function: H5Tget_offset
@@ -158,10 +158,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Moved real work to a private function.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -187,7 +183,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:
@@ -195,7 +191,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
@@ -227,18 +223,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);
@@ -249,7 +241,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/H5Toh.c b/src/H5Toh.c
index 95da9be..de011e4 100644
--- a/src/H5Toh.c
+++ b/src/H5Toh.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5Topaque.c b/src/H5Topaque.c
index 8d18abe..f097fca 100644
--- a/src/H5Topaque.c
+++ b/src/H5Topaque.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -34,8 +34,6 @@
* Programmer: Robb Matzke
* Thursday, May 20, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -80,8 +78,6 @@ done:
* Programmer: Robb Matzke
* Thursday, May 20, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
char *
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 877eddc..e0b48b3 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -45,7 +45,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);
/*********************/
/* Public Variables */
@@ -204,7 +204,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:
@@ -212,7 +212,7 @@ done:
} /* end H5Tset_order() */
/*-------------------------------------------------------------------------
- * Function: H5T_set_order
+ * Function: H5T__set_order
*
* Purpose: Private function to set the byte order for a datatype.
*
@@ -224,11 +224,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")
@@ -262,11 +262,11 @@ 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 ecb4b30..db1a2cb 100644
--- a/src/H5Tpad.c
+++ b/src/H5Tpad.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -35,10 +35,6 @@
* Programmer: Robb Matzke
* Friday, January 9, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works with derived data types.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -78,10 +74,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 13dbf88..51ecaca 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, December 8, 1997
*
* Purpose: This file contains declarations which are visible only within
@@ -23,8 +23,8 @@
#error "Do not include this file outside the H5T package!"
#endif
-#ifndef _H5Tpkg_H
-#define _H5Tpkg_H
+#ifndef H5Tpkg_H
+#define H5Tpkg_H
/*
* Define this to enable debugging.
@@ -49,7 +49,8 @@
#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)
@@ -148,9 +149,9 @@
/* Statistics about a conversion function */
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 */
+ unsigned ncalls; /*num calls to conversion function */
+ hsize_t nelmts; /*total data points converted */
+ H5_timevals_t times; /*total time for conversion */
};
/* Library internal datatype conversion functions are... */
@@ -851,14 +852,16 @@ H5_DLL herr_t H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset,
H5_DLL void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value);
H5_DLL uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size);
H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val);
-H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value);
+H5_DLL ssize_t H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
+ hbool_t value);
H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
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 htri_t H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
+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(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Array functions */
H5_DLL H5T_t *H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]);
@@ -866,7 +869,8 @@ 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 htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
+H5_DLL herr_t H5T__ref_reclaim(void *elem, const H5T_t *dt);
+H5_DLL htri_t H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Compound functions */
H5_DLL herr_t H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member);
@@ -887,4 +891,4 @@ H5_DLL herr_t H5T__sort_name(const H5T_t *dt, int *map);
/* Debugging functions */
H5_DLL herr_t H5T__print_stats(H5T_path_t *path, int *nprint /*in,out*/);
-#endif /* _H5Tpkg_H */
+#endif /* H5Tpkg_H */
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index d1570a8..1dc0073 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,7 +24,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);
/*-------------------------------------------------------------------------
* Function: H5Tget_precision
@@ -42,10 +42,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
@@ -129,10 +125,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Moved real work to a private function.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -161,7 +153,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:
@@ -169,7 +161,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
@@ -191,19 +183,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);
@@ -214,7 +202,7 @@ 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)
+ 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 */
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index d9fe1ac..9ee0d04 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains private information about the H5T module
*/
-#ifndef _H5Tprivate_H
-#define _H5Tprivate_H
+#ifndef H5Tprivate_H
+#define H5Tprivate_H
/* Early typedefs to avoid circular dependencies */
typedef struct H5T_t H5T_t;
@@ -24,7 +24,7 @@ typedef struct H5T_t H5T_t;
#include "H5Tpublic.h"
/* Other public headers needed by this file */
-#include "H5MMpublic.h" /* Memory management */
+#include "H5MMpublic.h" /* Memory management */
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
@@ -41,11 +41,13 @@ typedef struct H5T_t H5T_t;
#define H5T_GET_SHARED(T) ((T)->shared)
#define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset)
#define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size)
+#define H5T_GET_FORCE_CONV(T) ((T)->shared->force_conv)
#else /* H5T_MODULE */
#define H5T_GET_SIZE(T) (H5T_get_size(T))
#define H5T_GET_SHARED(T) (H5T_get_shared(T))
#define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I)))
#define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I)))
+#define H5T_GET_FORCE_CONV(T) (H5T_get_force_conv(T))
#endif /* H5T_MODULE */
/* Forward references of package typedefs (declared in H5Tpkg.h) */
@@ -56,10 +58,7 @@ typedef struct H5T_path_t H5T_path_t;
struct H5S_t;
/* How to copy a datatype */
-typedef enum H5T_copy_t {
- H5T_COPY_TRANSIENT,
- H5T_COPY_ALL,
-} H5T_copy_t;
+typedef enum H5T_copy_t { H5T_COPY_TRANSIENT, H5T_COPY_ALL } H5T_copy_t;
/* Location of datatype information */
typedef enum {
@@ -117,6 +116,7 @@ H5_DLL H5T_t * H5T_get_super(const H5T_t *dt);
H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal);
H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api);
H5_DLL size_t H5T_get_size(const H5T_t *dt);
+H5_DLL hbool_t H5T_get_force_conv(const H5T_t *dt);
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf);
@@ -135,8 +135,6 @@ H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t
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);
@@ -175,4 +173,4 @@ H5_DLL int H5T_get_offset(const H5T_t *dt);
/* Fixed-point functions */
H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
-#endif /* _H5Tprivate_H */
+#endif /* H5Tprivate_H */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 73a00b6..b708506 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* This file contains public declarations for the H5T module.
*/
-#ifndef _H5Tpublic_H
-#define _H5Tpublic_H
+#ifndef H5Tpublic_H
+#define H5Tpublic_H
/* Public headers needed by this file */
#include "H5public.h"
@@ -23,212 +23,300 @@
#define HOFFSET(S, M) (offsetof(S, M))
-/* These are the various classes of datatypes */
-/* If this goes over 16 types (0-15), the file format will need to change) */
+/**
+ * These are the various classes of datatypes
+ * internal If this goes over 16 types (0-15), the file format will need to
+ * change.
+ */
+//! <!-- [H5T_class_t_snip] -->
typedef enum H5T_class_t {
- H5T_NO_CLASS = -1, /*error */
- H5T_INTEGER = 0, /*integer types */
- H5T_FLOAT = 1, /*floating-point types */
- H5T_TIME = 2, /*date and time types */
- H5T_STRING = 3, /*character string types */
- H5T_BITFIELD = 4, /*bit field types */
- H5T_OPAQUE = 5, /*opaque types */
- H5T_COMPOUND = 6, /*compound types */
- H5T_REFERENCE = 7, /*reference types */
- H5T_ENUM = 8, /*enumeration types */
- H5T_VLEN = 9, /*Variable-Length types */
- H5T_ARRAY = 10, /*Array types */
-
- H5T_NCLASSES /*this must be last */
+ H5T_NO_CLASS = -1, /**< error */
+ H5T_INTEGER = 0, /**< integer types */
+ H5T_FLOAT = 1, /**< floating-point types */
+ H5T_TIME = 2, /**< date and time types */
+ H5T_STRING = 3, /**< character string types */
+ H5T_BITFIELD = 4, /**< bit field types */
+ H5T_OPAQUE = 5, /**< opaque types */
+ H5T_COMPOUND = 6, /**< compound types */
+ H5T_REFERENCE = 7, /**< reference types */
+ H5T_ENUM = 8, /**< enumeration types */
+ H5T_VLEN = 9, /**< variable-Length types */
+ H5T_ARRAY = 10, /**< array types */
+
+ H5T_NCLASSES /**< sentinel: this must be last */
} H5T_class_t;
+//! <!-- [H5T_class_t_snip] -->
-/* Byte orders */
+/**
+ * Byte orders
+ */
+//! <!-- [H5T_order_t_snip] -->
typedef enum H5T_order_t {
- H5T_ORDER_ERROR = -1, /*error */
- H5T_ORDER_LE = 0, /*little endian */
- H5T_ORDER_BE = 1, /*bit endian */
- H5T_ORDER_VAX = 2, /*VAX mixed endian */
- H5T_ORDER_MIXED = 3, /*Compound type with mixed member orders */
- H5T_ORDER_NONE = 4 /*no particular order (strings, bits,..) */
+ H5T_ORDER_ERROR = -1, /**< error */
+ H5T_ORDER_LE = 0, /**< little endian */
+ H5T_ORDER_BE = 1, /**< bit endian */
+ H5T_ORDER_VAX = 2, /**< VAX mixed endian */
+ H5T_ORDER_MIXED = 3, /**< Compound type with mixed member orders */
+ H5T_ORDER_NONE = 4 /**< no particular order (strings, bits,..) */
/*H5T_ORDER_NONE must be last */
} H5T_order_t;
+//! <!-- [H5T_order_t_snip] -->
-/* Types of integer sign schemes */
+/**
+ * Types of integer sign schemes
+ */
+//! <!-- [H5T_sign_t_snip] -->
typedef enum H5T_sign_t {
- H5T_SGN_ERROR = -1, /*error */
- H5T_SGN_NONE = 0, /*this is an unsigned type */
- H5T_SGN_2 = 1, /*two's complement */
+ H5T_SGN_ERROR = -1, /**< error */
+ H5T_SGN_NONE = 0, /**< this is an unsigned type */
+ H5T_SGN_2 = 1, /**< two's complement */
- H5T_NSGN = 2 /*this must be last! */
+ H5T_NSGN = 2 /** sentinel: this must be last! */
} H5T_sign_t;
+//! <!-- [H5T_sign_t_snip] -->
-/* Floating-point normalization schemes */
+/**
+ * Floating-point normalization schemes
+ */
+//! <!-- [H5T_norm_t_snip] -->
typedef enum H5T_norm_t {
- H5T_NORM_ERROR = -1, /*error */
- H5T_NORM_IMPLIED = 0, /*msb of mantissa isn't stored, always 1 */
- H5T_NORM_MSBSET = 1, /*msb of mantissa is always 1 */
- H5T_NORM_NONE = 2 /*not normalized */
+ H5T_NORM_ERROR = -1, /**< error */
+ H5T_NORM_IMPLIED = 0, /**< msb of mantissa isn't stored, always 1 */
+ H5T_NORM_MSBSET = 1, /**< msb of mantissa is always 1 */
+ H5T_NORM_NONE = 2 /**< not normalized */
/*H5T_NORM_NONE must be last */
} H5T_norm_t;
+//! <!-- [H5T_norm_t_snip] -->
-/*
- * Character set to use for text strings. Do not change these values since
- * they appear in HDF5 files!
+/**
+ * Character set to use for text strings.
+ * \internal Do not change these values since they appear in HDF5 files!
*/
typedef enum H5T_cset_t {
- H5T_CSET_ERROR = -1, /*error */
- H5T_CSET_ASCII = 0, /*US ASCII */
- H5T_CSET_UTF8 = 1, /*UTF-8 Unicode encoding */
- H5T_CSET_RESERVED_2 = 2, /*reserved for later use */
- H5T_CSET_RESERVED_3 = 3, /*reserved for later use */
- H5T_CSET_RESERVED_4 = 4, /*reserved for later use */
- H5T_CSET_RESERVED_5 = 5, /*reserved for later use */
- H5T_CSET_RESERVED_6 = 6, /*reserved for later use */
- H5T_CSET_RESERVED_7 = 7, /*reserved for later use */
- H5T_CSET_RESERVED_8 = 8, /*reserved for later use */
- H5T_CSET_RESERVED_9 = 9, /*reserved for later use */
- H5T_CSET_RESERVED_10 = 10, /*reserved for later use */
- H5T_CSET_RESERVED_11 = 11, /*reserved for later use */
- H5T_CSET_RESERVED_12 = 12, /*reserved for later use */
- H5T_CSET_RESERVED_13 = 13, /*reserved for later use */
- H5T_CSET_RESERVED_14 = 14, /*reserved for later use */
- H5T_CSET_RESERVED_15 = 15 /*reserved for later use */
+ H5T_CSET_ERROR = -1, /**< error */
+ H5T_CSET_ASCII = 0, /**< US ASCII */
+ H5T_CSET_UTF8 = 1, /**< UTF-8 Unicode encoding */
+ H5T_CSET_RESERVED_2 = 2, /**< reserved for later use */
+ H5T_CSET_RESERVED_3 = 3, /**< reserved for later use */
+ H5T_CSET_RESERVED_4 = 4, /**< reserved for later use */
+ H5T_CSET_RESERVED_5 = 5, /**< reserved for later use */
+ H5T_CSET_RESERVED_6 = 6, /**< reserved for later use */
+ H5T_CSET_RESERVED_7 = 7, /**< reserved for later use */
+ H5T_CSET_RESERVED_8 = 8, /**< reserved for later use */
+ H5T_CSET_RESERVED_9 = 9, /**< reserved for later use */
+ H5T_CSET_RESERVED_10 = 10, /**< reserved for later use */
+ H5T_CSET_RESERVED_11 = 11, /**< reserved for later use */
+ H5T_CSET_RESERVED_12 = 12, /**< reserved for later use */
+ H5T_CSET_RESERVED_13 = 13, /**< reserved for later use */
+ H5T_CSET_RESERVED_14 = 14, /**< reserved for later use */
+ H5T_CSET_RESERVED_15 = 15 /**< reserved for later use */
} H5T_cset_t;
#define H5T_NCSET H5T_CSET_RESERVED_2 /*Number of character sets actually defined */
-/*
- * Type of padding to use in character strings. Do not change these values
- * since they appear in HDF5 files!
+/**
+ * Type of padding to use in character strings.
+ * \internal Do not change these values since they appear in HDF5 files!
*/
typedef enum H5T_str_t {
- H5T_STR_ERROR = -1, /*error */
- H5T_STR_NULLTERM = 0, /*null terminate like in C */
- H5T_STR_NULLPAD = 1, /*pad with nulls */
- H5T_STR_SPACEPAD = 2, /*pad with spaces like in Fortran */
- H5T_STR_RESERVED_3 = 3, /*reserved for later use */
- H5T_STR_RESERVED_4 = 4, /*reserved for later use */
- H5T_STR_RESERVED_5 = 5, /*reserved for later use */
- H5T_STR_RESERVED_6 = 6, /*reserved for later use */
- H5T_STR_RESERVED_7 = 7, /*reserved for later use */
- H5T_STR_RESERVED_8 = 8, /*reserved for later use */
- H5T_STR_RESERVED_9 = 9, /*reserved for later use */
- H5T_STR_RESERVED_10 = 10, /*reserved for later use */
- H5T_STR_RESERVED_11 = 11, /*reserved for later use */
- H5T_STR_RESERVED_12 = 12, /*reserved for later use */
- H5T_STR_RESERVED_13 = 13, /*reserved for later use */
- H5T_STR_RESERVED_14 = 14, /*reserved for later use */
- H5T_STR_RESERVED_15 = 15 /*reserved for later use */
+ H5T_STR_ERROR = -1, /**< error */
+ H5T_STR_NULLTERM = 0, /**< null terminate like in C */
+ H5T_STR_NULLPAD = 1, /**< pad with nulls */
+ H5T_STR_SPACEPAD = 2, /**< pad with spaces like in Fortran */
+ H5T_STR_RESERVED_3 = 3, /**< reserved for later use */
+ H5T_STR_RESERVED_4 = 4, /**< reserved for later use */
+ H5T_STR_RESERVED_5 = 5, /**< reserved for later use */
+ H5T_STR_RESERVED_6 = 6, /**< reserved for later use */
+ H5T_STR_RESERVED_7 = 7, /**< reserved for later use */
+ H5T_STR_RESERVED_8 = 8, /**< reserved for later use */
+ H5T_STR_RESERVED_9 = 9, /**< reserved for later use */
+ H5T_STR_RESERVED_10 = 10, /**< reserved for later use */
+ H5T_STR_RESERVED_11 = 11, /**< reserved for later use */
+ H5T_STR_RESERVED_12 = 12, /**< reserved for later use */
+ H5T_STR_RESERVED_13 = 13, /**< reserved for later use */
+ H5T_STR_RESERVED_14 = 14, /**< reserved for later use */
+ H5T_STR_RESERVED_15 = 15 /**< reserved for later use */
} H5T_str_t;
#define H5T_NSTR H5T_STR_RESERVED_3 /*num H5T_str_t types actually defined */
-/* Type of padding to use in other atomic types */
+/**
+ * Type of padding to use in other atomic types
+ */
+//! <!-- [H5T_pad_t_snip] -->
typedef enum H5T_pad_t {
- H5T_PAD_ERROR = -1, /*error */
- H5T_PAD_ZERO = 0, /*always set to zero */
- H5T_PAD_ONE = 1, /*always set to one */
- H5T_PAD_BACKGROUND = 2, /*set to background value */
+ H5T_PAD_ERROR = -1, /**< error */
+ H5T_PAD_ZERO = 0, /**< always set to zero */
+ H5T_PAD_ONE = 1, /**< always set to one */
+ H5T_PAD_BACKGROUND = 2, /**< set to background value */
- H5T_NPAD = 3 /*THIS MUST BE LAST */
+ H5T_NPAD = 3 /**< sentinal: THIS MUST BE LAST */
} H5T_pad_t;
+//! <!-- [H5T_pad_t_snip] -->
-/* Commands sent to conversion functions */
+/**
+ * Commands sent to conversion functions
+ */
typedef enum H5T_cmd_t {
- H5T_CONV_INIT = 0, /*query and/or initialize private data */
- H5T_CONV_CONV = 1, /*convert data from source to dest datatype */
- H5T_CONV_FREE = 2 /*function is being removed from path */
+ H5T_CONV_INIT = 0, /**< query and/or initialize private data */
+ H5T_CONV_CONV = 1, /**< convert data from source to dest datatype */
+ H5T_CONV_FREE = 2 /**< function is being removed from path */
} H5T_cmd_t;
-/* How is the `bkg' buffer used by the conversion function? */
+/**
+ * How is the `bkg' buffer used by the conversion function?
+ */
typedef enum H5T_bkg_t {
- H5T_BKG_NO = 0, /*background buffer is not needed, send NULL */
- H5T_BKG_TEMP = 1, /*bkg buffer used as temp storage only */
- H5T_BKG_YES = 2 /*init bkg buf with data before conversion */
+ H5T_BKG_NO = 0, /**< background buffer is not needed, send NULL */
+ H5T_BKG_TEMP = 1, /**< bkg buffer used as temp storage only */
+ H5T_BKG_YES = 2 /**< init bkg buf with data before conversion */
} H5T_bkg_t;
-/* Type conversion client data */
+/**
+ * Type conversion client data
+ */
+//! <!-- [H5T_cdata_t_snip] -->
typedef struct H5T_cdata_t {
- H5T_cmd_t command; /*what should the conversion function do? */
- H5T_bkg_t need_bkg; /*is the background buffer needed? */
- hbool_t recalc; /*recalculate private data */
- void * priv; /*private data */
+ H5T_cmd_t command; /**< what should the conversion function do? */
+ H5T_bkg_t need_bkg; /**< is the background buffer needed? */
+ hbool_t recalc; /**< recalculate private data */
+ void * priv; /**< private data */
} H5T_cdata_t;
+//! <!-- [H5T_cdata_t_snip] -->
-/* Conversion function persistence */
+/**
+ * Conversion function persistence
+ */
typedef enum H5T_pers_t {
- H5T_PERS_DONTCARE = -1, /*wild card */
- H5T_PERS_HARD = 0, /*hard conversion function */
- H5T_PERS_SOFT = 1 /*soft conversion function */
+ H5T_PERS_DONTCARE = -1, /**< wild card */
+ H5T_PERS_HARD = 0, /**< hard conversion function */
+ H5T_PERS_SOFT = 1 /**< soft conversion function */
} H5T_pers_t;
-/* The order to retrieve atomic native datatype */
+/**
+ * The order to retrieve atomic native datatype
+ */
+//! <!-- [H5T_direction_t_snip] -->
typedef enum H5T_direction_t {
- H5T_DIR_DEFAULT = 0, /*default direction is inscendent */
- H5T_DIR_ASCEND = 1, /*in inscendent order */
- H5T_DIR_DESCEND = 2 /*in descendent order */
+ H5T_DIR_DEFAULT = 0, /**< default direction is inscendent */
+ H5T_DIR_ASCEND = 1, /**< in inscendent order */
+ H5T_DIR_DESCEND = 2 /**< in descendent order */
} H5T_direction_t;
+//! <!-- [H5T_direction_t_snip] -->
-/* The exception type passed into the conversion callback function */
+/**
+ * The exception type passed into the conversion callback function
+ */
typedef enum H5T_conv_except_t {
- H5T_CONV_EXCEPT_RANGE_HI = 0, /*source value is greater than destination's range */
- H5T_CONV_EXCEPT_RANGE_LOW = 1, /*source value is less than destination's range */
- H5T_CONV_EXCEPT_PRECISION = 2, /*source value loses precision in destination */
- H5T_CONV_EXCEPT_TRUNCATE = 3, /*source value is truncated in destination */
- H5T_CONV_EXCEPT_PINF = 4, /*source value is positive infinity(floating number) */
- H5T_CONV_EXCEPT_NINF = 5, /*source value is negative infinity(floating number) */
- H5T_CONV_EXCEPT_NAN = 6 /*source value is NaN(floating number) */
+ H5T_CONV_EXCEPT_RANGE_HI = 0,
+ /**< Source value is greater than destination's range */
+ H5T_CONV_EXCEPT_RANGE_LOW = 1,
+ /**< Source value is less than destination's range */
+ H5T_CONV_EXCEPT_PRECISION = 2,
+ /**< Source value loses precision in destination */
+ H5T_CONV_EXCEPT_TRUNCATE = 3,
+ /**< Source value is truncated in destination */
+ H5T_CONV_EXCEPT_PINF = 4,
+ /**< Source value is positive infinity */
+ H5T_CONV_EXCEPT_NINF = 5,
+ /**< Source value is negative infinity */
+ H5T_CONV_EXCEPT_NAN = 6
+ /**< Source value is \c NaN (not a number, including \c QNaN and \c SNaN) */
} H5T_conv_except_t;
-/* The return value from conversion callback function H5T_conv_except_func_t */
+/**
+ * The return value from conversion callback function H5T_conv_except_func_t()
+ */
typedef enum H5T_conv_ret_t {
- H5T_CONV_ABORT = -1, /*abort conversion */
- H5T_CONV_UNHANDLED = 0, /*callback function failed to handle the exception */
- H5T_CONV_HANDLED = 1 /*callback function handled the exception successfully */
+ H5T_CONV_ABORT = -1, /**< abort conversion */
+ H5T_CONV_UNHANDLED = 0, /**< callback function failed to handle the exception */
+ H5T_CONV_HANDLED = 1 /**< callback function handled the exception successfully */
} H5T_conv_ret_t;
-/* Variable Length Datatype struct in memory */
-/* (This is only used for VL sequences, not VL strings, which are stored in char *'s) */
+/**
+ * Variable Length Datatype struct in memory (This is only used for VL
+ * sequences, not VL strings, which are stored in char *'s)
+ */
typedef struct {
- size_t len; /* Length of VL data (in base type units) */
- void * p; /* Pointer to VL data */
+ size_t len; /**< Length of VL data (in base type units) */
+ void * p; /**< Pointer to VL data */
} hvl_t;
/* Variable Length String information */
-#define H5T_VARIABLE \
- ((size_t)( \
- -1)) /* Indicate that a string is variable length (null-terminated in C, instead of fixed length) */
+/**
+ * Indicate that a string is variable length (null-terminated in C, instead of
+ * fixed length)
+ */
+#define H5T_VARIABLE ((size_t)(-1))
/* Opaque information */
-#define H5T_OPAQUE_TAG_MAX 256 /* Maximum length of an opaque tag */
- /* This could be raised without too much difficulty */
+/**
+ * Maximum length of an opaque tag
+ * \internal This could be raised without too much difficulty
+ */
+#define H5T_OPAQUE_TAG_MAX 256
#ifdef __cplusplus
extern "C" {
#endif
-/* All datatype conversion functions are... */
+/**
+ * All datatype conversion functions are...
+ */
+//! <!-- [H5T_conv_t_snip] -->
typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist);
+//! <!-- [H5T_conv_t_snip] -->
-/* Exception handler. If an exception like overflow happenes during conversion,
- * this function is called if it's registered through H5Pset_type_conv_cb.
+//! <!-- [H5T_conv_except_func_t_snip] -->
+/**
+ * \brief Exception handler.
+ *
+ * \param[in] except_type The kind of exception that occurred
+ * \param[in] src_id Source datatype identifier
+ * \param[in] dst_id Destination datatype identifier
+ * \param[in] src_buf Source data buffer
+ * \param[in,out] dst_buf Destination data buffer
+ * \param[in,out] user_data Callback context
+ * \returns Valid callback function return values are #H5T_CONV_ABORT,
+ * #H5T_CONV_UNHANDLED and #H5T_CONV_HANDLED.
+ *
+ * \details If an exception like overflow happenes during conversion, this
+ * function is called if it's registered through H5Pset_type_conv_cb().
+ *
*/
typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type, hid_t src_id, hid_t dst_id,
void *src_buf, void *dst_buf, void *user_data);
+//! <!-- [H5T_conv_except_func_t_snip] -->
/* When this header is included from a private header, don't make calls to H5open() */
#undef H5OPEN
-#ifndef _H5private_H
+#ifndef H5private_H
#define H5OPEN H5open(),
-#else /* _H5private_H */
+#else /* H5private_H */
#define H5OPEN
-#endif /* _H5private_H */
+#endif /* H5private_H */
/*
* The IEEE floating point types in various byte orders.
*/
+/**
+ * \ingroup PDTIEEE
+ * 32-bit big-endian IEEE floating-point numbers
+ */
#define H5T_IEEE_F32BE (H5OPEN H5T_IEEE_F32BE_g)
+/**
+ * \ingroup PDTIEEE
+ * 32-bit little-endian IEEE floating-point numbers
+ */
#define H5T_IEEE_F32LE (H5OPEN H5T_IEEE_F32LE_g)
+/**
+ * \ingroup PDTIEEE
+ * 64-bit big-endian IEEE floating-point numbers
+ */
#define H5T_IEEE_F64BE (H5OPEN H5T_IEEE_F64BE_g)
+/**
+ * \ingroup PDTIEEE
+ * 64-bit little-endian IEEE floating-point numbers
+ */
#define H5T_IEEE_F64LE (H5OPEN H5T_IEEE_F64LE_g)
H5_DLLVAR hid_t H5T_IEEE_F32BE_g;
H5_DLLVAR hid_t H5T_IEEE_F32LE_g;
@@ -239,33 +327,141 @@ H5_DLLVAR hid_t H5T_IEEE_F64LE_g;
* These are "standard" types. For instance, signed (2's complement) and
* unsigned integers of various sizes and byte orders.
*/
-#define H5T_STD_I8BE (H5OPEN H5T_STD_I8BE_g)
-#define H5T_STD_I8LE (H5OPEN H5T_STD_I8LE_g)
-#define H5T_STD_I16BE (H5OPEN H5T_STD_I16BE_g)
-#define H5T_STD_I16LE (H5OPEN H5T_STD_I16LE_g)
-#define H5T_STD_I32BE (H5OPEN H5T_STD_I32BE_g)
-#define H5T_STD_I32LE (H5OPEN H5T_STD_I32LE_g)
-#define H5T_STD_I64BE (H5OPEN H5T_STD_I64BE_g)
-#define H5T_STD_I64LE (H5OPEN H5T_STD_I64LE_g)
-#define H5T_STD_U8BE (H5OPEN H5T_STD_U8BE_g)
-#define H5T_STD_U8LE (H5OPEN H5T_STD_U8LE_g)
-#define H5T_STD_U16BE (H5OPEN H5T_STD_U16BE_g)
-#define H5T_STD_U16LE (H5OPEN H5T_STD_U16LE_g)
-#define H5T_STD_U32BE (H5OPEN H5T_STD_U32BE_g)
-#define H5T_STD_U32LE (H5OPEN H5T_STD_U32LE_g)
-#define H5T_STD_U64BE (H5OPEN H5T_STD_U64BE_g)
-#define H5T_STD_U64LE (H5OPEN H5T_STD_U64LE_g)
-#define H5T_STD_B8BE (H5OPEN H5T_STD_B8BE_g)
-#define H5T_STD_B8LE (H5OPEN H5T_STD_B8LE_g)
-#define H5T_STD_B16BE (H5OPEN H5T_STD_B16BE_g)
-#define H5T_STD_B16LE (H5OPEN H5T_STD_B16LE_g)
-#define H5T_STD_B32BE (H5OPEN H5T_STD_B32BE_g)
-#define H5T_STD_B32LE (H5OPEN H5T_STD_B32LE_g)
-#define H5T_STD_B64BE (H5OPEN H5T_STD_B64BE_g)
-#define H5T_STD_B64LE (H5OPEN H5T_STD_B64LE_g)
-#define H5T_STD_REF_OBJ (H5OPEN H5T_STD_REF_OBJ_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit big-endian signed integers
+ */
+#define H5T_STD_I8BE (H5OPEN H5T_STD_I8BE_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit little-endian signed integers
+ */
+#define H5T_STD_I8LE (H5OPEN H5T_STD_I8LE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit big-endian signed integers
+ */
+#define H5T_STD_I16BE (H5OPEN H5T_STD_I16BE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit little-endian signed integers
+ */
+#define H5T_STD_I16LE (H5OPEN H5T_STD_I16LE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit big-endian signed integers
+ */
+#define H5T_STD_I32BE (H5OPEN H5T_STD_I32BE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit little-endian signed integers
+ */
+#define H5T_STD_I32LE (H5OPEN H5T_STD_I32LE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit big-endian signed integers
+ */
+#define H5T_STD_I64BE (H5OPEN H5T_STD_I64BE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit little-endian signed integers
+ */
+#define H5T_STD_I64LE (H5OPEN H5T_STD_I64LE_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit big-endian unsigned integers
+ */
+#define H5T_STD_U8BE (H5OPEN H5T_STD_U8BE_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit little-endian unsigned integers
+ */
+#define H5T_STD_U8LE (H5OPEN H5T_STD_U8LE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit big-endian unsigned integers
+ */
+#define H5T_STD_U16BE (H5OPEN H5T_STD_U16BE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit little-endian unsigned integers
+ */
+#define H5T_STD_U16LE (H5OPEN H5T_STD_U16LE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit big-endian unsigned integers
+ */
+#define H5T_STD_U32BE (H5OPEN H5T_STD_U32BE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit little-endian unsigned integers
+ */
+#define H5T_STD_U32LE (H5OPEN H5T_STD_U32LE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit big-endian unsigned integers
+ */
+#define H5T_STD_U64BE (H5OPEN H5T_STD_U64BE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit little-endian unsigned integers
+ */
+#define H5T_STD_U64LE (H5OPEN H5T_STD_U64LE_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit big-endian bitfield
+ */
+#define H5T_STD_B8BE (H5OPEN H5T_STD_B8BE_g)
+/**
+ * \ingroup PDTSTD
+ * 8-bit little-endian bitfield
+ */
+#define H5T_STD_B8LE (H5OPEN H5T_STD_B8LE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit big-endian bitfield
+ */
+#define H5T_STD_B16BE (H5OPEN H5T_STD_B16BE_g)
+/**
+ * \ingroup PDTSTD
+ * 16-bit little-endian bitfield
+ */
+#define H5T_STD_B16LE (H5OPEN H5T_STD_B16LE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit big-endian bitfield
+ */
+#define H5T_STD_B32BE (H5OPEN H5T_STD_B32BE_g)
+/**
+ * \ingroup PDTSTD
+ * 32-bit little-endian bitfield
+ */
+#define H5T_STD_B32LE (H5OPEN H5T_STD_B32LE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit big-endian bitfield
+ */
+#define H5T_STD_B64BE (H5OPEN H5T_STD_B64BE_g)
+/**
+ * \ingroup PDTSTD
+ * 64-bit little-endian bitfield
+ */
+#define H5T_STD_B64LE (H5OPEN H5T_STD_B64LE_g)
+/**
+ * \ingroup PDTSTD
+ * Object reference
+ */
+#define H5T_STD_REF_OBJ (H5OPEN H5T_STD_REF_OBJ_g)
+/**
+ * \ingroup PDTSTD
+ * Dataset region reference
+ */
#define H5T_STD_REF_DSETREG (H5OPEN H5T_STD_REF_DSETREG_g)
-#define H5T_STD_REF (H5OPEN H5T_STD_REF_g)
+/**
+ * \ingroup PDTSTD
+ * Generic reference
+ */
+#define H5T_STD_REF (H5OPEN H5T_STD_REF_g)
H5_DLLVAR hid_t H5T_STD_I8BE_g;
H5_DLLVAR hid_t H5T_STD_I8LE_g;
H5_DLLVAR hid_t H5T_STD_I16BE_g;
@@ -297,9 +493,21 @@ H5_DLLVAR hid_t H5T_STD_REF_g;
/*
* Types which are particular to Unix.
*/
+/**
+ * \ingroup PDTUNIX
+ */
#define H5T_UNIX_D32BE (H5OPEN H5T_UNIX_D32BE_g)
+/**
+ * \ingroup PDTUNIX
+ */
#define H5T_UNIX_D32LE (H5OPEN H5T_UNIX_D32LE_g)
+/**
+ * \ingroup PDTUNIX
+ */
#define H5T_UNIX_D64BE (H5OPEN H5T_UNIX_D64BE_g)
+/**
+ * \ingroup PDTUNIX
+ */
#define H5T_UNIX_D64LE (H5OPEN H5T_UNIX_D64LE_g)
H5_DLLVAR hid_t H5T_UNIX_D32BE_g;
H5_DLLVAR hid_t H5T_UNIX_D32LE_g;
@@ -310,12 +518,20 @@ H5_DLLVAR hid_t H5T_UNIX_D64LE_g;
* Types particular to the C language. String types use `bytes' instead
* of `bits' as their size.
*/
+/**
+ * \ingroup PDTS
+ * String datatype in C (size defined in bytes rather than in bits)
+ */
#define H5T_C_S1 (H5OPEN H5T_C_S1_g)
H5_DLLVAR hid_t H5T_C_S1_g;
/*
* Types particular to Fortran.
*/
+/**
+ * \ingroup PDTS
+ * String datatype in Fortran (as defined for the HDF5 C library)
+ */
#define H5T_FORTRAN_S1 (H5OPEN H5T_FORTRAN_S1_g)
H5_DLLVAR hid_t H5T_FORTRAN_S1_g;
@@ -323,63 +539,239 @@ H5_DLLVAR hid_t H5T_FORTRAN_S1_g;
* These types are for Intel CPU's. They are little endian with IEEE
* floating point.
*/
-#define H5T_INTEL_I8 H5T_STD_I8LE
+/**
+ * \ingroup PDTX86
+ * 8-bit little-endian signed (2's complement) integers for Intel CPUs
+ */
+#define H5T_INTEL_I8 H5T_STD_I8LE
+/**
+ * \ingroup PDTX86
+ * 16-bit little-endian signed (2's complement) integers for Intel CPUs
+ */
#define H5T_INTEL_I16 H5T_STD_I16LE
+/**
+ * \ingroup PDTX86
+ * 32-bit little-endian signed (2's complement) integers for Intel CPUs
+ */
#define H5T_INTEL_I32 H5T_STD_I32LE
+/**
+ * \ingroup PDTX86
+ * 64-bit little-endian signed (2's complement) integers for Intel CPUs
+ */
#define H5T_INTEL_I64 H5T_STD_I64LE
-#define H5T_INTEL_U8 H5T_STD_U8LE
+/**
+ * \ingroup PDTX86
+ * 8-bit little-endian unsigned integers for Intel CPUs
+ */
+#define H5T_INTEL_U8 H5T_STD_U8LE
+/**
+ * \ingroup PDTX86
+ * 16-bit little-endian unsigned integers for Intel CPUs
+ */
#define H5T_INTEL_U16 H5T_STD_U16LE
+/**
+ * \ingroup PDTX86
+ * 32-bit little-endian unsigned integers for Intel CPUs
+ */
#define H5T_INTEL_U32 H5T_STD_U32LE
+/**
+ * \ingroup PDTX86
+ * 64-bit little-endian unsigned integers for Intel CPUs
+ */
#define H5T_INTEL_U64 H5T_STD_U64LE
-#define H5T_INTEL_B8 H5T_STD_B8LE
+/**
+ * \ingroup PDTX86
+ * 8-bit little-endian bitfield for Intel CPUs
+ */
+#define H5T_INTEL_B8 H5T_STD_B8LE
+/**
+ * \ingroup PDTX86
+ * 16-bit little-endian bitfield for Intel CPUs
+ */
#define H5T_INTEL_B16 H5T_STD_B16LE
+/**
+ * \ingroup PDTX86
+ * 32-bit little-endian bitfield for Intel CPUs
+ */
#define H5T_INTEL_B32 H5T_STD_B32LE
+/**
+ * \ingroup PDTX86
+ * 64-bit little-endian bitfield for Intel CPUs
+ */
#define H5T_INTEL_B64 H5T_STD_B64LE
+/**
+ * \ingroup PDTX86
+ * 32-bit little-endian IEEE floating-point numbers for Intel CPUs
+ */
#define H5T_INTEL_F32 H5T_IEEE_F32LE
+/**
+ * \ingroup PDTX86
+ * 64-bit little-endian IEEE floating-point numbers for Intel CPUs
+ */
#define H5T_INTEL_F64 H5T_IEEE_F64LE
/*
* These types are for DEC Alpha CPU's. They are little endian with IEEE
* floating point.
*/
-#define H5T_ALPHA_I8 H5T_STD_I8LE
+/**
+ * \ingroup PDTALPHA
+ * 8-bit little-endian signed (2's complement) integers for DEC Alpha CPUs
+ */
+#define H5T_ALPHA_I8 H5T_STD_I8LE
+/**
+ * \ingroup PDTALPHA
+ * 16-bit little-endian signed (2's complement) integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_I16 H5T_STD_I16LE
+/**
+ * \ingroup PDTALPHA
+ * 32-bit little-endian signed (2's complement) integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_I32 H5T_STD_I32LE
+/**
+ * \ingroup PDTALPHA
+ * 64-bit little-endian signed (2's complement) integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_I64 H5T_STD_I64LE
-#define H5T_ALPHA_U8 H5T_STD_U8LE
+/**
+ * \ingroup PDTALPHA
+ * 8-bit little-endian unsigned integers for DEC Alpha CPUs
+ */
+#define H5T_ALPHA_U8 H5T_STD_U8LE
+/**
+ * \ingroup PDTALPHA
+ * 16-bit little-endian unsigned integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_U16 H5T_STD_U16LE
+/**
+ * \ingroup PDTALPHA
+ * 32-bit little-endian unsigned integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_U32 H5T_STD_U32LE
+/**
+ * \ingroup PDTALPHA
+ * 64-bit little-endian unsigned integers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_U64 H5T_STD_U64LE
-#define H5T_ALPHA_B8 H5T_STD_B8LE
+/**
+ * \ingroup PDTALPHA
+ * 8-bit little-endian bitfield for DEC Alpha CPUs
+ */
+#define H5T_ALPHA_B8 H5T_STD_B8LE
+/**
+ * \ingroup PDTALPHA
+ * 16-bit little-endian bitfield for DEC Alpha CPUs
+ */
#define H5T_ALPHA_B16 H5T_STD_B16LE
+/**
+ * \ingroup PDTALPHA
+ * 32-bit little-endian bitfield for DEC Alpha CPUs
+ */
#define H5T_ALPHA_B32 H5T_STD_B32LE
+/**
+ * \ingroup PDTALPHA
+ * 64-bit little-endian bitfield for DEC Alpha CPUs
+ */
#define H5T_ALPHA_B64 H5T_STD_B64LE
+/**
+ * \ingroup PDTALPHA
+ * 32-bit little-endian IEEE floating-point numbers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_F32 H5T_IEEE_F32LE
+/**
+ * \ingroup PDTALPHA
+ * 64-bit little-endian IEEE floating-point numbers for DEC Alpha CPUs
+ */
#define H5T_ALPHA_F64 H5T_IEEE_F64LE
/*
* These types are for MIPS cpu's commonly used in SGI systems. They are big
* endian with IEEE floating point.
*/
-#define H5T_MIPS_I8 H5T_STD_I8BE
+/**
+ * \ingroup PDTMIPS
+ * 8-bit big-endian signed (2's complement) integers for SGI MIPS CPUs
+ */
+#define H5T_MIPS_I8 H5T_STD_I8BE
+/**
+ * \ingroup PDTMIPS
+ * 16-bit big-endian signed (2's complement) integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_I16 H5T_STD_I16BE
+/**
+ * \ingroup PDTMIPS
+ * 32-bit big-endian signed (2's complement) integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_I32 H5T_STD_I32BE
+/**
+ * \ingroup PDTMIPS
+ * 64-bit big-endian signed (2's complement) integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_I64 H5T_STD_I64BE
-#define H5T_MIPS_U8 H5T_STD_U8BE
+/**
+ * \ingroup PDTMIPS
+ * 8-bit big-endian unsigned integers for SGI MIPS CPUs
+ */
+#define H5T_MIPS_U8 H5T_STD_U8BE
+/**
+ * \ingroup PDTMIPS
+ * 16-bit big-endian unsigned integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_U16 H5T_STD_U16BE
+/**
+ * \ingroup PDTMIPS
+ * 32-bit big-endian unsigned integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_U32 H5T_STD_U32BE
+/**
+ * \ingroup PDTMIPS
+ * 64-bit big-endian unsigned integers for SGI MIPS CPUs
+ */
#define H5T_MIPS_U64 H5T_STD_U64BE
-#define H5T_MIPS_B8 H5T_STD_B8BE
+/**
+ * \ingroup PDTMIPS
+ * 8-bit big-endian bitfield for SGI MIPS CPUs
+ */
+#define H5T_MIPS_B8 H5T_STD_B8BE
+/**
+ * \ingroup PDTMIPS
+ * 16-bit big-endian bitfield for SGI MIPS CPUs
+ */
#define H5T_MIPS_B16 H5T_STD_B16BE
+/**
+ * \ingroup PDTMIPS
+ * 32-bit big-endian bitfield for SGI MIPS CPUs
+ */
#define H5T_MIPS_B32 H5T_STD_B32BE
+/**
+ * \ingroup PDTMIPS
+ * 64-bit big-endian bitfield for SGI MIPS CPUs
+ */
#define H5T_MIPS_B64 H5T_STD_B64BE
+/**
+ * \ingroup PDTMIPS
+ * 32-bit big-endian IEEE floating-point numbers for MIPS CPUs
+ */
#define H5T_MIPS_F32 H5T_IEEE_F32BE
+/**
+ * \ingroup PDTMIPS
+ * 64-bit big-endian IEEE floating-point numbers for MIPS CPUs
+ */
#define H5T_MIPS_F64 H5T_IEEE_F64BE
/*
* The VAX floating point types (i.e. in VAX byte order)
*/
+/**
+ * \ingroup PDTALPHA
+ * 32-bit VAX byte order floating-point numbers for OpenVMS on DEC Alpha CPUs
+ */
#define H5T_VAX_F32 (H5OPEN H5T_VAX_F32_g)
+/**
+ * \ingroup PDTALPHA
+ * 64-bit VAX byte order floating-point numbers for OpenVMS on DEC Alpha CPUs
+ */
#define H5T_VAX_F64 (H5OPEN H5T_VAX_F64_g)
H5_DLLVAR hid_t H5T_VAX_F32_g;
H5_DLLVAR hid_t H5T_VAX_F64_g;
@@ -393,32 +785,128 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
* to C's `long long' and LDOUBLE is `long double' (these types might be the
* same as `LONG' and `DOUBLE' respectively).
*/
-#define H5T_NATIVE_CHAR (CHAR_MIN ? H5T_NATIVE_SCHAR : H5T_NATIVE_UCHAR)
-#define H5T_NATIVE_SCHAR (H5OPEN H5T_NATIVE_SCHAR_g)
-#define H5T_NATIVE_UCHAR (H5OPEN H5T_NATIVE_UCHAR_g)
-#define H5T_NATIVE_SHORT (H5OPEN H5T_NATIVE_SHORT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \c char
+ */
+#define H5T_NATIVE_CHAR (CHAR_MIN ? H5T_NATIVE_SCHAR : H5T_NATIVE_UCHAR)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{signed char}
+ */
+#define H5T_NATIVE_SCHAR (H5OPEN H5T_NATIVE_SCHAR_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{unsigned char}
+ */
+#define H5T_NATIVE_UCHAR (H5OPEN H5T_NATIVE_UCHAR_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{short}
+ */
+#define H5T_NATIVE_SHORT (H5OPEN H5T_NATIVE_SHORT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{unsigned short}
+ */
#define H5T_NATIVE_USHORT (H5OPEN H5T_NATIVE_USHORT_g)
-#define H5T_NATIVE_INT (H5OPEN H5T_NATIVE_INT_g)
-#define H5T_NATIVE_UINT (H5OPEN H5T_NATIVE_UINT_g)
-#define H5T_NATIVE_LONG (H5OPEN H5T_NATIVE_LONG_g)
-#define H5T_NATIVE_ULONG (H5OPEN H5T_NATIVE_ULONG_g)
-#define H5T_NATIVE_LLONG (H5OPEN H5T_NATIVE_LLONG_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{int}
+ */
+#define H5T_NATIVE_INT (H5OPEN H5T_NATIVE_INT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{unsigned int}
+ */
+#define H5T_NATIVE_UINT (H5OPEN H5T_NATIVE_UINT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{long}
+ */
+#define H5T_NATIVE_LONG (H5OPEN H5T_NATIVE_LONG_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{unsigned long}
+ */
+#define H5T_NATIVE_ULONG (H5OPEN H5T_NATIVE_ULONG_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{long long}
+ */
+#define H5T_NATIVE_LLONG (H5OPEN H5T_NATIVE_LLONG_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{unsigned long long}
+ */
#define H5T_NATIVE_ULLONG (H5OPEN H5T_NATIVE_ULLONG_g)
-#define H5T_NATIVE_FLOAT (H5OPEN H5T_NATIVE_FLOAT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{float}
+ */
+#define H5T_NATIVE_FLOAT (H5OPEN H5T_NATIVE_FLOAT_g)
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{double}
+ */
#define H5T_NATIVE_DOUBLE (H5OPEN H5T_NATIVE_DOUBLE_g)
#if H5_SIZEOF_LONG_DOUBLE != 0
+/**
+ * \ingroup PDTNAT
+ * C-style \Code{long double}
+ */
#define H5T_NATIVE_LDOUBLE (H5OPEN H5T_NATIVE_LDOUBLE_g)
#endif
-#define H5T_NATIVE_B8 (H5OPEN H5T_NATIVE_B8_g)
-#define H5T_NATIVE_B16 (H5OPEN H5T_NATIVE_B16_g)
-#define H5T_NATIVE_B32 (H5OPEN H5T_NATIVE_B32_g)
-#define H5T_NATIVE_B64 (H5OPEN H5T_NATIVE_B64_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 8-bit bitfield based on native types
+ */
+#define H5T_NATIVE_B8 (H5OPEN H5T_NATIVE_B8_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 16-bit bitfield based on native types
+ */
+#define H5T_NATIVE_B16 (H5OPEN H5T_NATIVE_B16_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 32-bit bitfield based on native types
+ */
+#define H5T_NATIVE_B32 (H5OPEN H5T_NATIVE_B32_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 64-bit bitfield based on native types
+ */
+#define H5T_NATIVE_B64 (H5OPEN H5T_NATIVE_B64_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 opaque unit based on native types
+ */
#define H5T_NATIVE_OPAQUE (H5OPEN H5T_NATIVE_OPAQUE_g)
-#define H5T_NATIVE_HADDR (H5OPEN H5T_NATIVE_HADDR_g)
-#define H5T_NATIVE_HSIZE (H5OPEN H5T_NATIVE_HSIZE_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 address type based on native types
+ */
+#define H5T_NATIVE_HADDR (H5OPEN H5T_NATIVE_HADDR_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 size type based on native types
+ */
+#define H5T_NATIVE_HSIZE (H5OPEN H5T_NATIVE_HSIZE_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 signed size type based on native types
+ */
#define H5T_NATIVE_HSSIZE (H5OPEN H5T_NATIVE_HSSIZE_g)
-#define H5T_NATIVE_HERR (H5OPEN H5T_NATIVE_HERR_g)
-#define H5T_NATIVE_HBOOL (H5OPEN H5T_NATIVE_HBOOL_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 error code type based on native types
+ */
+#define H5T_NATIVE_HERR (H5OPEN H5T_NATIVE_HERR_g)
+/**
+ * \ingroup PDTNAT
+ * HDF5 Boolean type based on native types
+ */
+#define H5T_NATIVE_HBOOL (H5OPEN H5T_NATIVE_HBOOL_g)
H5_DLLVAR hid_t H5T_NATIVE_SCHAR_g;
H5_DLLVAR hid_t H5T_NATIVE_UCHAR_g;
H5_DLLVAR hid_t H5T_NATIVE_SHORT_g;
@@ -446,12 +934,30 @@ H5_DLLVAR hid_t H5T_NATIVE_HERR_g;
H5_DLLVAR hid_t H5T_NATIVE_HBOOL_g;
/* C9x integer types */
-#define H5T_NATIVE_INT8 (H5OPEN H5T_NATIVE_INT8_g)
-#define H5T_NATIVE_UINT8 (H5OPEN H5T_NATIVE_UINT8_g)
-#define H5T_NATIVE_INT_LEAST8 (H5OPEN H5T_NATIVE_INT_LEAST8_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT8 (H5OPEN H5T_NATIVE_INT8_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT8 (H5OPEN H5T_NATIVE_UINT8_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_LEAST8 (H5OPEN H5T_NATIVE_INT_LEAST8_g)
+/**
+ * \ingroup PDTC9x
+ */
#define H5T_NATIVE_UINT_LEAST8 (H5OPEN H5T_NATIVE_UINT_LEAST8_g)
-#define H5T_NATIVE_INT_FAST8 (H5OPEN H5T_NATIVE_INT_FAST8_g)
-#define H5T_NATIVE_UINT_FAST8 (H5OPEN H5T_NATIVE_UINT_FAST8_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_FAST8 (H5OPEN H5T_NATIVE_INT_FAST8_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT_FAST8 (H5OPEN H5T_NATIVE_UINT_FAST8_g)
H5_DLLVAR hid_t H5T_NATIVE_INT8_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT8_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_LEAST8_g;
@@ -459,12 +965,30 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_LEAST8_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_FAST8_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST8_g;
-#define H5T_NATIVE_INT16 (H5OPEN H5T_NATIVE_INT16_g)
-#define H5T_NATIVE_UINT16 (H5OPEN H5T_NATIVE_UINT16_g)
-#define H5T_NATIVE_INT_LEAST16 (H5OPEN H5T_NATIVE_INT_LEAST16_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT16 (H5OPEN H5T_NATIVE_INT16_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT16 (H5OPEN H5T_NATIVE_UINT16_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_LEAST16 (H5OPEN H5T_NATIVE_INT_LEAST16_g)
+/**
+ * \ingroup PDTC9x
+ */
#define H5T_NATIVE_UINT_LEAST16 (H5OPEN H5T_NATIVE_UINT_LEAST16_g)
-#define H5T_NATIVE_INT_FAST16 (H5OPEN H5T_NATIVE_INT_FAST16_g)
-#define H5T_NATIVE_UINT_FAST16 (H5OPEN H5T_NATIVE_UINT_FAST16_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_FAST16 (H5OPEN H5T_NATIVE_INT_FAST16_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT_FAST16 (H5OPEN H5T_NATIVE_UINT_FAST16_g)
H5_DLLVAR hid_t H5T_NATIVE_INT16_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT16_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_LEAST16_g;
@@ -472,12 +996,30 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_LEAST16_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_FAST16_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST16_g;
-#define H5T_NATIVE_INT32 (H5OPEN H5T_NATIVE_INT32_g)
-#define H5T_NATIVE_UINT32 (H5OPEN H5T_NATIVE_UINT32_g)
-#define H5T_NATIVE_INT_LEAST32 (H5OPEN H5T_NATIVE_INT_LEAST32_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT32 (H5OPEN H5T_NATIVE_INT32_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT32 (H5OPEN H5T_NATIVE_UINT32_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_LEAST32 (H5OPEN H5T_NATIVE_INT_LEAST32_g)
+/**
+ * \ingroup PDTC9x
+ */
#define H5T_NATIVE_UINT_LEAST32 (H5OPEN H5T_NATIVE_UINT_LEAST32_g)
-#define H5T_NATIVE_INT_FAST32 (H5OPEN H5T_NATIVE_INT_FAST32_g)
-#define H5T_NATIVE_UINT_FAST32 (H5OPEN H5T_NATIVE_UINT_FAST32_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_FAST32 (H5OPEN H5T_NATIVE_INT_FAST32_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT_FAST32 (H5OPEN H5T_NATIVE_UINT_FAST32_g)
H5_DLLVAR hid_t H5T_NATIVE_INT32_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT32_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_LEAST32_g;
@@ -485,12 +1027,30 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_LEAST32_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_FAST32_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST32_g;
-#define H5T_NATIVE_INT64 (H5OPEN H5T_NATIVE_INT64_g)
-#define H5T_NATIVE_UINT64 (H5OPEN H5T_NATIVE_UINT64_g)
-#define H5T_NATIVE_INT_LEAST64 (H5OPEN H5T_NATIVE_INT_LEAST64_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT64 (H5OPEN H5T_NATIVE_INT64_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT64 (H5OPEN H5T_NATIVE_UINT64_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_LEAST64 (H5OPEN H5T_NATIVE_INT_LEAST64_g)
+/**
+ * \ingroup PDTC9x
+ */
#define H5T_NATIVE_UINT_LEAST64 (H5OPEN H5T_NATIVE_UINT_LEAST64_g)
-#define H5T_NATIVE_INT_FAST64 (H5OPEN H5T_NATIVE_INT_FAST64_g)
-#define H5T_NATIVE_UINT_FAST64 (H5OPEN H5T_NATIVE_UINT_FAST64_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_INT_FAST64 (H5OPEN H5T_NATIVE_INT_FAST64_g)
+/**
+ * \ingroup PDTC9x
+ */
+#define H5T_NATIVE_UINT_FAST64 (H5OPEN H5T_NATIVE_UINT_FAST64_g)
H5_DLLVAR hid_t H5T_NATIVE_INT64_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT64_g;
H5_DLLVAR hid_t H5T_NATIVE_INT_LEAST64_g;
@@ -499,98 +1059,1827 @@ H5_DLLVAR hid_t H5T_NATIVE_INT_FAST64_g;
H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g;
/* Operations defined on all datatypes */
-H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size);
-H5_DLL hid_t H5Tcopy(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Creates a new datatype.
+ *
+ * \param[in] type Class of datatype to create
+ * \param[in] size Size, in bytes, of the datatype being created
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Tcreate() creates a new datatype of the specified class with the
+ * specified number of bytes. This function is used only with the
+ * following datatype classes:
+ * - #H5T_COMPOUND
+ * - #H5T_OPAQUE
+ * - #H5T_ENUM
+ * - #H5T_STRING
+ *
+ * Other datatypes, including integer and floating-point datatypes,
+ * are typically created by using H5Tcopy() to copy and modify a
+ * predefined datatype.
+ *
+ * When creating a variable-length string datatype, \p size must
+ * be #H5T_VARIABLE; see \ref_vlen_strings.
+ *
+ * When creating a fixed-length string datatype, \p size will
+ * be the length of the string in bytes. The length of the
+ * string in characters will depend on i the encoding used; see
+ * H5Pset_char_encoding().
+ *
+ * ENUMs created with this function have a signed native integer
+ * base datatype. Use H5Tenum_create() if a different integer base
+ * datatype is required.
+ *
+ * The datatype identifier returned from this function should be
+ * released with H5Tclose or resource leaks will result.
+ *
+ * \see H5Tclose()
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size);
+/**
+ * \ingroup H5T
+ *
+ * \brief Copies an existing datatype.
+ *
+ * \type_id
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Tcopy() makes a copy of an existing datatype. The returned type
+ * is always transient and unlocked.
+ *
+ * The \p type_id argument can be either a datatype identifier,
+ * a predefined datatype (defined in H5Tpublic.h), or a dataset
+ * identifier. If \p type_id is a dataset identifier, this function
+ * returns a transient, modifiable datatype which is a copy of the
+ * dataset's datatype.
+ *
+ * The returned datatype identifier should be released with H5Tclose()
+ * to prevent resource leak.
+ *
+ */
+H5_DLL hid_t H5Tcopy(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Releases a datatype
+ *
+ * \type_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tclose() releases the datatype \p dtype_id. Further access
+ * through this datatype identifier is illegal. Failure to release
+ * a datatype with this call will result in resource leaks.
+ *
+ */
H5_DLL herr_t H5Tclose(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Determines whether two datatype identifiers refer to the same datatype
+ *
+ * \type_id{type1_id}
+ * \type_id{type2_id}
+ *
+ * \return \htri_t
+ *
+ * \details H5Tequal() determines whether two datatype identifiers refer to
+ * the same datatype.
+ *
+ * \since 1.6 or earlier
+ *
+ */
H5_DLL htri_t H5Tequal(hid_t type1_id, hid_t type2_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Locks a datatype
+ *
+ * \type_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tlock() locks the datatype specified by the dtype_id identifier,
+ * making it read-only and non-destructible. This is normally done by
+ * the library for predefined datatypes so the application does not
+ * inadvertently change or delete a predefined type. Once a datatype
+ * is locked it can never be unlocked.
+ *
+ */
H5_DLL herr_t H5Tlock(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Commits a transient datatype, linking it into the file and creating
+ * a new committed datatype
+ *
+ * \fg_loc_id
+ * \param[in] name Name given to committed datatype
+ * \type_id Identifier of datatype to be committed and, upon function’s
+ * return, identifier for the committed datatype
+ * \lcpl_id
+ * \tcpl_id
+ * \tapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tcommit2() saves a transient datatype as an immutable committed
+ * datatype in a file. The datatype specified by \p dtype_id is
+ * committed to the file with the name name at the location specified
+ * by \p loc_id and with the datatype creation and access property
+ * lists \p tcpl_id and \p tapl_id, respectively.
+ *
+ * \p loc_id may be a file identifier, or a group identifier within
+ * that file. \p name may be either an absolute path in the file or
+ * a relative path from \p loc_id naming the newly-commited datatype.
+ *
+ * The link creation property list, \p lcpl_id, governs creation of
+ * the link(s) by which the new committed datatype is accessed and
+ * the creation of any intermediate groups that may be missing.
+ *
+ * Once commited, this datatype may be used to define the datatype
+ * of any other dataset or attribute in the file.
+ *
+ * This function will not accept a datatype that cannot actually hold
+ * information. This currently includes compound datatypes with no
+ * fields and enumerated datatypes with no members.
+ *
+ * Committed datatypes are sometimes referred to as named datatypes.
+ *
+ * \version 1.8.7 Function modified in this release to reject datatypes that
+ * will not accomodate actual data, such as a compound datatype
+ * with no fields or an enumerated datatype with no members.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
hid_t tapl_id);
-H5_DLL hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5T
+ *
+ * \brief Opens a committed (named) datatype
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the datatype to open
+ * \tapl_id
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Topen2() opens a committed datatype at the location specified
+ * by \p loc_id and returns an identifier for the datatype. \p
+ * loc_id is either a file or group identifier. The identifier should
+ * eventually be closed by calling H5Tclose() to release resources.
+ *
+ * The committed datatype is opened with the datatype access property
+ * list tapl_id.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Commits a transient datatype to a file, creating a new named
+ * datatype, but does not link it into the file structure
+ *
+ * \fg_loc_id
+ * \type_id
+ * \tcpl_id
+ * \tapl_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tcommit_anon() commits a transient datatype (not immutable)
+ * to a file, turning it into a named datatype with the specified
+ * creation and property lists. With default property lists,
+ * #H5P_DEFAULT, H5Tcommit_anon() provides similar functionality to
+ * that of H5Tcommit(), with the differences described below.
+ *
+ * #H5P_DEFAULT can be passed in for the datatype creation property
+ * list identifier, \p tcpl_id. The datatype access property list
+ * identifier, \p tapl_id, is provided for future functionality and
+ * is not used at this time. This parameter should always be passed
+ * as the value #H5P_DEFAULT.
+ *
+ * Note that H5Tcommit_anon() does not link this newly-committed
+ * datatype into the file. After the H5Tcommit_anon() call, the
+ * datatype identifier \p type_id must be linked into the HDF5 file
+ * structure with H5Olink() or it will be deleted from the file when
+ * the file is closed.
+ *
+ * The differences between this function and H5Tcommit() are as follows:
+ * \li H5Tcommit_anon() explicitly includes property lists,
+ * which provides for greater control of the creation process
+ * and of the properties of the new named datatype. H5Tcommit()
+ * always uses default properties.
+ * \li H5Tcommit_anon() neither provides the new named datatype’s
+ * name nor links it into the HDF5 file structure; those actions
+ * must be performed separately through a call to H5Olink(),
+ * which offers greater control over linking.
+ *
+ * This function will not accept a datatype that cannot actually
+ * hold data. This currently includes compound datatypes with no
+ * fields and enumerated datatypes with no members.
+ *
+ * \version 1.8.7 Function modified in this release to reject datatypes that
+ * will not accomodate actual data, such as a compound datatype
+ * with no fields or an enumerated datatype with no members.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id);
-H5_DLL hid_t H5Tget_create_plist(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Returns a copy of a datatype's creation property list
+ *
+ * \type_id
+ *
+ * \return \hid_t{datatype creation property list}
+ *
+ * \details H5Tget_create_plist() returns a property list identifier
+ * for the datatype creation property list associated with the datatype
+ * specified by \p type_id.
+ *
+ * The creation property list identifier should be released with
+ * H5Pclose() to prevent memory leaks.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Tget_create_plist(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Determines whether a datatype is a committed type or a transient type
+ *
+ * \type_id
+ *
+ * \return \htri_t
+ *
+ * \details H5Tcommitted() queries a type to determine whether the type
+ * specified by the \p dtype_id identifier is a committed (formerly
+ * known as a \Emph{named}) type or a transient type. If this function returns
+ * a positive value, then the type is committed (that is, it has been
+ * committed, perhaps by some other application). Datasets which
+ * return committed datatypes with H5Dget_type() are able to share
+ * the datatype with other datasets in the same file.
+ *
+ * \version 1.8.0 Fortran API was added
+ *
+ * \since 1.6 or earlier
+ *
+ */
H5_DLL htri_t H5Tcommitted(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Encodes a datatype object description into a binary buffer
+ *
+ * \param[in] obj_id Identifier of the object to be encoded
+ * \param[in,out] buf Buffer for the object to be encoded into.
+ * \param[in,out] nalloc IN: The size of the allocated buffer
+ * OUT: The size of the buffer needed
+ *
+ * \return \herr_t
+ *
+ * \details H5Tencode() Given datatype identifier, H5Tencode() converts a
+ * datatype description into binary form in a buffer. Using this
+ * binary form in the buffer, a datatype object can be reconstructed
+ * using H5Tdecode() to return a new object handle (\ref hid_t) for
+ * this datatype.
+ *
+ * If the provided buffer is NULL, only the size of buffer needed is
+ * returned through \p nalloc.
+ *
+ * A preliminary H5Tencode() call can be made to find out the size
+ * of the buffer needed. This value is returned as \p nalloc. That
+ * value can then be assigned to \p nalloc for a second H5Tencode()
+ * call, which will retrieve the actual encoded object.
+ *
+ * If the library finds that \p nalloc is not big enough for the
+ * object, it simply returns the size of the buffer needed through
+ * \p nalloc without encoding the provided buffer.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tencode(hid_t obj_id, void *buf, size_t *nalloc);
-H5_DLL hid_t H5Tdecode(const void *buf);
+/**
+ * \ingroup H5T
+ *
+ * \brief Decodes a binary object description of datatype and return a new
+ * object handle
+ *
+ * \param[in] buf Buffer for the datatype object to be decoded
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Tdecode() Given an object description of datatype in binary in a
+ * buffer, H5Tdecode() reconstructs the HDF5 datatype object and
+ * returns a new object handle for it. The binary description of
+ * the object is encoded by H5Tencode(). User is responsible for
+ * passing in the right buffer.
+ *
+ * The datatype identifier returned by this function can be released
+ * with H5Tclose() when the identifier is no longer needed so that
+ * resource leaks will not develop.
+ *
+ */
+H5_DLL hid_t H5Tdecode(const void *buf);
+/**
+ * \ingroup H5T
+ *
+ * \brief Flushes all buffers associated with a committed datatype to disk
+ *
+ * \type_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tflush() causes all buffers associated with a committed datatype
+ * \p type_id to be immediately flushed to disk without removing the
+ * data from the cache.
+ *
+ * HDF5 does not possess full control over buffering. H5Tflush()
+ * flushes the internal HDF5 buffers and then asks the operating
+ * system (the OS) to flush the system buffers for the open
+ * files. After that, the OS is responsible for ensuring that the
+ * data is actually flushed to disk.
+ *
+ * \return \herr_t
+ *
+ * \since 1.10.0 C function introduced with this release.
+ *
+ * \see H5Dflush()
+ * H5Drefresh()
+ * H5Tflush()
+ * H5Grefresh()
+ * H5Oflush()
+ * H5Orefresh()
+ * H5Tflush()
+ * H5Trefresh()
+ * H5Fstart_swmr_write()
+ * H5Pget_append_flush()
+ * H5Pget_object_flush_cb()
+ * H5Pset_append_flush()
+ * H5Pset_object_flush_cb()
+ *
+ */
H5_DLL herr_t H5Tflush(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Refreshes all buffers associated with a committed datatype
+ *
+ * \type_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Trefresh() causes all buffers associated with a committed
+ * datatype to be cleared and immediately re-loaded with updated
+ * contents from disk.
+ *
+ * This function essentially closes the datatype, evicts all
+ * metadata associated with it from the cache, and then re-opens the
+ * datatype. The reopened datatype is automatically re-registered
+ * with the same identifier.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Trefresh(hid_t type_id);
/* Operations defined on compound datatypes */
+/**
+ * \ingroup COMPOUND
+ *
+ * \brief Adds a new member to a compound datatype.
+ *
+ * \type_id{parent_id}
+ * \param[in] name Name of the field to insert
+ * \param[in] offset Offset in memory structure of the field to insert
+ * \param[in] member_id Datatype identifier of the field to insert
+ *
+ * \return \herr_t
+ *
+ * \details H5Tinsert() adds another member to the compound datatype, specified
+ * \p type_id.
+ *
+ * The new member has a \p name which must be unique within the
+ * compound datatype. The \p offset argument defines the start of the
+ * member in an instance of the compound datatype, and \p member_id
+ * is the datatype identifier of the new member.
+ *
+ * \note Members of a compound datatype do not have to be atomic
+ * datatypes; a compound datatype can have a member which is a
+ * compound datatype.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id);
+/**
+ * \ingroup COMPOUND
+ *
+ * \brief Recursively removes padding from within a compound datatype
+ *
+ * \type_id
+ *
+ * \return \herr_t
+ *
+ * \details H5Tpack() recursively removes padding from within a compound
+ * datatype to make it more efficient (space-wise) to store that data.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tpack(hid_t type_id);
/* Operations defined on enumeration datatypes */
-H5_DLL hid_t H5Tenum_create(hid_t base_id);
+/**
+ * \ingroup ENUM
+ *
+ * \brief Creates a new enumeration datatype
+ *
+ * \param[in] base_id Datatype identifier for the base datatype. Must be an
+ * integer datatype
+ *
+ * \return \hid_t{enumeration datatype}
+ *
+ * \details H5Tenum_create() creates a new enumeration datatype based on the
+ * specified base datatype, dtype_id, which must be an integer datatype.
+ *
+ * If a particular architecture datatype is required, a little endian
+ * or big endian datatype for example, use a native datatype as the
+ * base datatype and use H5Tconvert() on values as they are read
+ * from or written to a dataset.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL hid_t H5Tenum_create(hid_t base_id);
+/**
+ * \ingroup ENUM
+ *
+ * \brief Inserts a new enumeration datatype member
+ *
+ * \type_id{type}
+ * \param[in] name Name of the new member
+ * \param[in] value Pointer to the value of the new member
+ *
+ * \return \herr_t
+ *
+ * \details H5Tenum_insert() inserts a new enumeration datatype member into an
+ * enumeration datatype.
+ *
+ * \p type_id is the datatype identifier for the enumeration datatype,
+ * \p name is the name of the new member, and \p value points to the
+ * value of the new member.
+ *
+ * \p name and \p value must both be unique within \p dtype_id.
+ *
+ * \p value points to data which must be of the integer base datatype
+ * used when the enumeration datatype was created. If a particular
+ * architecture datatype is required, a little endian or big endian
+ * datatype for example, use a native datatype as the base datatype
+ * and use H5Tconvert() on values as they are read from or written
+ * to a dataset.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tenum_insert(hid_t type, const char *name, const void *value);
+/**
+ * \ingroup ENUM
+ *
+ * \brief Returns the symbol name corresponding to a specified member of an
+ * enumeration datatype
+ *
+ * \type_id{type}
+ * \param[in] value Value of the enumeration datatype
+ * \param[out] name Buffer for output of the symbol name
+ * \param[in] size Anticipated size of the symbol name, in bytes
+ *
+ * \return Returns a non-negative value if successful. Otherwise returns a
+ * negative value
+ *
+ * \details H5Tenum_nameof() finds the symbol name that corresponds to the
+ * specified \p value of the enumeration datatype \p type.
+ *
+ * At most \p size characters of the symbol \p name are copied into
+ * the \p name buffer. If the entire symbol name and null terminator
+ * do not fit in the name buffer, then as many characters as possible
+ * are copied (not null terminated) and the function fails.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tenum_nameof(hid_t type, const void *value, char *name /*out*/, size_t size);
+/**
+ * \ingroup ENUM
+ *
+ * \brief Returns the value corresponding to a specified member of an
+ * enumeration datatype
+ *
+ * \type_id{type}
+ * \param[in] name Symbol name of the enumeration datatype
+ * \param[out] value Buffer for the value of the enumeration datatype
+ *
+ * \return \herr_t
+ *
+ * \details H5Tenum_valueof() finds the value that corresponds to the
+ * specified name of the enumeration datatype \p dtype_id.
+ *
+ * Values returned in \p value will be of the enumerated type’s
+ * base type, that is, the datatype used by H5Tenum_create() when
+ * the enumerated type was created.
+ *
+ * The \p value buffer must be at least large enough to hold a value
+ * of that base type. If the size is unknown, you can determine it
+ * with H5Tget_size().
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/);
/* Operations defined on variable-length datatypes */
+/**
+ * \ingroup VLEN
+ *
+ * \brief Creates a new variable-length array datatype
+ *
+ * \type_id{base_id}, the element type of the datatype to create
+ *
+ * \return \hid_t{variable-length datatype}
+ *
+ * \details H5Tvlen_create() creates a new one-dimensional array datatype of
+ * variable-length (VL) with the base datatype \p base_id.
+ *
+ * This one-dimensional array often represents a data sequence of the
+ * base datatype, such as characters for character sequences or vertex
+ * coordinates for polygon lists. The base type specified for the VL
+ * datatype can be any HDF5 datatype, including another VL datatype, a
+ * compound datatype, or an atomic datatype.
+ *
+ * When necessary, use H5Tget_super() to determine the base type of
+ * the VL datatype.
+ *
+ * The datatype identifier returned from this function should be
+ * released with H5Tclose() or resource leaks will result. Under
+ * certain circumstances, H5Dvlen_reclaim() must also be used.
+ *
+ * \attention H5Tvlen_create() cannot be used to create a variable-length
+ * string datatype. H5Tvlen_create() called with a string or
+ * character base type creates a variable-length sequence of strings
+ * (a variable-length, 1-dimensional array), with each element of
+ * the array being of the string or character base type.\n
+ * To create a variable-length string datatype, see \ref_vlen_strings.
+ *
+ */
H5_DLL hid_t H5Tvlen_create(hid_t base_id);
/* Operations defined on array datatypes */
+/**
+ * \ingroup ARRAY
+ *
+ * \brief Creates an array datatype object
+ *
+ * \param[in] base_id Datatype identifier for the array base datatype
+ * \param[in] ndims Rank of the array
+ * \param[in] dim Size of each array dimension
+ *
+ * \return \hid_t{array datatype}
+ *
+ * \details H5Tarray_create2() creates a new array datatype object.\n\n
+ * \p base_id is the datatype of every element of the array, i.e.,
+ * of the number at each position in the array.
+ *
+ * \p ndims is the number of dimensions and the size of each dimension
+ * is specified in the array \p dim. The value of \p rank is
+ * currently limited to #H5S_MAX_RANK and must be greater than 0
+ * (zero). All dimension sizes specified in \p dim must be greater
+ * than 0 (zero).
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL hid_t H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */]);
-H5_DLL int H5Tget_array_ndims(hid_t type_id);
-H5_DLL int H5Tget_array_dims2(hid_t type_id, hsize_t dims[]);
+/**
+ * \ingroup ARRAY
+ *
+ * \brief Returns the rank of an array datatype
+ *
+ * \type_id
+ *
+ * \return Returns the rank of the array if successful; otherwise returns a
+ * negative value.
+ *
+ * \details H5Tget_array_ndims() returns the rank, i.e., the number of
+ * dimensions, of an array datatype object.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_array_ndims(hid_t type_id);
+/**
+ * \ingroup ARRAY
+ *
+ * \brief Retrieves sizes of array dimensions
+ *
+ * \type_id
+ * \param[out] dims Sizes of array dimensions
+ *
+ * \return Returns the non-negative number of dimensions of the array type
+ * if successful; otherwise returns a negative value.
+ *
+ * \details H5Tget_array_dims2() returns the sizes of the dimensions of the
+ * specified array datatype object in the array \p dims.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_array_dims2(hid_t type_id, hsize_t dims[]);
/* Operations defined on opaque datatypes */
+/**
+ * \ingroup OPAQUE
+ *
+ * \brief Tags an opaque datatype
+ *
+ * \type_id{type} of an opaque datatype
+ * \param[in] tag Descriptive ASCII string with which the opaque datatype is
+ * to be tagged
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_tag() tags an opaque datatype \p type with a descriptive
+ * ASCII identifier, \p tag.
+ *
+ * \p tag is intended to provide a concise description; the maximum
+ * size is hard-coded in the HDF5 library as 256 bytes
+ * (#H5T_OPAQUE_TAG_MAX).
+ *
+ * \version 1.6.5 The #H5T_OPAQUE_TAG_MAX macro constant, specifying the
+ * maximum size of an opaque datatype tag, was added in
+ * H5Tpublic.h.
+ *
+ */
H5_DLL herr_t H5Tset_tag(hid_t type, const char *tag);
-H5_DLL char * H5Tget_tag(hid_t type);
+/**
+ * \ingroup OPAQUE
+ *
+ * \brief Gets the tag associated with an opaque datatype
+ *
+ * \type_id{type} of an opaque datatype
+ *
+ * \return Returns a pointer to an allocated string if successful; otherwise
+ * returns NULL.
+ *
+ * \details H5Tget_tag() returns the tag associated with the opaque datatype
+ * \p type.
+ *
+ * \attention The tag is returned via a pointer to an allocated string, which
+ * the caller must free.
+ *
+ */
+H5_DLL char *H5Tget_tag(hid_t type);
/* Querying property values */
-H5_DLL hid_t H5Tget_super(hid_t type);
+/**
+ * \ingroup H5T
+ *
+ * \brief Returns the base datatype from which a datatype is derived
+ *
+ * \type_id{type}
+ *
+ * \return \hid_t{datatype}
+ *
+ * \details H5Tget_super() returns the base datatype from which the datatype
+ * \p type_id is derived. In the case of an enumeration type, the
+ * return value is an integer type.
+ *
+ * The datatype identifier returned by this function must be released
+ * with H5Tclose() when the identifier is no longer needed so that
+ * resource leaks will not develop.
+ *
+ */
+H5_DLL hid_t H5Tget_super(hid_t type);
+/**
+ * \ingroup H5T
+ *
+ * \brief Returns a datatype class
+ *
+ * \type_id
+ *
+ * \return Returns the datatype class if successful; otherwise #H5T_NO_CLASS.
+ *
+ * \details H5Tget_class() returns the class of the datatype \p type_id.
+ * Valid class identifiers, as defined in H5Tpublic.h, are:
+ * \snippet this H5T_class_t_snip
+ *
+ * \note The library returns #H5T_STRING for both fixed-length and
+ * variable-length strings.
+ *
+ * \note Unsupported datatype: The time datatype class, #H5T_TIME,
+ * is not supported. If #H5T_TIME is used, the resulting data will
+ * be readable and modifiable only on the originating computing
+ * platform; it will not be portable to other platforms.
+ *
+ */
H5_DLL H5T_class_t H5Tget_class(hid_t type_id);
-H5_DLL htri_t H5Tdetect_class(hid_t type_id, H5T_class_t cls);
-H5_DLL size_t H5Tget_size(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Determines whether a datatype contains any datatypes of the given
+ * datatype class
+ *
+ * \type_id
+ * \param[in] cls Datatype class
+ *
+ * \return \htri_t
+ *
+ * \details H5Tdetect_class() determines whether the datatype specified in
+ * \p type_id contains any datatypes of the datatype class specified
+ * in \p dtype_class.
+ *
+ * This function is useful primarily in recursively examining all the
+ * fields and/or base types of compound, array, and variable-length
+ * datatypes.
+ *
+ * Valid class identifiers, as defined in H5Tpublic.h, are:
+ * \snippet this H5T_class_t_snip
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL htri_t H5Tdetect_class(hid_t type_id, H5T_class_t cls);
+/**
+ * \ingroup H5T
+ *
+ * \brief Returns the size of a datatype
+ *
+ * \type_id
+ *
+ * \return Returns the size of the datatype in bytes if successful; otherwise,
+ * returns 0.
+ *
+ * \details H5Tget_size() returns the size of a datatype in bytes.
+ * \li For atomic datatypes, array datatypes, compound datatypes, and
+ * other datatypes of a constant size, the returned value is the
+ * size of the actual datatype in bytes.
+ * \li For variable-length string datatypes the returned value is
+ * the size of the pointer to the actual string, or \c sizeof(\c
+ * char \c *). This function does not return the size of actual
+ * variable-length string data.
+ * \li For variable-length sequence datatypes (see H5Tvlen_create()),
+ * the returned value is the size of the \p hvl_t struct, or \c
+ * sizeof(\p hvl_t). The \p hvl_t struct contains a pointer to the
+ * actual data and a size value. This function does not return the
+ * size of actual variable-length sequence data.
+ *
+ * \see H5Tset_size()
+ *
+ * \since 1.2.0
+ */
+H5_DLL size_t H5Tget_size(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Returns the byte order of an atomic datatype
+ *
+ * \type_id
+ *
+ * \return Returns a byte order constant if successful; otherwise returns
+ * #H5T_ORDER_ERROR (-1)
+ *
+ * \details H5Tget_order() returns the byte order of an atomic datatype.
+ * Possible return values are:
+ * \snippet this H5T_order_t_snip
+ * Members of a compound datatype need not have the same byte
+ * order. If members of a compound datatype have more than one of
+ * little endian, big endian, or VAX byte order, H5Tget_order() will
+ * return #H5T_ORDER_MIXED for the compound datatype. A byte order of
+ * #H5T_ORDER_NONE will, however, be ignored; for example, if one or
+ * more members of a compound datatype have byte order #H5T_ORDER_NONE
+ * but all other members have byte order #H5T_ORDER_LE, H5Tget_order()
+ * will return #H5T_ORDER_LE for the compound datatype.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL H5T_order_t H5Tget_order(hid_t type_id);
-H5_DLL size_t H5Tget_precision(hid_t type_id);
-H5_DLL int H5Tget_offset(hid_t type_id);
-H5_DLL herr_t H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out*/, H5T_pad_t *msb /*out*/);
-H5_DLL H5T_sign_t H5Tget_sign(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Returns the precision of an atomic datatype
+ *
+ * \type_id
+ *
+ * \return Returns the number of significant bits if successful; otherwise 0
+ *
+ * \details H5Tget_precision() returns the precision of an atomic datatype
+ * (for example, integer or float) or a datatype whose base (parent)
+ * type is an atomic type (for example, array, enum and variable
+ * length). The precision is the number of significant bits which,
+ * unless padding is present, is 8 times larger than the value
+ * returned by H5Tget_size().
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL size_t H5Tget_precision(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the bit offset of the first significant bit
+ *
+ * \type_id
+ *
+ * \return Returns an offset value if successful; otherwise returns a
+ * negative value.
+ *
+ * \details H5Tget_offset() retrieves the bit offset of the first significant
+ * bit. The significant bits of an atomic datum can be offset from the
+ * beginning of the memory for that datum by an amount of padding. The
+ * 'offset' property specifies the number of bits of padding that
+ * appear to the "right of" the value. That is, if we have a 32-bit
+ * datum with 16-bits of precision having the value 0x1122 then it
+ * will be laid out in memory as (from small byte address toward
+ * larger byte addresses):
+ * \code{.unparsed}
+ * 0: [ pad] [0x11] [0x22] [ pad]
+ * 1: [ pad] [0x22] [0x11] [ pad]
+ * 2: [0x11] [ pad] [ pad] [0x22]
+ * 3: [0x22] [ pad] [ pad] [0x11]
+ * \endcode
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_offset(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the padding type of the least and most-significant bit padding
+ *
+ * \type_id
+ * \param[out] lsb Buffer for the least-significant bit padding type
+ * \param[out] msb Buffer for the most-significant bit padding type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tget_pad() retrieves the padding type of the least and
+ * most-significant bit padding. Valid padding types are:
+ * \snippet this H5T_pad_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out*/, H5T_pad_t *msb /*out*/);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the sign type for an integer type
+ *
+ * \type_id
+ *
+ * \return Returns a valid sign type if successful; otherwise #H5T_SGN_ERROR (-1)
+ *
+ * \details H5Tget_sign() retrieves the sign type for an integer type.
+ * Valid types are:
+ * \snippet this H5T_sign_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL H5T_sign_t H5Tget_sign(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves floating point datatype bit field information
+ *
+ * \type_id
+ * \param[out] spos Pointer to location to return floating-point sign bit
+ * \param[out] epos Pointer to location to return exponent bit-position
+ * \param[out] esize Pointer to location to return size of exponent in bits
+ * \param[out] mpos Pointer to location to return mantissa bit-position
+ * \param[out] msize Pointer to location to return size of mantissa in bits
+ *
+ * \return \herr_t
+ *
+ * \details H5Tget_fields() retrieves information about the locations of
+ * the various bit fields of a floating point datatype. The field
+ * positions are bit positions in the significant region of the
+ * datatype. Bits are numbered with the least significant bit number
+ * zero. Any (or even all) of the arguments can be null pointers.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tget_fields(hid_t type_id, size_t *spos /*out*/, size_t *epos /*out*/, size_t *esize /*out*/,
size_t *mpos /*out*/, size_t *msize /*out*/);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the exponent bias of a floating-point type
+ *
+ * \type_id
+ *
+ * \return Returns the bias if successful and 0, otherwise.
+ *
+ * \details H5Tget_ebias() retrieves the exponent bias of a floating-point type.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL size_t H5Tget_ebias(hid_t type_id);
-H5_DLL H5T_norm_t H5Tget_norm(hid_t type_id);
-H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
-H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
-H5_DLL int H5Tget_nmembers(hid_t type_id);
-H5_DLL char * H5Tget_member_name(hid_t type_id, unsigned membno);
-H5_DLL int H5Tget_member_index(hid_t type_id, const char *name);
-H5_DLL size_t H5Tget_member_offset(hid_t type_id, unsigned membno);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ATOM
+ *
+ * \brief Retrieves mantissa normalization of a floating-point datatype
+ *
+ * \type_id
+ *
+ * \return Returns a valid normalization type if successful; otherwise
+ * returns #H5T_NORM_ERROR (-1)
+ *
+ * \details H5Tget_norm() retrieves the mantissa normalization of a
+ * floating-point datatype. Valid normalization types are:
+ * \snippet this H5T_norm_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL H5T_norm_t H5Tget_norm(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the internal padding type for unused bits in floating-point
+ * datatypes
+ *
+ * \type_id
+ *
+ * \return Returns a valid padding type if successful; otherwise returns
+ * #H5T_PAD_ERROR (-1).
+ *
+ * \details H5Tget_inpad() retrieves the internal padding type for unused
+ * bits in floating-point datatypes. Valid padding types are:
+ * \snippet this H5T_pad_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the type of padding used for a string datatype
+ *
+ * \type_id
+ *
+ * \return Returns a valid string of the padding if successful; otherwise
+ * returns #H5T_STR_ERROR (-1)
+ *
+ * \details H5Tget_strpad() retrieves the type of padding used for a string
+ * datatype.
+ *
+ * The string padding type is set with H5Tset_strpad(). Possible
+ * values returned are:
+ * \str_pad_type
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
+/**
+ * \ingroup COMPOUND ENUM
+ *
+ * \brief Retrieves the number of elements in a compound or enumeration datatype
+ *
+ * \type_id
+ *
+ * \return Returns the number of elements if successful; otherwise returns a
+ * negative value.
+ *
+ * \details H5Tget_nmembers() retrieves the number of fields in a compound
+ * datatype or the number of members of an enumeration datatype.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_nmembers(hid_t type_id);
+/**
+ * \ingroup COMPOUND ENUM
+ *
+ * \brief Retrieves the name of a compound or enumeration datatype member
+ *
+ * \type_id
+ * \param[in] membno Zero-based index of the field or element
+ *
+ * \return Returns a valid pointer to a string allocated with malloc() if
+ * successful; otherwise returns NULL.
+ *
+ * \details H5Tget_member_name() retrieves the name of a field of a compound
+ * datatype or an element of an enumeration datatype.
+ *
+ * The index of the target field or element is specified in \p
+ * member_no. Compound datatype fields and enumeration datatype
+ * elements are stored in no particular order with index values of
+ * 0 through N-1, where N is the value returned by H5Tget_nmembers().
+ *
+ * The HDF5 library allocates a buffer to receive the name of
+ * the field. The caller must subsequently free the buffer with
+ * H5free_memory().
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
+/**
+ * \ingroup COMPOUND ENUM
+ *
+ * \brief Retrieves the index of a compound or enumeration datatype member
+ *
+ * \type_id
+ * \param[in] name Name of the field or member
+ *
+ * \return \herr_t
+ *
+ * \details H5Tget_member_index() retrieves the index of a field of a compound
+ * datatype or an element of an enumeration datatype.
+ *
+ * The name of the target field or element is specified by \p name.
+ *
+ * Fields are stored in no particular order with index values of 0
+ * through N-1, where N is the value returned by H5Tget_nmembers() .
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_member_index(hid_t type_id, const char *name);
+/**
+ * \ingroup COMPOUND
+ *
+ * \brief Retrieves the offset of a field of a compound datatype
+ *
+ * \type_id
+ * \param[in] membno Zero-based index of the field or element
+ *
+ * \return Returns the byte offset of the field if successful; otherwise
+ * returns 0 (zero).
+ *
+ * \details H5Tget_member_offset() retrieves the byte offset of the beginning
+ * of a field within a compound datatype with respect to the beginning
+ * of the compound datatype datum.
+ *
+ * Note that zero is a valid offset and that this function will fail
+ * only if a call to H5Tget_member_class() fails with the same arguments.
+ *
+ * \version 1.6.4 \p member_no parameter type changed to unsigned.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL size_t H5Tget_member_offset(hid_t type_id, unsigned membno);
+/**
+ * \ingroup COMPOUND
+ *
+ * \brief Returns datatype class of compound datatype member
+ *
+ * \type_id
+ * \param[in] membno Zero-based index of the field or element
+ *
+ * \return Returns the datatype class, a non-negative value, if successful;
+ * otherwise returns a negative value.
+ *
+ * \details Given a compound datatype, \p dtype_id, H5Tget_member_class()
+ * returns the datatype class of the member specified by \p member_no.
+ *
+ * Valid class identifiers, as defined in H5Tpublic.h, are:
+ * \snippet this H5T_class_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno);
-H5_DLL hid_t H5Tget_member_type(hid_t type_id, unsigned membno);
-H5_DLL herr_t H5Tget_member_value(hid_t type_id, unsigned membno, void *value /*out*/);
-H5_DLL H5T_cset_t H5Tget_cset(hid_t type_id);
-H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
-H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
+/**
+ * \ingroup COMPOUND
+ *
+ * \brief Returns the datatype of the specified member
+ *
+ * \type_id
+ * \param[in] membno Zero-based index of the field or element
+ *
+ * \return Returns the identifier of a copy of the datatype of the field if
+ * successful; otherwise returns a negative value.
+ *
+ * \details H5Tget_member_type() returns the datatype of the specified member.
+ * The caller should invoke H5Tclose() to release resources associated
+ * with the type.
+ *
+ * \version 1.6.4 \p membno parameter type changed to unsigned.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL hid_t H5Tget_member_type(hid_t type_id, unsigned membno);
+/**
+ * \ingroup ENUM
+ *
+ * \brief Returns the value of an enumeration datatype member
+ *
+ * \type_id
+ * \param[in] membno Number of the enumeration datatype member
+ * \param[out] value Buffer for the value of the enumeration datatype member
+ *
+ * \return \herr_t
+ *
+ * \details H5Tget_member_value() returns the value of the enumeration datatype
+ * member \p member_no.
+ *
+ * The member value is returned in a user-supplied buffer pointed to
+ * by \p value. Values returned in \p value will be of the enumerated
+ * type’s base type, that is, the datatype used by H5Tenum_create()
+ * when the enumerated type was created.
+ *
+ * The value buffer must be at least large enough to hold a value
+ * of that base type. If the size is unknown, you can determine it
+ * with H5Tget_size().
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL herr_t H5Tget_member_value(hid_t type_id, unsigned membno, void *value /*out*/);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Retrieves the character set type of a string datatype
+ *
+ * \type_id
+ *
+ * \return Returns a valid character set type if successful; otherwise
+ * #H5T_CSET_ERROR (-1).
+ *
+ * \details H5Tget_cset() retrieves the character set type of a string datatype.
+ * Valid character set types are:
+ * \csets
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL H5T_cset_t H5Tget_cset(hid_t type_id);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Determines whether datatype is a variable-length string
+ *
+ * \type_id
+ *
+ * \return Returns:
+ * \li a positive value if the specified datatype is a variable-length
+ * string
+ * \li 0 if the specified datatype is not a variable-length string
+ * \li a negative value when the function fails
+ *
+ * \details H5Tis_variable_str() determines whether the datatype identified
+ * by \p dtype_id is a variable-length string.
+ *
+ * This function can be used to distinguish between fixed and
+ * variable-length string datatypes.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
+/**
+ * \ingroup H5T
+ *
+ * \brief Returns the native datatype identifier of a specified datatype
+ *
+ * \type_id
+ * \param[in] direction Direction of search
+ *
+ * \return \hid_t{native datatype}
+ *
+ * \details H5Tget_native_type() returns the equivalent native datatype
+ * identifier for the datatype specified by \p type_id.
+ *
+ * H5Tget_native_type() is designed primarily to facilitate use of
+ * the H5Dread() function, for which users otherwise must undertake a
+ * multi-step process to determine the native datatype of a dataset
+ * prior to reading it into memory. This function can be used for
+ * the following purposes:
+ *
+ * \li To determine the native datatype of an atomic datatype
+ * \li To determine the base datatype of an array, enumerated, or
+ * variable-length datatype
+ * \li To determine the native atomic datatypes of the individual
+ * components of a compound datatype
+ *
+ * For example, if \p type_id is a compound datatype, the returned
+ * datatype identifier will be for a similar compound datatype with
+ * each element converted to the corresponding native datatype;
+ * nested compound datatypes will be unwound. If \p type_id is an
+ * array, the returned datatype identifier will be for the native
+ * datatype of a single array element.
+ *
+ * H5Tget_native_type() selects the first matching native datatype
+ * from the following list:
+ *
+ * \li #H5T_NATIVE_CHAR
+ * \li #H5T_NATIVE_SHORT
+ * \li #H5T_NATIVE_INT
+ * \li #H5T_NATIVE_LONG
+ * \li #H5T_NATIVE_LLONG
+ *
+ * \li #H5T_NATIVE_UCHAR
+ * \li #H5T_NATIVE_USHORT
+ * \li #H5T_NATIVE_UINT
+ * \li #H5T_NATIVE_ULONG
+ * \li #H5T_NATIVE_ULLONG
+ *
+ * \li #H5T_NATIVE_FLOAT
+ * \li #H5T_NATIVE_DOUBLE
+ * \li #H5T_NATIVE_LDOUBLE
+ *
+ * \li #H5T_NATIVE_B8
+ * \li #H5T_NATIVE_B16
+ * \li #H5T_NATIVE_B32
+ * \li #H5T_NATIVE_B64
+ *
+ * The direction parameter indicates the order in which the library
+ * searches for a native datatype match. Valid values for direction
+ * are as follows:
+ * \snippet this H5T_direction_t_snip
+ *
+ * H5Tget_native_type() is designed primarily for use with integer,
+ * floating point, and bitfield datatypes. String, time, opaque, and
+ * reference datatypes are returned as a copy of dtype_id. See above
+ * for compound, array, enumerated, and variable-length datatypes.
+ *
+ * The identifier returned by H5Tget_native_type() should eventually
+ * be closed by calling H5Tclose() to release resources.
+ *
+ * \note Please note that a datatype is actually an object
+ * identifier or handle returned from opening the datatype. It
+ * is not persistent and its value can be different from one HDF5
+ * session to the next.
+ *
+ * \note H5Tequal() can be used to compare datatypes.
+ *
+ * \note HDF5 High Level APIs that may also be of interest are: H5LTdtype_to_text()
+ * creates a text description of a datatype. H5LTtext_to_dtype() creates an
+ * HDF5 datatype given a text description.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
/* Setting property values */
+/**
+ * \ingroup H5T
+ *
+ * \brief Sets size for a datatype.
+ *
+ * \type_id
+ * \param[in] size New datatype size is bytes or #H5T_VARIABLE
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_size() sets the total size, \p size, in bytes, for a
+ * datatype.
+ *
+ * \p size must have a positive value, unless it is passed in as
+ * #H5T_VARIABLE and the datatype is a string datatype.
+ *
+ * \li Numeric datatypes: If the datatype is atomic and the size
+ * is decreased so that significant bits of the datatype extend
+ * beyond the edge of the new size, then the offset property of the
+ * datatype is decreased toward zero. If the offset becomes zero
+ * and the significant bits of the datatype still hang over the edge
+ * of the new size, then the number of significant bits is decreased.
+ *
+ * \li String or character datatypes: The size set for a string
+ * datatype should include space for the null-terminator character,
+ * otherwise it will not be stored on (or retrieved from)
+ * disk. Adjusting the size of a string automatically sets the
+ * precision to \p 8*size.
+ *
+ * \li Variable-length string datatypes: If \p dtype_id is a
+ * variable-length string, size must normally be set to #H5T_VARIABLE.
+ * See \ref_vlen_strings.
+ *
+ * \li Compound datatypes: This function may be used to increase or
+ * decrease the size of a compound datatype, but the function will
+ * fail if the new size is too small to accommodate all member fields.
+ *
+ * \li Ineligible datatypes: This function cannot be used with
+ * enumerated datatypes (#H5T_ENUM), array datatypes (#H5T_ARRAY),
+ * variable-length array datatypes (#H5T_VLEN), or reference datatypes
+ * (#H5T_REFERENCE).
+ *
+ * \see H5Tget_size()
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_size(hid_t type_id, size_t size);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the byte order of a datatype
+ *
+ * \type_id
+ * \param[in] order Byte order constant
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_order() sets the byte order of a datatype.\n
+ * Byte order can currently be set to any of the following:
+ * \snippet this H5T_order_t_snip
+ * #H5T_ORDER_MIXED (3) is a valid value for order only when
+ * returned by the function H5Tget_order(); it cannot be set with
+ * H5Tset_order().
+ *
+ * #H5T_ORDER_NONE (4) is a valid value for order, but it has no
+ * effect. It is valid only for fixed-length strings and object and
+ * region references and specifies “no particular order.”
+ *
+ * The byte order of a derived datatype is initially the same as
+ * that of the parent type, but can be changed with H5Tset_order().
+ *
+ * This function cannot be used with a datatype after it has been
+ * committed.
+ *
+ * \note Special considerations:
+ * \li ENUM datatypes: Byte order must be set before any member on
+ * an ENUM is defined.
+ * \li Compound datatypes: Byte order is set individually on each member
+ * of a compound datatype; members of a compound datatype need not
+ * have the same byte order.
+ * \li Opaque datatypes: Byte order can be set but has no effect.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_order(hid_t type_id, H5T_order_t order);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the precision of an atomic datatype
+ *
+ * \type_id
+ * \param[in] prec Number of bits of precision for datatype
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_precision() sets the precision of an atomic datatype. The
+ * precision is the number of significant bits which, unless
+ * padding is present, is 8 times larger than the value returned
+ * by H5Tget_size().
+ *
+ * If the precision is increased then the offset is decreased and
+ * then the size is increased to insure that significant bits do not
+ * "hang over" the edge of the datatype.
+ *
+ * Changing the precision of an #H5T_STRING automatically changes
+ * the size as well. The precision must be a multiple of 8.
+ *
+ * When decreasing the precision of a floating point type, set the
+ * locations and sizes of the sign, mantissa, and exponent fields
+ * first.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_precision(hid_t type_id, size_t prec);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the bit offset of the first significant bit
+ *
+ * \type_id
+ * \param[in] offset Offset of first significant bit
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_offset() sets the bit offset of the first significant
+ * bit. The significant bits of an atomic datum can be offset from
+ * the beginning of the memory for that datum by an amount of
+ * padding. The offset property specifies the number of bits of
+ * padding that appear “to the right of” the value. That is,
+ * if we have a 32-bit datum with 16-bits of precision having the
+ * value 0x1122, then it will be laid out in memory as (from small
+ * byte address toward larger byte addresses):
+ * \code{.unparsed}
+ * 0: [ pad] [0x11] [0x22] [ pad]
+ * 1: [ pad] [0x22] [0x11] [ pad]
+ * 2: [0x11] [ pad] [ pad] [0x22]
+ * 3: [0x22] [ pad] [ pad] [0x11]
+ * \endcode
+ * If the offset is incremented then the total size is incremented
+ * also if necessary to prevent significant bits of the value from
+ * hanging over the edge of the datatype.
+ *
+ * The offset of an #H5T_STRING cannot be set to anything but zero.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_offset(hid_t type_id, size_t offset);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the least and most-significant bits padding types
+ *
+ * \type_id
+ * \param[in] lsb Padding type for least-significant bits
+ * \param[in] msb Padding type for most-significant bits
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_pad() sets the least and most-significant bits padding types.
+ * Available values are:
+ * \padding_type
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the sign property for an integer type
+ *
+ * \type_id
+ * \param[in] sign Sign type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_sign() sets the sign property for an integer type:
+ * \sign_prop
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_sign(hid_t type_id, H5T_sign_t sign);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets locations and sizes of floating point bit fields
+ *
+ * \type_id
+ * \param[in] spos Sign position, i.e., the bit offset of the floating-point
+ * sign bit
+ * \param[in] epos Exponent bit position
+ * \param[in] esize Size of exponent in bits
+ * \param[in] mpos Mantissa bit position
+ * \param[in] msize Size of mantissa in bits
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_fields() sets the locations and sizes of the various
+ * floating-point bit fields. The field positions are bit positions
+ * in the significant region of the datatype. Bits are numbered with
+ * the least significant bit number zero.
+ *
+ * Fields are not allowed to extend beyond the number of bits of
+ * precision, nor are they allowed to overlap with one another.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the exponent bias of a floating-point type
+ *
+ * \type_id
+ * \param[in] ebias Exponent bias value
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_ebias() sets the exponent bias of a floating-point type.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_ebias(hid_t type_id, size_t ebias);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets the mantissa normalization of a floating-point datatype
+ *
+ * \type_id
+ * \param[in] norm Mantissa normalization type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_norm() sets the mantissa normalization of a floating-point
+ * datatype. Valid normalization types are:
+ * \snippet this H5T_norm_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_norm(hid_t type_id, H5T_norm_t norm);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Fills unused internal floating-point bits
+ *
+ * \type_id
+ * \param[in] pad Padding type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_inpad() If any internal bits of a floating point-type are
+ * unused (that is, those significant bits which are not part of the
+ * sign, exponent, or mantissa), then H5Tset_inpad() will be filled
+ * according to the value of the padding value property inpad. Valid
+ * padding types are:
+ * \snippet this H5T_pad_t_snip
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_inpad(hid_t type_id, H5T_pad_t pad);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Sets character set to be used in a string or character datatype
+ *
+ * \type_id
+ * \param[in] cset Character set type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_cset() sets the character set to be used in a dataset with
+ * a string or character datatype.
+ *
+ * Valid values for cset include the following:
+ * \csets
+ * For example, if the character set for the datatype \p type_id is set
+ * to #H5T_CSET_UTF8, string or character data of datatype dtype_id
+ * will be encoded using the UTF-8 Unicode character set.
+ *
+ * ASCII and UTF-8 Unicode are the only currently supported character
+ * encodings. Extended ASCII encodings (for example, ISO 8859) are
+ * not supported. This encoding policy is not enforced by the HDF5
+ * library. Using encodings other than ASCII and UTF-8 can lead to
+ * compatibility and usability problems.
+ *
+ * Note that H5Tset_cset() sets the character set for a character or
+ * string datatype while H5Pset_char_encoding() sets the character
+ * set used for an HDF5 link or attribute name.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_cset(hid_t type_id, H5T_cset_t cset);
+/**
+ * \ingroup ATOM
+ *
+ * \brief Defines the type of padding used for character strings
+ *
+ * \type_id
+ * \param[in] strpad String padding type
+ *
+ * \return \herr_t
+ *
+ * \details H5Tset_strpad() defines the type of padding used for a string
+ * datatype.
+ *
+ * The method used to store character strings differs with the
+ * programming language. C usually null terminates strings while
+ * Fortran left-justifies and space-pads strings.
+ *
+ * Valid values of \p strpad are as follows:
+ * \str_pad_type
+ * When converting from a longer string to a shorter string, the
+ * behavior is as follows. If the shorter string is #H5T_STR_NULLPAD
+ * or #H5T_STR_SPACEPAD, then the string is simply truncated. If
+ * the short string is #H5T_STR_NULLTERM, it is truncated and a null
+ * terminator is appended.
+ *
+ * When converting from a shorter string to a longer string, the
+ * longer string is padded on the end by appending nulls or spaces.
+ *
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tset_strpad(hid_t type_id, H5T_str_t strpad);
/* Type conversion database */
+/**
+ * \ingroup CONV
+ *
+ * \brief Registers a datatype conversion function
+ *
+ * \param[in] pers Conversion function type
+ * \param[in] name Name displayed in diagnostic output
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[in] func Function to convert between source and destination datatypes
+ *
+ * \return \herr_t
+ *
+ * \details H5Tregister() registers a hard or soft conversion function for a
+ * datatype conversion path. The parameter \p pers indicates whether a
+ * conversion function is hard (#H5T_PERS_HARD) or soft
+ * (#H5T_PERS_SOFT). User-defined functions employing compiler casting
+ * are designated as \Emph{hard}; other user-defined conversion
+ * functions registered with the HDF5 library (with H5Tregister() )
+ * are designated as \Emph{soft}. The HDF5 library also has its own
+ * hard and soft conversion functions.
+ *
+ * A conversion path can have only one hard function. When type is
+ * #H5T_PERS_HARD, \p func replaces any previous hard function.
+ *
+ * When type is #H5T_PERS_SOFT, H5Tregister() adds the function to the
+ * end of the master soft list and replaces the soft function in all
+ * applicable existing conversion paths. Soft functions are used when
+ * determining which conversion function is appropriate for this path.
+ *
+ * The \p name is used only for debugging and should be a short
+ * identifier for the function.
+ *
+ * The path is specified by the source and destination datatypes \p
+ * src_id and \p dst_id. For soft conversion functions, only the class
+ * of these types is important.
+ *
+ * The type of the conversion function pointer is declared as:
+ * \snippet this H5T_conv_t_snip
+ *
+ * The \ref H5T_cdata_t \c struct is declared as:
+ * \snippet this H5T_cdata_t_snip
+ *
+ * \since 1.6.3 The following change occurred in the \ref H5T_conv_t function:
+ * the \c nelmts parameter type changed to size_t.
+ *
+ */
H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
+/**
+ * \ingroup CONV
+ *
+ * \brief Removes a conversion function
+ *
+ * \param[in] pers Conversion function type
+ * \param[in] name Name displayed in diagnostic output
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[in] func Function to convert between source and destination datatypes
+ *
+ * \return \herr_t
+ *
+ * \details H5Tunregister() removes a conversion function matching criteria
+ * such as soft or hard conversion, source and destination types, and
+ * the conversion function.
+ *
+ * If a user is trying to remove a conversion function he registered,
+ * all parameters can be used. If he is trying to remove a library’s
+ * default conversion function, there is no guarantee the \p name and
+ * \p func parameters will match the user’s chosen values. Passing in
+ * some values may cause this function to fail. A good practice is to
+ * pass in NULL as their values.
+ *
+ * All parameters are optional. The missing parameters will be used to
+ * generalize the search criteria.
+ *
+ * The conversion function pointer type declaration is described in
+ * H5Tregister().
+ *
+ * \version 1.6.3 The following change occurred in the \ref H5T_conv_t function:
+ * the \c nelmts parameter type changed to size_t.
+ *
+ */
H5_DLL herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
+/**
+ * \ingroup CONV
+ *
+ * \brief Finds a conversion function
+ *
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[out] pcdata Pointer to type conversion data
+ *
+ * \return Returns a pointer to a suitable conversion function if successful.
+ * Otherwise returns NULL.
+ *
+ * \details H5Tfind() finds a conversion function that can handle a conversion
+ * from type \p src_id to type \p dst_id. The \p pcdata argument is a
+ * pointer to a pointer to type conversion data which was created and
+ * initialized by the soft type conversion function of this path when
+ * the conversion function was installed on the path.
+ *
+ */
H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
-H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
-H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background,
- hid_t plist_id);
-H5_DLL herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
+/**
+ * \ingroup CONV
+ *
+ * \brief Check whether the library’s default conversion is hard conversion
+ *
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ *
+ * \return \htri_t
+ *
+ * \details H5Tcompiler_conv() determines whether the library’s conversion
+ * function from type \p src_id to type \p dst_id is a compiler (hard)
+ * conversion or not. A compiler conversion uses compiler’s casting; a
+ * library (soft) conversion uses the library’s own conversion
+ * function.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup CONV
+ *
+ * \brief Converts data from one specified datatype to another
+ *
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[in] nelmts Size of array \p buf
+ * \param[in,out] buf Array containing pre- and post-conversion values
+ * \param[in] background Optional background buffer
+ * \dxpl_id{plist_id}
+ *
+ * \return \herr_t
+ *
+ * \details H5Tconvert() converts \p nelmts elements from a source datatype,
+ * specified by \p src_id, to a destination datatype, \p dst_id. The
+ * source elements are packed in \p buf and on return the destination
+ * elements will be packed in \p buf. That is, the conversion is
+ * performed in place.
+ *
+ * The optional background buffer is for use with compound datatypes.
+ * It is an array of \p nelmts values for the destination datatype
+ * which can then be merged with the converted values to recreate the
+ * compound datatype. For instance, background might be an array of
+ * structs with the \c a and \c b fields already initialized and the
+ * conversion of buf supplies the \c c and \c d field values.
+ *
+ * The parameter \p plist_id contains the dataset transfer property list
+ * identifier which is passed to the conversion functions. As of
+ * Release 1.2, this parameter is only used to pass along the
+ * variable-length datatype custom allocation information.
+ *
+ * \note H5Tconvert() will not resize the buffer \p buf; it must be large
+ * enough to hold the larger of the input and output data.
+ *
+ * \version 1.6.3 \p nelmts parameter type changed to size_t.
+ * \version 1.4.0 \p nelmts parameter type changed to hsize_t.
+ *
+ */
+H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background,
+ hid_t plist_id);
+/**
+ * \ingroup VLEN
+ *
+ * \brief Reclaims the variable length (VL) datatype memory buffers
+ *
+ * \type_id
+ * \space_id
+ * \dxpl_id{plist_id} used to create the buffer
+ * \param[in] buf Pointer to the buffer to be reclaimed
+ *
+ * \return \herr_t
+ *
+ * \details H5Treclaim() reclaims memory buffers created to store VL datatypes.
+ * It only frees the variable length data in the selection defined in
+ * the dataspace specified by \p space_id. The dataset transfer
+ * property list \p plist_id is required to find the correct
+ * allocation and/or free methods for the variable-length data in the
+ * buffer.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
* Use of these symbols is deprecated.
*/
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Macros */
@@ -598,15 +2887,144 @@ H5_DLL herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void
/* Typedefs */
/* Function prototypes */
+/**
+ * \ingroup H5T
+ *
+ * \brief Commits a transient datatype to a file, creating a new named datatype
+ *
+ * \fg_loc_id
+ * \param[in] name Name given to committed datatype
+ * \param[in] type_id Identifier of datatype to be committed
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function has been renamed from H5Tcommit() and is
+ * deprecated in favor of the macro #H5Tcommit or the function
+ * H5Tcommit2().
+ *
+ * \details H5Tcommit1() commits the transient datatype (not immutable) to
+ * a file, turning it into a named datatype.
+ *
+ * The datatype \p dtype_id is committed as a named datatype at the
+ * location \p loc_id, which is either a file or group identifier,
+ * with the name \p name.
+ *
+ * \p name can be a relative path based at \p loc_id or an absolute
+ * path from the root of the file. Use of this function requires
+ * that any intermediate groups specified in the path already exist.
+ *
+ * As is the case for any object in a group, the length of the name
+ * of a named datatype is not limited.
+ *
+ * See H5Tcommit_anon() for a discussion of the differences between
+ * H5Tcommit() and H5Tcommit_anon().
+ *
+ * This function will not accept a datatype that cannot actually
+ * hold data. This currently includes compound datatypes with no
+ * fields and enumerated datatypes with no members.
+ *
+ * \version 1.8.7 Function modified in this release to reject datatypes that
+ * will not accommodate actual data, such as a compound datatype with
+ * no fields or an enumerated datatype with no members.
+ * \version 1.8.0 C function H5Tcommit() renamed to H5Tcommit1() and deprecated
+ * in this release.
+ * \since 1.2.0
+ *
+ */
H5_DLL herr_t H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id);
-H5_DLL hid_t H5Topen1(hid_t loc_id, const char *name);
-H5_DLL hid_t H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
- const int perm[/* ndims */]);
-H5_DLL int H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int perm[]);
+/**
+ * \ingroup H5T
+ *
+ * \brief Opens a named datatype
+ *
+ * \fg_loc_id
+ * \param[in] name A datatype name, defined within the specified file or group
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function has been renamed from H5Topen() and is
+ * deprecated in favor of the macro #H5Topen or the function
+ * H5Topen2().
+ *
+ * \details H5Topen1() opens a named datatype at the location specified by
+ * \p loc_id and returns an identifier for the datatype. \p loc_id
+ * can be either a file or group identifier. The identifier should
+ * eventually be closed by calling H5Tclose() to release resources.
+ *
+ * \version 1.8.0 Function H5Topen() renamed to H5Topen1() and deprecated in
+ * this release.
+ *
+ * \since 1.2.0
+ *
+ */
+H5_DLL hid_t H5Topen1(hid_t loc_id, const char *name);
+/**
+ * \ingroup ARRAY
+ *
+ * \brief Creates an array datatype object
+ *
+ * \param[in] base_id Datatype identifier for the array base datatype
+ * \param[in] ndims Rank of the array
+ * \param[in] dim Size of each array dimension
+ * \param[in] perm Dimension permutation (Currently not implemented.)
+ *
+ * \return \hid_t{array datatype}
+ *
+ * \deprecated This function has been renamed from H5Tarray_create() and is
+ * deprecated in favor of the macro #H5Tarray_create or the function
+ * H5Tarray_create2().
+ *
+ * \details H5Tarray_create1() creates a new array datatype object.\n\n
+ * \p base_id is the datatype of every element of the array, i.e.,
+ * of the number at each position in the array.
+ *
+ * \p rank is the number of dimensions and the size of each dimension
+ * is specified in the array dims. The value of rank is currently
+ * limited to #H5S_MAX_RANK and must be greater than 0 (zero). All
+ * dimension sizes specified in dims must be greater than 0 (zero).
+ *
+ * The array \p perm is designed to contain the dimension permutation,
+ * i.e. C versus FORTRAN array order. (The parameter perm is
+ * currently unused and is not yet implemented.)
+ *
+ * \version 1.8.0 Function H5Tarray_create() renamed to H5Tarray_create1()
+ * and deprecated in this release.
+ * \since 1.4.0
+ *
+ */
+H5_DLL hid_t H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
+ const int perm[/* ndims */]);
+/**
+ * \ingroup ARRAY
+ *
+ * \brief Retrieves sizes of array dimensions
+ *
+ * \type_id
+ * \param[out] dims Sizes of array dimensions
+ * \param[out] perm Dimension permutations (This parameter is not used.)
+ *
+ * \return Returns the non-negative number of dimensions of the array type
+ * if successful; otherwise, returns a negative value.
+ *
+ * \deprecated This function has been renamed from H5Tget_array_dims() and is
+ * deprecated in favor of the macro #H5Tget_array_dims or the
+ * function H5Tget_array_dims2().
+ *
+ * \details H5Tget_array_dims1() returns the sizes of the dimensions and
+ * the dimension permutations of the specified array datatype object.
+ *
+ * The sizes of the dimensions are returned in the array \p dims.
+ *
+ * \version 1.8.0 Function H5Tarray_create() renamed to H5Tarray_create1()
+ * and deprecated in this release.
+ * \since 1.2.0
+ *
+ */
+H5_DLL int H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int perm[]);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
#endif
-#endif /* _H5Tpublic_H */
+#endif /* H5Tpublic_H */
diff --git a/src/H5Tref.c b/src/H5Tref.c
index ee98c2b..1114c25 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -40,6 +40,22 @@
#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 */
/******************/
@@ -140,11 +156,12 @@ static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = {
*-------------------------------------------------------------------------
*/
htri_t
-H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
+H5T__ref_set_loc(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 */
@@ -156,11 +173,20 @@ 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;
+ /* Release owned file */
+ if (dt->shared->owned_vol_obj) {
+ if (H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+ dt->shared->owned_vol_obj = NULL;
+ } /* end if */
+
/* Reset file ID (since this reference is in memory) */
dt->shared->u.atomic.u.r.file = file; /* file is NULL */
@@ -201,6 +227,10 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Set file pointer (since this reference is on disk) */
dt->shared->u.atomic.u.r.file = file;
+ /* dt now owns a reference to file */
+ if (H5T_own_vol_obj(dt, file) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
+
if (dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) {
H5F_t *f;
@@ -329,6 +359,7 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *sr
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_NOERR
+ H5T_REF_LOG_DEBUG("");
/* Check parameters */
HDassert(src_buf);
@@ -354,6 +385,7 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_A
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_NOERR
+ H5T_REF_LOG_DEBUG("");
HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE);
@@ -373,28 +405,32 @@ 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 */
- 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 */
+ 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;
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) {
@@ -469,8 +505,8 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
{
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 */
@@ -478,14 +514,20 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
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) {
+ H5MM_memcpy(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")
@@ -516,17 +558,19 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
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")
+ /* 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,
- (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+ 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")
- } /* end if */
+ 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 */
if (H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref,
@@ -553,22 +597,30 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
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;
- hid_t file_id = H5I_INVALID_HID;
- H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf;
+ H5F_t * src_f = NULL;
+ hid_t file_id = H5I_INVALID_HID;
+ H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf;
+ H5R_ref_priv_t tmp_ref; /* Temporary reference to decode into */
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);
+ HDcompile_assert(sizeof(*dst_ref) == sizeof(tmp_ref));
+
+ /* Memory-to-memory conversion to support vlen conversion */
+ if (NULL == src_file) {
+ H5MM_memcpy(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 */
@@ -585,13 +637,13 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
/* Make sure reference buffer is correctly initialized */
- HDmemset(dst_buf, 0, dst_size);
+ HDmemset(&tmp_ref, 0, sizeof(tmp_ref));
switch (src_type) {
case H5R_OBJECT1: {
size_t token_size = H5F_SIZEOF_ADDR(src_f);
- if (H5R__create_object((const H5O_token_t *)src_buf, token_size, dst_ref) < 0)
+ if (H5R__create_object((const H5O_token_t *)src_buf, token_size, &tmp_ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference")
} break;
@@ -599,7 +651,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf;
size_t token_size = H5F_SIZEOF_ADDR(src_f);
- if (H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0)
+ if (H5R__create_region(&src_reg->token, token_size, src_reg->space, &tmp_ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference")
/* create_region creates its internal copy of the space */
@@ -611,11 +663,12 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
/* Pass the correct encoding version for the selection depending on the
* file libver bounds, this is later retrieved in H5S hyper decode */
H5CX_set_libver_bounds(src_f);
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case H5R_OBJECT2:
case H5R_ATTR:
/* Decode reference */
- if (H5R__decode((const unsigned char *)src_buf, &src_size, dst_ref) < 0)
+ if (H5R__decode((const unsigned char *)src_buf, &src_size, &tmp_ref) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference")
break;
@@ -627,17 +680,20 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
} /* end switch */
/* If no filename set, this is not an external reference */
- if (NULL == H5R_REF_FILENAME(dst_ref)) {
+ if (NULL == H5R_REF_FILENAME(&tmp_ref)) {
/* TODO temporary hack to retrieve file object */
if ((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Attach loc ID to reference and hold reference to it, this is a
* user exposed reference so set app_ref to TRUE. */
- if (H5R__set_loc_id(dst_ref, file_id, TRUE, TRUE) < 0)
+ if (H5R__set_loc_id(&tmp_ref, file_id, TRUE, TRUE) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference")
} /* end if */
+ /* Set output info */
+ HDmemcpy(dst_ref, &tmp_ref, sizeof(tmp_ref));
+
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 location id")
@@ -661,6 +717,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
+ H5T_REF_LOG_DEBUG("");
/* Check parameters */
HDassert(src_file);
@@ -703,6 +760,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);
@@ -751,6 +809,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);
@@ -799,6 +858,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);
@@ -806,7 +866,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_
HDassert(dst_size);
/* Copy header manually */
- HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
+ H5MM_memcpy(q, p, H5R_ENCODE_HEADER_SIZE);
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
blob_size -= H5R_ENCODE_HEADER_SIZE;
@@ -844,6 +904,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);
@@ -865,7 +926,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
} /* end if */
/* Copy header manually so that it does not get encoded into the blob */
- HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
+ H5MM_memcpy(q, p, H5R_ENCODE_HEADER_SIZE);
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
src_size -= H5R_ENCODE_HEADER_SIZE;
@@ -902,6 +963,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
+ H5T_REF_LOG_DEBUG("");
/* Check parameters */
HDassert(src_file);
@@ -953,6 +1015,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);
@@ -999,6 +1062,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 +1115,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);
@@ -1105,6 +1170,7 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void
#else
FUNC_ENTER_STATIC_NOERR
#endif
+ H5T_REF_LOG_DEBUG("");
HDassert(src_buf);
@@ -1153,6 +1219,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);
@@ -1188,7 +1255,7 @@ done:
} /* end H5T__ref_dsetreg_disk_read() */
/*-------------------------------------------------------------------------
- * Function: H5T_ref_reclaim
+ * Function: H5T__ref_reclaim
*
* Purpose: Internal routine to free reference datatypes
*
@@ -1197,11 +1264,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);
@@ -1212,4 +1280,4 @@ 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 cf9f047..5937f74 100644
--- a/src/H5Tstrpad.c
+++ b/src/H5Tstrpad.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -38,10 +38,6 @@
* Programmer: Robb Matzke
* Friday, January 9, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived datatypes.
- *
*-------------------------------------------------------------------------
*/
H5T_str_t
@@ -94,10 +90,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 a9319b4..7974d49 100644
--- a/src/H5Tvisit.c
+++ b/src/H5Tvisit.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -22,7 +22,7 @@
*
* Created: H5Tvisit.c
* Jul 19 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Visit all the components of a datatype
*
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index dd8aa76..0d412ba 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -245,7 +245,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
+H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
htri_t ret_value = FALSE; /* Indicate success, but no location change */
@@ -282,6 +282,13 @@ H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
else
HDassert(0 && "Invalid VL type");
+ /* Release owned file */
+ if (dt->shared->owned_vol_obj) {
+ if (H5VL_free_object(dt->shared->owned_vol_obj) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object")
+ dt->shared->owned_vol_obj = NULL;
+ } /* end if */
+
/* Reset file pointer (since this VL is in memory) */
dt->shared->u.vlen.file = NULL;
break;
@@ -307,6 +314,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* Set file ID (since this VL is on disk) */
dt->shared->u.vlen.file = file;
+
+ /* dt now owns a reference to file */
+ if (H5T_own_vol_obj(dt, file) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
break;
case H5T_LOC_BADLOC:
@@ -1012,7 +1023,7 @@ done:
} /* end H5T__vlen_disk_delete() */
/*-------------------------------------------------------------------------
- * Function: H5T_vlen_reclaim
+ * Function: H5T__vlen_reclaim
*
* Purpose: Internal recursive routine to free VL datatypes
*
@@ -1024,7 +1035,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 */
@@ -1133,7 +1144,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() */
/*-------------------------------------------------------------------------
* Function: H5T_vlen_reclaim_elmt
@@ -1167,7 +1178,7 @@ 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:
diff --git a/src/H5UC.c b/src/H5UC.c
index 25f02c9..c1c8b5b 100644
--- a/src/H5UC.c
+++ b/src/H5UC.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5UCprivate.h b/src/H5UCprivate.h
index 2d6f40f..9f4f15a 100644
--- a/src/H5UCprivate.h
+++ b/src/H5UCprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,8 +17,8 @@
* conflicting requirement for the use of H5RC.
*/
-#ifndef _H5UCprivate_H
-#define _H5UCprivate_H
+#ifndef H5UCprivate_H
+#define H5UCprivate_H
/**************************************/
/* Public headers needed by this file */
@@ -59,4 +59,4 @@ typedef struct H5UC_t {
H5_DLL H5UC_t *H5UC_create(void *s, H5UC_free_func_t free_func);
H5_DLL herr_t H5UC_decr(H5UC_t *rc);
-#endif /* _H5RSprivate_H */
+#endif /* H5UCprivate_H */
diff --git a/src/H5VL.c b/src/H5VL.c
index 6340835..f65d149 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -87,25 +87,6 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "*xi", cls, vipl_id);
- /* Check arguments */
- if (!cls)
- HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID,
- "VOL connector class pointer cannot be NULL")
- if (!cls->name)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
- "VOL connector class name cannot be the NULL pointer")
- if (0 == HDstrlen(cls->name))
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
- "VOL connector class name cannot be the empty string")
- if (cls->info_cls.copy && !cls->info_cls.free)
- HGOTO_ERROR(
- H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
- "VOL connector must provide free callback for VOL info objects when a copy callback is provided")
- if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
- "VOL connector must provide free callback for object wrapping contexts when a get "
- "callback is provided")
-
/* Check VOL initialization property list */
if (H5P_DEFAULT == vipl_id)
vipl_id = H5P_VOL_INITIALIZE_DEFAULT;
@@ -113,7 +94,7 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list")
/* Register connector */
- if ((ret_value = H5VL__register_connector(cls, TRUE, vipl_id)) < 0)
+ if ((ret_value = H5VL__register_connector_by_class(cls, TRUE, vipl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
done:
@@ -646,7 +627,7 @@ done:
/*---------------------------------------------------------------------------
* Function: H5VLobject
*
- * Purpose: Retrieve the object pointer associated with an hid_t for a.
+ * Purpose: Retrieve the object pointer associated with an hid_t for a
* VOL object.
*
* Note: This routine is mainly targeted toward unwrapping objects for
@@ -701,8 +682,10 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
if (NULL == (dtype = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
- /* Create VOL object for file */
- if (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))
+ /* Create VOL object for file if necessary (force_conv will be TRUE if and
+ * only if file needs to be passed to H5T_set_loc) */
+ if (H5T_GET_FORCE_CONV(dtype) &&
+ (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id))))
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object")
/* Copy the datatype */
@@ -719,10 +702,12 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
if (H5T_set_loc(file_type, file_vol_obj, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location")
- /* file_type now owns file_vol_obj */
- if (H5T_own_vol_obj(file_type, file_vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
- file_vol_obj = NULL;
+ /* Release our reference to file_type */
+ if (file_vol_obj) {
+ if (H5VL_free_object(file_vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ file_vol_obj = NULL;
+ } /* end if */
/* Set return value */
ret_value = file_type_id;
@@ -881,7 +866,7 @@ H5VLfree_lib_state(void *state)
/* Check args */
if (NULL == state)
- HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid state pointer")
/* Free the library state */
if (H5VL_free_lib_state(state) < 0)
@@ -890,3 +875,37 @@ H5VLfree_lib_state(void *state)
done:
FUNC_LEAVE_API(ret_value)
} /* H5VLfree_lib_state() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLquery_optional
+ *
+ * Purpose: Determine if a VOL connector supports a particular optional
+ * callback operation.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "iVSIs*b", obj_id, subcls, opt_type, supported);
+
+ /* Check args */
+ if (NULL == supported)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid supported pointer")
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Query the connector */
+ if (H5VL_introspect_opt_query(vol_obj, subcls, opt_type, supported) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to query VOL connector support")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLquery_optional() */
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 3bad3b6..cde3f84 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -29,10 +29,11 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
+#include "H5PLprivate.h" /* Plugins */
#include "H5VLpkg.h" /* Virtual Object Layer */
/****************/
@@ -43,6 +44,16 @@
/* Local Typedefs */
/******************/
+/* Structure used when trying to find a
+ * VOL connector to open a given file with.
+ */
+typedef struct H5VL_file_open_find_connector_t {
+ const char * filename;
+ const H5VL_class_t * cls;
+ H5VL_connector_prop_t *connector_prop;
+ hid_t fapl_id;
+} H5VL_file_open_find_connector_t;
+
/********************/
/* Package Typedefs */
/********************/
@@ -101,6 +112,8 @@ static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsig
hid_t fapl_id, hid_t dxpl_id, void **req);
static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id,
hid_t dxpl_id, void **req);
+static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info,
+ void *op_data);
static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id,
void **req, va_list arguments);
static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
@@ -491,7 +504,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_free_connector_info(hid_t connector_id, void *info)
+H5VL_free_connector_info(hid_t connector_id, const void *info)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
@@ -509,12 +522,13 @@ H5VL_free_connector_info(hid_t connector_id, void *info)
if (info) {
/* Allow the connector to free info or do it ourselves */
if (cls->info_cls.free) {
- if ((cls->info_cls.free)(info) < 0)
+ /* Cast through uintptr_t to de-const memory */
+ if ((cls->info_cls.free)((void *)(uintptr_t)info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
- } /* end if */
+ }
else
- H5MM_xfree(info);
- } /* end if */
+ H5MM_xfree_const(info);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3341,6 +3355,98 @@ done:
} /* end H5VL__file_open() */
/*-------------------------------------------------------------------------
+ * Function: H5VL__file_open_find_connector_cb
+ *
+ * Purpose: Iteration callback for H5PL_iterate that tries to find the
+ * correct VOL connector to open a file with when
+ * H5VL_file_open fails for its given VOL connector. Iterates
+ * through all of the available VOL connector plugins until
+ * H5Fis_accessible returns true for the given filename and
+ * VOL connector.
+ *
+ * Return: H5_ITER_CONT if current plugin can't open the given file
+ * H5_ITER_STOP if current plugin can open given file
+ * H5_ITER_ERROR if an error occurs while trying to determine
+ * if current plugin can open given file.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info, void *op_data)
+{
+ H5VL_file_open_find_connector_t *udata = (H5VL_file_open_find_connector_t *)op_data;
+ const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info;
+ H5P_genplist_t * fapl_plist;
+ H5P_genplist_t * fapl_plist_copy;
+ herr_t status;
+ htri_t is_accessible = FALSE;
+ hid_t connector_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ herr_t ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(udata);
+ HDassert(udata->filename);
+ HDassert(udata->connector_prop);
+ HDassert(cls);
+ HDassert(plugin_type == H5PL_TYPE_VOL);
+
+ /* Silence compiler */
+ (void)plugin_type;
+
+ udata->cls = cls;
+
+ /* Attempt to register plugin as a VOL connector */
+ if ((connector_id = H5VL__register_connector_by_class(cls, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5_ITER_ERROR, "unable to register VOL connector")
+
+ /* Setup FAPL with registered VOL connector */
+ if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object_verify(udata->fapl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list")
+ if ((fapl_id = H5P_copy_plist(fapl_plist, TRUE)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy fapl");
+ if (NULL == (fapl_plist_copy = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list")
+ if (H5P_set_vol(fapl_plist_copy, connector_id, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl")
+
+ /* Check if file is accessible with given VOL connector */
+ H5E_BEGIN_TRY
+ {
+ status = H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ fapl_id, udata->filename, &is_accessible);
+ }
+ H5E_END_TRY;
+
+ /* If the file was accessible with the current VOL connector, return
+ * the FAPL with that VOL connector set on it. Errors are ignored here
+ * as some VOL connectors may not support H5Fis_accessible.
+ */
+ if (status == SUCCEED && is_accessible > 0) {
+ /* Modify 'connector_prop' to point to the VOL connector that
+ * was actually used to open the file, rather than the original
+ * VOL connector that was requested.
+ */
+ udata->connector_prop->connector_id = connector_id;
+ udata->connector_prop->connector_info = NULL;
+
+ udata->fapl_id = fapl_id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+
+done:
+ if (ret_value != H5_ITER_STOP) {
+ if (fapl_id >= 0 && H5I_dec_app_ref(fapl_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close fapl")
+ if (connector_id >= 0 && H5I_dec_app_ref(connector_id) < 0)
+ HDONE_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close VOL connector ID")
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_open_find_connector_cb() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_file_open
*
* Purpose: Opens a file through the VOL.
@@ -3354,7 +3460,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id,
+H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id,
hid_t dxpl_id, void **req)
{
H5VL_class_t *cls; /* VOL Class structure for callback info */
@@ -3367,8 +3473,54 @@ H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, un
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+ if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) {
+ H5VL_file_open_find_connector_t find_connector_ud;
+ hbool_t find_connector;
+ hbool_t connector_available = FALSE;
+
+ /* Opening the file failed - Determine whether we should search
+ * the plugin path to see if any other VOL connectors are available
+ * to attempt to open the file with. This only occurs if no particular
+ * VOL connector was specified (either via a FAPL or the
+ * HDF5_VOL_CONNECTOR environment variable).
+ */
+ find_connector = !getenv("HDF5_VOL_CONNECTOR") && ((H5P_FILE_ACCESS_DEFAULT == fapl_id) ||
+ connector_prop->connector_id == H5_DEFAULT_VOL);
+
+ if (find_connector) {
+ herr_t iter_ret;
+
+ find_connector_ud.connector_prop = connector_prop;
+ find_connector_ud.filename = name;
+ find_connector_ud.cls = NULL;
+ find_connector_ud.fapl_id = fapl_id;
+
+ iter_ret = H5PL_iterate(H5PL_ITER_TYPE_VOL, H5VL__file_open_find_connector_cb,
+ (void *)&find_connector_ud);
+ if (iter_ret < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, NULL,
+ "failed to iterate over available VOL connector plugins")
+ else if (iter_ret)
+ connector_available = TRUE;
+ } /* end if */
+
+ /* If one of the available VOL connector plugins is
+ * able to open the file, clear the error stack from any
+ * previous file open failures and then open the file.
+ * Otherwise, if no VOL connectors are available, throw
+ * error from original file open failure.
+ */
+ if (connector_available) {
+ H5E_clear_stack(NULL);
+
+ if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags,
+ find_connector_ud.fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'",
+ name, find_connector_ud.cls->name)
+ }
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index bda5d8f..de3f6b3 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* This file contains public declarations for authoring VOL connectors.
*/
-#ifndef _H5VLconnector_H
-#define _H5VLconnector_H
+#ifndef H5VLconnector_H
+#define H5VLconnector_H
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
@@ -46,24 +46,6 @@
/* Public Typedefs */
/*******************/
-/* Enum type for each VOL subclass */
-/* (Used for various queries, etc) */
-typedef enum H5VL_subclass_t {
- H5VL_SUBCLS_NONE, /* Operations outside of a subclass */
- H5VL_SUBCLS_INFO, /* 'Info' subclass */
- H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */
- H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */
- H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */
- H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */
- H5VL_SUBCLS_FILE, /* 'File' subclass */
- H5VL_SUBCLS_GROUP, /* 'Group' subclass */
- H5VL_SUBCLS_LINK, /* 'Link' subclass */
- H5VL_SUBCLS_OBJECT, /* 'Object' subclass */
- H5VL_SUBCLS_REQUEST, /* 'Request' subclass */
- H5VL_SUBCLS_BLOB, /* 'Blob' subclass */
- H5VL_SUBCLS_TOKEN /* 'Token' subclass */
-} H5VL_subclass_t;
-
/* types for attribute GET callback */
typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_ACPL, /* creation property list */
@@ -186,7 +168,7 @@ typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_FILE, /* object file */
H5VL_OBJECT_GET_NAME, /* object name */
H5VL_OBJECT_GET_TYPE, /* object type */
- H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */
+ H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */
} H5VL_object_get_t;
/* types for object SPECIFIC callback */
@@ -456,39 +438,44 @@ typedef struct H5VL_token_class_t {
herr_t (*from_str)(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
} H5VL_token_class_t;
-/* Class information for each VOL connector */
+/**
+ * \ingroup H5VLDEV
+ * Class information for each VOL connector
+ */
+//! <!-- [H5VL_class_t_snip] -->
typedef struct H5VL_class_t {
/* Overall connector fields & callbacks */
- unsigned int version; /* VOL connector class struct version # */
- H5VL_class_value_t value; /* Value to identify connector */
- const char * name; /* Connector name (MUST be unique!) */
- unsigned cap_flags; /* Capability flags for connector */
- herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
- herr_t (*terminate)(void); /* Connector termination callback */
+ unsigned version; /**< VOL connector class struct version # */
+ H5VL_class_value_t value; /**< Value to identify connector */
+ const char * name; /**< Connector name (MUST be unique!) */
+ unsigned cap_flags; /**< Capability flags for connector */
+ herr_t (*initialize)(hid_t vipl_id); /**< Connector initialization callback */
+ herr_t (*terminate)(void); /**< Connector termination callback */
/* VOL framework */
- H5VL_info_class_t info_cls; /* VOL info fields & callbacks */
- H5VL_wrap_class_t wrap_cls; /* VOL object wrap / retrieval callbacks */
+ H5VL_info_class_t info_cls; /**< VOL info fields & callbacks */
+ H5VL_wrap_class_t wrap_cls; /**< VOL object wrap / retrieval callbacks */
/* Data Model */
- H5VL_attr_class_t attr_cls; /* Attribute (H5A*) class callbacks */
- H5VL_dataset_class_t dataset_cls; /* Dataset (H5D*) class callbacks */
- H5VL_datatype_class_t datatype_cls; /* Datatype (H5T*) class callbacks */
- H5VL_file_class_t file_cls; /* File (H5F*) class callbacks */
- H5VL_group_class_t group_cls; /* Group (H5G*) class callbacks */
- H5VL_link_class_t link_cls; /* Link (H5L*) class callbacks */
- H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */
+ H5VL_attr_class_t attr_cls; /**< Attribute (H5A*) class callbacks */
+ H5VL_dataset_class_t dataset_cls; /**< Dataset (H5D*) class callbacks */
+ H5VL_datatype_class_t datatype_cls; /**< Datatype (H5T*) class callbacks */
+ H5VL_file_class_t file_cls; /**< File (H5F*) class callbacks */
+ H5VL_group_class_t group_cls; /**< Group (H5G*) class callbacks */
+ H5VL_link_class_t link_cls; /**< Link (H5L*) class callbacks */
+ H5VL_object_class_t object_cls; /**< Object (H5O*) class callbacks */
/* Infrastructure / Services */
- H5VL_introspect_class_t introspect_cls; /* Container/connector introspection class callbacks */
- H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */
- H5VL_blob_class_t blob_cls; /* 'Blob' class callbacks */
- H5VL_token_class_t token_cls; /* VOL connector object token class callbacks */
+ H5VL_introspect_class_t introspect_cls; /**< Container/connector introspection class callbacks */
+ H5VL_request_class_t request_cls; /**< Asynchronous request class callbacks */
+ H5VL_blob_class_t blob_cls; /**< 'Blob' class callbacks */
+ H5VL_token_class_t token_cls; /**< VOL connector object token class callbacks */
/* Catch-all */
herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req,
- va_list arguments); /* Optional callback */
+ va_list arguments); /**< Optional callback */
} H5VL_class_t;
+//! <!-- [H5VL_class_t_snip] -->
/********************/
/* Public Variables */
@@ -503,14 +490,57 @@ extern "C" {
#endif
/* Helper routines for VOL connector authors */
+/**
+ * \ingroup H5VLDEV
+ * \brief Registers a new VOL connector
+ *
+ * \param[in] cls A pointer to the plugin structure to register
+ * \vipl_id
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLregister_connector() registers a new VOL connector as a member
+ * of the virtual object layer class. This VOL connector identifier is
+ * good until the library is closed or the connector is unregistered.
+ *
+ * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
+ * initialization property list of class #H5P_VOL_INITIALIZE created
+ * with H5Pcreate(). When created, this property list contains no
+ * library properties. If a VOL connector author decides that
+ * initialization-specific data are needed, they can be added to the
+ * empty list and retrieved by the connector in the VOL connector's
+ * initialize callback. Use of the VOL initialization property list is
+ * uncommon, as most VOL-specific properties are added to the file
+ * access property list via the connector's API calls which set the
+ * VOL connector for the file open/create. For more information, see
+ * the \ref_vol_doc.
+ *
+ * H5VL_class_t is defined in H5VLconnector.h in the source code. It
+ * contains class information for each VOL connector:
+ * \snippet this H5VL_class_t_snip
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
+/**
+ * \ingroup H5VLDEV
+ */
H5_DLL void *H5VLobject(hid_t obj_id);
+/**
+ * \ingroup H5VLDEV
+ */
H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id);
+/**
+ * \ingroup H5VLDEV
+ */
H5_DLL hid_t H5VLpeek_connector_id_by_name(const char *name);
+/**
+ * \ingroup H5VLDEV
+ */
H5_DLL hid_t H5VLpeek_connector_id_by_value(H5VL_class_value_t value);
#ifdef __cplusplus
}
#endif
-#endif /* _H5VLconnector_H */
+#endif /* H5VLconnector_H */
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
index 07297e1..1b6715b 100644
--- a/src/H5VLconnector_passthru.h
+++ b/src/H5VLconnector_passthru.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,8 +23,8 @@
* the H5VLconnector.h header easier to understand.
*/
-#ifndef _H5VLconnector_passthru_H
-#define _H5VLconnector_passthru_H
+#ifndef H5VLconnector_passthru_H
+#define H5VLconnector_passthru_H
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
@@ -233,4 +233,4 @@ H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxp
}
#endif
-#endif /* _H5VLconnector_passthru_H */
+#endif /* H5VLconnector_passthru_H */
diff --git a/src/H5VLint.c b/src/H5VLint.c
index a94a389..774d160 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -259,7 +259,7 @@ H5VL_term_package(void)
else {
if (H5I_nmembers(H5I_VOL) > 0) {
/* Unregister all VOL connectors */
- (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ (void)H5I_clear_type(H5I_VOL, TRUE, FALSE);
n++;
} /* end if */
else {
@@ -303,7 +303,7 @@ H5VL__free_cls(H5VL_class_t *cls)
HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly")
/* Release the class */
- H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */
+ H5MM_xfree_const(cls->name);
H5FL_FREE(H5VL_class_t, cls);
done:
@@ -570,6 +570,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t
} /* end if */
else
new_vol_obj->data = object;
+ new_vol_obj->rc = 1;
/* Bump the reference count on the VOL connector */
H5VL__conn_inc_rc(vol_connector);
@@ -665,16 +666,15 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
if (connector_prop->connector_id > 0) {
if (connector_prop->connector_info)
/* Free the connector info */
- if (H5VL_free_connector_info(connector_prop->connector_id,
- (void *)connector_prop->connector_info) <
- 0) /* Casting away const OK - QAK */
+ if (H5VL_free_connector_info(connector_prop->connector_id, connector_prop->connector_info) <
+ 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
/* Decrement reference count for connector ID */
if (H5I_dec_ref(connector_prop->connector_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID")
- } /* end if */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -817,6 +817,46 @@ done:
} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_create_object
+ *
+ * Purpose: Similar to H5VL_register but does not create an ID.
+ * Creates a new VOL object for the provided generic object
+ * using the provided vol connector. Should only be used for
+ * internal objects returned from the connector such as
+ * requests.
+ *
+ * Return: Success: A valid VOL object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5VL_object_t *
+H5VL_create_object(void *object, H5VL_t *vol_connector)
+{
+ H5VL_object_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_connector);
+
+ /* Set up VOL object for the passed-in data */
+ /* (Does not wrap object, since it's from a VOL callback) */
+ if (NULL == (ret_value = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object")
+ ret_value->connector = vol_connector;
+ ret_value->data = object;
+ ret_value->rc = 1;
+
+ /* Bump the reference count on the VOL connector */
+ H5VL__conn_inc_rc(vol_connector);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_create_object() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_create_object_using_vol_id
*
* Purpose: Similar to H5VL_register_using_vol_id but does not create
@@ -940,6 +980,27 @@ done:
} /* end H5VL__conn_dec_rc() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_object_inc_rc
+ *
+ * Purpose: Wrapper to increment the ref count on a VOL object.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5VL_object_inc_rc(H5VL_object_t *vol_obj)
+{
+ FUNC_ENTER_NOAPI_NOERR_NOFS
+
+ /* Check arguments */
+ HDassert(vol_obj);
+
+ /* Increment refcount for object and return */
+ FUNC_LEAVE_NOAPI(++vol_obj->rc)
+} /* end H5VL_object_inc_rc() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_free_object
*
* Purpose: Wrapper to unregister an object ID with a VOL aux struct
@@ -959,11 +1020,13 @@ H5VL_free_object(H5VL_object_t *vol_obj)
/* Check arguments */
HDassert(vol_obj);
- /* Decrement refcount on connector */
- if (H5VL__conn_dec_rc(vol_obj->connector) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+ if (--vol_obj->rc == 0) {
+ /* Decrement refcount on connector */
+ if (H5VL__conn_dec_rc(vol_obj->connector) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
- vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
+ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj);
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1076,7 +1139,7 @@ done:
} /* end H5VL_file_is_same() */
/*-------------------------------------------------------------------------
- * Function: H5VL_register_connector
+ * Function: H5VL__register_connector
*
* Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
@@ -1092,13 +1155,13 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
+H5VL__register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
{
const H5VL_class_t *cls = (const H5VL_class_t *)_cls;
H5VL_class_t * saved = NULL;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(cls);
@@ -1123,16 +1186,16 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id)
done:
if (ret_value < 0 && saved) {
if (saved->name)
- H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */
+ H5MM_xfree_const(saved->name);
H5FL_FREE(H5VL_class_t, saved);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_register_connector() */
+} /* end H5VL__register_connector() */
/*-------------------------------------------------------------------------
- * Function: H5VL__register_connector
+ * Function: H5VL__register_connector_by_class
*
* Purpose: Registers a new VOL connector as a member of the virtual object
* layer class.
@@ -1149,13 +1212,34 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id)
+H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id)
{
H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
+ /* Check arguments */
+ if (!cls)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID,
+ "VOL connector class pointer cannot be NULL")
+ if (H5VL_VERSION != cls->version)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector has incompatible version")
+ if (!cls->name)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
+ "VOL connector class name cannot be the NULL pointer")
+ if (0 == HDstrlen(cls->name))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
+ "VOL connector class name cannot be the empty string")
+ if (cls->info_cls.copy && !cls->info_cls.free)
+ HGOTO_ERROR(
+ H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
+ "VOL connector must provide free callback for VOL info objects when a copy callback is provided")
+ if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID,
+ "VOL connector must provide free callback for object wrapping contexts when a get "
+ "callback is provided")
+
/* Set up op data for iteration */
op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
op_data.u.name = cls->name;
@@ -1174,13 +1258,13 @@ H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id
} /* end if */
else {
/* Create a new class ID */
- if ((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL__register_connector() */
+} /* end H5VL__register_connector_by_class() */
/*-------------------------------------------------------------------------
* Function: H5VL__register_connector_by_name
@@ -1234,7 +1318,7 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
/* Register the connector we loaded */
- if ((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
} /* end else */
@@ -1294,7 +1378,7 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
/* Register the connector we loaded */
- if ((ret_value = H5VL_register_connector(cls, app_ref, vipl_id)) < 0)
+ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
} /* end else */
@@ -2316,24 +2400,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 (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")
@@ -2341,3 +2426,55 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_wrap_register() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_check_plugin_load
+ *
+ * Purpose: Check if a VOL connector matches the search criteria, and
+ * can be loaded.
+ *
+ * Note: Matching the connector's name / value, but the connector
+ * having an incompatible version is not an error, but means
+ * that the connector isn't a "match". Setting the SUCCEED
+ * value to FALSE and not failing for that case allows the
+ * plugin framework to keep looking for other DLLs that match
+ * and have a compatible version.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_check_plugin_load(const H5VL_class_t *cls, const H5PL_key_t *key, hbool_t *success)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cls);
+ HDassert(key);
+ HDassert(success);
+
+ /* Which kind of key are we looking for? */
+ if (key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ /* Check if plugin name matches VOL connector class name */
+ if (cls->name && !HDstrcmp(cls->name, key->vol.u.name))
+ *success = TRUE;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
+
+ /* Check if plugin value matches VOL connector class value */
+ if (cls->value == key->vol.u.value)
+ *success = TRUE;
+ } /* end else */
+
+ /* Connector is a match, but might not be a compatible version */
+ if (*success && cls->version != H5VL_VERSION)
+ *success = FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_check_plugin_load() */
diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h
index 1ff9137..78c5986 100644
--- a/src/H5VLmodule.h
+++ b/src/H5VLmodule.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,8 +16,8 @@
* is part of the H5VL package.
*/
-#ifndef _H5VLmodule_H
-#define _H5VLmodule_H
+#ifndef H5VLmodule_H
+#define H5VLmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -27,4 +27,19 @@
#define H5_MY_PKG_ERR H5E_VOL
#define H5_MY_PKG_INIT YES
-#endif /* _H5VLmodule_H */
+/**
+ * \defgroup H5VL H5VL
+ * \brief Virtual Object Layer Interface
+ * \todo Describe concisely what the functions in this module are about.
+ *
+ * \defgroup H5VLDEF Definitions
+ * \ingroup H5VL
+ * \defgroup H5VLDEV VOL Developer
+ * \ingroup H5VL
+ * \defgroup H5VLNAT Native VOL
+ * \ingroup H5VL
+ * \defgroup H5VLPT Pass-through VOL
+ * \ingroup H5VL
+ */
+
+#endif /* H5VLmodule_H */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 0973e34..48c5a80 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,17 +15,27 @@
* using HDF5 VFDs.
*/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5VL_FRIEND /* Suppress error about including H5VLpkg */
+
+/***********/
+/* Headers */
+/***********/
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5VLpkg.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
@@ -37,12 +47,12 @@ static herr_t H5VL__native_term(void);
/* Native VOL connector class struct */
static const H5VL_class_t H5VL_native_cls_g = {
- H5VL_NATIVE_VERSION, /* version */
- H5VL_NATIVE_VALUE, /* value */
- H5VL_NATIVE_NAME, /* name */
- 0, /* capability flags */
- NULL, /* initialize */
- H5VL__native_term, /* terminate */
+ H5VL_VERSION, /* VOL class struct version */
+ H5VL_NATIVE_VALUE, /* value */
+ H5VL_NATIVE_NAME, /* name */
+ 0, /* capability flags */
+ NULL, /* initialize */
+ H5VL__native_term, /* terminate */
{
/* info_cls */
(size_t)0, /* info size */
@@ -176,7 +186,7 @@ H5VL_native_register(void)
/* Register the native VOL connector, if it isn't already */
if (H5I_INVALID_HID == H5VL_NATIVE_ID_g)
if ((H5VL_NATIVE_ID_g =
- H5VL_register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0)
+ H5VL__register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector")
/* Set return value */
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index b703c4f..cb7f0e03 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* Purpose: The public header file for the native VOL connector.
*/
-#ifndef _H5VLnative_H
-#define _H5VLnative_H
+#ifndef H5VLnative_H
+#define H5VLnative_H
/* Public headers needed by this file */
#include "H5VLpublic.h" /* Virtual Object Layer */
@@ -123,7 +123,13 @@ extern "C" {
#endif
/* Token <--> address converters */
+/**
+ * \ingroup H5VLNAT
+ */
H5_DLL herr_t H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token);
+/**
+ * \ingroup H5VLNAT
+ */
H5_DLL herr_t H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr);
/* Not really public but must be included here */
@@ -133,4 +139,4 @@ H5_DLL hid_t H5VL_native_register(void);
}
#endif
-#endif /* _H5VLnative_H */
+#endif /* H5VLnative_H */
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index 082e423..ab97c40 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -510,7 +510,8 @@ done:
*/
herr_t
H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
+ va_list H5_ATTR_DEPRECATED_USED arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index aaac2b3..170a5bc 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -104,7 +104,7 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, vo
H5F_t * f = (H5F_t *)obj; /* Retrieve file pointer */
const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the disk blob ID */
H5HG_t hobjid; /* Global heap ID for sequence */
- size_t hobj_size; /* Global heap object size returned from H5HG_read() */
+ size_t hobj_size = 0; /* Global heap object size returned from H5HG_read() */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 8eac4a3..f23267e 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,6 +18,7 @@
#define H5D_FRIEND /* Suppress error about including H5Dpkg */
#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
@@ -138,7 +139,7 @@ done:
*/
herr_t
H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void *buf, void H5_ATTR_UNUSED **req)
+ hid_t dxpl_id, void *buf, void H5_ATTR_UNUSED **req)
{
H5D_t * dset = (H5D_t *)obj;
const H5S_t *mem_space = NULL;
@@ -157,6 +158,9 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_
if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
/* Read raw data */
if (H5D__read(dset, mem_type_id, mem_space, file_space, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
@@ -176,7 +180,7 @@ done:
*/
herr_t
H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
- hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, void H5_ATTR_UNUSED **req)
+ hid_t dxpl_id, const void *buf, void H5_ATTR_UNUSED **req)
{
H5D_t * dset = (H5D_t *)obj;
const H5S_t *mem_space = NULL;
@@ -195,6 +199,9 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid
if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id")
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
/* Write the data */
if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
@@ -357,7 +364,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
+H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type, hid_t dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments)
{
H5D_t *dset = (H5D_t *)obj; /* Dataset */
@@ -368,6 +375,9 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Sanity checks */
HDassert(dset);
+ /* Set DXPL for operation */
+ H5CX_set_dxpl(dxpl_id);
+
switch (optional_type) {
case H5VL_NATIVE_DATASET_FORMAT_CONVERT: { /* H5Dformat_convert */
switch (dset->shared->layout.type) {
diff --git a/src/H5VLnative_datatype.c b/src/H5VLnative_datatype.c
index 5b585ad..9551f50 100644
--- a/src/H5VLnative_datatype.c
+++ b/src/H5VLnative_datatype.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index f343d29..a2dd058 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index 8e01213..e3fa702 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -259,8 +259,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_optional(void *obj, H5VL_group_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_group_optional_t optional_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
+ va_list H5_ATTR_DEPRECATED_USED arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c
index e59f7fd..9d1244b 100644
--- a/src/H5VLnative_introspect.c
+++ b/src/H5VLnative_introspect.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 5ecc1ce..c17f5e6 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -73,8 +73,9 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H
"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, link_loc_p,
- loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
+ 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 */
else { /* H5Olink */
@@ -93,8 +94,8 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H
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;
}
@@ -157,8 +158,8 @@ H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void
dst_loc_p = src_loc_p;
/* Copy the link */
- 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)
+ 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")
done:
@@ -199,8 +200,8 @@ H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void
dst_loc_p = src_loc_p;
/* Move the link */
- 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)
+ 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")
done:
@@ -239,7 +240,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(
+ 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")
@@ -257,10 +258,10 @@ 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,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
+ 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")
break;
@@ -273,15 +274,15 @@ 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,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
+ 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")
}
else
@@ -324,7 +325,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;
}
@@ -383,11 +384,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(
+ 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")
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index a5262de..449f389 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -61,10 +61,10 @@ 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,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, opened_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;
}
@@ -79,7 +79,7 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ
"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;
}
@@ -121,8 +121,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)
@@ -338,7 +338,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
/* Lookup object */
case H5VL_OBJECT_LOOKUP: {
- H5O_token_t *token = va_arg(arguments, H5O_token_t *);
+ H5O_token_t *token = HDva_arg(arguments, H5O_token_t *);
HDassert(token);
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 0c2584c..126441d 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* Purpose: The private header file for the native VOL connector.
*/
-#ifndef _H5VLnative_private_H
-#define _H5VLnative_private_H
+#ifndef H5VLnative_private_H
+#define H5VLnative_private_H
/* Private headers needed by this file */
#include "H5Fprivate.h" /* Files */
@@ -178,4 +178,4 @@ H5_DLL herr_t H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **fi
}
#endif
-#endif /* _H5VLnative_private_H */
+#endif /* H5VLnative_private_H */
diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c
index f077ca4..65591c7 100644
--- a/src/H5VLnative_token.c
+++ b/src/H5VLnative_token.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 5debca7..434fd43 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -263,7 +263,7 @@ static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id,
/* Pass through VOL connector class struct */
static const H5VL_class_t H5VL_pass_through_g = {
- H5VL_PASSTHRU_VERSION, /* version */
+ H5VL_VERSION, /* VOL class struct version */
(H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value */
H5VL_PASSTHRU_NAME, /* name */
0, /* capability flags */
@@ -487,7 +487,7 @@ H5VL_pass_through_init(hid_t vipl_id)
#endif
/* Shut compiler up about unused parameter */
- vipl_id = vipl_id;
+ (void)vipl_id;
return 0;
} /* end H5VL_pass_through_init() */
@@ -1633,6 +1633,10 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, h
/* 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);
@@ -1685,6 +1689,10 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid
/* 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);
@@ -1823,6 +1831,10 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
/* 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);
@@ -2893,8 +2905,11 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
/* Finish use of copied vararg list */
va_end(tmp_arguments);
} /* end if */
- else
- assert(0 && "Unknown 'specific' operation");
+ else {
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+
+ ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, specific_type, arguments);
+ } /* end else */
return ret_value;
} /* end H5VL_pass_through_request_specific() */
diff --git a/src/H5VLpassthru.h b/src/H5VLpassthru.h
index a8ef42c..79caca7 100644
--- a/src/H5VLpassthru.h
+++ b/src/H5VLpassthru.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* Purpose: The public header file for the pass-through VOL connector.
*/
-#ifndef _H5VLpassthru_H
-#define _H5VLpassthru_H
+#ifndef H5VLpassthru_H
+#define H5VLpassthru_H
/* Public headers needed by this file */
#include "H5VLpublic.h" /* Virtual Object Layer */
@@ -44,4 +44,4 @@ H5_DLL hid_t H5VL_pass_through_register(void);
}
#endif
-#endif /* _H5VLpassthru_H */
+#endif /* H5VLpassthru_H */
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index c784e50..7b8a877 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,8 +20,8 @@
#error "Do not include this file outside the H5VL package!"
#endif
-#ifndef _H5VLpkg_H
-#define _H5VLpkg_H
+#ifndef H5VLpkg_H
+#define H5VLpkg_H
/* Get package's private header */
#include "H5VLprivate.h" /* Generic Functions */
@@ -43,7 +43,8 @@
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL hid_t H5VL__register_connector(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
+H5_DLL hid_t H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid_t vipl_id);
H5_DLL htri_t H5VL__is_connector_registered_by_name(const char *name);
@@ -56,4 +57,4 @@ H5_DLL hid_t H5VL__peek_connector_id_by_value(H5VL_class_value_t value);
H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info);
H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size);
-#endif /* _H5VLpkg_H */
+#endif /* H5VLpkg_H */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 25fec72..678a27f 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -5,13 +5,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef _H5VLprivate_H
-#define _H5VLprivate_H
+#ifndef H5VLprivate_H
+#define H5VLprivate_H
/* Include package's public header */
#include "H5VLpublic.h" /* Generic Functions */
@@ -37,12 +37,13 @@ typedef struct H5VL_t {
typedef struct H5VL_object_t {
void * data; /* Pointer to connector-managed data for this object */
H5VL_t *connector; /* Pointer to VOL connector struct */
+ size_t rc; /* Reference count */
} H5VL_object_t;
/* Internal structure to hold the connector ID & info for FAPLs */
typedef struct H5VL_connector_prop_t {
- hid_t connector_id; /* VOL connector's ID */
- void *connector_info; /* VOL connector info, for open callbacks */
+ hid_t connector_id; /* VOL connector's ID */
+ const void *connector_info; /* VOL connector info, for open callbacks */
} H5VL_connector_prop_t;
/* Which kind of VOL connector field to use for searching */
@@ -67,7 +68,8 @@ H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value);
H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
/* Functions that deal with VOL connectors */
-H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
+union H5PL_key_t;
+H5_DLL herr_t H5VL_check_plugin_load(const H5VL_class_t *cls, const union H5PL_key_t *key, hbool_t *success);
/* NOTE: The object and ID functions below deal in VOL objects (i.e.;
* H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use
@@ -85,7 +87,9 @@ H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
+H5_DLL H5VL_object_t *H5VL_create_object(void *object, H5VL_t *vol_connector);
H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id);
+H5_DLL hsize_t H5VL_object_inc_rc(H5VL_object_t *obj);
H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native);
H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
@@ -122,7 +126,7 @@ H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5V
H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, const void *src_info);
H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, const void *info1,
const void *info2);
-H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info);
+H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, const void *info);
/* Attribute functions */
H5_DLL void * H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
@@ -177,7 +181,7 @@ H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, v
/* File functions */
H5_DLL void * H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags,
hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL void * H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags,
+H5_DLL void * H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags,
hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
...);
@@ -267,4 +271,4 @@ H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_t
/* Generic functions */
H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...);
-#endif /* _H5VLprivate_H */
+#endif /* H5VLprivate_H */
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 2634635..aec4851 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -5,7 +5,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
* This file contains public declarations for the H5VL (VOL) module.
*/
-#ifndef _H5VLpublic_H
-#define _H5VLpublic_H
+#ifndef H5VLpublic_H
+#define H5VLpublic_H
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
@@ -25,25 +25,79 @@
/* Public Macros */
/*****************/
+/**
+ * \ingroup H5VLDEF
+ * \brief Version # of VOL class struct & callbacks
+ *
+ * \details Each VOL connector must set the 'version' field in the H5VL_class_t
+ * struct to the version of the H5VL_class_t struct that the connector
+ * implements. The HDF5 library will reject connectors with
+ * incompatible structs.
+ */
+#define H5VL_VERSION 0
+
/* VOL connector identifier values
* These are H5VL_class_value_t values, NOT hid_t values!
*/
-#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector ID */
-#define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */
-#define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */
-#define H5_VOL_MAX 65535 /* Maximum VOL connector ID */
+/**
+ * \ingroup H5VLDEF
+ * Invalid ID for VOL connector ID
+ */
+#define H5_VOL_INVALID (-1)
+/**
+ * \ingroup H5VLDEF
+ * Native HDF5 file format VOL connector
+ */
+#define H5_VOL_NATIVE 0
+/**
+ * \ingroup H5VLDEF
+ * VOL connector IDs below this value are reserved for library use
+ */
+#define H5_VOL_RESERVED 256
+/**
+ * \ingroup H5VLDEF
+ * Maximum VOL connector ID
+ */
+#define H5_VOL_MAX 65535
/*******************/
/* Public Typedefs */
/*******************/
-/*
- * VOL connector identifiers. Values 0 through 255 are for connectors defined
- * by the HDF5 library. Values 256 through 511 are available for testing new
- * connectors. Subsequent values should be obtained from the HDF5 development
- * team at help@hdfgroup.org.
+/**
+ * \ingroup H5VLDEF
+ *
+ * \brief VOL connector identifiers.
+ *
+ * \details Values 0 through 255 are for connectors defined by the HDF5
+ * library. Values 256 through 511 are available for testing new
+ * connectors. Subsequent values should be obtained from the HDF5
+ * development team at mailto:help@hdfgroup.org.
*/
+//! <!-- [H5VL_class_value_t_snip] -->
typedef int H5VL_class_value_t;
+//! <!-- [H5VL_class_value_t_snip] -->
+
+/**
+ * \ingroup H5VLDEF
+ * \details Enum type for each VOL subclass
+ * (Used for various queries, etc)
+ */
+typedef enum H5VL_subclass_t {
+ H5VL_SUBCLS_NONE, /**< Operations outside of a subclass */
+ H5VL_SUBCLS_INFO, /**< 'Info' subclass */
+ H5VL_SUBCLS_WRAP, /**< 'Wrap' subclass */
+ H5VL_SUBCLS_ATTR, /**< 'Attribute' subclass */
+ H5VL_SUBCLS_DATASET, /**< 'Dataset' subclass */
+ H5VL_SUBCLS_DATATYPE, /**< 'Named datatype' subclass */
+ H5VL_SUBCLS_FILE, /**< 'File' subclass */
+ H5VL_SUBCLS_GROUP, /**< 'Group' subclass */
+ H5VL_SUBCLS_LINK, /**< 'Link' subclass */
+ H5VL_SUBCLS_OBJECT, /**< 'Object' subclass */
+ H5VL_SUBCLS_REQUEST, /**< 'Request' subclass */
+ H5VL_SUBCLS_BLOB, /**< 'Blob' subclass */
+ H5VL_SUBCLS_TOKEN /**< 'Token' subclass */
+} H5VL_subclass_t;
/********************/
/* Public Variables */
@@ -57,16 +111,229 @@ typedef int H5VL_class_value_t;
extern "C" {
#endif
-H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
-H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
-H5_DLL htri_t H5VLis_connector_registered_by_name(const char *name);
-H5_DLL htri_t H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value);
-H5_DLL hid_t H5VLget_connector_id(hid_t obj_id);
-H5_DLL hid_t H5VLget_connector_id_by_name(const char *name);
-H5_DLL hid_t H5VLget_connector_id_by_value(H5VL_class_value_t connector_value);
+/**
+ * \ingroup H5VL
+ * \brief Registers a new VOL connector by name
+ *
+ * \param[in] connector_name Connector name
+ * \vipl_id
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLregister_connector_by_name() registers a new VOL connector with
+ * the name \p connector_name as a member of the virtual object layer
+ * class. This VOL connector identifier is good until the library is
+ * closed or the connector is unregistered.
+ *
+ * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
+ * initialization property list of class #H5P_VOL_INITIALIZE created
+ * with H5Pcreate(). When created, this property list contains no
+ * library properties. If a VOL connector author decides that
+ * initialization-specific data are needed, they can be added to the
+ * empty list and retrieved by the connector in the VOL connector's
+ * initialize callback. Use of the VOL initialization property list is
+ * uncommon, as most VOL-specific properties are added to the file
+ * access property list via the connector's API calls which set the
+ * VOL connector for the file open/create. For more information, see
+ * \ref_vol_doc.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
+/**
+ * \ingroup H5VL
+ * \brief Registers a new VOL connector by value
+ *
+ * \param[in] connector_value Connector value
+ * \vipl_id
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLregister_connector_by_value() registers a new VOL connector
+ * with value connector_value as a member of the virtual object layer
+ * class. This VOL connector identifier is good until the library is
+ * closed or the connector is unregistered.
+ *
+ * \p connector_value has a type of H5VL_class_value_t, which is
+ * defined in H5VLpublic.h as follows:
+ * \snippet this H5VL_class_value_t_snip
+ *
+ * Valid VOL connector identifiers can have values from 0 through 255
+ * for connectors defined by the HDF5 library. Values 256 through 511
+ * are available for testing new connectors. Subsequent values should
+ * be obtained by contacting the The HDF Help Desk.
+ *
+ * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
+ * initialization property list of class #H5P_VOL_INITIALIZE created
+ * with H5Pcreate(). When created, this property list contains no
+ * library properties. If a VOL connector author decides that
+ * initialization-specific data are needed, they can be added to the
+ * empty list and retrieved by the connector in the VOL connector's
+ * initialize callback. Use of the VOL initialization property list is
+ * uncommon, as most VOL-specific properties are added to the file
+ * access property list via the connector's API calls which set the
+ * VOL connector for the file open/create. For more information, see
+ * the \ref_vol_doc.
+ *
+ * \since 1.12.0
+ *
+ */
+H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
+/**
+ * \ingroup H5VL
+ * \brief Tests whether a VOL class has been registered under a certain name
+ *
+ * \param[in] name Alleged name of connector
+ * \return \htri_t
+ *
+ * \details H5VLis_connector_registered_by_name() tests whether a VOL class has
+ * been registered or not, according to the supplied connector name
+ * \p name.
+ *
+ * \since 1.12.0
+ */
+H5_DLL htri_t H5VLis_connector_registered_by_name(const char *name);
+/**
+ * \ingroup H5VL
+ * \brief Tests whether a VOL class has been registered for a given value
+ *
+ * \param[in] connector_value Connector value
+ * \return \htri_t
+ *
+ * \details H5VLis_connector_registered_by_value() tests whether a VOL class
+ * has been registered, according to the supplied connector value \p
+ * connector_value.
+ *
+ * \p connector_value has a type of H5VL_class_value_t, which is
+ * defined in H5VLpublic.h as follows:
+ * \snippet this H5VL_class_value_t_snip
+ *
+ * Valid VOL connector identifiers can have values from 0 through 255
+ * for connectors defined by the HDF5 library. Values 256 through 511
+ * are available for testing new connectors. Subsequent values should
+ * be obtained by contacting the The HDF Help Desk.
+ *
+ * \since 1.12.0
+ */
+H5_DLL htri_t H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value);
+/**
+ * \ingroup H5VL
+ * \brief Retrieves the VOL connector identifier for a given object identifier
+ *
+ * \obj_id
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLget_connector_id() retrieves the registered VOL connector
+ * identifier for the specified object identifier \p obj_id. The VOL
+ * connector identifier must be closed with H5VLclose() when no longer
+ * in use.
+ *
+ * \since 1.12.0
+ */
+H5_DLL hid_t H5VLget_connector_id(hid_t obj_id);
+/**
+ * \ingroup H5VL
+ * \brief Retrieves the identifier for a registered VOL connector name
+ *
+ * \param[in] name Connector name
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLget_connector_id_by_name() retrieves the identifier for a
+ * registered VOL connector with the name \p name. The identifier must
+ * be closed with H5VLclose() when no longer in use.
+ *
+ * \since 1.12.0
+ */
+H5_DLL hid_t H5VLget_connector_id_by_name(const char *name);
+/**
+ * \ingroup H5VL
+ * \brief Retrieves the identifier for a registered VOL connector value
+ *
+ * \param[in] connector_value Connector value
+ * \return \hid_t{VOL connector}
+ *
+ * \details H5VLget_connector_id_by_value() retrieves the identifier for a
+ * registered VOL connector with the value \p connector_value. The
+ * identifier will need to be closed by H5VLclose().
+ *
+ * \p connector_value has a type of H5VL_class_value_t, which is
+ * defined in H5VLpublic.h as follows:
+ * \snippet this H5VL_class_value_t_snip
+ *
+ * Valid VOL connector identifiers can have values from 0 through 255
+ * for connectors defined by the HDF5 library. Values 256 through 511
+ * are available for testing new connectors. Subsequent values should
+ * be obtained by contacting the The HDF Help Desk.
+ *
+ * \since 1.12.0
+ */
+H5_DLL hid_t H5VLget_connector_id_by_value(H5VL_class_value_t connector_value);
+/**
+ * \ingroup H5VL
+ * \brief Retrieves a connector name for a VOL
+ *
+ * \obj_id{id} or file identifier
+ * \param[out] name Connector name
+ * \param[in] size Maximum length of the name to retrieve
+ * \return Returns the length of the connector name on success, and a negative value on failure.
+ *
+ * \details H5VLget_connector_name() retrieves up to \p size elements of the
+ * VOL name \p name associated with the object or file identifier \p
+ * id.
+ *
+ * Passing in a NULL pointer for size will return the size of the
+ * connector name. This can be used to determine the size of the
+ * buffer to allocate for the name.
+ *
+ * \since 1.12.0
+ */
H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name /*out*/, size_t size);
-H5_DLL herr_t H5VLclose(hid_t connector_id);
-H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
+/**
+ * \ingroup H5VL
+ * \brief Closes a VOL connector identifier
+ *
+ * \param[in] connector_id Connector identifier
+ * \return \herr_t
+ *
+ * \details H5VLclose() closes a VOL connector identifier. This does not affect
+ * the file access property lists which have been defined to use this
+ * VOL connector or files which are already opened under this
+ * connector.
+ *
+ * \since 1.12.0
+ */
+H5_DLL herr_t H5VLclose(hid_t connector_id);
+/**
+ * \ingroup H5VL
+ * \brief Removes a VOL connector identifier from the library
+ *
+ * \param[in] connector_id Connector identifier
+ * \return \herr_t
+ *
+ * \details H5VLunregister_connector() removes a VOL connector identifier from
+ * the library. This does not affect the file access property lists
+ * which have been defined to use the VOL connector or any files which
+ * are already opened with this connector.
+ *
+ * \attention H5VLunregister_connector() will fail if attempting to unregister
+ * the native VOL connector.
+ *
+ * \since 1.12.0
+ */
+H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
+/**
+ * \ingroup H5VL
+ * \brief Determine if a VOL connector supports a particular
+ * optional callback operation.
+ *
+ * \obj_id
+ * \param[in] subcls VOL subclass
+ * \param[in] opt_type Option type
+ * \param[out] supported Flag
+ * \return \herr_t
+ *
+ * \since 1.12.0
+ */
+H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported);
#ifdef __cplusplus
}
@@ -77,4 +344,4 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
-#endif /* _H5VLpublic_H */
+#endif /* H5VLpublic_H */
diff --git a/src/H5VM.c b/src/H5VM.c
index ea81f06..4d65d75 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 10, 1997
*/
@@ -32,51 +32,46 @@ typedef struct H5VM_memcpy_ud_t {
#define H5VM_HYPER_NDIMS H5O_LAYOUT_NDIMS
/* Local prototypes */
-static void 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*/, const hsize_t *size,
- hsize_t *stride1, hsize_t *stride2);
+static void 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*/,
+ const hsize_t *size, hsize_t *stride1, hsize_t *stride2);
#ifdef LATER
-static void 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);
+static void 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
- * vector, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given a stride vector which references elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vector, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, const hsize_t *size,
- hsize_t *stride1)
+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
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) {
*elmt_size *= size[*np - 1];
if (--*np)
@@ -87,44 +82,36 @@ H5VM_stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co
}
/*-------------------------------------------------------------------------
- * 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
- * vectors, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given two stride vectors which reference elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vectors, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
- *
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, const hsize_t *size,
- hsize_t *stride1, hsize_t *stride2)
+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
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
HDassert(*elmt_size > 0);
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
/* Unroll loop for common cases */
switch (*np) {
@@ -213,34 +200,26 @@ H5VM_stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_stride
+ * Function: H5VM_hyper_stride
*
- * Purpose: Given a description of a hyperslab, this function returns
- * (through STRIDE[]) the byte strides appropriate for accessing
- * all bytes of the hyperslab and the byte offset where the
- * striding will begin. The SIZE can be passed to the various
- * stride functions.
+ * Purpose: Given a description of a hyperslab, this function returns
+ * (through STRIDE[]) the byte strides appropriate for accessing
+ * all bytes of the hyperslab and the byte offset where the
+ * striding will begin. The SIZE can be passed to the various
+ * stride functions.
*
- * The dimensionality of the whole array, the hyperslab, and the
- * returned stride array is N. The whole array dimensions are
- * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
- * dimensions SIZE.
+ * The dimensionality of the whole array, the hyperslab, and the
+ * returned stride array is N. The whole array dimensions are
+ * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
+ * dimensions SIZE.
*
- * The stride and starting point returned will cause the
- * hyperslab elements to be referenced in C order.
+ * The stride and starting point returned will cause the
+ * hyperslab elements to be referenced in C order.
*
- * Return: Success: Byte offset from beginning of array to start
- * of striding.
+ * Return: Byte offset from beginning of array to start of striding.
*
- * Failure: abort() -- should never fail
- *
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
- *
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -320,25 +299,22 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_eq
- *
- * Purpose: Determines whether two hyperslabs are equal. This function
- * assumes that both hyperslabs are relative to the same array,
- * for if not, they could not possibly be equal.
+ * Function: H5VM_hyper_eq
*
- * Return: Success: TRUE if the hyperslabs are equal (that is,
- * both refer to exactly the same elements of an
- * array)
+ * Purpose: Determines whether two hyperslabs are equal. This function
+ * assumes that both hyperslabs are relative to the same array,
+ * for if not, they could not possibly be equal.
*
- * FALSE otherwise.
+ * Return: TRUE if the hyperslabs are equal (that is,
+ * both refer to exactly the same elements of an
+ * array)
*
- * Failure: TRUE the rank is zero or if both hyperslabs
- * are of zero size.
+ * FALSE otherwise
*
- * Programmer: Robb Matzke
- * Friday, October 17, 1997
+ * Never returns FAIL
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Friday, October 17, 1997
*
*-------------------------------------------------------------------------
*/
@@ -374,21 +350,19 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_hyper_fill
*
- * Purpose: Similar to memset() except it operates on hyperslabs...
+ * Purpose: Similar to memset() except it operates on hyperslabs...
*
- * Fills a hyperslab of array BUF with some value VAL. BUF
- * is treated like a C-order array with N dimensions where the
- * size of each dimension is TOTAL_SIZE[]. The hyperslab which
- * will be filled with VAL begins at byte offset OFFSET[] from
- * the minimum corner of BUF and continues for SIZE[] bytes in
- * each dimension.
+ * Fills a hyperslab of array BUF with some value VAL. BUF
+ * is treated like a C-order array with N dimensions where the
+ * size of each dimension is TOTAL_SIZE[]. The hyperslab which
+ * will be filled with VAL begins at byte offset OFFSET[] from
+ * the minimum corner of BUF and continues for SIZE[] bytes in
+ * each dimension.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -425,7 +399,7 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con
/* 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, fill_value);
@@ -434,47 +408,37 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_copy
- *
- * Purpose: Copies a hyperslab from the source to the destination.
+ * Function: H5VM_hyper_copy
*
- * A hyperslab is a logically contiguous region of
- * multi-dimensional size SIZE of an array whose dimensionality
- * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
- * The minimum corner of the hyperslab begins at a
- * multi-dimensional offset from the minimum corner of the DST
- * (destination) or SRC (source) array. The sizes and offsets
- * are assumed to be in C order, that is, the first size/offset
- * varies the slowest while the last varies the fastest in the
- * mapping from N-dimensional space to linear space. This
- * function assumes that the array elements are single bytes (if
- * your array has multi-byte elements then add an additional
- * dimension whose size is that of your element).
+ * Purpose: Copies a hyperslab from the source to the destination.
*
- * The SRC and DST array may be the same array, but the results
- * are undefined if the source hyperslab overlaps the
- * destination hyperslab.
+ * A hyperslab is a logically contiguous region of
+ * multi-dimensional size SIZE of an array whose dimensionality
+ * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
+ * The minimum corner of the hyperslab begins at a
+ * multi-dimensional offset from the minimum corner of the DST
+ * (destination) or SRC (source) array. The sizes and offsets
+ * are assumed to be in C order, that is, the first size/offset
+ * varies the slowest while the last varies the fastest in the
+ * mapping from N-dimensional space to linear space. This
+ * function assumes that the array elements are single bytes (if
+ * your array has multi-byte elements then add an additional
+ * dimension whose size is that of your element).
*
- * Return: Non-negative on success/Negative on failure
+ * The SRC and DST array may be the same array, but the results
+ * are undefined if the source hyperslab overlaps the
+ * destination hyperslab.
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
herr_t
-H5VM_hyper_copy(unsigned n, const hsize_t *_size,
-
- /*destination*/
- const hsize_t *dst_size, const hsize_t *dst_offset, void *_dst,
-
- /*source*/
- const hsize_t *src_size, const hsize_t *src_offset, const void *_src)
+H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const hsize_t *dst_offset,
+ void *_dst, const hsize_t *src_size, const hsize_t *src_offset, const void *_src)
{
const uint8_t *src = (const uint8_t *)_src; /*cast for ptr arithmtc */
uint8_t * dst = (uint8_t *)_dst; /*cast for ptr arithmtc */
@@ -606,7 +570,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 =
@@ -618,15 +582,13 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size,
/*-------------------------------------------------------------------------
* Function: H5VM_stride_fill
*
- * Purpose: Fills all bytes of a hyperslab with the same value using
- * memset().
- *
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Fills all bytes of a hyperslab with the same value using
+ * memset().
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -671,21 +633,19 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -739,21 +699,19 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy_s
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
- *
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Return: Non-negative on success/Negative on failure
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -807,30 +765,24 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss
#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
- * we copy exactly NELMTS elements each of size ELMT_SIZE. The
- * size counters wrap if NELMTS is more than a size counter.
+ * Purpose: Similar to H5VM_stride_copy() except the source and
+ * destination each have their own dimensionality and size and
+ * we copy exactly NELMTS elements each of size ELMT_SIZE. The
+ * size counters wrap if NELMTS is more than a size counter.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
-
- /* destination */
- unsigned dst_n, const hsize_t *dst_size, const hsize_t *dst_stride, void *_dst,
-
- /* source */
- unsigned src_n, const hsize_t *src_size, const hsize_t *src_stride, const void *_src)
+H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsize_t *dst_size,
+ const hsize_t *dst_stride, void *_dst, unsigned src_n, const hsize_t *src_size,
+ const hsize_t *src_stride, const void *_src)
{
uint8_t * dst = (uint8_t *)_dst;
const uint8_t *src = (const uint8_t *)_src;
@@ -840,7 +792,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);
@@ -881,18 +833,16 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_fill
+ * Function: H5VM_array_fill
*
- * Purpose: Fills all bytes of an array with the same value using
- * memset(). Increases amount copied by power of two until the
- * halfway point is crossed, then copies the rest in one swoop.
+ * Purpose: Fills all bytes of an array with the same value using
+ * memset(). Increases amount copied by power of two until the
+ * halfway point is crossed, then copies the rest in one swoop.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, June 18, 1998
- *
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Thursday, June 18, 1998
*
*-------------------------------------------------------------------------
*/
@@ -935,27 +885,25 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
} /* H5VM_array_fill() */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_down
+ * Function: H5VM_array_down
*
- * Purpose: Given a set of dimension sizes, calculate the size of each
+ * Purpose: Given a set of dimension sizes, calculate the size of each
* "down" slice. This is the size of the dimensions for all the
* dimensions below the current one, which is used for indexing
* offsets in this dimension.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, April 28, 2003
+ * Return: void
*
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Monday, April 28, 2003
*
*-------------------------------------------------------------------------
*/
-herr_t
+void
H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
{
- hsize_t acc; /*accumulator */
- int i; /*counter */
+ hsize_t acc; /* Accumulator */
+ int i; /* Counter */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -963,31 +911,31 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
HDassert(total_size);
HDassert(down);
- /* Build the sizes of each dimension in the array */
- /* (From fastest to slowest) */
+ /* Build the sizes of each dimension in the array
+ * (From fastest to slowest)
+ */
for (i = (int)(n - 1), acc = 1; i >= 0; i--) {
down[i] = acc;
acc *= total_size[i];
- } /* end for */
+ }
- FUNC_LEAVE_NOAPI(SUCCEED)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5VM_array_down() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset_pre
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array, this
+ * function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -1013,20 +961,17 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array,
+ * this function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
- *
- * Modifications:
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -1036,38 +981,36 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset)
hsize_t acc_arr[H5VM_HYPER_NDIMS]; /* Accumulated size of down dimensions */
hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */
+ FUNC_ENTER_NOAPI_NOERR
HDassert(n <= H5VM_HYPER_NDIMS);
HDassert(total_size);
HDassert(offset);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, acc_arr) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, acc_arr);
/* Set return value */
ret_value = H5VM_array_offset_pre(n, acc_arr, offset);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VM_array_offset() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc_pre
*
- * Purpose: Given a linear offset in an array, the dimensions of that
+ * Purpose: Given a linear offset in an array, the dimensions of that
* array and the pre-computed 'down' (accumulator) sizes, this
* function computes the coordinates of that offset in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, July 16, 2009
+ * Programmer: Quincey Koziol
+ * Thursday, July 16, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1094,20 +1037,18 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc
*
- * Purpose: Given a linear offset in an array and the dimensions of that
+ * Purpose: Given a linear offset in an array and the dimensions of that
* array, this function computes the coordinates of that offset
* in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, April 16, 2003
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Wednesday, April 16, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1125,8 +1066,7 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *
HDassert(coords);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, idx) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, idx);
/* Compute the coordinates from the offset */
if (H5VM_array_calc_pre(offset, n, idx, coords) < 0)
@@ -1139,7 +1079,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1169,10 +1109,10 @@ done:
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Quincey Koziol
- * Monday, April 21, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1197,14 +1137,14 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co
} /* end H5VM_chunk_index() */
/*-------------------------------------------------------------------------
- * Function: H5VM_chunk_scaled
+ * Function: H5VM_chunk_scaled
*
- * Purpose: Compute the scaled coordinates for a chunk offset
+ * Purpose: Compute the scaled coordinates for a chunk offset
*
- * Return: <none>
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Wednesday, November 19, 2014
+ * Programmer: Quincey Koziol
+ * Wednesday, November 19, 2014
*
*-------------------------------------------------------------------------
*/
@@ -1232,7 +1172,7 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index_scaled
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1262,13 +1202,13 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Note: This routine is identical to H5VM_chunk_index(), except for
- * caching the scaled information. Make changes in both places.
+ * Note: This routine is identical to H5VM_chunk_index(), except for
+ * caching the scaled information. Make changes in both places.
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Vailin Choi
- * Monday, February 9, 2015
+ * Programmer: Vailin Choi
+ * Monday, February 9, 2015
*
*-------------------------------------------------------------------------
*/
@@ -1303,22 +1243,22 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch
/*-------------------------------------------------------------------------
* Function: H5VM_opvv
*
- * Purpose: Perform an operation on a source & destination sequences
- * of offset/length pairs. Each set of sequnces has an array
- * of lengths, an array of offsets, the maximum number of
- * sequences and the current sequence to start at in the sequence.
+ * Purpose: Perform an operation on a source & destination sequences
+ * of offset/length pairs. Each set of sequnces has an array
+ * of lengths, an array of offsets, the maximum number of
+ * sequences and the current sequence to start at in the sequence.
*
* There may be different numbers of bytes in the source and
* destination sequences, the operation stops when either the
* source or destination sequence runs out of information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_memcpyvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_memcpyvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes operated on, on success/Negative on failure
+ * Return: Non-negative # of bytes operated on, on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, September 30, 2010
+ * Programmer: Quincey Koziol
+ * Thursday, September 30, 2010
*
*-------------------------------------------------------------------------
*/
@@ -1506,7 +1446,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_memcpyvv
*
- * Purpose: Given source and destination buffers in memory (SRC & DST)
+ * Purpose: Given source and destination buffers in memory (SRC & DST)
* copy sequences of from the source buffer into the destination
* buffer. Each set of sequences has an array of lengths, an
* array of offsets, the maximum number of sequences and the
@@ -1516,13 +1456,13 @@ done:
* destination sequences, data copying stops when either the
* source or destination buffer runs out of sequence information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_opvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_opvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes copied on success/Negative on failure
+ * Return: Non-negative # of bytes copied on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Friday, May 2, 2003
+ * Programmer: Quincey Koziol
+ * Friday, May 2, 2003
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index 3c79370..0d3bd0f 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -6,22 +6,22 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 10, 1997
*/
#ifndef H5VMprivate_H
#define H5VMprivate_H
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/* Vector-Vector sequence operation callback */
typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, void *udata);
@@ -105,7 +105,7 @@ H5_DLL herr_t H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_
const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride,
const void *_src);
H5_DLL herr_t H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count);
-H5_DLL herr_t H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
+H5_DLL void H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset);
H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset);
H5_DLL herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords);
@@ -130,6 +130,10 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s
* 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
@@ -137,11 +141,9 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE hsize_t H5_ATTR_UNUSED
+static inline hsize_t H5_ATTR_UNUSED
H5VM_vector_reduce_product(unsigned n, const hsize_t *v)
{
hsize_t ret_value = 1;
@@ -163,6 +165,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
*
@@ -171,11 +177,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_u(int n, const hsize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -198,6 +202,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
*
@@ -206,11 +214,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_s(int n, const hssize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -234,6 +240,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
@@ -243,11 +253,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -275,25 +283,27 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5VM_vector_cmp_s
+ * Function: H5VM_vector_cmp_s
*
* 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
*
* Failure: 0 if N is zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 8, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -325,16 +335,18 @@ 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
+static inline void H5_ATTR_UNUSED
H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
{
while (n--)
@@ -343,14 +355,17 @@ H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
/* Lookup table for general log2(n) routine */
static const unsigned char LogTable256[] = {
- 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
+ /* clang-clang-format off */
+ 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+ /* clang-clang-format on */
+};
/*-------------------------------------------------------------------------
* Function: H5VM_log2_gen
@@ -364,6 +379,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
@@ -371,7 +390,7 @@ static const unsigned char LogTable256[] = {
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_log2_gen(uint64_t n)
{
unsigned r; /* r will be log2(n) */
@@ -409,6 +428,10 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14,
* 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
@@ -416,7 +439,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_PURE unsigned
+static inline H5_ATTR_PURE unsigned
H5VM_log2_of2(uint32_t n)
{
#ifndef NDEBUG
@@ -426,17 +449,21 @@ H5VM_log2_of2(uint32_t n)
} /* H5VM_log2_of2() */
/*-------------------------------------------------------------------------
- * Function: H5VM_power2up
+ * Function: H5VM_power2up
*
- * Purpose: Round up a number to the next power of 2
+ * Purpose: Round up a number to the next power of 2
*
- * Return: Return the number which is a 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.
*
- * Programmer: Vailin Choi; Nov 2014
+ * Return: Return the number which is a power of 2
+ *
+ * Programmer: Vailin Choi; Nov 2014
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_CONST hsize_t
+static inline H5_ATTR_CONST hsize_t
H5VM_power2up(hsize_t n)
{
hsize_t ret_value = 1; /* Return value */
@@ -457,6 +484,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
@@ -464,7 +495,7 @@ H5VM_power2up(hsize_t n)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_limit_enc_size(uint64_t limit)
{
return (H5VM_log2_gen(limit) / 8) + 1;
@@ -478,13 +509,17 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*
* Purpose: Determine the value of the n'th bit in a buffer.
*
- * Note: No range checking on <offset> is performed!
+ * Note: No range checking on <offset> is performed!
*
- * Note #2: Bits are sequentially stored in the buffer, starting with bit
+ * Note #2: Bits are sequentially stored in the buffer, starting with bit
* offset 0 in the first byte's high-bit position, proceeding down
* 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
@@ -492,7 +527,7 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE hbool_t H5_ATTR_UNUSED
+static inline hbool_t H5_ATTR_UNUSED
H5VM_bit_get(const unsigned char *buf, size_t offset)
{
/* Test the appropriate bit in the buffer */
@@ -504,13 +539,17 @@ H5VM_bit_get(const unsigned char *buf, size_t offset)
*
* Purpose: Set/reset the n'th bit in a buffer.
*
- * Note: No range checking on <offset> is performed!
+ * Note: No range checking on <offset> is performed!
*
- * Note #2: Bits are sequentially stored in the buffer, starting with bit
+ * Note #2: Bits are sequentially stored in the buffer, starting with bit
* offset 0 in the first byte's high-bit position, proceeding down
* 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
@@ -518,7 +557,7 @@ H5VM_bit_get(const unsigned char *buf, size_t offset)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void H5_ATTR_UNUSED
+static inline void H5_ATTR_UNUSED
H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val)
{
/* Set/reset the appropriate bit in the buffer */
diff --git a/src/H5WB.c b/src/H5WB.c
index 8d0bcd1..df7627f 100644
--- a/src/H5WB.c
+++ b/src/H5WB.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5WB.c
* Jun 26 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implements the "wrapped buffer" code for wrapping
* an existing [staticly sized] buffer, in order to
@@ -88,7 +88,6 @@ H5FL_BLK_DEFINE_STATIC(extra_buf);
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 26 2007
*
*-------------------------------------------------------------------------
@@ -141,7 +140,6 @@ done:
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 26 2007
*
*-------------------------------------------------------------------------
@@ -208,7 +206,6 @@ done:
* NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 26 2007
*
*-------------------------------------------------------------------------
@@ -245,7 +242,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 34077a6..1092365 100644
--- a/src/H5WBprivate.h
+++ b/src/H5WBprivate.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,15 +15,15 @@
*
* Created: H5WBprivate.h
* Jun 26 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Private header for library accessible wrapped buffer routines.
*
*-------------------------------------------------------------------------
*/
-#ifndef _H5WBprivate_H
-#define _H5WBprivate_H
+#ifndef H5WBprivate_H
+#define H5WBprivate_H
/* Include package's public header */
/* #include "H5WBpublic.h" */
@@ -55,4 +55,4 @@ H5_DLL void * H5WB_actual(H5WB_t *wb, size_t need);
H5_DLL void * H5WB_actual_clear(H5WB_t *wb, size_t need);
H5_DLL herr_t H5WB_unwrap(H5WB_t *wb);
-#endif /* _H5WBprivate_H */
+#endif /* H5WBprivate_H */
diff --git a/src/H5Z.c b/src/H5Z.c
index ab4e8df..6b44024 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -34,10 +34,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);
@@ -137,8 +137,15 @@ H5Z_term_package(void)
if (H5DEBUG(Z)) {
for (i = 0; i < H5Z_table_used_g; i++) {
for (dir = 0; dir < 2; dir++) {
+ struct {
+ char *user;
+ char *system;
+ char *elapsed;
+ } timestrs = {H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)};
if (0 == H5Z_stat_table_g[i].stats[dir].total)
- continue;
+ goto next;
if (0 == nprint++) {
/* Print column headers */
@@ -160,24 +167,26 @@ H5Z_term_package(void)
* the word `Inf' if the elapsed time is zero.
*/
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, 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, bandwidth);
+ HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
+ (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total,
+ H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system,
+ timestrs.elapsed, bandwidth);
+next:
+ HDfree(timestrs.user);
+ HDfree(timestrs.system);
+ HDfree(timestrs.elapsed);
} /* end for */
} /* end for */
} /* end if */
#endif /* H5Z_DEBUG */
+
/* Free the table of filters */
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 */
@@ -334,8 +343,8 @@ done:
*
* Purpose: This function unregisters a filter.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -573,7 +582,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
+H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARALLEL_USED *key)
{
H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
#ifdef H5_HAVE_PARALLEL
@@ -696,7 +705,7 @@ done:
} /* end H5Z_filter_avail() */
/*-------------------------------------------------------------------------
- * Function: H5Z_prelude_callback
+ * Function: H5Z__prelude_callback
*
* Purpose: Makes a dataset creation "prelude" callback for the "can_apply"
* or "set_local" routines.
@@ -709,14 +718,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hid_t space_id,
- H5Z_prelude_type_t prelude_type)
+H5Z__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);
@@ -774,10 +783,10 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hid
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.
@@ -790,13 +799,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));
@@ -844,7 +853,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")
}
}
@@ -858,7 +867,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() */
/*-------------------------------------------------------------------------
* Function: H5Z_can_apply
@@ -883,7 +892,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:
@@ -913,7 +922,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:
@@ -941,7 +950,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:
@@ -973,7 +982,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:
@@ -981,6 +990,70 @@ done:
} /* end H5Z_set_local_direct() */
/*-------------------------------------------------------------------------
+ * 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.
@@ -1143,7 +1216,7 @@ done:
} /* end H5Z_append() */
/*-------------------------------------------------------------------------
- * 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.
@@ -1153,12 +1226,12 @@ 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)
@@ -1166,7 +1239,7 @@ H5Z_find_idx(H5Z_filter_t id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z_find_idx() */
+} /* end H5Z__find_idx() */
/*-------------------------------------------------------------------------
* Function: H5Z_find
@@ -1187,7 +1260,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 */
@@ -1225,15 +1298,18 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
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;
+ 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;
+ size_t i;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1245,10 +1321,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
HDassert(buf && *buf);
HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS);
+#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 */
@@ -1258,10 +1336,10 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
* 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);
@@ -1272,7 +1350,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
/* 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
@@ -1292,17 +1370,24 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
} /* 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);
#ifdef H5Z_DEBUG
- H5_timer_end(&(fstats->stats[1].timer), &timer);
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ 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)
fstats->stats[1].errors += *nbytes;
@@ -1326,30 +1411,39 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
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)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered")
-
failed |= (unsigned)1 << idx;
H5E_clear_stack(NULL);
- continue; /*filter excluded*/
- }
+ 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);
+
#ifdef H5Z_DEBUG
- H5_timer_end(&(fstats->stats[0].timer), &timer);
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ 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)
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,
@@ -1359,13 +1453,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
*nbytes = *buf_size;
}
-
failed |= (unsigned)1 << idx;
H5E_clear_stack(NULL);
}
else
*nbytes = new_nbytes;
- }
+ } /* end for */
}
*filter_mask = failed;
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index 8be79ae..d29d8e5 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, August 27, 1999
*/
@@ -33,25 +33,25 @@
#endif
/* Local function prototypes */
-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);
+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_FILTER_DEFLATE, /* Filter id number */
- 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_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 */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z__filter_deflate, /* The actual filter function */
}};
-#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12)
+#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12)
/*-------------------------------------------------------------------------
- * Function: H5Z_filter_deflate
+ * Function: H5Z__filter_deflate
*
* Purpose: Implement an I/O filter around the 'deflate' algorithm in
* libz
@@ -62,19 +62,17 @@ 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, const unsigned cd_values[], size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes,
+ size_t *buf_size, void **buf)
{
void * outbuf = NULL; /* Pointer to new buffer */
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 978703d..4b0801c 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -6,13 +6,13 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Jan 3, 2003
*/
@@ -25,25 +25,25 @@
#include "H5Zpkg.h" /* Data filters */
/* Local function prototypes */
-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);
+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_FILTER_FLETCHER32, /* Filter id number */
- 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_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) */
+ "fletcher32", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ 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
*
@@ -53,22 +53,11 @@ 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[], size_t nbytes, size_t *buf_size, void **buf)
+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 */
unsigned char *src = (unsigned char *)(*buf);
@@ -78,7 +67,7 @@ H5Z_filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts,
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 c636f82..76a2380 100644
--- a/src/H5Zmodule.h
+++ b/src/H5Zmodule.h
@@ -5,21 +5,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Saturday, September 12, 2015
*
* Purpose: This file contains declarations which define macros for the
* H5Z package. Including this header means that the source file
* is part of the H5Z package.
*/
-#ifndef _H5Zmodule_H
-#define _H5Zmodule_H
+#ifndef H5Zmodule_H
+#define H5Zmodule_H
/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
* reporting macros.
@@ -29,4 +29,69 @@
#define H5_MY_PKG_ERR H5E_PLINE
#define H5_MY_PKG_INIT YES
-#endif /* _H5Zmodule_H */
+/**
+ * \defgroup H5Z H5Z
+ *
+ *
+ * \brief Filter and Compression Interface
+ *
+ * \details The functions in this module let you configure filters that process
+ * data during I/O operation.
+ *
+ * HDF5 supports a filter pipeline that provides the capability for
+ * standard and customized raw data processing during I/O operations.
+ * HDF5 is distributed with a small set of standard filters such as
+ * compression (gzip, SZIP, and a shuffling algorithm) and error
+ * checking (Fletcher32 checksum). For further flexibility, the
+ * library allows a user application to extend the pipeline through
+ * the creation and registration of customized filters.
+ *
+ * The flexibility of the filter pipeline implementation enables the
+ * definition of additional filters by a user application. A filter
+ * \li is associated with a dataset when the dataset is created,
+ * \li can be used only with chunked data (i.e., datasets stored in
+ * the #H5D_CHUNKED storage layout), and
+ * \li is applied independently to each chunk of the dataset.
+ *
+ * The HDF5 library does not support filters for contiguous datasets
+ * because of the difficulty of implementing random access for partial
+ * I/O. Compact dataset filters are not supported because it would not
+ * produce significant results.
+ *
+ * Filter identifiers for the filters distributed with the HDF5
+ * Library are as follows:
+ * <table>
+ * <tr><td>#H5Z_FILTER_DEFLATE</td><td>The gzip compression, or
+ * deflation, filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SZIP</td><td>The SZIP compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_NBIT</td><td>The N-bit compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SCALEOFFSET</td><td>The scale-offset
+ * compression filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SHUFFLE</td><td>The shuffle algorithm
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_FLETCHER32</td><td>The Fletcher32 checksum,
+ * or error checking, filter</td></tr>
+ * </table>
+ * Custom filters that have been registered with the library will have
+ * additional unique identifiers.
+ *
+ * See \ref_dld_filters for more information on how an HDF5
+ * application can apply a filter that is not registered with the HDF5
+ * library.
+ *
+ * \defgroup H5ZPRE Predefined Filters
+ * \ingroup H5Z
+ * \defgroup FLETCHER32 Checksum Filter
+ * \ingroup H5ZPRE
+ * \defgroup SCALEOFFSET Scale-Offset Filter
+ * \ingroup H5ZPRE
+ * \defgroup SHUFFLE Shuffle Filter
+ * \ingroup H5ZPRE
+ * \defgroup SZIP Szip Filter
+ * \ingroup H5ZPRE
+ *
+ */
+
+#endif /* H5Zmodule_H */
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 7a8a88c..795fdce 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -34,35 +34,37 @@ 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[], 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 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, 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 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, unsigned cd_values[],
+ hbool_t *need_not_compress);
+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_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, 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, 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,
- 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, 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, unsigned char *buffer,
- size_t *j, size_t *buf_len, const parms_atomic *p);
+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, unsigned k,
+ unsigned begin_i, unsigned end_i, const 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(const 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,
+ const 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, 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[],
unsigned *parms_index);
@@ -71,29 +73,27 @@ static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data
const unsigned parms[], 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, 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, 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, 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,
- size_t *buffer_size, const unsigned parms[]);
+static void H5Z__nbit_compress_one_nooptype(const 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_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, 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,
+ 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_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 */
+ 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 */
}};
/* Local macros */
@@ -108,7 +108,7 @@ H5Z_class2_t H5Z_NBIT[1] = {{
/* Local variables */
/*-------------------------------------------------------------------------
- * 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.
@@ -119,17 +119,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)))
@@ -145,10 +143,10 @@ 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
@@ -157,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;
@@ -172,7 +168,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
@@ -181,12 +177,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;
@@ -205,7 +199,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
@@ -217,18 +211,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;
@@ -248,16 +240,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;
@@ -269,7 +261,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:
@@ -286,10 +278,10 @@ 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
@@ -301,19 +293,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;
@@ -347,16 +337,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;
@@ -368,7 +358,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:
@@ -394,7 +384,7 @@ done:
} /* end H5Z_calc_params_compound */
/*-------------------------------------------------------------------------
- * 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
@@ -407,17 +397,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;
@@ -432,10 +420,10 @@ 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
@@ -446,13 +434,11 @@ done:
* Programmer: Xiaowen Wu
* Tuesday, January 11, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[],
- hbool_t *need_not_compress)
+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 */
size_t dtype_size; /* Atomic datatype's size (in bytes) */
@@ -461,7 +447,7 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v
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;
@@ -525,10 +511,10 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v
*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
@@ -539,13 +525,11 @@ done:
* Programmer: Xiaowen Wu
* Tuesday, April 5, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[],
- hbool_t *need_not_compress)
+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 */
H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */
@@ -553,7 +537,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_va
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;
@@ -578,17 +562,17 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_va
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;
@@ -602,7 +586,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_va
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;
@@ -612,7 +596,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_va
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;
@@ -630,10 +614,10 @@ 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
@@ -644,13 +628,11 @@ done:
* Programmer: Xiaowen Wu
* Tuesday, April 5, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[],
- hbool_t *need_not_compress)
+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 */
unsigned nmembers; /* Compound datatype's number of members */
@@ -663,7 +645,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd
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;
@@ -705,17 +687,17 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd
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;
@@ -755,7 +737,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd
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;
@@ -782,7 +764,7 @@ done:
} /* end H5Z_set_params_compound */
/*-------------------------------------------------------------------------
- * Function: H5Z_set_local_nbit
+ * Function: H5Z__set_local_nbit
*
* Purpose: Set the "local" dataset parameters for nbit compression.
*
@@ -792,12 +774,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 */
@@ -812,7 +792,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)))
@@ -832,16 +812,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;
@@ -903,17 +883,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;
@@ -952,10 +932,10 @@ 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
*
@@ -968,15 +948,15 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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 */
size_t size_out = 0; /* size of output buffer */
unsigned d_nelmts = 0; /* number of elements in the chunk */
size_t ret_value = 0; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments
* cd_values[0] stores actual number of parameters in cd_values[]
@@ -1016,7 +996,7 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], si
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 */
@@ -1029,7 +1009,7 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], si
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z_filter_nbit() */
+} /* end H5Z__filter_nbit() */
/* ======== Nbit Algorithm ===============================================
* assume one byte has 8 bit
@@ -1040,16 +1020,16 @@ 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, unsigned begin_i,
- unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len,
- const parms_atomic *p, size_t datatype_len)
+H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
+ unsigned end_i, const unsigned char *buffer, size_t *j, size_t *buf_len,
+ const parms_atomic *p, size_t datatype_len)
{
size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */
size_t dat_offset;
@@ -1084,7 +1064,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;
@@ -1097,8 +1077,8 @@ 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, unsigned char *buffer, size_t *j,
- size_t *buf_len, unsigned size)
+H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, const unsigned char *buffer,
+ size_t *j, size_t *buf_len, unsigned size)
{
unsigned i; /* index */
size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */
@@ -1112,7 +1092,7 @@ H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsign
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;
@@ -1124,8 +1104,8 @@ H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsign
}
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)
+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
end_i: the index of byte having last significant bit */
@@ -1144,8 +1124,8 @@ H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned
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, buffer, j, buf_len,
- p, datatype_len);
+ H5Z__nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len,
+ p, datatype_len);
}
else { /* big endian */
/* Sanity check */
@@ -1159,8 +1139,8 @@ H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned
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, buffer, j, buf_len,
- p, datatype_len);
+ H5Z__nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len,
+ p, datatype_len);
}
}
@@ -1190,7 +1170,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned
n = total_size / p.size;
for (i = 0; i < n; i++)
- H5Z_nbit_decompress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p);
+ H5Z__nbit_decompress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p);
break;
case H5Z_NBIT_ARRAY:
@@ -1219,7 +1199,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned
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:
@@ -1265,7 +1245,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig
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, buffer, j, buf_len, &p);
+ H5Z__nbit_decompress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, &p);
break;
case H5Z_NBIT_ARRAY:
@@ -1283,8 +1263,8 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig
case H5Z_NBIT_NOOPTYPE:
/* Advance past member size */
(*parms_index)++;
- H5Z_nbit_decompress_one_nooptype(data, data_offset + member_offset, buffer, j, buf_len,
- member_size);
+ H5Z__nbit_decompress_one_nooptype(data, data_offset + member_offset, buffer, j, buf_len,
+ member_size);
break;
default:
@@ -1329,7 +1309,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:
@@ -1363,9 +1343,9 @@ done:
}
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)
+H5Z__nbit_compress_one_byte(const 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)
{
size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */
unsigned char val; /* value to be copied in each data byte */
@@ -1395,7 +1375,7 @@ H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
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;
@@ -1405,8 +1385,8 @@ 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, unsigned char *buffer, size_t *j,
- size_t *buf_len, unsigned size)
+H5Z__nbit_compress_one_nooptype(const unsigned char *data, size_t data_offset, unsigned char *buffer,
+ size_t *j, size_t *buf_len, unsigned size)
{
unsigned i; /* index */
size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */
@@ -1420,7 +1400,7 @@ H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned
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,8 +1410,8 @@ H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned
}
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)
+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
end_i: the index of byte having last significant bit */
@@ -1450,8 +1430,8 @@ H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned c
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, buffer, j, buf_len, p,
- datatype_len);
+ H5Z__nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len, p,
+ datatype_len);
}
else { /* big endian */
/* Sanity check */
@@ -1465,14 +1445,14 @@ H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned c
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, buffer, j, buf_len, p,
- datatype_len);
+ 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, unsigned char *buffer, size_t *j,
- size_t *buf_len, const unsigned parms[], unsigned *parms_index)
+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)
{
unsigned i, total_size, base_class, base_size, n, begin_index;
parms_atomic p;
@@ -1488,7 +1468,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch
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, buffer, j, buf_len, &p);
+ H5Z__nbit_compress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p);
break;
case H5Z_NBIT_ARRAY:
@@ -1496,8 +1476,8 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch
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, buffer, j, buf_len, parms,
- parms_index);
+ H5Z__nbit_compress_one_array(data, data_offset + i * base_size, buffer, j, buf_len, parms,
+ parms_index);
*parms_index = begin_index;
}
break;
@@ -1507,15 +1487,15 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch
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, buffer, j, buf_len, parms,
- parms_index);
+ H5Z__nbit_compress_one_compound(data, data_offset + i * base_size, buffer, j, buf_len, parms,
+ parms_index);
*parms_index = begin_index;
}
break;
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:
@@ -1524,8 +1504,8 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned ch
}
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)
+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)
{
unsigned i, nmembers, member_offset, member_class, size;
parms_atomic p;
@@ -1543,22 +1523,22 @@ H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigned
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, buffer, j, buf_len, &p);
+ 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, buffer, j, buf_len, parms,
- parms_index);
+ 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, buffer, j, buf_len, parms,
- parms_index);
+ 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, buffer, j, buf_len, size);
+ H5Z__nbit_compress_one_nooptype(data, data_offset + member_offset, buffer, j, buf_len, size);
break;
default:
@@ -1568,8 +1548,8 @@ H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigned
}
static void
-H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t *buffer_size,
- const unsigned parms[])
+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,
buf_len: number of bits to be filled in current byte */
@@ -1594,14 +1574,15 @@ 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;
@@ -1610,8 +1591,8 @@ 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/H5Zpkg.h b/src/H5Zpkg.h
index 17fd96d..726478a 100644
--- a/src/H5Zpkg.h
+++ b/src/H5Zpkg.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
#error "Do not include this file outside the H5Z package!"
#endif
-#ifndef _H5Zpkg_H
-#define _H5Zpkg_H
+#ifndef H5Zpkg_H
+#define H5Zpkg_H
/* Include private header file */
#include "H5Zprivate.h" /* Filter functions */
@@ -54,4 +54,4 @@ H5_DLLVAR H5Z_class2_t H5Z_SZIP[1];
/* Package internal routines */
H5_DLL herr_t H5Z__unregister(H5Z_filter_t filter_id);
-#endif /* _H5Zpkg_H */
+#endif /* H5Zpkg_H */
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 2504efb..51690b4 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -6,17 +6,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Thursday, April 16, 1998
*/
-#ifndef _H5Zprivate_H
-#define _H5Zprivate_H
+#ifndef H5Zprivate_H
+#define H5Zprivate_H
/* Early typedefs to avoid circular dependencies */
typedef struct H5Z_filter_info_t H5Z_filter_info_t;
@@ -26,6 +26,7 @@ typedef struct H5Z_filter_info_t H5Z_filter_info_t;
/* Private headers needed by this file */
#include "H5Tprivate.h" /* Datatypes */
+#include "H5Sprivate.h" /* Dataspace */
/**************************/
/* Library Private Macros */
@@ -86,6 +87,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);
H5_DLL htri_t H5Z_all_filters_avail(const struct H5O_pline_t *pline);
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 9da4eaf..90277cf 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -6,126 +6,246 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Thursday, April 16, 1998
*/
-#ifndef _H5Zpublic_H
-#define _H5Zpublic_H
+#ifndef H5Zpublic_H
+#define H5Zpublic_H
/* Public headers needed by this file */
#include "H5public.h"
-/*
- * Filter identifiers. Values 0 through 255 are for filters defined by the
- * HDF5 library. Values 256 through 511 are available for testing new
- * filters. Subsequent values should be obtained from the HDF5 development
- * team at help@hdfgroup.org. These values will never change because they
- * appear in the HDF5 files.
+/**
+ * \brief Filter identifiers
+ *
+ * \details Values 0 through 255 are for filters defined by the HDF5 library.
+ * Values 256 through 511 are available for testing new filters.
+ * Subsequent values should be obtained from the HDF5 development team
+ * at mailto:help@hdfgroup.org. These values will never change because
+ * they appear in the HDF5 files.
*/
typedef int H5Z_filter_t;
/* Filter IDs */
-#define H5Z_FILTER_ERROR (-1) /*no filter */
-#define H5Z_FILTER_NONE 0 /*reserved indefinitely */
-#define H5Z_FILTER_DEFLATE 1 /*deflation like gzip */
-#define H5Z_FILTER_SHUFFLE 2 /*shuffle the data */
-#define H5Z_FILTER_FLETCHER32 3 /*fletcher32 checksum of EDC */
-#define H5Z_FILTER_SZIP 4 /*szip compression */
-#define H5Z_FILTER_NBIT 5 /*nbit compression */
-#define H5Z_FILTER_SCALEOFFSET 6 /*scale+offset compression */
-#define H5Z_FILTER_RESERVED 256 /*filter ids below this value are reserved for library use */
-
-#define H5Z_FILTER_MAX 65535 /*maximum filter id */
+/**
+ * no filter
+ */
+#define H5Z_FILTER_ERROR (-1)
+/**
+ * reserved indefinitely
+ */
+#define H5Z_FILTER_NONE 0
+/**
+ * deflation like gzip
+ */
+#define H5Z_FILTER_DEFLATE 1
+/**
+ * shuffle the data
+ */
+#define H5Z_FILTER_SHUFFLE 2
+/**
+ * fletcher32 checksum of EDC
+ */
+#define H5Z_FILTER_FLETCHER32 3
+/**
+ * szip compression
+ */
+#define H5Z_FILTER_SZIP 4
+/**
+ * nbit compression
+ */
+#define H5Z_FILTER_NBIT 5
+/**
+ * scale+offset compression
+ */
+#define H5Z_FILTER_SCALEOFFSET 6
+/**
+ * filter ids below this value are reserved for library use
+ */
+#define H5Z_FILTER_RESERVED 256
+/**
+ * maximum filter id
+ */
+#define H5Z_FILTER_MAX 65535
/* General macros */
-#define H5Z_FILTER_ALL 0 /* Symbol to remove all filters in H5Premove_filter */
-#define H5Z_MAX_NFILTERS 32 /* Maximum number of filters allowed in a pipeline */
- /* (should probably be allowed to be an
- * unlimited amount, but currently each
- * filter uses a bit in a 32-bit field,
- * so the format would have to be
- * changed to accommodate that)
- */
+/**
+ * Symbol to remove all filters in H5Premove_filter()
+ */
+#define H5Z_FILTER_ALL 0
+/**
+ * Maximum number of filters allowed in a pipeline
+ *
+ * \internal (should probably be allowed to be an unlimited amount, but
+ * currently each filter uses a bit in a 32-bit field, so the format
+ * would have to be changed to accommodate that)
+ */
+#define H5Z_MAX_NFILTERS 32
/* Flags for filter definition (stored) */
-#define H5Z_FLAG_DEFMASK 0x00ff /*definition flag mask */
-#define H5Z_FLAG_MANDATORY 0x0000 /*filter is mandatory */
-#define H5Z_FLAG_OPTIONAL 0x0001 /*filter is optional */
+/**
+ * definition flag mask
+ */
+#define H5Z_FLAG_DEFMASK 0x00ff
+/**
+ * filter is mandatory
+ */
+#define H5Z_FLAG_MANDATORY 0x0000
+/**
+ * filter is optional
+ */
+#define H5Z_FLAG_OPTIONAL 0x0001
/* Additional flags for filter invocation (not stored) */
-#define H5Z_FLAG_INVMASK 0xff00 /*invocation flag mask */
-#define H5Z_FLAG_REVERSE 0x0100 /*reverse direction; read */
-#define H5Z_FLAG_SKIP_EDC 0x0200 /*skip EDC filters for read */
+/**
+ * invocation flag mask
+ */
+#define H5Z_FLAG_INVMASK 0xff00
+/**
+ * reverse direction; read
+ */
+#define H5Z_FLAG_REVERSE 0x0100
+/**
+ * skip EDC filters for read
+ */
+#define H5Z_FLAG_SKIP_EDC 0x0200
/* Special parameters for szip compression */
/* [These are aliases for the similar definitions in szlib.h, which we can't
* include directly due to the duplication of various symbols with the zlib.h
* header file] */
+/**
+ * \ingroup SZIP */
#define H5_SZIP_ALLOW_K13_OPTION_MASK 1
-#define H5_SZIP_CHIP_OPTION_MASK 2
-#define H5_SZIP_EC_OPTION_MASK 4
-#define H5_SZIP_NN_OPTION_MASK 32
-#define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
+/**
+ * \ingroup SZIP */
+#define H5_SZIP_CHIP_OPTION_MASK 2
+/**
+ * \ingroup SZIP */
+#define H5_SZIP_EC_OPTION_MASK 4
+/**
+ * \ingroup SZIP */
+#define H5_SZIP_NN_OPTION_MASK 32
+/**
+ * \ingroup SZIP */
+#define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
/* Macros for the shuffle filter */
-#define H5Z_SHUFFLE_USER_NPARMS 0 /* Number of parameters that users can set */
-#define H5Z_SHUFFLE_TOTAL_NPARMS 1 /* Total number of parameters for filter */
+/**
+ * \ingroup SHUFFLE
+ * Number of parameters that users can set for the shuffle filter
+ */
+#define H5Z_SHUFFLE_USER_NPARMS 0
+/**
+ * \ingroup SHUFFLE
+ * Total number of parameters for the shuffle filter
+ */
+#define H5Z_SHUFFLE_TOTAL_NPARMS 1
/* Macros for the szip filter */
-#define H5Z_SZIP_USER_NPARMS 2 /* Number of parameters that users can set */
-#define H5Z_SZIP_TOTAL_NPARMS 4 /* Total number of parameters for filter */
-#define H5Z_SZIP_PARM_MASK 0 /* "User" parameter for option mask */
-#define H5Z_SZIP_PARM_PPB 1 /* "User" parameter for pixels-per-block */
-#define H5Z_SZIP_PARM_BPP 2 /* "Local" parameter for bits-per-pixel */
-#define H5Z_SZIP_PARM_PPS 3 /* "Local" parameter for pixels-per-scanline */
+/**
+ * \ingroup SZIP
+ * Number of parameters that users can set for SZIP
+ */
+#define H5Z_SZIP_USER_NPARMS 2
+/**
+ * \ingroup SZIP
+ * Total number of parameters for SZIP filter
+ */
+#define H5Z_SZIP_TOTAL_NPARMS 4
+/**
+ * \ingroup SZIP
+ * "User" parameter for option mask
+ */
+#define H5Z_SZIP_PARM_MASK 0
+/**
+ * \ingroup SZIP
+ * "User" parameter for pixels-per-block
+ */
+#define H5Z_SZIP_PARM_PPB 1
+/**
+ * \ingroup SZIP
+ * "Local" parameter for bits-per-pixel
+ */
+#define H5Z_SZIP_PARM_BPP 2
+/**
+ * \ingroup SZIP
+ * "Local" parameter for pixels-per-scanline
+ */
+#define H5Z_SZIP_PARM_PPS 3
/* Macros for the nbit filter */
+/**
+ * \ingroup NBIT
+ * Number of parameters that users can set for the N-bit filter
+ */
#define H5Z_NBIT_USER_NPARMS 0 /* Number of parameters that users can set */
/* Macros for the scale offset filter */
-#define H5Z_SCALEOFFSET_USER_NPARMS 2 /* Number of parameters that users can set */
+/**
+ * \ingroup SCALEOFFSET
+ * Number of parameters that users can set for the scale-offset filter
+ */
+#define H5Z_SCALEOFFSET_USER_NPARMS 2
/* Special parameters for ScaleOffset filter*/
+/**
+ * \ingroup SCALEOFFSET */
#define H5Z_SO_INT_MINBITS_DEFAULT 0
+/**
+ * \ingroup SCALEOFFSET */
typedef enum H5Z_SO_scale_type_t {
H5Z_SO_FLOAT_DSCALE = 0,
H5Z_SO_FLOAT_ESCALE = 1,
H5Z_SO_INT = 2
} H5Z_SO_scale_type_t;
-/* Current version of the H5Z_class_t struct */
+/**
+ * Current version of the H5Z_class_t struct
+ */
#define H5Z_CLASS_T_VERS (1)
-/* Values to decide if EDC is enabled for reading data */
+/**
+ * \ingroup FLETCHER32
+ * Values to decide if EDC is enabled for reading data
+ */
typedef enum H5Z_EDC_t {
- H5Z_ERROR_EDC = -1, /* error value */
+ H5Z_ERROR_EDC = -1, /**< error value */
H5Z_DISABLE_EDC = 0,
H5Z_ENABLE_EDC = 1,
- H5Z_NO_EDC = 2 /* must be the last */
+ H5Z_NO_EDC = 2 /**< sentinel */
} H5Z_EDC_t;
/* Bit flags for H5Zget_filter_info */
#define H5Z_FILTER_CONFIG_ENCODE_ENABLED (0x0001)
#define H5Z_FILTER_CONFIG_DECODE_ENABLED (0x0002)
-/* Return values for filter callback function */
+/**
+ * Return values for filter callback function
+ */
typedef enum H5Z_cb_return_t {
- H5Z_CB_ERROR = -1,
- H5Z_CB_FAIL = 0, /* I/O should fail if filter fails. */
- H5Z_CB_CONT = 1, /* I/O continues if filter fails. */
- H5Z_CB_NO = 2
+ H5Z_CB_ERROR = -1, /**< error value */
+ H5Z_CB_FAIL = 0, /**< I/O should fail if filter fails. */
+ H5Z_CB_CONT = 1, /**< I/O continues if filter fails. */
+ H5Z_CB_NO = 2 /**< sentinel */
} H5Z_cb_return_t;
-/* Filter callback function definition */
+//! <!-- [H5Z_filter_func_t_snip] -->
+/**
+ * Filter callback function definition
+ */
typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void *buf, size_t buf_size, void *op_data);
+//! <!-- [H5Z_filter_func_t_snip] -->
-/* Structure for filter callback property */
+/**
+ * Structure for filter callback property
+ */
typedef struct H5Z_cb_t {
H5Z_filter_func_t func;
void * op_data;
@@ -135,87 +255,411 @@ typedef struct H5Z_cb_t {
extern "C" {
#endif
-/*
- * Before a dataset gets created, the "can_apply" callbacks for any filters used
- * in the dataset creation property list are called
- * with the dataset's dataset creation property list, the dataset's datatype and
- * a dataspace describing a chunk (for chunked dataset storage).
+/**
+ * \brief This callback determines if a filter can be applied to the dataset
+ * with the characteristics provided
+ *
+ * \dcpl_id
+ * \type_id
+ * \space_id
+ *
+ * \return \htri_t
*
- * The "can_apply" callback must determine if the combination of the dataset
- * creation property list setting, the datatype and the dataspace represent a
- * valid combination to apply this filter to. For example, some cases of
- * invalid combinations may involve the filter not operating correctly on
- * certain datatypes (or certain datatype sizes), or certain sizes of the chunk
- * dataspace.
+ * \details Before a dataset gets created, the \ref H5Z_can_apply_func_t
+ * callbacks for any filters used in the dataset creation property list
+ * are called with the dataset's dataset creation property list, the
+ * dataset's datatype and a dataspace describing a chunk (for chunked
+ * dataset storage).
*
- * The "can_apply" callback can be the NULL pointer, in which case, the library
- * will assume that it can apply to any combination of dataset creation
- * property list values, datatypes and dataspaces.
+ * The \ref H5Z_can_apply_func_t callback must determine if the
+ * combination of the dataset creation property list setting, the
+ * datatype and the dataspace represent a valid combination to apply
+ * this filter to. For example, some cases of invalid combinations may
+ * involve the filter not operating correctly on certain datatypes (or
+ * certain datatype sizes), or certain sizes of the chunk dataspace.
*
- * The "can_apply" callback returns positive a valid combination, zero for an
- * invalid combination and negative for an error.
+ * The \ref H5Z_can_apply_func_t callback can be the NULL pointer, in
+ * which case, the library will assume that it can apply to any
+ * combination of dataset creation property list values, datatypes and
+ * dataspaces.
+ *
+ * The \ref H5Z_can_apply_func_t callback returns positive a valid
+ * combination, zero for an invalid combination and negative for an
+ * error.
*/
+//! <!-- [H5Z_can_apply_func_t_snip] -->
typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id);
-
-/*
- * After the "can_apply" callbacks are checked for new datasets, the "set_local"
- * callbacks for any filters used in the dataset creation property list are
- * called. These callbacks receive the dataset's private copy of the dataset
- * creation property list passed in to H5Dcreate (i.e. not the actual property
- * list passed in to H5Dcreate) and the datatype ID passed in to H5Dcreate
- * (which is not copied and should not be modified) and a dataspace describing
- * the chunk (for chunked dataset storage) (which should also not be modified).
+//! <!-- [H5Z_can_apply_func_t_snip] -->
+/**
+ * \brief The filter operation callback function, defining a filter's operation
+ * on data
+ *
+ * \dcpl_id
+ * \type_id
+ * \space_id
*
- * The "set_local" callback must set any parameters that are specific to this
- * dataset, based on the combination of the dataset creation property list
- * values, the datatype and the dataspace. For example, some filters perform
- * different actions based on different datatypes (or datatype sizes) or
- * different number of dimensions or dataspace sizes.
+ * \return \herr_t
*
- * The "set_local" callback can be the NULL pointer, in which case, the library
- * will assume that there are no dataset-specific settings for this filter.
+ * \details After the \ref H5Z_can_apply_func_t callbacks are checked for new
+ * datasets, the \ref H5Z_set_local_func_t callbacks for any filters
+ * used in the dataset creation property list are called. These
+ * callbacks receive the dataset's private copy of the dataset creation
+ * property list passed in to H5Dcreate() (i.e. not the actual property
+ * list passed in to H5Dcreate()) and the datatype ID passed in to
+ * H5Dcreate() (which is not copied and should not be modified) and a
+ * dataspace describing the chunk (for chunked dataset storage) (which
+ * should also not be modified).
*
- * The "set_local" callback must return non-negative on success and negative
- * for an error.
+ * The \ref H5Z_set_local_func_t callback must set any parameters that
+ * are specific to this dataset, based on the combination of the
+ * dataset creation property list values, the datatype and the
+ * dataspace. For example, some filters perform different actions based
+ * on different datatypes (or datatype sizes) or different number of
+ * dimensions or dataspace sizes.
+ *
+ * The \ref H5Z_set_local_func_t callback can be the NULL pointer, in
+ * which case, the library will assume that there are no
+ * dataset-specific settings for this filter.
+ *
+ * The \ref H5Z_set_local_func_t callback must return non-negative on
+ * success and negative for an error.
*/
+//! <!-- [H5Z_set_local_func_t_snip] -->
typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+//! <!-- [H5Z_set_local_func_t_snip] -->
-/*
- * A filter gets definition flags and invocation flags (defined above), the
- * client data array and size defined when the filter was added to the
- * pipeline, the size in bytes of the data on which to operate, and pointers
- * to a buffer and its allocated size.
+/**
+ * \brief The filter operation callback function, defining a filter's operation
+ * on data
+ *
+ * \param[in] flags Bit vector specifying certain general properties of the filter
+ * \param[in] cd_nelmts Number of elements in \p cd_values
+ * \param[in] cd_values Auxiliary data for the filter
+ * \param[in] nbytes The number of valid bytes in \p buf to be filtered
+ * \param[in,out] buf_size The size of \p buf
+ * \param[in,out] buf The filter buffer
+ *
+ * \return Returns the number of valid bytes of data contained in \p buf. In the
+ * case of failure, the return value is 0 (zero) and all pointer
+ * arguments are left unchanged.
*
- * The filter should store the result in the supplied buffer if possible,
- * otherwise it can allocate a new buffer, freeing the original. The
- * allocated size of the new buffer should be returned through the BUF_SIZE
- * pointer and the new buffer through the BUF pointer.
+ * \details A filter gets definition flags and invocation flags (defined
+ * above), the client data array and size defined when the filter was
+ * added to the pipeline, the size in bytes of the data on which to
+ * operate, and pointers to a buffer and its allocated size.
*
- * The return value from the filter is the number of bytes in the output
- * buffer. If an error occurs then the function should return zero and leave
- * all pointer arguments unchanged.
+ * The filter should store the result in the supplied buffer if
+ * possible, otherwise it can allocate a new buffer, freeing the
+ * original. The allocated size of the new buffer should be returned
+ * through the \p buf_size pointer and the new buffer through the \p
+ * buf pointer.
+ *
+ * The return value from the filter is the number of bytes in the
+ * output buffer. If an error occurs then the function should return
+ * zero and leave all pointer arguments unchanged.
*/
+//! <!-- [H5Z_func_t_snip] -->
typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[],
size_t nbytes, size_t *buf_size, void **buf);
-
-/*
+//! <!-- [H5Z_func_t_snip] -->
+/**
* The filter table maps filter identification numbers to structs that
* contain a pointers to the filter function and timing statistics.
*/
+//! <!-- [H5Z_class2_t_snip] -->
typedef struct H5Z_class2_t {
- int version; /* Version number of the H5Z_class_t struct */
- H5Z_filter_t id; /* Filter ID number */
- unsigned encoder_present; /* Does this filter have an encoder? */
- unsigned decoder_present; /* Does this filter have a decoder? */
- const char * name; /* Comment for debugging */
- H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
- H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
- H5Z_func_t filter; /* The actual filter function */
+ int version; /**< Version number of the H5Z_class_t struct */
+ H5Z_filter_t id; /**< Filter ID number */
+ unsigned encoder_present; /**< Does this filter have an encoder? */
+ unsigned decoder_present; /**< Does this filter have a decoder? */
+ const char * name; /**< Comment for debugging */
+ H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */
+ H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */
+ H5Z_func_t filter; /**< The actual filter function */
} H5Z_class2_t;
+//! <!-- [H5Z_class2_t_snip] -->
+/**
+ * \ingroup H5Z
+ *
+ * \brief Registers a new filter with the HDF5 library
+ *
+ * \param[in] cls A pointer to a buffer for the struct containing the
+ * filter-definition
+ *
+ * \return \herr_t
+ *
+ * \details H5Zregister() registers a new filter with the HDF5 library.
+ *
+ * \details Making a new filter available to an application is a two-step
+ * process. The first step is to write the three filter callback
+ * functions described below: \c can_apply, \c set_local, and \c
+ * filter. This call to H5Zregister(), registering the filter with the
+ * library, is the second step. The can_apply and set_local fields can
+ * be set to NULL if they are not required for the filter being
+ * registered.
+ *
+ * H5Zregister() accepts a single parameter, a pointer to a buffer for
+ * the \p cls data structure. That data structure must conform to one
+ * of the following definitions:
+ * \snippet this H5Z_class1_t_snip
+ * or
+ * \snippet this H5Z_class2_t_snip
+ *
+ * \c version is a library-defined value reporting the version number
+ * of the #H5Z_class_t struct. This currently must be set to
+ * #H5Z_CLASS_T_VERS.
+ *
+ * \c id is the identifier for the new filter. This is a user-defined
+ * value between #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX. These
+ * values are defined in the HDF5 source file H5Zpublic.h, but the
+ * symbols #H5Z_FILTER_RESERVED and #H5Z_FILTER_MAX should always be
+ * used instead of the literal values.
+ *
+ * \c encoder_present is a library-defined value indicating whether
+ * the filter’s encoding capability is available to the application.
+ *
+ * \c decoder_present is a library-defined value indicating whether
+ * the filter’s encoding capability is available to the application.
+ *
+ * \c name is a descriptive comment used for debugging, may contain a
+ * descriptive name for the filter, and may be the null pointer.
+ *
+ * \c can_apply, described in detail below, is a user-defined callback
+ * function which determines whether the combination of the dataset
+ * creation property list values, the datatype, and the dataspace
+ * represent a valid combination to apply this filter to.
+ *
+ * \c set_local, described in detail below, is a user-defined callback
+ * function which sets any parameters that are specific to this
+ * dataset, based on the combination of the dataset creation property
+ * list values, the datatype, and the dataspace.
+ *
+ * \c filter, described in detail below, is a user-defined callback
+ * function which performs the action of the filter.
+ *
+ * The statistics associated with a filter are not reset by this
+ * function; they accumulate over the life of the library.
+ *
+ * #H5Z_class_t is a macro which maps to either H5Z_class1_t or
+ * H5Z_class2_t, depending on the needs of the application. To affect
+ * only this macro, H5Z_class_t_vers may be defined to either 1 or 2.
+ * Otherwise, it will behave in the same manner as other API
+ * compatibility macros. See API Compatibility Macros in HDF5 for more
+ * information. H5Z_class1_t matches the #H5Z_class_t structure that is
+ * used in the 1.6.x versions of the HDF5 library.
+ *
+ * H5Zregister() will automatically detect which structure type has
+ * been passed in, regardless of the mapping of the #H5Z_class_t macro.
+ * However, the application must make sure that the fields are filled
+ * in according to the correct structure definition if the macro is
+ * used to declare the structure.
+ *
+ * \Bold{The callback functions:}\n Before H5Zregister() can link a
+ * filter into an application, three callback functions must be
+ * defined as described in the HDF5 library header file H5Zpublic.h.
+ *
+ * When a filter is applied to the fractal heap for a group (e.g.,
+ * when compressing group metadata) and if the can apply and set local
+ * callback functions have been defined for that filter, HDF5 passes
+ * the value -1 for all parameters for those callback functions. This
+ * is done to ensure that the filter will not be applied to groups if
+ * it relies on these parameters, as they are not applicable to group
+ * fractal heaps; to operate on group fractal heaps, a filter must be
+ * capable of operating on an opaque block of binary data.
+ *
+ * The \Emph{can apply} callback function must return a positive value
+ * for a valid combination, zero for an invalid combination, and a
+ * negative value for an error.
+ * \snippet this H5Z_can_apply_func_t_snip
+ *
+ * Before a dataset is created, the \Emph{can apply} callbacks for any
+ * filters used in the dataset creation property list are called with
+ * the dataset's dataset creation property list, \c dcpl_id, the
+ * dataset's datatype, \p type_id, and a dataspace describing a chunk,
+ * \p space_id, (for chunked dataset storage).
+ *
+ * This callback must determine whether the combination of the dataset
+ * creation property list settings, the datatype, and the dataspace
+ * represent a valid combination to which to apply this filter. For
+ * example, an invalid combination may involve the filter not
+ * operating correctly on certain datatypes, on certain datatype
+ * sizes, or on certain sizes of the chunk dataspace. If this filter
+ * is enabled through H5Pset_filter() as optional and the can apply
+ * function returns 0, the library will skip the filter in the filter
+ * pipeline.
+ *
+ * This callback can be the NULL pointer, in which case the library
+ * will assume that the filter can be applied to a dataset with any
+ * combination of dataset creation property list values, datatypes,
+ * and dataspaces.
+ *
+ * The \Emph{set local} callback function is defined as follows:
+ * \snippet this H5Z_set_local_func_t_snip
+ *
+ * After the can apply callbacks are checked for a new dataset, the
+ * \Emph{set local} callback functions for any filters used in the
+ * dataset creation property list are called. These callbacks receive
+ * \c dcpl_id, the dataset's private copy of the dataset creation
+ * property list passed in to H5Dcreate() (i.e. not the actual
+ * property list passed in to H5Dcreate()); \c type_id, the datatype
+ * identifier passed in to H5Dcreate(), which is not copied and should
+ * not be modified; and \c space_id, a dataspace describing the chunk
+ * (for chunked dataset storage), which should also not be modified.
+ *
+ * The set local callback must set any filter parameters that are
+ * specific to this dataset, based on the combination of the dataset
+ * creation property list values, the datatype, and the dataspace. For
+ * example, some filters perform different actions based on different
+ * datatypes, datatype sizes, numbers of dimensions, or dataspace
+ * sizes.
+ *
+ * The \Emph{set local} callback may be the NULL pointer, in which
+ * case, the library will assume that there are no dataset-specific
+ * settings for this filter.
+ *
+ * The \Emph{set local} callback function must return a non-negative
+ * value on success and a negative value for an error.
+ *
+ * The \Emph{filter operation} callback function, defining the
+ * filter's operation on the data, is defined as follows:
+ * \snippet this H5Z_func_t_snip
+ *
+ * The parameters \c flags, \c cd_nelmts, and \c cd_values are the
+ * same as for the function H5Pset_filter(). The one exception is that
+ * an additional flag, #H5Z_FLAG_REVERSE, is set when the filter is
+ * called as part of the input pipeline.
+ *
+ * The parameter \c buf points to the input buffer which has a size of
+ * \c buf_size bytes, \c nbytes of which are valid data.
+ *
+ * The filter should perform the transformation in place if possible.
+ * If the transformation cannot be done in place, then the filter
+ * should allocate a new buffer with malloc() and assign it to \c buf,
+ * assigning the allocated size of that buffer to \c buf_size. The old
+ * buffer should be freed by calling free().
+ *
+ * If successful, the \Emph{filter operation} callback function
+ * returns the number of valid bytes of data contained in \c buf. In
+ * the case of failure, the return value is 0 (zero) and all pointer
+ * arguments are left unchanged.
+ *
+ * \version 1.8.6 Return type for the \Emph{can apply} callback function,
+ * \ref H5Z_can_apply_func_t, changed to \ref htri_t.
+ * \version 1.8.5 Semantics of the \Emph{can apply} and \Emph{set local}
+ * callback functions changed to accommodate the use of filters
+ * with group fractal heaps.
+ * \version 1.8.3 #H5Z_class_t renamed to H5Z_class2_t, H5Z_class1_t structure
+ * introduced for backwards compatibility with release 1.6.x,
+ * and #H5Z_class_t macro introduced in this release. Function
+ * modified to accept either structure type.
+ * \version 1.8.0 The fields \c version, \c encoder_present, and
+ * \c decoder_present were added to the #H5Z_class_t \c struct
+ * in this release.
+ * \version 1.6.0 This function was substantially revised in Release 1.6.0 with
+ * a new #H5Z_class_t struct and new set local and can apply
+ * callback functions.
+ *
+ */
H5_DLL herr_t H5Zregister(const void *cls);
+/**
+ * \ingroup H5Z
+ *
+ * \brief Unregisters a filter.
+ *
+ * \param[in] id Identifier of the filter to be unregistered.
+ * \return \herr_t
+ *
+ * \details H5Zunregister() unregisters the filter specified in \p id.
+ *
+ * \details This function first iterates through all opened datasets and
+ * groups. If an open object that uses this filter is found, the
+ * function will fail with a message indicating that an object using
+ * the filter is still open. All open files are then flushed to make
+ * sure that all cached data that may use this filter are written out.
+ *
+ * If the application is a parallel program, all processes that
+ * participate in collective data write should call this function to
+ * ensure that all data is flushed.
+ *
+ * After a call to H5Zunregister(), the filter specified in filter
+ * will no longer be available to the application.
+ *
+ * \version 1.8.12 Function modified to check for open objects using the
+ * filter.
+ * \since 1.6.0
+ */
H5_DLL herr_t H5Zunregister(H5Z_filter_t id);
+/**
+ * \ingroup H5Z
+ *
+ * \brief Determines whether a filter is available
+ *
+ * \param[in] id Filter identifier
+ * \return \htri_t
+ *
+ * \details H5Zfilter_avail() determines whether the filter specified in \p id
+ * is available to the application.
+ *
+ * \since 1.6.0
+ */
H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id);
+/**
+ * \ingroup H5Z
+ *
+ * \brief Retrieves information about a filter
+ *
+ * \param[in] filter Filter identifier
+ * \param[out] filter_config_flags A bit field encoding the returned filter
+ * information
+ * \return \herr_t
+ *
+ * \details H5Zget_filter_info() retrieves information about a filter. At
+ * present, this means that the function retrieves a filter's
+ * configuration flags, indicating whether the filter is configured to
+ * decode data, to encode data, neither, or both.
+ *
+ * If \p filter_config_flags is not set to NULL prior to the function
+ * call, the returned parameter contains a bit field specifying the
+ * available filter configuration. The configuration flag values can
+ * then be determined through a series of bitwise AND operations, as
+ * described below.
+ *
+ * Valid filter configuration flags include the following:
+ * <table>
+ * <tr><td>#H5Z_FILTER_CONFIG_ENCODE_ENABLED</td>
+ * <td>Encoding is enabled for this filter</td></tr>
+ * <tr><td>#H5Z_FILTER_CONFIG_DECODE_ENABLED</td>
+ * <td>Decoding is enabled for this filter</td></tr>
+ * </table>
+ *
+ * A bitwise AND of the returned \p filter_config_flags and a valid
+ * filter configuration flag will reveal whether the related
+ * configuration option is available. For example, if the value of
+ * \code
+ * H5Z_FILTER_CONFIG_ENCODE_ENABLED & filter_config_flags
+ * \endcode
+ * is true, i.e., greater than 0 (zero), the queried filter
+ * is configured to encode data; if the value is \c FALSE, i.e., equal to
+ * 0 (zero), the filter is not so configured.
+ *
+ * If a filter is not encode-enabled, the corresponding \c H5Pset_*
+ * function will return an error if the filter is added to a dataset
+ * creation property list (which is required if the filter is to be
+ * used to encode that dataset). For example, if the
+ * #H5Z_FILTER_CONFIG_ENCODE_ENABLED flag is not returned for the SZIP
+ * filter, #H5Z_FILTER_SZIP, a call to H5Pset_szip() will fail.
+ *
+ * If a filter is not decode-enabled, the application will not be able
+ * to read an existing file encoded with that filter.
+ *
+ * This function should be called, and the returned \p
+ * filter_config_flags analyzed, before calling any other function,
+ * such as H5Pset_szip() , that might require a particular filter
+ * configuration.
+ *
+ * \since 1.6.3
+ */
H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
@@ -224,17 +668,19 @@ H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_confi
*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
-/*
+/**
* The filter table maps filter identification numbers to structs that
* contain a pointers to the filter function and timing statistics.
*/
+//! <!-- [H5Z_class1_t_snip] -->
typedef struct H5Z_class1_t {
- H5Z_filter_t id; /* Filter ID number */
- const char * name; /* Comment for debugging */
- H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
- H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
- H5Z_func_t filter; /* The actual filter function */
+ H5Z_filter_t id; /**< Filter ID number */
+ const char * name; /**< Comment for debugging */
+ H5Z_can_apply_func_t can_apply; /**< The "can apply" callback for a filter */
+ H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */
+ H5Z_func_t filter; /**< The actual filter function */
} H5Z_class1_t;
+//! <!-- [H5Z_class1_t_snip] -->
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 4046508..97678b0 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -48,57 +48,57 @@ enum H5Z_scaleoffset_t {
};
/* 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, unsigned dtype_size,
- unsigned dtype_sign);
-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, 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, 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, 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, enum H5Z_scaleoffset_t type,
+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, 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, 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, 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, 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, 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, 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,
- 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,
- unsigned char *buffer, size_t *j, unsigned *buf_len,
- parms_atomic p);
-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,
- size_t buffer_size, parms_atomic p);
+ unsigned long long *minval);
+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, 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, 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, unsigned k,
+ unsigned begin_i, const unsigned char *buffer, size_t *j,
+ unsigned *buf_len, parms_atomic p, unsigned dtype_len);
+static void H5Z__scaleoffset_compress_one_byte(const 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,
+ 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,
+ unsigned char *buffer, size_t *j, unsigned *buf_len,
+ parms_atomic p);
+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,
+ 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 */
@@ -198,7 +198,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
/* Set the fill value parameter in cd_values[] for unsigned integer type */
#define H5Z_scaleoffset_set_filval_1(type, dcpl_plist, dt, cd_values, need_convert) \
- { \
+ do { \
type fill_val; \
\
/* Get dataset fill value */ \
@@ -206,14 +206,14 @@ 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) \
- }
+ } while (0)
/* Set the fill value parameter in cd_values[] for signed integer type */
#define H5Z_scaleoffset_set_filval_2(type, dcpl_plist, dt, cd_values, need_convert) \
- { \
+ do { \
type fill_val; \
\
/* Get dataset fill value */ \
@@ -221,14 +221,14 @@ 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) \
- }
+ } while (0)
/* Set the fill value parameter in cd_values[] for character integer type */
#define H5Z_scaleoffset_set_filval_3(type, dcpl_plist, dt, cd_values, need_convert) \
- { \
+ do { \
type fill_val; \
\
/* Get dataset fill value */ \
@@ -237,11 +237,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
\
/* Store the fill value as the last entry in cd_values[] */ \
(cd_values)[H5Z_SCALEOFFSET_PARM_FILVAL] = (unsigned)((unsigned char)fill_val); \
- }
+ } while (0)
/* Set the fill value parameter in cd_values[] for floating-point type */
#define H5Z_scaleoffset_set_filval_4(type, dcpl_plist, dt, cd_values, need_convert) \
- { \
+ do { \
type fill_val; \
\
/* Get dataset fill value */ \
@@ -249,10 +249,10 @@ 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) \
- }
+ } while (0)
/* Get the fill value for integer type */
#define H5Z_scaleoffset_get_filval_1(type, cd_values, fill_val) \
@@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
{ \
i = 0; \
- while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \
+ while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
i++; \
if (i < d_nelmts) \
min = max = buf[i]; \
for (; i < d_nelmts; i++) { \
- if (HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \
+ if (HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
continue; /* ignore fill value */ \
if (buf[i] > max) \
max = buf[i]; \
@@ -451,7 +451,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
/* Precompress for unsigned integer type */
#define H5Z_scaleoffset_precompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \
- { \
+ do { \
type * buf = (type *)data, min = 0, max = 0, span, filval = 0; \
unsigned i; \
\
@@ -461,7 +461,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ /* minbits not set yet, calculate max, min, and minbits */ \
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( \
@@ -475,7 +475,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \
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( \
@@ -484,11 +484,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
for (i = 0; i < d_nelmts; i++) buf[i] = (type)(buf[i] - min); \
} \
*minval = min; \
- }
+ } while (0)
/* Precompress for signed integer type */
#define H5Z_scaleoffset_precompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \
- { \
+ do { \
type * buf = (type *)data, min = 0, max = 0, filval = 0; \
unsigned type span; \
unsigned i; \
@@ -499,7 +499,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ /* minbits not set yet, calculate max, min, and minbits */ \
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( \
@@ -513,7 +513,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \
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( \
@@ -522,7 +522,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
for (i = 0; i < d_nelmts; i++) buf[i] = (type)(buf[i] - min); \
} \
*minval = (unsigned long long)min; \
- }
+ } while (0)
/* Modify values of data in precompression if fill value defined for floating-point type */
#define H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, filval, \
@@ -596,7 +596,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
/* Precompress for floating-point type using variable-minimum-bits method */
#define H5Z_scaleoffset_precompress_3(type, pow_fun, abs_fun, round_fun, lround_fun, llround_fun, data, \
d_nelmts, filavail, cd_values, minbits, minval, D_val) \
- { \
+ do { \
type * buf = (type *)data, min = 0, max = 0, filval = 0; \
unsigned long long span; \
unsigned i; \
@@ -609,7 +609,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
(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) \
@@ -620,17 +620,17 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
(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) \
} \
H5Z_scaleoffset_save_min(i, type, minval, min) \
- }
+ } while (0)
/* Postdecompress for unsigned integer type */
#define H5Z_scaleoffset_postdecompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \
- { \
+ do { \
type * buf = (type *)data, filval = 0; \
unsigned i; \
\
@@ -641,11 +641,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
else /* fill value undefined */ \
for (i = 0; i < d_nelmts; i++) \
buf[i] = (type)(buf[i] + (type)(minval)); \
- }
+ } while (0)
/* Postdecompress for signed integer type */
#define H5Z_scaleoffset_postdecompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \
- { \
+ do { \
type * buf = (type *)data, filval = 0; \
unsigned i; \
\
@@ -657,7 +657,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
else /* fill value undefined */ \
for (i = 0; i < d_nelmts; i++) \
buf[i] = (type)(buf[i] + (type)(minval)); \
- }
+ } while (0)
/* Retrive minimum value of floating-point type */
#define H5Z_scaleoffset_get_min(type, minval, min) \
@@ -721,7 +721,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
/* Postdecompress for floating-point type using variable-minimum-bits method */
#define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, minbits, \
minval, D_val) \
- { \
+ do { \
type * buf = (type *)data, filval = 0, min = 0; \
unsigned i; \
\
@@ -734,10 +734,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
} \
else /* fill value undefined */ \
H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \
- }
+ } while (0)
/*-------------------------------------------------------------------------
- * 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.
@@ -748,19 +748,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)))
@@ -788,10 +786,10 @@ 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
@@ -802,17 +800,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 */
@@ -867,7 +863,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[]
*
@@ -880,47 +876,44 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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) else if (scale_type == t_ushort)
- H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_uint)
- H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_ulong)
- H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_ulong_long)
- H5Z_scaleoffset_set_filval_1(unsigned long long, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_schar)
- H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values,
- need_convertd) else if (scale_type == t_short)
- H5Z_scaleoffset_set_filval_2(short, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_int)
- H5Z_scaleoffset_set_filval_2(int, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_long)
- H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type ==
- t_long_long)
- H5Z_scaleoffset_set_filval_2(
- long long, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_float)
- H5Z_scaleoffset_set_filval_4(
- float, dcpl_plist, type, cd_values,
- need_convert) else if (scale_type == t_double)
- H5Z_scaleoffset_set_filval_4(double, dcpl_plist, type,
- cd_values, need_convert)
-
- done : FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z_scaleoffset_set_parms_fillval() */
+ H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_ushort)
+ H5Z_scaleoffset_set_filval_1(unsigned short, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_uint)
+ H5Z_scaleoffset_set_filval_1(unsigned int, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_ulong)
+ H5Z_scaleoffset_set_filval_1(unsigned long, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_ulong_long)
+ H5Z_scaleoffset_set_filval_1(unsigned long long, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_schar)
+ H5Z_scaleoffset_set_filval_3(signed char, dcpl_plist, type, cd_values, need_convertd);
+ else if (scale_type == t_short)
+ H5Z_scaleoffset_set_filval_2(short, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_int)
+ H5Z_scaleoffset_set_filval_2(int, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_long)
+ H5Z_scaleoffset_set_filval_2(long, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_long_long)
+ H5Z_scaleoffset_set_filval_2(long long, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_float)
+ H5Z_scaleoffset_set_filval_4(float, dcpl_plist, type, cd_values, need_convert);
+ else if (scale_type == t_double)
+ H5Z_scaleoffset_set_filval_4(double, dcpl_plist, type, cd_values, need_convert);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* 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.
@@ -931,12 +924,10 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum
* 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 */
@@ -953,7 +944,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)))
@@ -1080,13 +1071,13 @@ 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],
- cd_values[H5Z_SCALEOFFSET_PARM_SIZE],
- cd_values[H5Z_SCALEOFFSET_PARM_SIGN])) == 0)
+ 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 */
@@ -1097,10 +1088,10 @@ 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.
@@ -1111,13 +1102,11 @@ 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[], size_t nbytes,
- size_t *buf_size, void **buf)
+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 */
size_t size_out = 0; /* size of output buffer */
@@ -1127,7 +1116,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
unsigned filavail; /* flag indicating if fill value is defined or not */
H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE; /* scale type */
int scale_factor = 0; /* scale factor */
- double D_val = 0.0f; /* decimal scale factor */
+ double D_val = 0.0; /* decimal scale factor */
uint32_t minbits = 0; /* minimum number of bits to store values */
unsigned long long minval = 0; /* minimum value of input buffer */
enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */
@@ -1137,7 +1126,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)
@@ -1266,7 +1255,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;
@@ -1277,7 +1266,7 @@ 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++)
@@ -1285,23 +1274,23 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
}
/* 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, cd_values, minbits, minval);
+ 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, cd_values, minbits,
- minval, D_val) == FAIL)
+ 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 {
@@ -1309,20 +1298,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, cd_values, &minbits, &minval);
+ 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, cd_values, &minbits,
- &minval, D_val) == FAIL)
+ 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")
}
@@ -1376,8 +1365,8 @@ 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 */
@@ -1407,7 +1396,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;
@@ -1422,13 +1411,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 */
@@ -1447,178 +1436,180 @@ 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, unsigned filavail,
- const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval)
+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)
- H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_ushort)
- H5Z_scaleoffset_precompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_uint)
- H5Z_scaleoffset_precompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_ulong)
- H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_ulong_long)
- H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, cd_values,
- minbits, minval) else if (type == t_schar)
- {
- signed char * buf = (signed char *)data, min = 0, max = 0, filval = 0;
- unsigned char span;
- unsigned i;
-
- if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */
- H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval);
- if (*minbits ==
- H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */
- H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max,
- min) if ((unsigned char)(max - min) >
- (unsigned char)(~(unsigned char)0 - 2))
- {
- *minbits = sizeof(signed char) * 8;
- return;
- }
- span = (unsigned char)(max - min + 1);
- *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1));
+ H5Z_scaleoffset_precompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ushort)
+ H5Z_scaleoffset_precompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_uint)
+ H5Z_scaleoffset_precompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ulong)
+ H5Z_scaleoffset_precompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ulong_long)
+ H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, minbits,
+ minval);
+ else if (type == t_schar) {
+ signed char * buf = (signed char *)data, min = 0, max = 0, filval = 0;
+ unsigned char span;
+ unsigned i;
+
+ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */
+ H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval);
+ if (*minbits ==
+ H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */
+ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max,
+ min) if ((unsigned char)(max - min) >
+ (unsigned char)(~(unsigned char)0 - 2))
+ {
+ *minbits = sizeof(signed char) * 8;
+ return;
}
- 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 */
- for (i = 0; i < d_nelmts; i++) buf[i] =
- (signed char)((buf[i] == filval) ? (((unsigned char)1 << *minbits) - 1)
- : (buf[i] - min));
+ span = (unsigned char)(max - min + 1);
+ *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1));
}
- else { /* fill value undefined */
- if (*minbits ==
- H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */
- H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max,
- min) if ((unsigned char)(max - min) >
- (unsigned char)(~(unsigned char)0 - 2))
- {
- *minbits = sizeof(signed char) * 8;
- *minval = (unsigned long long)min;
- return;
- }
- span = (unsigned char)(max - min + 1);
- *minbits = H5Z_scaleoffset_log2((unsigned long long)span);
+ 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 */
+ for (i = 0; i < d_nelmts; i++) buf[i] =
+ (signed char)((buf[i] == filval) ? (((unsigned char)1 << *minbits) - 1)
+ : (buf[i] - min));
+ }
+ else { /* fill value undefined */
+ if (*minbits ==
+ H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */
+ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max,
+ min) if ((unsigned char)(max - min) >
+ (unsigned char)(~(unsigned char)0 - 2))
+ {
+ *minbits = sizeof(signed char) * 8;
+ *minval = (unsigned long long)min;
+ return;
}
- 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 */
- for (i = 0; i < d_nelmts; i++) buf[i] = (signed char)(buf[i] - min);
+ span = (unsigned char)(max - min + 1);
+ *minbits = H5Z__scaleoffset_log2((unsigned long long)span);
}
- *minval = (unsigned long long)min;
+ 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 */
+ for (i = 0; i < d_nelmts; i++) buf[i] = (signed char)(buf[i] - min);
}
+ *minval = (unsigned long long)min;
+ }
else if (type == t_short)
- H5Z_scaleoffset_precompress_2(short, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_int)
- H5Z_scaleoffset_precompress_2(int, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_long)
- H5Z_scaleoffset_precompress_2(long, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_long_long)
- H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, filavail, cd_values, minbits,
- minval)
+ H5Z_scaleoffset_precompress_2(short, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_int)
+ H5Z_scaleoffset_precompress_2(int, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_long)
+ H5Z_scaleoffset_precompress_2(long, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_long_long)
+ H5Z_scaleoffset_precompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, minval);
}
/* postdecompress for integer type */
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)
+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 */
if (type == t_uchar)
- H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_ushort)
- H5Z_scaleoffset_postdecompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_uint)
- H5Z_scaleoffset_postdecompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits,
- minval) else if (type == t_ulong)
- H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, cd_values,
- minbits, minval) else if (type == t_ulong_long)
- H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail,
- cd_values, minbits, minval) else if (type == t_schar)
- {
- signed char *buf = (signed char *)data, filval = 0;
- unsigned i;
-
- if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */
- H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for (i = 0; i < d_nelmts; i++)
- buf[i] =
- (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval
- : (buf[i] + sminval));
- }
- else /* fill value undefined */
- for (i = 0; i < d_nelmts; i++)
- buf[i] = (signed char)(buf[i] + sminval);
+ H5Z_scaleoffset_postdecompress_1(unsigned char, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ushort)
+ H5Z_scaleoffset_postdecompress_1(unsigned short, data, d_nelmts, filavail, cd_values, minbits,
+ minval);
+ else if (type == t_uint)
+ H5Z_scaleoffset_postdecompress_1(unsigned int, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ulong)
+ H5Z_scaleoffset_postdecompress_1(unsigned long, data, d_nelmts, filavail, cd_values, minbits, minval);
+ else if (type == t_ulong_long)
+ H5Z_scaleoffset_postdecompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, minbits,
+ minval);
+ else if (type == t_schar) {
+ signed char *buf = (signed char *)data, filval = 0;
+ unsigned i;
+
+ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */
+ H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for (i = 0; i < d_nelmts;
+ i++) buf[i] =
+ (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval : (buf[i] + sminval));
}
+ else /* fill value undefined */
+ for (i = 0; i < d_nelmts; i++)
+ buf[i] = (signed char)(buf[i] + sminval);
+ }
else if (type == t_short)
- H5Z_scaleoffset_postdecompress_2(short, data, d_nelmts, filavail, cd_values, minbits,
- sminval) else if (type == t_int)
- H5Z_scaleoffset_postdecompress_2(int, data, d_nelmts, filavail, cd_values, minbits,
- sminval) else if (type == t_long)
- H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, cd_values, minbits,
- sminval) else if (type == t_long_long)
- H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, cd_values, minbits,
- sminval)
+ H5Z_scaleoffset_postdecompress_2(short, data, d_nelmts, filavail, cd_values, minbits, sminval);
+ else if (type == t_int)
+ H5Z_scaleoffset_postdecompress_2(int, data, d_nelmts, filavail, cd_values, minbits, sminval);
+ else if (type == t_long)
+ H5Z_scaleoffset_postdecompress_2(long, data, d_nelmts, filavail, cd_values, minbits, sminval);
+ else if (type == t_long_long)
+ H5Z_scaleoffset_postdecompress_2(long long, data, d_nelmts, filavail, cd_values, minbits, sminval);
}
/* 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, unsigned filavail,
- const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval,
- double D_val)
+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,
- filavail, cd_values, minbits, minval, D_val) else if (type == t_double)
- H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts,
- filavail, cd_values, minbits, minval, D_val)
+ filavail, cd_values, minbits, minval, D_val);
+ else if (type == t_double)
+ H5Z_scaleoffset_precompress_3(double, HDpow, HDfabs, HDround, HDlround, HDllround, data, d_nelmts,
+ filavail, cd_values, minbits, minval, D_val);
- done : FUNC_LEAVE_NOAPI(ret_value)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
}
/* 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,
- unsigned filavail, const unsigned cd_values[], uint32_t minbits,
- unsigned long long minval, double D_val)
+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, cd_values, minbits, sminval,
- D_val) else if (type == t_double)
- H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits,
- sminval, D_val)
+ D_val);
+ else if (type == t_double)
+ H5Z_scaleoffset_postdecompress_3(double, HDpow, data, d_nelmts, filavail, cd_values, minbits, sminval,
+ D_val);
- done : FUNC_LEAVE_NOAPI(ret_value)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
}
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, unsigned k, unsigned begin_i,
- unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p,
- unsigned dtype_len)
+H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
+ const unsigned char *buffer, size_t *j, unsigned *buf_len,
+ parms_atomic p, unsigned dtype_len)
{
unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */
unsigned char val; /* value to be copied in each data byte */
@@ -1639,7 +1630,7 @@ H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, uns
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;
@@ -1651,8 +1642,8 @@ H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, uns
}
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)
+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 */
unsigned begin_i;
@@ -1667,8 +1658,8 @@ H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, u
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, buffer, j, buf_len,
- p, dtype_len);
+ H5Z__scaleoffset_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len,
+ p, dtype_len);
}
else { /* big endian */
HDassert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE);
@@ -1676,13 +1667,13 @@ H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, u
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, buffer, j, buf_len,
- p, dtype_len);
+ 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, unsigned char *buffer, parms_atomic p)
+H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, parms_atomic p)
{
/* i: index of data, j: index of buffer,
buf_len: number of bits to be filled in current byte */
@@ -1699,13 +1690,13 @@ H5Z_scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned char
/* 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, unsigned k, unsigned begin_i,
- unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p,
- unsigned dtype_len)
+H5Z__scaleoffset_compress_one_byte(const 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)
{
unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */
unsigned char val; /* value to be copied in each data byte */
@@ -1725,7 +1716,7 @@ H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsig
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;
@@ -1735,8 +1726,8 @@ H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsig
}
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)
+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 */
unsigned begin_i;
@@ -1751,22 +1742,22 @@ H5Z_scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, uns
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, buffer, j, buf_len, p,
- dtype_len);
+ H5Z__scaleoffset_compress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len, p,
+ dtype_len);
}
else { /* big endian */
HDassert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE);
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, buffer, j, buf_len, p,
- dtype_len);
+ 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, unsigned char *buffer, size_t buffer_size,
- parms_atomic p)
+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,
buf_len: number of bits to be filled in current byte */
@@ -1783,5 +1774,5 @@ H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, unsigned char *
/* 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 e34bdf0..bf272c4 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -22,27 +22,27 @@
#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, const unsigned cd_values[], size_t nbytes,
- size_t *buf_size, void **buf);
+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_FILTER_SHUFFLE, /* Filter id number */
- 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_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) */
+ "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 */
}};
/* Local macros */
#define H5Z_SHUFFLE_PARM_SIZE 0 /* "Local" parameter for shuffling size */
/*-------------------------------------------------------------------------
- * 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.
@@ -53,12 +53,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 */
@@ -67,7 +65,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,10 +91,10 @@ 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
@@ -111,15 +109,11 @@ 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[], size_t nbytes,
- size_t *buf_size, void **buf)
+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 */
unsigned char *_src = NULL; /* Alias for source buffer */
@@ -133,7 +127,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)
@@ -183,24 +177,31 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
case 0:
do {
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 7:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 6:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 5:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 4:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 3:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 2:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 1:
DUFF_GUTS
@@ -247,24 +248,31 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
case 0:
do {
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 7:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 6:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 5:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 4:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 3:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 2:
DUFF_GUTS
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 1:
DUFF_GUTS
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index b3e7491..a5c8dec 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -31,25 +31,25 @@
#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, const unsigned cd_values[], size_t nbytes,
- size_t *buf_size, void **buf);
+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_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 */
+ 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 */
}};
/*-------------------------------------------------------------------------
- * 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.
@@ -70,14 +70,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)))
@@ -102,10 +102,10 @@ 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.
*
@@ -115,18 +115,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 */
@@ -143,7 +135,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)))
@@ -250,10 +242,10 @@ 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
@@ -267,8 +259,8 @@ done:
*-------------------------------------------------------------------------
*/
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)
+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 */
size_t size_out = 0; /* Size of output buffer */
@@ -276,7 +268,7 @@ H5Z_filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], si
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 1b826ab..7d55efd 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -6,19 +6,19 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5Zmodule.h" /* This source code file is part of the H5Z module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* H5VM_array_fill */
-#include "H5Zpkg.h" /* Data filters */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* H5VM_array_fill */
+#include "H5Zpkg.h" /* Data filters */
/* Token types */
typedef enum {
@@ -81,26 +81,21 @@ 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, size_t array_size, 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:
@@ -310,12 +305,12 @@ 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); \
+ (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); \
+ (H5Z_node *)H5Z__xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \
else \
ret_value->rchild = NULL; \
} \
@@ -330,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, these two macros are called in different ways. (SLU
+ * 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 +366,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
}
/*
- * Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
+ * Programmer: Bill Wendling
* 25. August 2003
*/
@@ -392,22 +387,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);
@@ -420,7 +416,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
@@ -438,11 +434,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);
@@ -569,24 +565,22 @@ 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);
+ H5Z__xform_destroy_parse_tree(tree->lchild);
+ H5Z__xform_destroy_parse_tree(tree->rchild);
H5MM_xfree(tree);
tree = NULL;
}
@@ -600,7 +594,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
@@ -608,12 +602,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?")
@@ -621,59 +615,58 @@ 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)
}
/*-------------------------------------------------------------------------
- * 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")
}
@@ -681,18 +674,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")
}
@@ -700,7 +693,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:
@@ -714,7 +707,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")
}
}
@@ -724,49 +717,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")
}
@@ -774,25 +766,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:
@@ -804,12 +796,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 */
@@ -820,7 +812,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
@@ -830,28 +822,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")
@@ -859,7 +850,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")
@@ -867,7 +858,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")
@@ -877,41 +868,41 @@ 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")
}
@@ -919,28 +910,28 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers)
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")
}
@@ -948,7 +939,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers)
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;
@@ -971,23 +962,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,
@@ -1001,13 +993,12 @@ 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
- * transform.
+ * Purpose: If the transform is trivial, this function applies it.
+ * 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:
+ * 5/1/04
*
*-------------------------------------------------------------------------
*/
@@ -1027,7 +1018,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,
@@ -1090,7 +1081,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)
@@ -1116,27 +1107,30 @@ done:
} /* end H5Z_xform_eval() */
/*-------------------------------------------------------------------------
- * Function: H5Z_xform_eval_full
- * Purpose: Does a full evaluation of the parse tree contained in tree
- * and applies this transform to array.
+ * 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:
*
+ * Programmer: Leon Arber
+ * 5/1/04
*
- * 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);
@@ -1161,9 +1155,9 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_t
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;
@@ -1213,24 +1207,24 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_t
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);
@@ -1283,25 +1277,27 @@ 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);
@@ -1353,22 +1349,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);
@@ -1380,24 +1378,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);
@@ -1413,48 +1413,49 @@ 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);
}
}
}
@@ -1464,27 +1465,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(/)
@@ -1499,7 +1498,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.
*
@@ -1507,14 +1506,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 *
@@ -1543,10 +1538,20 @@ H5Z_xform_create(const char *expr)
"unable to allocate memory for data transform expression")
/* Find the number of times "x" is used in this equation, and allocate room for storing that many points
+ * A more sophisticated check is needed to support scientific notation.
*/
- for (i = 0; i < HDstrlen(expr); i++)
- if (HDisalpha(expr[i]))
+ for (i = 0; i < HDstrlen(expr); i++) {
+ if (HDisalpha(expr[i])) {
+ if ((i > 0) && (i < (HDstrlen(expr) - 1))) {
+ if (((expr[i] == 'E') || (expr[i] == 'e')) &&
+ (HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
+ (HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
+ continue;
+ }
+
count++;
+ }
+ }
/* When there are no "x"'s in the equation (ie, simple transform case),
* we don't need to allocate any space since no array will have to be
@@ -1563,7 +1568,7 @@ H5Z_xform_create(const char *expr)
/* 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)
+ (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
@@ -1580,7 +1585,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)
@@ -1603,14 +1608,10 @@ done:
* Success: SUCCEED
* Failure: FAIL
*
- * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu
+ * Programmer: Quincey Koziol
*
* Date: May 4, 2004
*
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1620,7 +1621,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);
@@ -1648,7 +1649,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
*
@@ -1700,7 +1701,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(
+ 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")
@@ -1720,7 +1721,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);
@@ -1737,14 +1738,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
@@ -1763,16 +1762,14 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop)
* Function: H5Z_xform_extract_xform_str
*
* Purpose: Extracts the pointer to the data transform strings from the
- * data transform property.`
+ * data transform property.`
* 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/H5api_adpt.h b/src/H5api_adpt.h
index 838cbf5..53080b7 100644
--- a/src/H5api_adpt.h
+++ b/src/H5api_adpt.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/H5checksum.c b/src/H5checksum.c
index 5eb735e..0cd7745 100644
--- a/src/H5checksum.c
+++ b/src/H5checksum.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5checksum.c
* Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Internal code for computing fletcher32 checksums
*
@@ -25,6 +25,7 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
@@ -141,7 +142,7 @@ H5_checksum_fletcher32(const void *_data, size_t _len)
} /* end H5_checksum_fletcher32() */
/*-------------------------------------------------------------------------
- * Function: H5_checksum_crc_make_table
+ * Function: H5__checksum_crc_make_table
*
* Purpose: Compute the CRC table for the CRC checksum algorithm
*
@@ -153,12 +154,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++) {
@@ -173,10 +174,10 @@ 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
@@ -191,22 +192,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() */
/*-------------------------------------------------------------------------
* Function: H5_checksum_crc
@@ -234,7 +235,8 @@ 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() */
/*
@@ -378,7 +380,7 @@ uint32_t
H5_checksum_lookup3(const void *key, size_t length, uint32_t initval)
{
const uint8_t *k = (const uint8_t *)key;
- uint32_t a, b, c; /* internal state */
+ uint32_t a, b, c = 0; /* internal state */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -413,36 +415,47 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval)
{
case 12:
c += ((uint32_t)k[11]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 11:
c += ((uint32_t)k[10]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 10:
c += ((uint32_t)k[9]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 9:
c += k[8];
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 8:
b += ((uint32_t)k[7]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 7:
b += ((uint32_t)k[6]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 6:
b += ((uint32_t)k[5]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 5:
b += k[4];
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 4:
a += ((uint32_t)k[3]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 3:
a += ((uint32_t)k[2]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 2:
a += ((uint32_t)k[1]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 1:
a += k[0];
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6ffd12a..d4ec65d 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -75,6 +75,9 @@
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
@@ -242,15 +245,15 @@
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
-/* Define to 1 if you have the <mach/mach_time.h> header file. */
-#undef HAVE_MACH_MACH_TIME_H
-
/* Define if the map API (H5M) should be compiled */
#undef HAVE_MAP_API
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define whether the Mirror virtual file driver (VFD) will be compiled */
+#undef HAVE_MIRROR_VFD
+
/* Define if we have MPE support */
#undef HAVE_MPE
@@ -263,6 +266,12 @@
/* Define if MPI_Info_c2f and MPI_Info_f2c exist */
#undef HAVE_MPI_MULTI_LANG_Info
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
/* Define to 1 if you have the <openssl/evp.h> header file. */
#undef HAVE_OPENSSL_EVP_H
@@ -447,6 +456,9 @@
/* Define if the compiler understands __inline__ */
#undef HAVE___INLINE__
+/* Define if the library will ignore file locks when disabled */
+#undef IGNORE_DISABLED_FILE_LOCKS
+
/* Define if the high-level library headers should be included in hdf5.h */
#undef INCLUDE_HL
@@ -659,6 +671,12 @@
/* Define using v1.8 public API symbols by default */
#undef USE_18_API_DEFAULT
+/* Define if the library will use file locking */
+#undef USE_FILE_LOCKING
+
+/* Define if the library will use recursive RW locks for thread safety */
+#undef USE_RECURSIVE_RW_LOCKS
+
/* 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/src/H5dbg.c b/src/H5dbg.c
index e0b2b74..5af6525 100644
--- a/src/H5dbg.c
+++ b/src/H5dbg.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5dbg.c
- * Mar 4 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Created: H5dbg.c
+ * Mar 4 2006
+ * Quincey Koziol
*
- * Purpose: Generic debugging routines
+ * Purpose: Generic debugging routines
*
*-------------------------------------------------------------------------
*/
@@ -25,11 +25,12 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
/****************/
/* Local Macros */
@@ -56,15 +57,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
*
*-------------------------------------------------------------------------
*/
@@ -92,7 +92,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark
for (u = 0; u < buf_size; u += 16) {
uint8_t c;
- HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset);
+ HDfprintf(stream, "%*s %8zu: ", indent, "", u + buf_offset);
/* Print the hex values */
for (v = 0; v < 16; v++) {
@@ -106,6 +106,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark
} /* end if */
else
HDfprintf(stream, " ");
+
if (7 == v)
HDfputc(' ', stream);
} /* end for */
@@ -118,12 +119,14 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark
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 */
diff --git a/src/H5detect.c b/src/H5detect.c
index 437acf2..e4fe453 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,7 +21,7 @@ static const char *FileHeader = "\n\
* This file is part of HDF5. The full HDF5 copyright notice, including *\n\
* terms governing use, modification, and redistribution, is contained in *\n\
* the COPYING file, which can be found at the root of the source code *\n\
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *\n\
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *\n\
* If you do not have access to either file, you may request a copy from *\n\
* help@hdfgroup.org. *\n\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *";
@@ -43,13 +43,16 @@ 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"
/* Disable warning about cast increasing the alignment of the target type,
* that's _exactly_ what this code is probing. -QAK
*/
-H5_GCC_DIAG_OFF(cast - align)
+H5_GCC_DIAG_OFF("cast-align")
#if defined(__has_attribute)
#if __has_attribute(no_sanitize_address)
@@ -116,9 +119,9 @@ typedef struct malign_t {
FILE *rawoutstream = NULL;
/* global variables types detection code */
-H5_GCC_DIAG_OFF(larger - than =)
+H5_GCC_DIAG_OFF("larger-than=")
static detected_t d_g[MAXDETECT];
-H5_GCC_DIAG_ON(larger - than =)
+H5_GCC_DIAG_ON("larger-than=")
static malign_t m_g[MAXDETECT];
static volatile int nd_g = 0, na_g = 0;
@@ -217,25 +220,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) \
@@ -320,10 +304,10 @@ precision(detected_t *d)
for (_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char)(_byte_mask << 1)) { \
_buf1[_i] ^= _byte_mask; \
HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \
- H5_GCC_DIAG_OFF(float - equal) \
+ H5_GCC_DIAG_OFF("float-equal") \
if (_v1 != _v2) \
_pad_mask[_i] |= _byte_mask; \
- H5_GCC_DIAG_ON(float - equal) \
+ H5_GCC_DIAG_ON("float-equal") \
_buf1[_i] ^= _byte_mask; \
} /* end for */ \
\
@@ -435,10 +419,10 @@ precision(detected_t *d)
HDmemcpy(_buf + align_g[_ano] + (INFO.offset / 8), ((char *)&_val) + (INFO.offset / 8), \
(size_t)(INFO.precision / 8)); \
_val2 = *((TYPE *)(_buf + align_g[_ano])); \
- H5_GCC_DIAG_OFF(float - equal) \
+ H5_GCC_DIAG_OFF("float-equal") \
if (_val != _val2) \
H5LONGJMP(jbuf_g, 1); \
- H5_GCC_DIAG_ON(float - equal) \
+ H5_GCC_DIAG_ON("float-equal") \
/* End Cray Check */ \
(INFO.align) = align_g[_ano]; \
} \
@@ -1650,12 +1634,6 @@ 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
@@ -1736,4 +1714,4 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
-H5_GCC_DIAG_ON(cast - align)
+H5_GCC_DIAG_ON("cast-align")
diff --git a/src/H5err.txt b/src/H5err.txt
index 9fec521..9bd6d0f 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -5,7 +5,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -46,6 +46,7 @@
MAJOR, H5E_ARGS, Invalid arguments to routine
MAJOR, H5E_RESOURCE, Resource unavailable
MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail)
+MAJOR, H5E_LIB, General library infrastructure
MAJOR, H5E_FILE, File accessibility
MAJOR, H5E_IO, Low-level I/O
MAJOR, H5E_FUNC, Function entry/exit
@@ -136,6 +137,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/H5make_libsettings.c b/src/H5make_libsettings.c
index 44768dd..06f7ae3 100644
--- a/src/H5make_libsettings.c
+++ b/src/H5make_libsettings.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,7 +21,7 @@ static const char *FileHeader = "\n\
* This file is part of HDF5. The full HDF5 copyright notice, including *\n\
* terms governing use, modification, and redistribution, is contained in *\n\
* the COPYING file, which can be found at the root of the source code *\n\
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *\n\
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *\n\
* If you do not have access to either file, you may request a copy from *\n\
* help@hdfgroup.org. *\n\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *";
@@ -32,9 +32,8 @@ static const char *FileHeader = "\n\
*-------------------------------------------------------------------------
*/
-#include <stdio.h>
-#include <time.h>
#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.
*/
@@ -65,7 +64,7 @@ insert_libhdf5_settings(FILE *flibinfo)
if (NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) {
HDperror(LIBSETTINGSFNAME);
HDexit(EXIT_FAILURE);
- } /* end if */
+ }
/* print variable definition and the string */
/* Do not use const else AIX strings does not show it. */
@@ -76,30 +75,31 @@ insert_libhdf5_settings(FILE *flibinfo)
/* Start a new line */
fprintf(flibinfo, "\t\"");
bol = 0;
- } /* end if */
+ }
if (inchar == '\n') {
/* end of a line */
fprintf(flibinfo, "\\n\"\n");
bol++;
- } /* end if */
+ }
else
HDputc(inchar, flibinfo);
- } /* end while */
+ }
+
if (HDfeof(fsettings)) {
/* wrap up */
if (!bol)
/* EOF found without a new line */
fprintf(flibinfo, "\\n\"\n");
fprintf(flibinfo, ";\n\n");
- } /* end if */
+ }
else {
fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
HDexit(EXIT_FAILURE);
- } /* end else */
+ }
if (0 != HDfclose(fsettings)) {
HDperror(LIBSETTINGSFNAME);
HDexit(EXIT_FAILURE);
- } /* end if */
+ }
#else
/* print variable definition and an empty string */
/* Do not use const else AIX strings does not show it. */
@@ -165,12 +165,12 @@ information about the library build configuration\n";
n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos));
HDstrncpy(real_name, pwd->pw_gecos, n);
real_name[n] = '\0';
- } /* end if */
+ }
else {
HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
real_name[sizeof(real_name) - 1] = '\0';
- } /* end else */
- } /* end if */
+ }
+ }
else
real_name[0] = '\0';
}
@@ -209,13 +209,15 @@ information about the library build configuration\n";
if (real_name[0])
fprintf(rawoutstream, ">");
HDfputc('\n', rawoutstream);
- } /* end if */
+ }
+
fprintf(rawoutstream, " *\n * Purpose:\t\t");
+
for (s = purpose; *s; s++) {
HDfputc(*s, rawoutstream);
if ('\n' == *s && s[1])
fprintf(rawoutstream, " *\t\t\t");
- } /* end for */
+ }
fprintf(rawoutstream, " *\n * Modifications:\n *\n");
fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n");
diff --git a/src/H5module.h b/src/H5module.h
new file mode 100644
index 0000000..64081bf
--- /dev/null
+++ b/src/H5module.h
@@ -0,0 +1,34 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This file contains declarations which define macros for the
+ * H5 package. Including this header means that the source file
+ * is part of the H5 package.
+ */
+#ifndef H5module_H
+#define H5module_H
+
+/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
+ * reporting macros.
+ */
+#define H5_MODULE
+#define H5_MY_PKG H5
+#define H5_MY_PKG_ERR H5E_LIB
+#define H5_MY_PKG_INIT YES
+
+/**\defgroup H5 H5
+ * \brief General Library Functions
+ * \todo Describe concisely what the functions in this module are about.
+ */
+
+#endif /* H5module_H */
diff --git a/src/H5mpi.c b/src/H5mpi.c
index 01f57b7..9749721 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,7 +25,7 @@
/****************/
/* Local Macros */
/****************/
-#define TWO_GIG_LIMIT (1 << 31)
+#define TWO_GIG_LIMIT INT32_MAX
#ifndef H5_MAX_MPI_COUNT
#define H5_MAX_MPI_COUNT (1 << 30)
#endif
@@ -33,7 +33,7 @@
/*******************/
/* Local Variables */
/*******************/
-static hsize_t bigio_count = H5_MAX_MPI_COUNT;
+static hsize_t bigio_count_g = H5_MAX_MPI_COUNT;
/*-------------------------------------------------------------------------
* Function: H5_mpi_set_bigio_count
@@ -42,7 +42,7 @@ static hsize_t bigio_count = H5_MAX_MPI_COUNT;
* when we utilize derived datatypes. This is of
* particular interest for allowing nightly testing
*
- * Return: The current/previous value of bigio_count.
+ * Return: The current/previous value of bigio_count_g.
*
* Programmer: Richard Warren, March 10, 2017
*
@@ -51,21 +51,21 @@ static hsize_t bigio_count = H5_MAX_MPI_COUNT;
hsize_t
H5_mpi_set_bigio_count(hsize_t new_count)
{
- hsize_t orig_count = bigio_count;
+ hsize_t orig_count = bigio_count_g;
if ((new_count > 0) && (new_count < (hsize_t)TWO_GIG_LIMIT)) {
- bigio_count = new_count;
+ bigio_count_g = new_count;
}
return orig_count;
-} /* end H5_mpio_set_bigio_count() */
+} /* end H5_mpi_set_bigio_count() */
/*-------------------------------------------------------------------------
* Function: H5_mpi_get_bigio_count
*
* Purpose: Allow other HDF5 library functions to access
- * the current value for bigio_count.
+ * the current value for bigio_count_g.
*
- * Return: The current/previous value of bigio_count.
+ * Return: The current/previous value of bigio_count_g.
*
* Programmer: Richard Warren, October 7, 2019
*
@@ -74,7 +74,7 @@ H5_mpi_set_bigio_count(hsize_t new_count)
hsize_t
H5_mpi_get_bigio_count(void)
{
- return bigio_count;
+ return bigio_count_g;
}
/*-------------------------------------------------------------------------
@@ -210,7 +210,7 @@ H5_mpi_comm_free(MPI_Comm *comm)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL")
/* Free the communicator */
- if (MPI_COMM_NULL != *comm)
+ if (MPI_COMM_WORLD != *comm && MPI_COMM_NULL != *comm)
MPI_Comm_free(comm);
*comm = MPI_COMM_NULL;
@@ -471,8 +471,8 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
FUNC_ENTER_NOAPI(FAIL)
/* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_elements / bigio_count);
- leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count;
+ num_big_types = (int)(num_elements / bigio_count_g);
+ leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count_g;
H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t);
/* Create a contiguous datatype of size equal to the largest
@@ -481,11 +481,11 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
* use type_hvector to create the type with the displacement provided
*/
if (0 == stride_bytes) {
- if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count, old_type, &inner_type)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count_g, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
} /* end if */
else if (MPI_SUCCESS !=
- (mpi_code = MPI_Type_create_hvector((int)bigio_count, 1, stride_bytes, old_type, &inner_type)))
+ (mpi_code = MPI_Type_create_hvector((int)bigio_count_g, 1, stride_bytes, old_type, &inner_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
/* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
@@ -510,7 +510,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
} /* end if */
else if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(
- (int)(num_elements - (hsize_t)num_big_types * bigio_count), 1,
+ (int)(num_elements - (hsize_t)num_big_types * bigio_count_g), 1,
stride_bytes, old_type, &leftover_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
@@ -529,7 +529,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
block_len[0] = 1;
block_len[1] = 1;
disp[0] = 0;
- disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
+ disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count_g;
if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
diff --git a/src/H5overflow.h b/src/H5overflow.h
index ba693e2..833f5ca 100644
--- a/src/H5overflow.h
+++ b/src/H5overflow.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new types to H5overflow.txt file */
-#ifndef _H5overflow_H
-#define _H5overflow_H
+#ifndef H5overflow_H
+#define H5overflow_H
/* Each type in this file is tested for assignment to the other types,
diff --git a/src/H5overflow.txt b/src/H5overflow.txt
index 9fb3b89..3f91a75 100644
--- a/src/H5overflow.txt
+++ b/src/H5overflow.txt
@@ -5,7 +5,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/src/H5private.h b/src/H5private.h
index 374c571..56ded14 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -6,12 +6,12 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Friday, October 30, 1998
*
* Purpose: This file is included by all HDF5 library source files to
@@ -21,8 +21,8 @@
*
*/
-#ifndef _H5private_H
-#define _H5private_H
+#ifndef H5private_H
+#define H5private_H
#include "H5public.h" /* Include Public Definitions */
@@ -190,23 +190,6 @@
#endif /*H5_HAVE_WIN32_API*/
-/* Various ways that inline functions can be declared */
-#if defined(H5_HAVE___INLINE__)
-/* GNU (alternative form) */
-#define H5_INLINE __inline__
-#elif defined(H5_HAVE___INLINE)
-/* Visual Studio */
-#define H5_INLINE __inline
-#elif defined(H5_HAVE_INLINE)
-/* GNU, C++
- * Use "inline" as a last resort on the off-chance that there will
- * be C++ problems.
- */
-#define H5_INLINE inline
-#else
-#define H5_INLINE
-#endif /* inline choices */
-
#ifndef F_OK
#define F_OK 00
#define W_OK 02
@@ -298,22 +281,34 @@
* Note that Solaris Studio supports attribute, but does not support the
* attributes we use.
*
+ * When using H5_ATTR_FALLTHROUGH, you should also include a comment that
+ * says FALLTHROUGH to reduce warnings on compilers that don't use
+ * attributes but do respect fall-through comments.
+ *
* H5_ATTR_CONST is redefined in tools/h5repack/dynlib_rpk.c to quiet
* gcc warnings (it has to use the public API and can't include this
* file). Be sure to update that file if the #ifdefs change here.
*/
-#ifdef __cplusplus
-#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
-#define H5_ATTR_UNUSED /*void*/
-#define H5_ATTR_NDEBUG_UNUSED /*void*/
-#define H5_ATTR_NORETURN /*void*/
-#define H5_ATTR_CONST /*void*/
-#define H5_ATTR_PURE /*void*/
-#define H5_ATTR_FALLTHROUGH /*void*/
-#else /* __cplusplus */
#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C)
#define H5_ATTR_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z)))
#define H5_ATTR_UNUSED __attribute__((unused))
+#ifdef H5_HAVE_PARALLEL
+#define H5_ATTR_PARALLEL_UNUSED __attribute__((unused))
+#define H5_ATTR_PARALLEL_USED /*void*/
+#else
+#define H5_ATTR_PARALLEL_UNUSED /*void*/
+#define H5_ATTR_PARALLEL_USED __attribute__((unused))
+#endif
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+#define H5_ATTR_DEPRECATED_USED H5_ATTR_UNUSED
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+#define H5_ATTR_DEPRECATED_USED /*void*/
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#ifdef H5_DEBUG_API
+#define H5_ATTR_DEBUG_API_USED /*void*/
+#else /* H5_DEBUG_API */
+#define H5_ATTR_DEBUG_API_USED H5_ATTR_UNUSED
+#endif /* H5_DEBUG_API */
#ifndef NDEBUG
#define H5_ATTR_NDEBUG_UNUSED /*void*/
#else /* NDEBUG */
@@ -331,12 +326,31 @@
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
#define H5_ATTR_UNUSED /*void*/
#define H5_ATTR_NDEBUG_UNUSED /*void*/
+#define H5_ATTR_DEBUG_API_USED /*void*/
+#define H5_ATTR_DEPRECATED_USED /*void*/
+#define H5_ATTR_PARALLEL_UNUSED /*void*/
+#define H5_ATTR_PARALLEL_USED /*void*/
#define H5_ATTR_NORETURN /*void*/
#define H5_ATTR_CONST /*void*/
#define H5_ATTR_PURE /*void*/
#define H5_ATTR_FALLTHROUGH /*void*/
#endif
-#endif /* __cplusplus */
+
+/*
+ * Networking headers used by the mirror VFD and related tests and utilities.
+ */
+#ifdef H5_HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef H5_HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef H5_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef H5_HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
/*
* Status return values for the `herr_t' type.
@@ -349,7 +363,6 @@
*/
#define SUCCEED 0
#define FAIL (-1)
-#define UFAIL (unsigned)(-1)
/* The HDF5 library uses the symbol `ERR` frequently. So do
* header files for libraries such as curses(3), terminfo(3), etc.
@@ -532,28 +545,6 @@ typedef long int32_t;
#define H5_REQUEST_NULL NULL
/*
- * A macro to portably decrement enumerated types.
- */
-#ifndef H5_DEC_ENUM
-#define H5_DEC_ENUM(TYPE, VAR) (VAR) = ((TYPE)((VAR)-1))
-#endif
-
-/* Double constant wrapper
- *
- * Quiets gcc warnings from -Wunsuffixed-float-constants.
- *
- * This is a really annoying warning since the standard specifies that
- * constants of type double do NOT get a suffix so there's no way
- * to specify a constant of type double. To quiet gcc, we specify floating
- * point constants as type long double and cast to double.
- *
- * Note that this macro only needs to be used where using a double
- * is important. For most code, suffixing constants with F will quiet the
- * compiler and not produce erroneous code.
- */
-#define H5_DOUBLE(S) ((double)S##L)
-
-/*
* Methods to compare the equality of floating-point values:
*
* 1. H5_XXX_ABS_EQUAL - check if the difference is smaller than the
@@ -593,20 +584,37 @@ typedef long int32_t;
#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*/);
-H5_DLL void H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds);
-H5_DLL time_t H5_now(void);
+/* 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 {
@@ -640,6 +648,9 @@ typedef struct {
#ifndef HDabs
#define HDabs(X) abs(X)
#endif /* HDabs */
+#ifndef HDaccept
+#define HDaccept(A, B, C) accept((A), (B), (C)) /* mirror VFD */
+#endif /* HDaccept */
#ifndef HDaccess
#define HDaccess(F, M) access(F, M)
#endif /* HDaccess */
@@ -686,6 +697,9 @@ typedef struct {
#ifndef HDatoll
#define HDatoll(S) atoll(S)
#endif /* HDatol */
+#ifndef HDbind
+#define HDbind(A, B, C) bind((A), (B), (C)) /* mirror VFD */
+#endif /* HDbind */
#ifndef HDbsearch
#define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F)
#endif /* HDbsearch */
@@ -722,12 +736,18 @@ 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 */
#ifndef HDclosedir
#define HDclosedir(D) closedir(D)
#endif /* HDclosedir */
+#ifndef HDconnect
+#define HDconnect(A, B, C) connect((A), (B), (C)) /* mirror VFD */
+#endif /* HDconnect */
#ifndef HDcos
#define HDcos(X) cos(X)
#endif /* HDcos */
@@ -838,8 +858,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)
@@ -862,10 +882,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDfork
#define HDfork() fork()
#endif /* HDfork */
+#ifndef HDfprintf
+#define HDfprintf fprintf
+#endif
#ifndef HDfpathconf
#define HDfpathconf(F, N) fpathconf(F, N)
#endif /* HDfpathconf */
-H5_DLL int HDfprintf(FILE *stream, const char *fmt, ...);
#ifndef HDfputc
#define HDfputc(C, F) fputc(C, F)
#endif /* HDfputc */
@@ -928,7 +950,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)
@@ -972,9 +994,12 @@ typedef off_t h5_stat_size_t;
#ifndef HDgetgroups
#define HDgetgroups(Z, G) getgroups(Z, G)
#endif /* HDgetgroups */
+#ifndef HDgethostbyaddr
+#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) /* mirror VFD */
+#endif /* HDgethostbyaddr */
#ifndef HDgethostname
#define HDgethostname(N, L) gethostname(N, L)
-#endif /* HDgetlogin */
+#endif /* HDgethostname */
#ifndef HDgetlogin
#define HDgetlogin() getlogin()
#endif /* HDgetlogin */
@@ -996,9 +1021,12 @@ typedef off_t h5_stat_size_t;
#ifndef HDgetrusage
#define HDgetrusage(X, S) getrusage(X, S)
#endif /* HDgetrusage */
-#ifndef HDgets
-#define HDgets(S) gets(S)
+
+/* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */
+#ifdef HDgets
+#undef HDgets
#endif /* HDgets */
+
#ifndef HDgettimeofday
#define HDgettimeofday(S, P) gettimeofday(S, P)
#endif /* HDgettimeofday */
@@ -1008,6 +1036,18 @@ typedef off_t h5_stat_size_t;
#ifndef HDgmtime
#define HDgmtime(T) gmtime(T)
#endif /* HDgmtime */
+#ifndef HDhtonl
+#define HDhtonl(X) htonl((X)) /* mirror VFD */
+#endif /* HDhtonl */
+#ifndef HDhtons
+#define HDhtons(X) htons((X)) /* mirror VFD */
+#endif /* HDhtons */
+#ifndef HDinet_addr
+#define HDinet_addr(C) inet_addr((C)) /* mirror VFD */
+#endif /* HDinet_addr */
+#ifndef HDinet_ntoa
+#define HDinet_ntoa(C) inet_ntoa((C)) /* mirror VFD */
+#endif /* HDinet_ntoa */
#ifndef HDisalnum
#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
#endif /* HDisalnum */
@@ -1062,6 +1102,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDlink
#define HDlink(OLD, NEW) link(OLD, NEW)
#endif /* HDlink */
+#ifndef HDlisten
+#define HDlisten(A, B) listen((A), (B)) /* mirror VFD */
+#endif /* HDlisten */
#ifndef HDllround
#define HDllround(V) llround(V)
#endif /* HDround */
@@ -1143,6 +1186,12 @@ typedef off_t h5_stat_size_t;
#ifndef HDnanosleep
#define HDnanosleep(N, O) nanosleep(N, O)
#endif /* HDnanosleep */
+#ifndef HDntohl
+#define HDntohl(A) ntohl((A)) /* mirror VFD */
+#endif /* HDntohl */
+#ifndef HDntohs
+#define HDntohs(A) ntohs((A)) /* mirror VFD */
+#endif /* HDntohs */
#ifndef HDopen
#define HDopen(F, ...) open(F, __VA_ARGS__)
#endif /* HDopen */
@@ -1171,7 +1220,7 @@ typedef off_t h5_stat_size_t;
#define HDpread(F, B, C, O) pread(F, B, C, O)
#endif /* HDpread */
#ifndef HDprintf
-#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
+#define HDprintf printf
#endif /* HDprintf */
#ifndef HDputc
#define HDputc(C, F) putc(C, F)
@@ -1290,12 +1339,21 @@ H5_DLL void HDsrand(unsigned int seed);
#ifndef HDsetsid
#define HDsetsid() setsid()
#endif /* HDsetsid */
+#ifndef HDsetsockopt
+#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) /* mirror VFD */
+#endif /* HDsetsockopt */
#ifndef HDsetuid
#define HDsetuid(U) setuid(U)
#endif /* HDsetuid */
#ifndef HDsetvbuf
#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z)
#endif /* HDsetvbuf */
+#ifndef HDshutdown
+#define HDshutdown(A, B) shutdown((A), (B)) /* mirror VFD */
+#endif /* HDshutdown */
+#ifndef HDsigaction
+#define HDsigaction(S, A, O) sigaction((S), (A), (O))
+#endif /* HDsigaction */
#ifndef HDsigaddset
#define HDsigaddset(S, N) sigaddset(S, N)
#endif /* HDsigaddset */
@@ -1341,6 +1399,9 @@ H5_DLL void HDsrand(unsigned int seed);
#ifndef HDsnprintf
#define HDsnprintf snprintf /*varargs*/
#endif /* HDsnprintf */
+#ifndef HDsocket
+#define HDsocket(A, B, C) socket((A), (B), (C)) /* mirror VFD */
+#endif /* HDsocket */
#ifndef HDsprintf
#define HDsprintf sprintf /*varargs*/
#endif /* HDsprintf */
@@ -1371,6 +1432,9 @@ H5_DLL void HDsrand(unsigned int seed);
#ifndef HDstrcspn
#define HDstrcspn(X, Y) strcspn(X, Y)
#endif /* HDstrcspn */
+#ifndef HDstrdup
+#define HDstrdup(S) strdup(S)
+#endif /* HDstrdup */
#ifndef HDstrerror
#define HDstrerror(N) strerror(N)
#endif /* HDstrerror */
@@ -1426,6 +1490,9 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#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 */
@@ -1509,6 +1576,13 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#ifndef HDutime
#define HDutime(S, T) utime(S, T)
#endif /* HDutime */
+#ifndef HDvasprintf
+#ifdef H5_HAVE_VASPRINTF
+#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
+#else
+H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
+#endif /* H5_HAVE_VASPRINTF */
+#endif /* HDvasprintf */
#ifndef HDva_arg
#define HDva_arg(A, T) va_arg(A, T)
#endif /* HDva_arg */
@@ -1521,9 +1595,6 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#ifndef HDva_start
#define HDva_start(A, P) va_start(A, P)
#endif /* HDva_start */
-#ifndef HDvasprintf
-#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
-#endif /* HDvasprintf */
#ifndef HDvfprintf
#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A)
#endif /* HDvfprintf */
@@ -1552,27 +1623,6 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#define HDwrite(F, M, Z) write(F, M, Z)
#endif /* HDwrite */
-/*
- * And now for a couple non-Posix functions... Watch out for systems that
- * define these in terms of macros.
- */
-#if !defined strdup && !defined H5_HAVE_STRDUP
-extern char * strdup(const char *s);
-#endif
-
-#ifndef HDstrdup
-#define HDstrdup(S) strdup(S)
-#endif /* HDstrdup */
-
-#ifndef HDpthread_self
-#define HDpthread_self() pthread_self()
-#endif /* HDpthread_self */
-
-/* Use this version of pthread_self for printing the thread ID */
-#ifndef HDpthread_self_ulong
-#define HDpthread_self_ulong() ((unsigned long)pthread_self())
-#endif /* HDpthread_self_ulong */
-
/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */
/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */
#define H5_STRINGIZE(x) #x
@@ -1918,17 +1968,20 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ
/* global library version information string */
extern char H5_lib_vers_info_g[];
+#include "H5TSprivate.h"
+
/* Lock headers */
#ifdef H5_HAVE_THREADSAFE
-/* Include required thread-safety header */
-#include "H5TSprivate.h"
-
/* replacement structure for original global variable */
typedef struct H5_api_struct {
- H5TS_mutex_t init_lock; /* API entrance mutex */
- hbool_t H5_libinit_g; /* Has the library been initialized? */
- hbool_t H5_libterm_g; /* Is the library being shutdown? */
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+ H5TS_rw_lock_t init_rw_lock; /* API entrance RW lock */
+#else
+ H5TS_mutex_t init_lock; /* API entrance mutex */
+#endif
+ hbool_t H5_libinit_g; /* Has the library been initialized? */
+ hbool_t H5_libterm_g; /* Is the library being shutdown? */
} H5_api_t;
/* Macros for accessing the global variables */
@@ -1943,13 +1996,17 @@ typedef struct H5_api_struct {
#endif
/* Macros for threadsafe HDF-5 Phase I locks */
+#ifdef H5_USE_RECURSIVE_WRITER_LOCKS
+#define H5_API_LOCK H5TS_rw_wrlock(&H5_g.init_rw_lock);
+#define H5_API_UNLOCK H5TS_rw_unlock(&H5_g.init_rw_lock);
+#else
#define H5_API_LOCK H5TS_mutex_lock(&H5_g.init_lock);
#define H5_API_UNLOCK H5TS_mutex_unlock(&H5_g.init_lock);
+#endif
/* Macros for thread cancellation-safe mechanism */
#define H5_API_UNSET_CANCEL H5TS_cancel_count_inc();
-
-#define H5_API_SET_CANCEL H5TS_cancel_count_dec();
+#define H5_API_SET_CANCEL H5TS_cancel_count_dec();
extern H5_api_t H5_g;
@@ -2072,14 +2129,14 @@ H5_DLL herr_t H5CX_pop(void);
#define FUNC_ENTER_API_INIT(err) \
/* Initialize the library */ \
if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
- H5_INIT_GLOBAL = TRUE; \
if (H5_init_library() < 0) \
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \
} /* 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 \
\
@@ -2095,6 +2152,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
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); \
{
@@ -2108,6 +2166,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
+ FUNC_ENTER_API_PUSH(err); \
{
/*
@@ -2144,6 +2203,23 @@ 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 */ \
@@ -2353,6 +2429,20 @@ H5_DLL herr_t H5CX_pop(void);
} \
} /*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*/ \
@@ -2481,7 +2571,6 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through API
\
/* Initialize the library or bust */ \
if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
- H5_INIT_GLOBAL = TRUE; \
if (H5_init_library() < 0) { \
/* (Can't use H5E_THROW here) */ \
H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
@@ -2725,4 +2814,4 @@ H5_DLL herr_t H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_b
H5_DLL 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);
-#endif /* _H5private_H */
+#endif /* H5private_H */
diff --git a/src/H5public.h b/src/H5public.h
index cd2fd15..44072ba 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,44 +14,44 @@
/*
* This file contains public declarations for the HDF5 module.
*/
-#ifndef _H5public_H
-#define _H5public_H
+#ifndef H5public_H
+#define H5public_H
/* Include files for public use... */
/*
* Since H5pubconf.h is a generated header file, it is messy to try
- * to put a #ifndef _H5pubconf_H ... #endif guard in it.
+ * to put a #ifndef H5pubconf_H ... #endif guard in it.
* HDF5 has set an internal rule that it is being included here.
* Source files should NOT include H5pubconf.h directly but include
- * it via H5public.h. The #ifndef _H5public_H guard above would
+ * 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 <features.h> /*for setting POSIX, BSD, etc. compatibility */
+#include <features.h> /* For setting POSIX, BSD, etc. compatibility */
#endif
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef H5_STDC_HEADERS
-#include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */
-#include <stdarg.h> /*for variadic functions in H5VLpublic.h */
+#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */
+#include <stdarg.h> /* For variadic functions in H5VLpublic.h */
#endif
#ifndef __cplusplus
#ifdef H5_HAVE_STDINT_H
-#include <stdint.h> /*for C9x types */
+#include <stdint.h> /* For C9x types */
#endif
#else
#ifdef H5_HAVE_STDINT_H_CXX
-#include <stdint.h> /*for C9x types when include from C++ */
+#include <stdint.h> /* For C9x types (when included from C++) */
#endif
#endif
#ifdef H5_HAVE_INTTYPES_H
-#include <inttypes.h> /* For uint64_t on some platforms */
+#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
#endif
#ifdef H5_HAVE_STDDEF_H
#include <stddef.h>
@@ -61,7 +61,7 @@
#define MPICH_SKIP_MPICXX 1
#define OMPI_SKIP_MPICXX 1
#include <mpi.h>
-#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 <mpio.h>
#endif
#endif
@@ -80,12 +80,11 @@ extern "C" {
*/
/* These pragmas are only implemented usefully in gcc 4.6+ */
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-#define H5_GCC_DIAG_STR(s) #s
-#define H5_GCC_DIAG_JOINSTR(x, y) H5_GCC_DIAG_STR(x##y)
+#define H5_GCC_DIAG_JOINSTR(x, y) x y
#define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
#define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-#define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR(-W, x))
+#define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR("-W", x))
#define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
#else
#define H5_GCC_DIAG_OFF(x)
@@ -93,50 +92,130 @@ extern "C" {
#endif
/* Version numbers */
-#define H5_VERS_MAJOR 1 /* For major interface/format changes */
-#define H5_VERS_MINOR 12 /* 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.12.0" /* Full version string */
+/**
+ * For major interface/format changes
+ */
+#define H5_VERS_MAJOR 1
+/**
+ * For minor interface/format changes
+ */
+#define H5_VERS_MINOR 12
+/**
+ * For tweaks, bug-fixes, or development
+ */
+#define H5_VERS_RELEASE 1
+/**
+ * For pre-releases like \c snap0. Empty string for official releases.
+ */
+#define H5_VERS_SUBRELEASE ""
+/**
+ * Full version string
+ */
+#define H5_VERS_INFO "HDF5 library version: 1.12.1"
#define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE)
/* macros for comparing the version */
+/**
+ * \brief Determines whether the version of the library being used is greater
+ * than or equal to the specified version
+ *
+ * \param[in] Maj Major version number - A non-negative integer value
+ * \param[in] Min Minor version number - A non-negative integer value
+ * \param[in] Rel Release version number - A non-negative integer value
+ * \returns A value of 1 is returned if the library version is greater than
+ * or equal to the version number specified.\n
+ * A value of 0 is returned if the library version is less than the
+ * version number specified.\n
+ * A library version is greater than the specified version number if
+ * its major version is larger than the specified major version
+ * number. If the major version numbers are the same, it is greater
+ * than the specified version number if its minor version is larger
+ * than the specified minor version number. If the minor version
+ * numbers are the same, then a library version would be greater than
+ * the specified version number if its release number is larger than
+ * the specified release number.
+ *
+ * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile
+ * time to conditionally include or exclude code based on the version
+ * of the HDF5 library against which an application will be linked.
+ *
+ * The #H5_VERSION_GE macro compares the version of the HDF5 library
+ * being used against the version number specified in the parameters.
+ *
+ * For more information about release versioning, see \ref_h5lib_relver.
+ *
+ * \since 1.8.7
+ *
+ */
#define H5_VERSION_GE(Maj, Min, Rel) \
(((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE >= Rel)) || \
((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR > Min)) || (H5_VERS_MAJOR > Maj))
+/**
+ * \brief Determines whether the version of the library being used is less
+ * than or equal to the specified version
+ *
+ * \param[in] Maj Major version number - A non-negative integer value
+ * \param[in] Min Minor version number - A non-negative integer value
+ * \param[in] Rel Release version number - A non-negative integer value
+ * \returns A value of 1 is returned if the library version is less than
+ * or equal to the version number specified.\n
+ * A value of 0 is returned if the library version is greater than the
+ * version number specified.\n
+ * A library version is less than the specified version number if
+ * its major version is smaller than the specified major version
+ * number. If the major version numbers are the same, it is smaller
+ * than the specified version number if its minor version is smaller
+ * than the specified minor version number. If the minor version
+ * numbers are the same, then a library version would be smaller than
+ * the specified version number if its release number is smaller than
+ * the specified release number.
+ *
+ * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile
+ * time to conditionally include or exclude code based on the version
+ * of the HDF5 library against which an application will be linked.
+ *
+ * The #H5_VERSION_LE macro compares the version of the HDF5 library
+ * being used against the version number specified in the parameters.
+ *
+ * For more information about release versioning, see \ref_h5lib_relver.
+ *
+ * \since 1.8.7
+ *
+ */
#define H5_VERSION_LE(Maj, Min, Rel) \
(((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE <= Rel)) || \
((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR < Min)) || (H5_VERS_MAJOR < Maj))
-/*
+/**
* Status return values. Failed integer functions in HDF5 result almost
* always in a negative value (unsigned failing functions sometimes return
* zero for failure) while successful return is non-negative (often zero).
* 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");
+ * \code
+ * if((dset = H5Dopen2(file, name)) < 0)
+ * fprintf(stderr, "unable to open the requested dataset\n");
+ * \endcode
*/
typedef int herr_t;
-/*
+/**
* Boolean type. Successful return values are zero (false) or positive
* (true). The typical true value is 1 but don't bet on it. Boolean
- * functions cannot fail. Functions that return `htri_t' however return zero
+ * functions cannot fail. Functions that return #htri_t however return zero
* (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");
- * }
+ * for truth from a #htri_t function is:
+ * \code
+ * 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");
+ * }
+ * \endcode
*/
#ifdef H5_HAVE_STDBOOL_H
#include <stdbool.h>
@@ -172,59 +251,118 @@ typedef long long ssize_t;
#endif
#endif
+/* int64_t type is used for creation order field for links. It may be
+ * defined in Posix.1g, otherwise it is defined here.
+ */
+#if H5_SIZEOF_INT64_T >= 8
+#elif H5_SIZEOF_INT >= 8
+typedef int int64_t;
+#undef H5_SIZEOF_INT64_T
+#define H5_SIZEOF_INT64_T H5_SIZEOF_INT
+#elif H5_SIZEOF_LONG >= 8
+typedef long int64_t;
+#undef H5_SIZEOF_INT64_T
+#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG
+#elif H5_SIZEOF_LONG_LONG >= 8
+typedef long long int64_t;
+#undef H5_SIZEOF_INT64_T
+#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG
+#else
+#error "nothing appropriate for int64_t"
+#endif
+
+/* uint64_t type is used for fields for H5O_info_t. It may be
+ * defined in Posix.1g, otherwise it is defined here.
+ */
+#if H5_SIZEOF_UINT64_T >= 8
+#ifndef UINT64_MAX
+#define UINT64_MAX ((uint64_t)-1)
+#endif
+#elif H5_SIZEOF_INT >= 8
+typedef unsigned uint64_t;
+#define UINT64_MAX UINT_MAX
+#undef H5_SIZEOF_UINT64_T
+#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT
+#elif H5_SIZEOF_LONG >= 8
+typedef unsigned long uint64_t;
+#define UINT64_MAX ULONG_MAX
+#undef H5_SIZEOF_UINT64_T
+#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG
+#elif H5_SIZEOF_LONG_LONG >= 8
+typedef unsigned long long uint64_t;
+#define UINT64_MAX ULLONG_MAX
+#undef H5_SIZEOF_UINT64_T
+#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG
+#else
+#error "nothing appropriate for uint64_t"
+#endif
+
/*
- * The sizes of file objects have their own types defined here, use a 64-bit
- * type.
+ * The sizes of file objects have their own types defined here, use a minimum
+ * 64-bit type.
*/
#if H5_SIZEOF_LONG_LONG >= 8
-H5_GCC_DIAG_OFF(long - long)
+H5_GCC_DIAG_OFF("long-long")
typedef unsigned long long hsize_t;
typedef signed long long hssize_t;
-H5_GCC_DIAG_ON(long - long)
+H5_GCC_DIAG_ON("long-long")
+#define PRIdHSIZE H5_PRINTF_LL_WIDTH "d"
+#define PRIiHSIZE H5_PRINTF_LL_WIDTH "i"
+#define PRIoHSIZE H5_PRINTF_LL_WIDTH "o"
+#define PRIuHSIZE H5_PRINTF_LL_WIDTH "u"
+#define PRIxHSIZE H5_PRINTF_LL_WIDTH "x"
+#define PRIXHSIZE H5_PRINTF_LL_WIDTH "X"
#define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
#define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
+#define HSIZE_UNDEF ULLONG_MAX
#else
#error "nothing appropriate for hsize_t"
#endif
-#define HSIZE_UNDEF ((hsize_t)(hssize_t)(-1))
/*
* File addresses have their own types.
*/
#if H5_SIZEOF_INT >= 8
typedef unsigned haddr_t;
-#define HADDR_UNDEF ((haddr_t)(-1))
+#define HADDR_UNDEF UINT_MAX
#define H5_SIZEOF_HADDR_T H5_SIZEOF_INT
#ifdef H5_HAVE_PARALLEL
#define HADDR_AS_MPI_TYPE MPI_UNSIGNED
#endif /* H5_HAVE_PARALLEL */
+#define PRIdHADDR "d"
+#define PRIoHADDR "o"
+#define PRIuHADDR "u"
+#define PRIxHADDR "x"
+#define PRIXHADDR "X"
#elif H5_SIZEOF_LONG >= 8
typedef unsigned long haddr_t;
-#define HADDR_UNDEF ((haddr_t)(long)(-1))
+#define HADDR_UNDEF ULONG_MAX
#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG
#ifdef H5_HAVE_PARALLEL
#define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG
#endif /* H5_HAVE_PARALLEL */
+#define PRIdHADDR "ld"
+#define PRIoHADDR "lo"
+#define PRIuHADDR "lu"
+#define PRIxHADDR "lx"
+#define PRIXHADDR "lX"
#elif H5_SIZEOF_LONG_LONG >= 8
typedef unsigned long long haddr_t;
-#define HADDR_UNDEF ((haddr_t)(long long)(-1))
+#define HADDR_UNDEF ULLONG_MAX
#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG
#ifdef H5_HAVE_PARALLEL
#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
#endif /* H5_HAVE_PARALLEL */
+#define PRIdHADDR H5_PRINTF_LL_WIDTH "d"
+#define PRIoHADDR H5_PRINTF_LL_WIDTH "o"
+#define PRIuHADDR H5_PRINTF_LL_WIDTH "u"
+#define PRIxHADDR H5_PRINTF_LL_WIDTH "x"
+#define PRIXHADDR H5_PRINTF_LL_WIDTH "X"
#else
#error "nothing appropriate for haddr_t"
#endif
-#if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT
-#define H5_PRINTF_HADDR_FMT "%u"
-#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG
-#define H5_PRINTF_HADDR_FMT "%lu"
-#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG
-#define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u"
-#else
-#error "nothing appropriate for H5_PRINTF_HADDR_FMT"
-#endif
-#define HADDR_MAX (HADDR_UNDEF - 1)
+#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR
+#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.
@@ -246,54 +384,18 @@ typedef unsigned long uint32_t;
#error "nothing appropriate for uint32_t"
#endif
-/* int64_t type is used for creation order field for links. It may be
- * defined in Posix.1g, otherwise it is defined here.
- */
-#if H5_SIZEOF_INT64_T >= 8
-#elif H5_SIZEOF_INT >= 8
-typedef int int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 8
-typedef long int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG
-#elif H5_SIZEOF_LONG_LONG >= 8
-typedef long long int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG
-#else
-#error "nothing appropriate for int64_t"
-#endif
-
-/* uint64_t type is used for fields for H5O_info_t. It may be
- * defined in Posix.1g, otherwise it is defined here.
+//! <!-- [H5_iter_order_t_snip] -->
+/**
+ * Common iteration orders
*/
-#if H5_SIZEOF_UINT64_T >= 8
-#elif H5_SIZEOF_INT >= 8
-typedef unsigned uint64_t;
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 8
-typedef unsigned long uint64_t;
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG
-#elif H5_SIZEOF_LONG_LONG >= 8
-typedef unsigned long long uint64_t;
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG
-#else
-#error "nothing appropriate for uint64_t"
-#endif
-
-/* Common iteration orders */
typedef enum {
- H5_ITER_UNKNOWN = -1, /* Unknown order */
- 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_UNKNOWN = -1, /**< Unknown order */
+ 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_order_t;
+//! <!-- [H5_iter_order_t_snip] -->
/* Iteration callback values */
/* (Actually, any positive value will cause the iterator to stop and pass back
@@ -303,53 +405,473 @@ typedef enum {
#define H5_ITER_CONT (0)
#define H5_ITER_STOP (1)
-/*
+//! <!-- [H5_index_t_snip] -->
+/**
* The types of indices on links in groups/attributes on objects.
* Primarily used for "<do> <foo> by index" routines and for iterating over
* 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;
+//! <!-- [H5_index_t_snip] -->
-/*
+/**
* Storage info struct used by H5O_info_t and H5F_info_t
*/
+//! <!-- [H5_ih_info_t_snip] -->
typedef struct H5_ih_info_t {
- hsize_t index_size; /* btree and/or list */
+ hsize_t index_size; /**< btree and/or list */
hsize_t heap_size;
} H5_ih_info_t;
+//! <!-- [H5_ih_info_t_snip] -->
-/* Tokens are unique and permanent identifiers that are
- * used to reference HDF5 objects in a container. */
-
-/* The maximum size allowed for tokens */
-#define H5O_MAX_TOKEN_SIZE (16) /* Allows for 128-bit tokens */
+/**
+ * The maximum size allowed for tokens
+ * \details Tokens are unique and permanent identifiers that are
+ * used to reference HDF5 objects in a container. This allows
+ * for 128-bit tokens
+ */
+#define H5O_MAX_TOKEN_SIZE (16)
-/* Type for object tokens */
-/* (Hoisted here, since it's used by both the H5Lpublic.h and H5Opublic.h headers) */
+//! <!-- [H5O_token_t_snip] -->
+/**
+ * Type for object tokens
+ *
+ * \internal (Hoisted here, since it's used by both the
+ * H5Lpublic.h and H5Opublic.h headers)
+ */
typedef struct H5O_token_t {
uint8_t __data[H5O_MAX_TOKEN_SIZE];
} H5O_token_t;
+//! <!-- [H5O_token_t_snip] -->
+
+/**
+ * Allocation statistics info struct
+ */
+typedef struct H5_alloc_stats_t {
+ unsigned long long total_alloc_bytes; /**< Running count of total # of bytes allocated */
+ size_t curr_alloc_bytes; /**< Current # of bytes allocated */
+ size_t peak_alloc_bytes; /**< Peak # of bytes allocated */
+ size_t max_block_size; /**< Largest block allocated */
+ size_t total_alloc_blocks_count; /**< Running count of total # of blocks allocated */
+ size_t curr_alloc_blocks_count; /**< Current # of blocks allocated */
+ size_t peak_alloc_blocks_count; /**< Peak # of blocks allocated */
+} H5_alloc_stats_t;
/* Functions in H5.c */
+/**
+ * \ingroup H5
+ * \brief Initializes the HDF5 library
+ * \return \herr_t
+ *
+ * \details H5open() initializes the HDF5 library.
+ *
+ * \details When the HDF5 library is used in a C application, the library is
+ * automatically initialized when the first HDf5 function call is
+ * issued. If one finds that an HDF5 library function is failing
+ * inexplicably, H5open() can be called first. It is safe to call
+ * H5open() before an application issues any other function calls to
+ * the HDF5 library as there are no damaging side effects in calling
+ * it more than once.
+ */
H5_DLL herr_t H5open(void);
+/**
+ * \ingroup H5
+ * \brief Flushes all data to disk, closes all open objects, and releases memory
+ * \return \herr_t
+ *
+ * \details H5close() flushes all data to disk, closes all open HDF5 objects,
+ * and cleans up all memory used by the HDF5 library. This function is
+ * generally called when the application calls exit(), but may be
+ * called earlier in the event of an emergency shutdown or out of a
+ * desire to free all resources used by the HDF5 library.
+ */
H5_DLL herr_t H5close(void);
+/**
+ * \ingroup H5
+ * \brief Instructs library not to install atexit() cleanup routine
+ * \return \herr_t
+ *
+ * \details H5dont_atexit() indicates to the library that an atexit() cleanup
+ * routine should not be installed. The major purpose for using this
+ * function is in situations where the library is dynamically linked
+ * into an application and is un-linked from the application before
+ * exit() gets called. In those situations, a routine installed with
+ * atexit() would jump to a routine which was no longer in memory,
+ * causing errors.
+ *
+ * \attention In order to be effective, this routine \Emph{must} be called
+ * before any other HDF5 function calls, and must be called each
+ * time the library is loaded/linked into the application (the first
+ * time and after it's been un-loaded).
+ */
H5_DLL herr_t H5dont_atexit(void);
+/**
+ * \ingroup H5
+ * \brief Garbage collects on all free-lists of all types
+ * \return \herr_t
+ *
+ * \details H5garbage_collect() walks through all garbage collection routines
+ * of the library, freeing any unused memory.
+ *
+ * It is not required that H5garbage_collect() be called at any
+ * particular time; it is only necessary in certain situations where
+ * the application has performed actions that cause the library to
+ * allocate many objects. The application should call
+ * H5garbage_collect() if it eventually releases those objects and
+ * wants to reduce the memory used by the library from the peak usage
+ * required.
+ *
+ * \note The library automatically garbage collects all the free lists when the
+ * application ends.
+ */
H5_DLL herr_t H5garbage_collect(void);
+/**
+ * \ingroup H5
+ * \brief Sets free-list size limits
+ *
+ * \param[in] reg_global_lim The cumulative limit, in bytes, on memory used for
+ * all regular free lists (Default: 1MB)
+ * \param[in] reg_list_lim The limit, in bytes, on memory used for each regular
+ * free list (Default: 64KB)
+ * \param[in] arr_global_lim The cumulative limit, in bytes, on memory used for
+ * all array free lists (Default: 4MB)
+ * \param[in] arr_list_lim The limit, in bytes, on memory used for each array
+ * free list (Default: 256KB)
+ * \param[in] blk_global_lim The cumulative limit, in bytes, on memory used for
+ * all block free lists and, separately, for all
+ * factory free lists (Default: 16MB)
+ * \param[in] blk_list_lim The limit, in bytes, on memory used for each block
+ * or factory free list (Default: 1MB)
+ * \return \herr_t
+ *
+ * \details H5set_free_list_limits() sets size limits on all types of free
+ * lists. The HDF5 library uses free lists internally to manage
+ * memory. The types of free lists used are as follows:
+ * \li Regular free lists manage memory for single internal data
+ * structures.
+ * \li Array free lists manage memory for arrays of internal
+ * data structures.
+ * \li Block free lists manage memory for arbitrarily-sized blocks
+ * of bytes.
+ * \li Factory free lists manage memory for fixed-size blocks of
+ * bytes.
+ *
+ * The parameters specify global and per-list limits; for example, \p
+ * reg_global_limit and \p reg_list_limit limit the accumulated size
+ * of all regular free lists and the size of each individual regular
+ * free list, respectively. Therefore, if an application sets a 1Mb
+ * limit on each of the global lists, up to 4Mb of total storage might
+ * be allocated, 1Mb for each of the regular, array, block, and
+ * factory type lists.
+ *
+ * The settings specified for block free lists are duplicated for
+ * factory free lists. Therefore, increasing the global limit on block
+ * free lists by x bytes will increase the potential free list memory
+ * usage by 2x bytes.
+ *
+ * Using a value of -1 for a limit means that no limit is set for the
+ * specified type of free list.
+ *
+ * \version 1.8.3 Function changed in this release to set factory free list
+ * memory limits.
+ *
+ * \since 1.6.0
+ */
H5_DLL herr_t H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim,
int arr_list_lim, int blk_global_lim, int blk_list_lim);
+/**
+ * \ingroup H5
+ * \brief Gets the current size of the free lists used to manage memory
+ *
+ * \param[out] reg_size The current size of all "regular" free list memory used
+ * \param[out] arr_size The current size of all "array" free list memory used
+ * \param[out] blk_size The current size of all "block" free list memory used
+ * \param[out] fac_size The current size of all "factory" free list memory used
+ * \return \herr_t
+ *
+ * \details H5get_free_list_sizes() obtains the current size of the different
+ * kinds of free lists that the library uses to manage memory. The
+ * free list sizes can be set with H5set_free_list_limits() and
+ * garbage collected with H5garbage_collect(). These lists are global
+ * for the entire library.
+ *
+ * \since 1.12.1
+ */
+H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size);
+/**
+ * \ingroup H5
+ * \brief Gets the memory allocation statistics for the library
+ *
+ * \param[out] stats Memory allocation statistics
+ * \return \herr_t
+ *
+ * \details H5get_alloc_stats() gets the memory allocation statistics for the
+ * library, if the \c --enable-memory-alloc-sanity-check option was
+ * given when building the library. Applications can check whether
+ * this option was enabled detecting if the
+ * \c H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. This option is
+ * enabled by default for debug builds of the library and disabled by
+ * default for non-debug builds. If the option is not enabled, all the
+ * values returned with be 0. These statistics are global for the
+ * entire library, but do not include allocations from chunked dataset
+ * I/O filters or non-native VOL connectors.
+ *
+ * \since 1.12.1
+ */
+H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats);
+/**
+ * \ingroup H5
+ * \brief Returns the HDF library release number
+ *
+ * \param[out] majnum The major version number of the library
+ * \param[out] minnum The minor version number of the library
+ * \param[out] relnum The release version number of the library
+ * \return \herr_t
+ *
+ * \details H5get_libversion() retrieves the major, minor, and release numbers
+ * of the version of the HDF5 library which is linked to the
+ * application.
+ *
+ */
H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum);
+/**
+ * \ingroup H5
+ * \brief Verifies that HDF5 library versions are consistent
+ *
+ * \param[in] majnum HDF5 library major version number
+ * \param[in] minnum HDF5 library minor version number
+ * \param[in] relnum HDF5 library release number
+ * \return \herr_t
+ *
+ * \details H5check_version() verifies that the version of the HDF5 library
+ * with which an application was compiled, as indicated by the passed
+ * parameters, matches the version of the HDF5 library against which
+ * the application is currently linked.
+ *
+ * \p majnum is the major version number of the HDF library with which
+ * the application was compiled, \p minnum is the minor version
+ * number, and \p relnum is the release number. Consider the following
+ * example:
+ *
+ * An official HDF5 release is labelled as follows:
+ * HDF5 Release \Code{\<majnum\>.\<minnum\>.\<relnum\>}\n
+ * For example, in HDF5 Release 1.8.5:
+ * \li 1 is the major version number, \p majnum.
+ * \li 8 is the minor version number, \p minnum.
+ * \li 5 is the release number, \p relnum.
+ *
+ * As stated above, H5check_version() first verifies that the version
+ * of the HDF5 library with which an application was compiled matches
+ * the version of the HDF5 library against which the application is
+ * currently linked. If this check fails, H5check_version() causes the
+ * application to abort (by means of a standard C abort() call) and
+ * prints information that is usually useful for debugging. This
+ * precaution is is taken to avoid the risks of data corruption or
+ * segmentation faults.
+ *
+ * The most common cause of this failure is that an application was
+ * compiled with one version of HDF5 and is dynamically linked with a
+ * different version different version.
+ *
+ * If the above test passes, H5check_version() proceeds to verify the
+ * consistency of additional library version information. This is
+ * designed to catch source code inconsistencies that do not normally
+ * cause failures; if this check reveals an inconsistency, an
+ * informational warning is printed but the application is allowed to
+ * run.
+ *
+ */
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum);
+/**
+ * \ingroup H5
+ * \brief Determines whether the HDF5 library was built with the thread-safety
+ * feature enabled
+ *
+ * \param[out] is_ts Boolean value indicating whether the library was built
+ * with thread-safety enabled
+ * \return \herr_t
+ *
+ * \details The HDF5 library, although not internally multi-threaded, can be
+ * built with a thread-safety feature enabled that protects internal
+ * data structures with a mutex. In certain circumstances, it may be
+ * useful to determine, at run-time, whether the linked HDF5 library
+ * was built with the thread-safety feature enabled.
+ */
H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
+/**
+ * \ingroup H5
+ * \brief Frees memory allocated by the HDF5 library
+ *
+ * \param[in] mem Buffer to be freed. Can be NULL
+ * \return \herr_t
+ *
+ * \details H5free_memory() frees memory that has been allocated by the caller
+ * with H5allocate_memory() or by the HDF5 library on behalf of the
+ * caller.
+ *
+ * H5Tget_member_name() provides an example of memory allocation on
+ * behalf of the caller: The function returns a buffer containing the
+ * name of a compound datatype member. It is the caller’s
+ * responsibility to eventually free that buffer with H5free_memory().
+ *
+ * \attention It is especially important to use this function to free memory
+ * allocated by the library on Windows. The C standard library is
+ * implemented in dynamic link libraries (DLLs) known as the C
+ * run-time (CRT). Each version of Visual Studio comes with two CRT
+ * DLLs (debug and release) and allocating and freeing across DLL
+ * boundaries can cause resource leaks and subtle bugs due to heap
+ * corruption.\n
+ * Only use this function to free memory allocated by the HDF5
+ * Library. It will generally not be safe to use this function to
+ * free memory allocated by any other means.\n
+ * Even when using this function, it is still best to ensure that
+ * all components of a C application are built with the same version
+ * of Visual Studio and build (debug or release) and thus linked
+ * against the same CRT.
+ *
+ * \see H5allocate_memory(), H5resize_memory()
+ *
+ * \since 1.8.13
+ *
+ */
H5_DLL herr_t H5free_memory(void *mem);
-H5_DLL void * H5allocate_memory(size_t size, hbool_t clear);
-H5_DLL void * H5resize_memory(void *mem, size_t size);
+/**
+ * \ingroup H5
+ * \brief Frees memory allocated by the HDF5 library
+ *
+ * \param[in] size The size in bytes of the buffer to be allocated
+ * \param[in] clear Flag whether the new buffer is to be initialized with 0
+ *
+ * \return On success, returns pointer to newly allocated buffer or returns
+ * NULL if size is 0 (zero).\n
+ * Returns NULL on failure.
+ *
+ * \details H5allocate_memory() allocates a memory buffer of size bytes that
+ * will later be freed internally by the HDF5 library.
+ *
+ * The boolean \p clear parameter specifies whether the buffer should
+ * be initialized. If clear is \c TRUE, all bits in the buffer are to be
+ * set to 0 (zero); if clear is \c FALSE, the buffer will not be
+ * initialized.
+ *
+ * This function is intended to have the semantics of malloc() and
+ * calloc(). However, unlike malloc() and calloc() which allow for a
+ * "special" pointer to be returned instead of NULL, this function
+ * always returns NULL on failure or when size is set to 0 (zero).
+ *
+ * \note At this time, the only intended use for this function is to allocate
+ * memory that will be returned to the library as a data buffer from a
+ * third-party filter.
+ *
+ * \attention To avoid heap corruption, allocated memory should be freed using
+ * the same library that initially allocated it. In most cases, the
+ * HDF5 API uses resources that are allocated and freed either
+ * entirely by the user or entirely by the library, so this is not a
+ * problem. In rare cases, however, HDF5 API calls will free memory
+ * that the user allocated. This function allows the user to safely
+ * allocate this memory.\n
+ * It is particularly important to use this function to allocate
+ * memory in Microsoft Windows environments. In Windows, the C
+ * standard library is implemented in dynamic link libraries (DLLs)
+ * known as the C run-time (CRT). Each version of Visual Studio
+ * comes with multiple versions of the CRT DLLs (debug, release, et
+ * cetera) and allocating and freeing memory across DLL boundaries
+ * can cause resource leaks and subtle bugs due to heap corruption.\n
+ * Even when using this function, it is best where possible to
+ * ensure that all components of a C application are built with the
+ * same version of Visual Studio and configuration (Debug or
+ * Release), and thus linked against the same CRT.\n
+ * Use this function only to allocate memory inside third-party HDF5
+ * filters. It will generally not be safe to use this function to
+ * allocate memory for any other purpose.
+ *
+ * \see H5free_memory(), H5resize_memory()
+ *
+ * \since 1.8.15
+ *
+ */
+H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
+/**
+ * \ingroup H5
+ * \brief Resizes and, if required, re-allocates memory that will later be
+ * freed internally by the HDF5 library
+ *
+ * \param[in] mem Pointer to a buffer to be resized. May be NULL
+ * \param[in] size New size of the buffer, in bytes
+
+ *
+ * \return On success, returns pointer to resized or reallocated buffer
+ * or returns NULL if size is 0 (zero).\n
+ * Returns NULL on failure.
+ *
+ * \details H5resize_memory() takes a pointer to an existing buffer and resizes
+ * the buffer to match the value in \p size. If necessary, the buffer
+ * is reallocated. If \p size is 0, the buffer is released.
+ *
+ * The input buffer must either be NULL or have been allocated by
+ * H5allocate_memory() since the input buffer may be freed by the
+ * library.
+ *
+ * For certain behaviors, the pointer \p mem may be passed in as NULL.
+ *
+ * This function is intended to have the semantics of realloc():
+ *
+ * <table>
+ * <tr><td>\Code{H5resize_memory(buffer, size)}</td>
+ * <td>Resizes buffer. Returns pointer to resized buffer.</td></tr>
+ * <tr><td>\Code{H5resize_memory(NULL, size)}</td>
+ * <td>Allocates memory using HDF5 Library allocator.
+ * Returns pointer to new buffer</td></tr>
+ * <tr><td>\Code{H5resize_memory(buffer, 0)}</td>
+ * <td>Frees memory using HDF5 Library allocator.
+ * Returns NULL.</td></tr>
+ * <tr><td>\Code{H5resize_memory(NULL, 0)}</td>
+ * <td>Returns NULL (undefined in C standard).</td></tr>
+ * </table>
+ *
+ * Unlike realloc(), which allows for a "special pointer to be
+ * returned instead of NULL, this function always returns NULL on
+ * failure or when size is 0 (zero).
+ *
+ * \note At this time, the only intended use for this function is to resize or
+ * reallocate memory that will be returned to the library (and eventually
+ * to the user) as a data buffer from a third-party HDF5 filter.
+ *
+ * \attention To avoid heap corruption, allocated memory should be freed using
+ * the same library that initially allocated it. In most cases, the
+ * HDF5 API uses resources that are allocated and freed either
+ * entirely by the user or entirely by the library, so this is not a
+ * problem. In rare cases, however, HDF5 API calls will free memory
+ * that the user allocated. This function allows the user to safely
+ * allocate this memory.\n
+ * It is particularly important to use this function to resize
+ * memory on Microsoft Windows systems. In Windows, the C standard
+ * library is implemented in dynamic link libraries (DLLs) known as
+ * the C run-time (CRT). Each version of Visual Studio comes with
+ * multiple versions of the CRT DLLs (debug, release, et cetera) and
+ * allocating and freeing memory across DLL boundaries can cause
+ * resource leaks and subtle bugs due to heap corruption.\n
+ * Even when using this function, it is still best to ensure that
+ * all components of a C application are built with the same version
+ * of Visual Studio and the same configuration (Debug or Release),
+ * and thus linked against the same CRT.\n
+ * Only use this function to resize memory inside third-party HDF5
+ * filters. It will generally not be safe to use this function to
+ * resize memory for any other purpose.
+ *
+ * \see H5allocate_memory(), H5free_memory()
+ *
+ * \since 1.8.15
+ *
+ */
+H5_DLL void *H5resize_memory(void *mem, size_t size);
#ifdef __cplusplus
}
#endif
-#endif /* _H5public_H */
+#endif /* H5public_H */
diff --git a/src/H5system.c b/src/H5system.c
index 1a85cf8..144e0bc 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -6,18 +6,18 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: H5system.c
- * Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5system.c
+ * Aug 21 2006
+ * Quincey Koziol
*
- * Purpose: System call wrapper implementations.
+ * Purpose: System call wrapper implementations.
*
*-------------------------------------------------------------------------
*/
@@ -25,14 +25,15 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* 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 */
/****************/
/* Local Macros */
@@ -65,393 +66,35 @@
/* Track whether tzset routine was called */
static hbool_t H5_ntzset = FALSE;
-/*-------------------------------------------------------------------------
- * Function: HDfprintf
- *
- * Purpose: Prints the optional arguments under the control of the format
- * string FMT to the stream STREAM. This function takes the
- * same format as fprintf(3c) with a few added features:
- *
- * The conversion modifier `H' refers to the size of an
- * `hsize_t' or `hssize_t' type. For instance, "0x%018Hx"
- * prints an `hsize_t' value as a hex number right justified and
- * zero filled in an 18-character field.
- *
- * The conversion 'a' refers to an haddr_t type.
- *
- * The conversion 't' refers to an htri_t type.
- *
- * The conversion 'k' refers to an H5O_token_t type.
- *
- * Return: Success: Number of characters printed
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, April 9, 1998
- *
- *-------------------------------------------------------------------------
- */
-/* Disable warning for "format not a string literal" here -QAK */
-/*
- * This pragma only needs to surround the fprintf() calls with
- * format_templ in the code below, but early (4.4.7, at least) gcc only
- * allows diagnostic pragmas to be toggled outside of functions.
+#ifndef H5_HAVE_VASPRINTF
+/* HDvasprintf provides vasprintf-like function on targets where it is
+ * unavailable.
*/
-H5_GCC_DIAG_OFF(format - nonliteral)
int
-HDfprintf(FILE *stream, const char *fmt, ...)
+HDvasprintf(char **bufp, const char *fmt, va_list _ap)
{
- int n = 0, nout = 0;
- int fwidth, prec;
- int zerofill;
- int leftjust;
- int plussign;
- int ldspace;
- int prefix;
- char modifier[8];
- int conv;
- char * rest, format_templ[128];
- int len;
- const char *s;
- va_list ap;
-
- HDassert(stream);
- HDassert(fmt);
-
- HDva_start(ap, fmt);
- while (*fmt) {
- fwidth = prec = 0;
- zerofill = 0;
- leftjust = 0;
- plussign = 0;
- prefix = 0;
- ldspace = 0;
- modifier[0] = '\0';
-
- if ('%' == fmt[0] && '%' == fmt[1]) {
- HDputc('%', stream);
- fmt += 2;
- nout++;
- }
- else if ('%' == fmt[0]) {
- s = fmt + 1;
-
- /* Flags */
- while (HDstrchr("-+ #", *s)) {
- switch (*s) {
- case '-':
- leftjust = 1;
- break;
-
- case '+':
- plussign = 1;
- break;
-
- case ' ':
- ldspace = 1;
- break;
-
- case '#':
- prefix = 1;
- break;
-
- default:
- HDassert(0 && "Unknown format flag");
- } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */
- s++;
- } /* end while */
-
- /* Field width */
- if (HDisdigit(*s)) {
- zerofill = ('0' == *s);
- fwidth = (int)HDstrtol(s, &rest, 10);
- s = rest;
- } /* end if */
- else if ('*' == *s) {
- fwidth = HDva_arg(ap, int);
- if (fwidth < 0) {
- leftjust = 1;
- fwidth = -fwidth;
- }
- s++;
- }
-
- /* Precision */
- if ('.' == *s) {
- s++;
- if (HDisdigit(*s)) {
- prec = (int)HDstrtol(s, &rest, 10);
- s = rest;
- }
- else if ('*' == *s) {
- prec = HDva_arg(ap, int);
- s++;
- }
- if (prec < 1)
- prec = 1;
- }
-
- /* Extra type modifiers */
- if (HDstrchr("zZHhlqLI", *s)) {
- switch (*s) {
- /*lint --e{506} Don't issue warnings about constant value booleans */
- /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
- case 'H':
- if (sizeof(hsize_t) < sizeof(long))
- modifier[0] = '\0';
- else if (sizeof(hsize_t) == sizeof(long)) {
- HDstrncpy(modifier, "l", sizeof(modifier));
- modifier[sizeof(modifier) - 1] = '\0';
- } /* end if */
- else {
- HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier));
- modifier[sizeof(modifier) - 1] = '\0';
- } /* end else */
- break;
-
- case 'Z':
- case 'z':
- if (sizeof(size_t) < sizeof(long))
- modifier[0] = '\0';
- else if (sizeof(size_t) == sizeof(long)) {
- HDstrncpy(modifier, "l", sizeof(modifier));
- modifier[sizeof(modifier) - 1] = '\0';
- } /* end if */
- else {
- HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier));
- modifier[sizeof(modifier) - 1] = '\0';
- } /* end else */
- break;
-
- default:
- /* Handle 'I64' modifier for Microsoft's "__int64" type */
- if (*s == 'I' && *(s + 1) == '6' && *(s + 2) == '4') {
- modifier[0] = *s;
- modifier[1] = *(s + 1);
- modifier[2] = *(s + 2);
- modifier[3] = '\0';
- s += 2; /* Increment over 'I6', the '4' is taken care of below */
- } /* end if */
- else {
- /* Handle 'll' for long long types */
- if (*s == 'l' && *(s + 1) == 'l') {
- modifier[0] = *s;
- modifier[1] = *s;
- modifier[2] = '\0';
- s++; /* Increment over first 'l', second is taken care of below */
- } /* end if */
- else {
- modifier[0] = *s;
- modifier[1] = '\0';
- } /* end else */
- } /* end else */
- break;
- }
- s++;
- }
-
- /* Conversion */
- conv = *s++;
-
- /* Create the format template */
- len = 0;
- len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s",
- (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""),
- (prefix ? "#" : ""), (zerofill ? "0" : ""));
- if (fwidth > 0)
- len +=
- HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth);
- if (prec > 0)
- len +=
- HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec);
- if (*modifier)
- len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s",
- modifier);
- HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv);
-
- /* Conversion */
- switch (conv) {
- case 'd':
- case 'i':
- if (!HDstrcmp(modifier, "h")) {
- short x = (short)HDva_arg(ap, int);
- n = fprintf(stream, format_templ, x);
- }
- else if (!*modifier) {
- int x = HDva_arg(ap, int);
- n = fprintf(stream, format_templ, x);
- }
- else if (!HDstrcmp(modifier, "l")) {
- long x = HDva_arg(ap, long);
- n = fprintf(stream, format_templ, x);
- }
- else {
- int64_t x = HDva_arg(ap, int64_t);
- n = fprintf(stream, format_templ, x);
- }
- break;
-
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- if (!HDstrcmp(modifier, "h")) {
- unsigned short x = (unsigned short)HDva_arg(ap, unsigned int);
- n = fprintf(stream, format_templ, x);
- }
- else if (!*modifier) {
- unsigned int x = HDva_arg(ap, unsigned int);
- n = fprintf(stream, format_templ, x);
- }
- else if (!HDstrcmp(modifier, "l")) {
- unsigned long x = HDva_arg(ap, unsigned long);
- n = fprintf(stream, format_templ, x);
- }
- else {
- uint64_t x = HDva_arg(ap, uint64_t);
- n = fprintf(stream, format_templ, x);
- }
- break;
-
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- if (!HDstrcmp(modifier, "h")) {
- float x = (float)HDva_arg(ap, double);
- n = fprintf(stream, format_templ, (double)x);
- }
- else if (!*modifier || !HDstrcmp(modifier, "l")) {
- double x = HDva_arg(ap, double);
- n = fprintf(stream, format_templ, x);
- }
- else {
- /*
- * Some compilers complain when `long double' and
- * `double' are the same thing.
- */
-#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- long double x = HDva_arg(ap, long double);
- n = fprintf(stream, format_templ, x);
-#else
- double x = HDva_arg(ap, double);
- n = fprintf(stream, format_templ, x);
-#endif
- }
- break;
-
- case 'a': {
- haddr_t x = HDva_arg(ap, haddr_t);
-
- if (H5F_addr_defined(x)) {
- len = 0;
- len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)),
- "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""),
- (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : ""));
- if (fwidth > 0)
- len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)),
- "%d", fwidth);
-
- /*lint --e{506} Don't issue warnings about constant value booleans */
- /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true
- */
- if (sizeof(x) == H5_SIZEOF_INT) {
- HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1)));
- len++;
- } /* end if */
- else if (sizeof(x) == H5_SIZEOF_LONG) {
- HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1)));
- len++;
- } /* end if */
- else if (sizeof(x) == H5_SIZEOF_LONG_LONG) {
- HDstrncat(format_templ, H5_PRINTF_LL_WIDTH,
- (sizeof(format_templ) - (size_t)(len + 1)));
- len += (int)sizeof(H5_PRINTF_LL_WIDTH);
- HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1)));
- len++;
- }
- n = fprintf(stream, format_templ, x);
- }
- else {
- len = 0;
- HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1)));
- len++;
- if (leftjust) {
- HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1)));
- len++;
- } /* end if */
- 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");
- }
- } break;
-
- case 'c': {
- char x = (char)HDva_arg(ap, int);
- n = fprintf(stream, format_templ, x);
- } break;
-
- case 's':
- case 'p': {
- char *x = HDva_arg(ap, char *);
- n = fprintf(stream, format_templ, x);
- } break;
-
- case 'n':
- format_templ[HDstrlen(format_templ) - 1] = 'u';
- n = fprintf(stream, format_templ, nout);
- break;
-
- case 't': {
- htri_t tri_var = HDva_arg(ap, htri_t);
-
- if (tri_var > 0)
- fprintf(stream, "TRUE");
- else if (!tri_var)
- fprintf(stream, "FALSE");
- else
- fprintf(stream, "FAIL(%d)", (int)tri_var);
- } break;
-
- case 'k': {
- H5O_token_t token = HDva_arg(ap, H5O_token_t);
-
- /* Print the raw token. */
- n = fprintf(
- stream,
- "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
- (unsigned char)token.__data[15], (unsigned char)token.__data[14],
- (unsigned char)token.__data[13], (unsigned char)token.__data[12],
- (unsigned char)token.__data[11], (unsigned char)token.__data[10],
- (unsigned char)token.__data[9], (unsigned char)token.__data[8],
- (unsigned char)token.__data[7], (unsigned char)token.__data[6],
- (unsigned char)token.__data[5], (unsigned char)token.__data[4],
- (unsigned char)token.__data[3], (unsigned char)token.__data[2],
- (unsigned char)token.__data[1], (unsigned char)token.__data[0]);
- } break;
-
- default:
- HDfputs(format_templ, stream);
- n = (int)HDstrlen(format_templ);
- break;
- }
- nout += n;
- fmt = s;
- }
- else {
- HDputc(*fmt, stream);
- fmt++;
- nout++;
+ char * buf; /* buffer to receive formatted string */
+ size_t bufsz; /* size of buffer to allocate */
+
+ for (bufsz = 32; (buf = HDmalloc(bufsz)) != NULL;) {
+ int ret;
+ va_list ap;
+
+ HDva_copy(ap, _ap);
+ ret = HDvsnprintf(buf, bufsz, fmt, ap);
+ va_end(ap);
+ if (ret >= 0 && (size_t)ret < bufsz) {
+ *bufp = buf;
+ return ret;
}
+ HDfree(buf);
+ if (ret < 0)
+ return ret;
+ bufsz = (size_t)ret + 1;
}
- HDva_end(ap);
- return nout;
-} /* end HDfprintf() */
-H5_GCC_DIAG_ON(format - nonliteral)
+ return -1;
+}
+#endif /* H5_HAVE_VASPRINTF */
/*-------------------------------------------------------------------------
* Function: HDstrtoll
@@ -493,8 +136,6 @@ H5_GCC_DIAG_ON(format - nonliteral)
* Programmer: Robb Matzke
* Thursday, April 9, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#ifndef HDstrtoll
@@ -666,15 +307,15 @@ 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() */
/*-------------------------------------------------------------------------
@@ -706,8 +347,8 @@ H5_make_time(struct tm *tm)
* VS 2015 is removed, with _get_timezone replacing it.
*/
long timezone = 0;
-#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */
- time_t ret_value; /* Return value */
+#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */
+ time_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -850,48 +491,96 @@ 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
- long bufferCount = WloginBuffer_count;
- if (GetUserName(Wlogin_buffer, &bufferCount) == 0)
+ DWORD bufferCount = WloginBuffer_count;
+ if (GetUserName(Wlogin_buffer, &bufferCount) != 0)
return (Wlogin_buffer);
else
#endif /* H5_HAVE_WINSOCK2_H */
return NULL;
}
-int
-c99_snprintf(char *str, size_t size, const char *format, ...)
-{
- int count;
- va_list ap;
-
- HDva_start(ap, format);
- count = c99_vsnprintf(str, size, format, ap);
- HDva_end(ap);
-
- return count;
-}
-
-int
-c99_vsnprintf(char *str, size_t size, const char *format, va_list ap)
-{
- int count = -1;
-
- if (size != 0)
- count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
- if (count == -1)
- count = _vscprintf(format, ap);
-
- return count;
-}
-
/*-------------------------------------------------------------------------
* Function: Wflock
*
@@ -903,110 +592,45 @@ c99_vsnprintf(char *str, size_t size, const char *format, va_list ap)
*-------------------------------------------------------------------------
*/
int
-Wflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation)
+Wflock(int fd, int operation)
{
-/* This is a no-op while we implement a Win32 VFD */
-#if 0
-int
-Wflock(int fd, int operation) {
-
- HANDLE hFile;
- DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
- DWORD dwReserved = 0;
- /* MAXDWORD for entire file */
- DWORD nNumberOfBytesToLockLow = MAXDWORD;
- DWORD nNumberOfBytesToLockHigh = MAXDWORD;
- /* Must initialize OVERLAPPED struct */
- OVERLAPPED overlapped = {0};
+ HANDLE hFile;
+ DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
+ DWORD dwReserved = 0;
+ /* MAXDWORD locks the entire file */
+ DWORD nNumberOfBytesToLockLow = MAXDWORD;
+ DWORD nNumberOfBytesToLockHigh = MAXDWORD;
+ /* Must initialize OVERLAPPED struct */
+ OVERLAPPED overlapped = {0};
/* Get Windows HANDLE */
- hFile = _get_osfhandle(fd);
+ if (INVALID_HANDLE_VALUE == (hFile = (HANDLE)_get_osfhandle(fd)))
+ return -1;
/* Convert to Windows flags */
- if(operation & LOCK_EX)
+ if (operation & LOCK_EX)
dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;
/* Lock or unlock */
- if(operation & LOCK_UN)
- if(0 == UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow,
- nNumberOfBytesToLockHigh, &overlapped))
- return -1;
- else
- if(0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow,
- nNumberOfBytesToLockHigh, &overlapped))
+ if (operation & LOCK_UN) {
+ if (0 ==
+ UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &overlapped)) {
+ /* Attempting to unlock an already unlocked file will fail and this can happen
+ * in H5Fstart_swmr_write(). For now, just ignore the "error" (error code: 0x9e / 158).
+ */
+ if (GetLastError() != 158)
+ return -1;
+ }
+ }
+ else {
+ if (0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh,
+ &overlapped))
return -1;
-#endif /* 0 */
- return 0;
-} /* end Wflock() */
+ }
-/*--------------------------------------------------------------------------
- * Function: Wnanosleep
- *
- * Purpose: Sleep for a given # of nanoseconds (Windows version)
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Dana Robinson
- * Fall 2016
- *--------------------------------------------------------------------------
- */
-int
-Wnanosleep(const struct timespec *req, struct timespec *rem)
-{
- /* XXX: Currently just a placeholder */
return 0;
-
-} /* end Wnanosleep() */
-
-/*-------------------------------------------------------------------------
- * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf
- *
- * Purpose: Wrapper function for round functions for use with VS2012
- * and earlier.
- *
- * Return: The rounded value that was passed in.
- *
- * Programmer: Dana Robinson
- * December 2016
- *
- *-------------------------------------------------------------------------
- */
-long long
-Wllround(double arg)
-{
- return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
-}
-
-long long
-Wllroundf(float arg)
-{
- return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
-
-long
-Wlround(double arg)
-{
- return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
-}
-
-long
-Wlroundf(float arg)
-{
- return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
-
-double
-Wround(double arg)
-{
- return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5);
-}
-
-float
-Wroundf(float arg)
-{
- return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
+} /* end Wflock() */
/*-------------------------------------------------------------------------
* Function: H5_get_utf16_str
@@ -1022,7 +646,7 @@ Wroundf(float arg)
*
*-------------------------------------------------------------------------
*/
-const wchar_t *
+wchar_t *
H5_get_utf16_str(const char *s)
{
int nwchars = -1; /* Length of the UTF-16 buffer */
@@ -1118,7 +742,7 @@ int
Wremove_utf8(const char *path)
{
wchar_t *wpath = NULL; /* UTF-16 version of the path */
- int ret;
+ int ret = -1;
/* Convert the input UTF-8 path to UTF-16 */
if (NULL == (wpath = H5_get_utf16_str(path)))
@@ -1271,7 +895,7 @@ done:
herr_t
H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/)
{
- size_t path1_len; /* length of path1 */
+ size_t path1_len = 0; /* length of path1 */
size_t path2_len; /* length of path2 */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1337,6 +961,9 @@ done:
*
* Purpose: Sleep for a given # of nanoseconds
*
+ * Note that commodity hardware is probably going to have a
+ * resolution of milliseconds, not nanoseconds.
+ *
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
@@ -1346,48 +973,29 @@ done:
void
H5_nanosleep(uint64_t nanosec)
{
- struct timespec sleeptime; /* Struct to hold time to sleep */
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
- /* Set up time to sleep */
- sleeptime.tv_sec = 0;
- sleeptime.tv_nsec = (long)nanosec;
-
- HDnanosleep(&sleeptime, NULL);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5_nanosleep() */
+#ifdef H5_HAVE_WIN32_API
-/*--------------------------------------------------------------------------
- * 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;
+ /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep()
+ * causes the thread to relinquish the rest of its time slice.
+ */
+ Sleep(nanosec / (1000 * 1000));
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+#else
+ {
+ struct timespec sleeptime; /* Struct to hold time to sleep */
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&curr_time, NULL);
+ /* Set up time to sleep */
+ sleeptime.tv_sec = 0;
+ sleeptime.tv_nsec = (long)nanosec;
- ret_value = (double)curr_time.tv_sec + ((double)curr_time.tv_usec / (double)1000000.0f);
-#endif /* H5_HAVE_GETTIMEOFDAY */
+ HDnanosleep(&sleeptime, NULL);
+ }
+#endif
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5_get_time() */
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5_nanosleep() */
#ifdef H5_HAVE_WIN32_API
diff --git a/src/H5timer.c b/src/H5timer.c
index 6616e1d..b2cc5f0 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -6,18 +6,17 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
- *
* Created: H5timer.c
* Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
- * Purpose: Internal 'timer' routines & support routines.
+ * Purpose: Internal, platform-independent 'timer' support routines.
*
*-------------------------------------------------------------------------
*/
@@ -25,25 +24,28 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
/***********/
#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 <sys/resource.h>
-#endif
-
-#if defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#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 (24.0 * 60.0 * 60.0)
+#define H5_SEC_PER_HOUR (60.0 * 60.0)
+#define H5_SEC_PER_MIN (60.0)
+
/******************/
/* Local Typedefs */
/******************/
@@ -69,100 +71,6 @@
/*******************/
/*-------------------------------------------------------------------------
- * 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() */
-
-/*-------------------------------------------------------------------------
* Function: H5_bandwidth
*
* Purpose: Prints the bandwidth (bytes per second) in a field 10
@@ -192,13 +100,13 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds)
{
double bw;
- if (nseconds <= (double)0.0F)
+ if (nseconds <= 0.0)
HDstrcpy(buf, " NaN");
else {
bw = nbytes / nseconds;
- if (H5_DBL_ABS_EQUAL(bw, (double)0.0F))
+ if (H5_DBL_ABS_EQUAL(bw, 0.0))
HDstrcpy(buf, "0.000 B/s");
- else if (bw < (double)1.0F)
+ else if (bw < 1.0)
HDsprintf(buf, "%10.4e", bw);
else if (bw < (double)H5_KB) {
HDsprintf(buf, "%05.4f", bw);
@@ -220,12 +128,16 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds)
HDsprintf(buf, "%05.4f", bw / (double)H5_TB);
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() */
/*-------------------------------------------------------------------------
@@ -253,8 +165,483 @@ H5_now(void)
now = now_tv.tv_sec;
}
#else /* H5_HAVE_GETTIMEOFDAY */
- now = HDtime(NULL);
+ now = HDtime(NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
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 = 0.0;
+
+ 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 / 1000000000.0);
+ }
+#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 / 1000000.0);
+ }
+#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 / 1.0E6);
+ times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / 1.0E6);
+ }
+#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 = 0.0;
+ double hours = 0.0;
+ double minutes = 0.0;
+ double remainder_sec = 0.0;
+
+ /* Extract larger time units from count of seconds */
+ if (seconds > 60.0) {
+ /* 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 < 0.0)
+ HDsprintf(s, "N/A");
+ else if (H5_DBL_ABS_EQUAL(0.0, seconds))
+ HDsprintf(s, "0.0 s");
+ else if (seconds < 1.0E-6)
+ /* t < 1 us, Print time in ns */
+ HDsprintf(s, "%.f ns", seconds * 1.0E9);
+ else if (seconds < 1.0E-3)
+ /* t < 1 ms, Print time in us */
+ HDsprintf(s, "%.1f us", seconds * 1.0E6);
+ else if (seconds < 1.0)
+ /* t < 1 s, Print time in ms */
+ HDsprintf(s, "%.1f ms", seconds * 1.0E3);
+ 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 0080b3e..71675aa 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,7 @@
*
* Created: H5trace.c
* Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Internal code for tracing API calls
*
@@ -25,7 +25,8 @@
/****************/
/* Module Setup */
/****************/
-#define H5I_FRIEND /*suppress error about including H5Ipkg */
+#include "H5module.h" /* This source code file is part of the H5 module */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
/***********/
/* Headers */
@@ -116,10 +117,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
int argno = 0, ptr, asize_idx;
hssize_t asize[16];
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};
+ void * vp = NULL;
+ FILE * out = H5_debug_g.trace;
+ static hbool_t is_first_invocation = TRUE;
+ H5_timer_t function_timer = {{0}, {0}, {0}, FALSE};
+ 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;
@@ -145,13 +149,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, H5_DOUBLE(0.0)))
- 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
@@ -167,7 +176,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++)
@@ -182,8 +193,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else {
if (current_depth > last_call_depth)
HDfputs(" = <delayed>\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);
@@ -241,21 +255,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
else {
haddr_t addr = HDva_arg(ap, haddr_t);
- HDfprintf(out, "%a", addr);
+ HDfprintf(out, "%" PRIuHADDR, addr);
} /* end else */
break;
case 'b':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -274,7 +288,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -290,7 +304,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -328,7 +342,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -354,7 +368,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -388,7 +402,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'F':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -422,7 +436,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -452,7 +466,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -491,7 +505,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'k':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -537,7 +551,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -579,7 +593,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -633,7 +647,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -664,7 +678,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -698,7 +712,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -724,7 +738,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'v':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -760,7 +774,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -779,7 +793,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -805,21 +819,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
else {
H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *);
- HDfprintf(out, "0x%lx", (unsigned long)error);
+ HDfprintf(out, "0x%p", (void *)error);
} /* end else */
break;
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -850,7 +864,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -884,7 +898,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -918,7 +932,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -953,7 +967,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'm':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1004,7 +1018,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1030,7 +1044,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1039,7 +1053,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'v':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1085,7 +1099,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1133,14 +1147,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
else {
H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t *);
- HDfprintf(out, "0x%lx", (unsigned long)statbuf);
+ HDfprintf(out, "0x%p", (void *)statbuf);
}
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1154,7 +1168,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
hsize_t *p = (hsize_t *)vp;
@@ -1163,7 +1177,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if (H5S_UNLIMITED == p[i])
HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : ""));
else
- HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "%s%" PRIuHSIZE, (i ? ", " : ""), p[i]);
} /* end for */
HDfprintf(out, "}");
} /* end if */
@@ -1177,7 +1191,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if (H5S_UNLIMITED == hsize)
HDfprintf(out, "H5S_UNLIMITED");
else {
- HDfprintf(out, "%Hu", hsize);
+ HDfprintf(out, "%" PRIuHSIZE, hsize);
asize[argno] = (hssize_t)hsize;
} /* end else */
} /* end else */
@@ -1188,13 +1202,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
hssize_t *p = (hssize_t *)vp;
HDfprintf(out, " {");
for (i = 0; i < asize[asize_idx]; i++)
- HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "%s%" PRIdHSIZE, (i ? ", " : ""), p[i]);
HDfprintf(out, "}");
} /* end if */
} /* end if */
@@ -1204,7 +1218,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else {
hssize_t hssize = HDva_arg(ap, hssize_t);
- HDfprintf(out, "%Hd", hssize);
+ HDfprintf(out, "%" PRIdHSIZE, hssize);
asize[argno] = (hssize_t)hssize;
} /* end else */
break;
@@ -1218,7 +1232,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1414,7 +1428,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1448,7 +1462,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1486,7 +1500,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
int *p = (int *)vp;
@@ -1510,7 +1524,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1600,7 +1614,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'u':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned *p = (unsigned *)vp;
@@ -1630,7 +1644,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'k':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1648,7 +1662,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1694,7 +1708,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1710,7 +1724,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1726,7 +1740,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1785,7 +1799,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1801,7 +1815,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1849,7 +1863,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1876,21 +1890,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
else {
hobj_ref_t ref = HDva_arg(ap, hobj_ref_t);
- HDfprintf(out, "Reference Object=%a", ref);
+ HDfprintf(out, "Reference Object=%" PRIuHADDR, ref);
} /* end else */
break;
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1904,7 +1918,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'r':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1918,7 +1932,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -1972,7 +1986,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2006,7 +2020,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2064,7 +2078,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2112,7 +2126,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2128,7 +2142,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2175,7 +2189,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2205,7 +2219,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2235,7 +2249,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2269,7 +2283,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2311,7 +2325,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2349,7 +2363,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2383,7 +2397,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2453,7 +2467,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'z':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2509,7 +2523,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2530,7 +2544,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long *p = (unsigned long *)vp;
@@ -2554,7 +2568,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'L':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long long *p = (unsigned long long *)vp;
@@ -2586,7 +2600,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2622,7 +2636,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'A':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2640,7 +2654,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'b':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2670,7 +2684,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'B':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2700,7 +2714,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'C':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2718,7 +2732,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2754,7 +2768,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2781,7 +2795,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2805,7 +2819,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2829,7 +2843,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'g':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2871,7 +2885,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2910,7 +2924,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2934,7 +2948,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'j':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2958,7 +2972,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'k':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -2985,7 +2999,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3012,7 +3026,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'L':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3036,7 +3050,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'm':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3063,7 +3077,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3093,7 +3107,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3129,7 +3143,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'r':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3156,7 +3170,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3179,7 +3193,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'S':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3236,7 +3250,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3284,7 +3298,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'u':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3302,7 +3316,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'v':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3407,7 +3421,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'w':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3433,7 +3447,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'x':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3451,7 +3465,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'y':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3487,7 +3501,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'z':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3511,14 +3525,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'x':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
void **p = (void **)vp;
HDfprintf(out, " {");
for (i = 0; i < asize[asize_idx]; i++) {
if (p[i])
- HDfprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i]));
+ HDfprintf(out, "%s0x%p", (i ? ", " : ""), p[i]);
else
HDfprintf(out, "%sNULL", (i ? ", " : ""));
} /* end for */
@@ -3532,7 +3546,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
vp = HDva_arg(ap, void *);
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end else */
@@ -3541,13 +3555,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'z':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
size_t *p = (size_t *)vp;
HDfprintf(out, " {");
for (i = 0; i < asize[asize_idx]; i++)
- HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "%s%zu", (i ? ", " : ""), p[i]);
HDfprintf(out, "}");
} /* end if */
} /* end if */
@@ -3557,7 +3571,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else {
size_t size = HDva_arg(ap, size_t);
- HDfprintf(out, "%Zu", size);
+ HDfprintf(out, "%zu", size);
asize[argno] = (hssize_t)size;
} /* end else */
break;
@@ -3567,7 +3581,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3597,21 +3611,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t *);
- HDfprintf(out, "0x%lx", (unsigned long)filter);
+ HDfprintf(out, "0x%p", (void *)filter);
} /* end else */
break;
case 'e':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3630,7 +3644,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if (ptr) {
if (vp)
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
else
HDfprintf(out, "NULL");
} /* end if */
@@ -3647,13 +3661,13 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if (ptr) {
if (vp) {
- HDfprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%p", vp);
if (asize_idx >= 0 && asize[asize_idx] >= 0) {
ssize_t *p = (ssize_t *)vp;
HDfprintf(out, " {");
for (i = 0; i < asize[asize_idx]; i++)
- HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "%s%zd", (i ? ", " : ""), p[i]);
HDfprintf(out, "}");
} /* end if */
} /* end if */
@@ -3663,7 +3677,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else {
ssize_t ssize = HDva_arg(ap, ssize_t);
- HDfprintf(out, "%Zd", ssize);
+ HDfprintf(out, "%zd", ssize);
asize[argno] = (hssize_t)ssize;
} /* end else */
break;
@@ -3684,9 +3698,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);
@@ -3698,5 +3715,8 @@ error:
} /* end else */
HDfflush(out);
- return event_time.etime;
+ if (H5_debug_g.ttimes)
+ return function_times.elapsed;
+ else
+ return 0.0;
} /* end H5_trace() */
diff --git a/src/H5vers.txt b/src/H5vers.txt
index ae1d600..ef7250f 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -5,7 +5,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/src/H5version.h b/src/H5version.h
index e756131..89ee7f6 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,8 +15,8 @@
/* Add new versioned symbols to H5vers.txt file */
-#ifndef _H5version_H
-#define _H5version_H
+#ifndef H5version_H
+#define H5version_H
/* If a particular default "global" version of the library's interfaces is
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 2910497..88911b0 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -6,25 +6,23 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Scott Wegner
- * June 3, 2008
- *
- * Purpose: This file is used to map HDF macros to Windows functions. This
+/* Purpose: This file is used to map HDF macros to Windows functions. This
* should get included H5private mappings, so as to override them.
* Any macro not mapped here, however, will receive a similar mapping
* inside H5private.h
*
*/
-/*
- * _MSC_VER = 1900 VS2015
- * _MSC_VER = 1800 VS2013
- * _MSC_VER = 1700 VS2012
+/* _MSC_VER = 192x VS2019
+ * _MSC_VER = 191x VS2017
+ * _MSC_VER = 1900 VS2015
+ * _MSC_VER = 1800 VS2013
+ * _MSC_VER = 1700 VS2012
*/
#ifdef H5_HAVE_WIN32_API
@@ -41,11 +39,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()
@@ -78,22 +71,8 @@ typedef __int64 h5_stat_size_t;
#ifdef H5_HAVE_VISUAL_STUDIO
-#if (_MSC_VER < 1800)
-#ifndef H5_HAVE_STRTOLL
-#define HDstrtoll(S, R, N) _strtoi64(S, R, N)
-#endif /* H5_HAVE_STRTOLL */
-#ifndef H5_HAVE_STRTOULL
-#define HDstrtoull(S, R, N) _strtoui64(S, R, N)
-#endif /* H5_HAVE_STRTOULL */
-/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are
- * just pointers into the stack in those CRTs, the usual work-around
- * is to just define the operation as a pointer copy.
- */
-#define HDva_copy(D, S) ((D) = (S))
-#endif /* MSC_VER < 1800 */
-
/*
- * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
+ * The (void*) cast just avoids a compiler warning in MSVC
*/
#define HDmemset(X, C, Z) memset((void *)(X), C, Z)
@@ -102,24 +81,6 @@ struct timezone {
int tz_dsttime;
};
-/* time.h before VS2015 does not include timespec */
-#if (_MSC_VER < 1900)
-struct timespec {
- time_t tv_sec; /* Seconds - >= 0 */
- long tv_nsec; /* Nanoseconds - [0, 999999999] */
-};
-#endif /* MSC_VER < 1900 */
-
-/* The round functions do not exist in VS2012 and earlier */
-#if (_MSC_VER <= 1700)
-#define HDllround(V) Wllround(V)
-#define HDllroundf(V) Wllroundf(V)
-#define HDlround(V) Wlround(V)
-#define HDlroundf(V) Wlroundf(V)
-#define HDround(V) Wround(V)
-#define HDroundf(V) Wroundf(V)
-#endif /* MSC_VER < 1700 */
-
#endif /* H5_HAVE_VISUAL_STUDIO */
#ifdef __cplusplus
@@ -129,25 +90,11 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
H5_DLL int Wsetenv(const char *name, const char *value, int overwrite);
H5_DLL int Wflock(int fd, int operation);
H5_DLL char * Wgetlogin(void);
-H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...);
-H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap);
-H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem);
H5_DLL herr_t H5_expand_windows_env_vars(char **env_var);
-H5_DLL const wchar_t *H5_get_utf16_str(const char *s);
-H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
-H5_DLL int Wremove_utf8(const char *path);
-
-/* Round functions only needed for VS2012 and earlier.
- * They are always built to ensure they don't go stale and
- * can be deleted (along with their #defines, above) when we
- * drop VS2012 support.
- */
-H5_DLL long long Wllround(double arg);
-H5_DLL long long Wllroundf(float arg);
-H5_DLL long Wlround(double arg);
-H5_DLL long Wlroundf(float arg);
-H5_DLL double Wround(double arg);
-H5_DLL float Wroundf(float arg);
+H5_DLL wchar_t *H5_get_utf16_str(const char *s);
+H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
+H5_DLL int Wremove_utf8(const char *path);
+H5_DLL int H5_get_win32_times(H5_timevals_t *tvs);
#ifdef __cplusplus
}
#endif /* __cplusplus */
@@ -156,15 +103,9 @@ H5_DLL float Wroundf(float arg);
#define HDsetenv(N, V, O) Wsetenv(N, V, O)
#define HDflock(F, L) Wflock(F, L)
#define HDgetlogin() Wgetlogin()
-#define HDsnprintf c99_snprintf /*varargs*/
-#define HDvsnprintf c99_vsnprintf /*varargs*/
/* Non-POSIX functions */
-/* Don't use actual pthread_self on Windows because the return
- * type cannot be cast as a ulong like other systems. */
-#define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
-
#ifndef H5_HAVE_MINGW
#define HDftruncate(F, L) _chsize_s(F, L)
#define HDfseek(F, O, W) _fseeki64(F, O, W)
diff --git a/src/Makefile.am b/src/Makefile.am
index 0c07c1b..ab9e13a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,7 +6,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
@@ -19,7 +19,6 @@
include $(top_srcdir)/config/commence.am
include $(top_srcdir)/config/lt_vers.am
-
# How to build H5detect for number format detection.
# Use -g to force no optimization since many compilers (e.g., Intel) takes
# a long time to compile it with any optimization on. H5detect is used
@@ -33,13 +32,13 @@ lib_LTLIBRARIES=libhdf5.la
libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# H5Tinit.c and H5lib_settings.c are generated files and should be cleaned.
-MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c
+MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c $(DX_CLEANFILES)
# H5pubconf.h is generated by configure, and should be cleaned.
DISTCLEANFILES=H5pubconf.h
# library sources
libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
- H5timer.c H5trace.c \
+ H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
H5AC.c H5ACdbg.c H5ACproxy_entry.c \
H5B.c H5Bcache.c H5Bdbg.c \
@@ -62,7 +61,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAint.c H5FAstat.c H5FAtest.c \
H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \
- H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \
+ H5FDmulti.c H5FDsec2.c H5FDspace.c \
+ H5FDsplitter.c H5FDstdio.c H5FDtest.c \
H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \
H5FSstat.c H5FStest.c \
H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \
@@ -74,7 +74,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \
H5HP.c \
- H5I.c H5Itest.c \
+ H5I.c H5Idbg.c H5Iint.c H5Itest.c \
H5L.c H5Ldeprec.c H5Lexternal.c \
H5M.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
@@ -98,7 +98,6 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5Sselect.c H5Stest.c \
H5SL.c \
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
- H5ST.c \
H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \
H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
@@ -125,6 +124,11 @@ if DIRECT_VFD_CONDITIONAL
libhdf5_la_SOURCES += H5FDdirect.c
endif
+# Only compile the mirror VFD if necessary
+if MIRROR_VFD_CONDITIONAL
+ libhdf5_la_SOURCES += H5FDmirror.c
+endif
+
# Only compile the read-only S3 VFD if necessary
if ROS3_VFD_CONDITIONAL
libhdf5_la_SOURCES += H5FDros3.c H5FDs3comms.c
@@ -135,9 +139,9 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Apublic.h H5ACpublic.h \
H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \
- H5FDpublic.h H5FDcore.h H5FDdirect.h \
- H5FDfamily.h H5FDhdfs.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
- H5FDmulti.h H5FDros3.h H5FDsec2.h H5FDstdio.h H5FDwindows.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 H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
@@ -195,7 +199,6 @@ $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt
# version of the source file is saved with a tilde (~) after its name and
# tracing information is inserted. trace should have no effect on files
# without HDF5 macros.
-.PHONY: trace
trace: $(libhdf5_la_SOURCES)
@for dep in $? dummy; do \
diff --git a/src/Makefile.in b/src/Makefile.in
index a3a8d73..6980019 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -22,7 +22,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,8 +114,11 @@ noinst_PROGRAMS = H5detect$(EXEEXT) H5make_libsettings$(EXEEXT)
# Only compile the direct VFD if necessary
@DIRECT_VFD_CONDITIONAL_TRUE@am__append_2 = H5FDdirect.c
+# Only compile the mirror VFD if necessary
+@MIRROR_VFD_CONDITIONAL_TRUE@am__append_3 = H5FDmirror.c
+
# Only compile the read-only S3 VFD if necessary
-@ROS3_VFD_CONDITIONAL_TRUE@am__append_3 = H5FDros3.c H5FDs3comms.c
+@ROS3_VFD_CONDITIONAL_TRUE@am__append_4 = H5FDros3.c H5FDs3comms.c
TESTS =
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -127,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -196,9 +200,9 @@ am__libhdf5_la_SOURCES_DIST = H5.c H5checksum.c H5dbg.c \
H5Fsuper_cache.c H5Ftest.c H5FA.c H5FAcache.c H5FAdbg.c \
H5FAdblock.c H5FAdblkpage.c H5FAhdr.c H5FAint.c H5FAstat.c \
H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c \
- H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \
- H5FDtest.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c \
- H5FSint.c H5FSsection.c H5FSstat.c H5FStest.c H5G.c \
+ H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDsplitter.c \
+ H5FDstdio.c H5FDtest.c H5FL.c H5FO.c H5FS.c H5FScache.c \
+ H5FSdbg.c H5FSint.c H5FSsection.c H5FSstat.c H5FStest.c H5G.c \
H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \
H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
@@ -207,43 +211,44 @@ am__libhdf5_la_SOURCES_DIST = H5.c H5checksum.c H5dbg.c \
H5HFman.c H5HFsection.c H5HFspace.c H5HFstat.c H5HFtest.c \
H5HFtiny.c H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HL.c \
H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c H5HP.c \
- H5I.c H5Itest.c H5L.c H5Ldeprec.c H5Lexternal.c H5M.c H5MF.c \
- H5MFaggr.c H5MFdbg.c H5MFsection.c H5MM.c H5MP.c H5MPtest.c \
- H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
- H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
- H5Ocache_image.c H5Ochunk.c H5Ocont.c H5Ocopy.c H5Ocopy_ref.c \
- H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oflush.c \
- H5Ofsinfo.c H5Oginfo.c H5Oint.c H5Olayout.c H5Olinfo.c \
- H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c H5Onull.c \
- H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c H5Oshmesg.c \
- H5Ostab.c H5Otest.c H5Ounknown.c H5P.c H5Pacpl.c H5Pdapl.c \
- H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c H5Pfapl.c \
- H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \
- H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \
- H5Ptest.c H5PB.c H5PL.c H5PLint.c H5PLpath.c \
+ H5I.c H5Idbg.c H5Iint.c H5Itest.c H5L.c H5Ldeprec.c \
+ H5Lexternal.c H5M.c H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
+ H5MM.c H5MP.c H5MPtest.c H5O.c H5Odeprec.c H5Oainfo.c \
+ H5Oalloc.c H5Oattr.c H5Oattribute.c H5Obogus.c H5Obtreek.c \
+ H5Ocache.c H5Ocache_image.c H5Ochunk.c H5Ocont.c H5Ocopy.c \
+ H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
+ H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c H5Oint.c \
+ H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
+ H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c H5Osdspace.c \
+ H5Oshared.c H5Oshmesg.c H5Ostab.c H5Otest.c H5Ounknown.c H5P.c \
+ H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c \
+ H5Pencdec.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c \
+ H5Plapl.c H5Plcpl.c H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c \
+ H5Pstrcpl.c H5Ptest.c H5PB.c H5PL.c H5PLint.c H5PLpath.c \
H5PLplugin_cache.c H5R.c H5Rdeprec.c H5Rint.c H5UC.c H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c \
H5Spoint.c H5Sselect.c H5Stest.c H5SL.c H5SM.c H5SMbtree2.c \
- H5SMcache.c H5SMmessage.c H5SMtest.c H5ST.c H5T.c H5Tarray.c \
- H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c \
- H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
- H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \
- H5Topaque.c H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c \
- H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VL.c H5VLcallback.c \
- H5VLint.c H5VLnative.c H5VLnative_attr.c H5VLnative_blob.c \
+ H5SMcache.c H5SMmessage.c H5SMtest.c H5T.c H5Tarray.c H5Tbit.c \
+ H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c H5Tdbg.c \
+ H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c H5Tfloat.c \
+ H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
+ H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c \
+ H5Tvisit.c H5Tvlen.c H5TS.c H5VL.c H5VLcallback.c H5VLint.c \
+ H5VLnative.c H5VLnative_attr.c H5VLnative_blob.c \
H5VLnative_dataset.c H5VLnative_datatype.c H5VLnative_file.c \
H5VLnative_group.c H5VLnative_link.c H5VLnative_introspect.c \
H5VLnative_object.c H5VLnative_token.c H5VLpassthru.c H5VM.c \
H5WB.c H5Z.c H5Zdeflate.c H5Zfletcher32.c H5Znbit.c \
H5Zshuffle.c H5Zscaleoffset.c H5Zszip.c H5Ztrans.c H5mpi.c \
H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c \
- H5Smpio.c H5FDdirect.c H5FDros3.c H5FDs3comms.c
+ H5Smpio.c H5FDdirect.c H5FDmirror.c H5FDros3.c H5FDs3comms.c
@BUILD_PARALLEL_CONDITIONAL_TRUE@am__objects_1 = H5mpi.lo H5ACmpio.lo \
@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5Cmpio.lo H5Dmpio.lo \
@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5Fmpi.lo H5FDmpi.lo \
@BUILD_PARALLEL_CONDITIONAL_TRUE@ H5FDmpio.lo H5Smpio.lo
@DIRECT_VFD_CONDITIONAL_TRUE@am__objects_2 = H5FDdirect.lo
-@ROS3_VFD_CONDITIONAL_TRUE@am__objects_3 = H5FDros3.lo H5FDs3comms.lo
+@MIRROR_VFD_CONDITIONAL_TRUE@am__objects_3 = H5FDmirror.lo
+@ROS3_VFD_CONDITIONAL_TRUE@am__objects_4 = H5FDros3.lo H5FDs3comms.lo
am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5lib_settings.lo \
H5system.lo H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo \
H5Adense.lo H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo \
@@ -266,50 +271,52 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5lib_settings.lo \
H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo H5FAdblock.lo \
H5FAdblkpage.lo H5FAhdr.lo H5FAint.lo H5FAstat.lo H5FAtest.lo \
H5FD.lo H5FDcore.lo H5FDfamily.lo H5FDhdfs.lo H5FDint.lo \
- H5FDlog.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo H5FDstdio.lo \
- H5FDtest.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \
- H5FSint.lo H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo \
- H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \
- H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \
- H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \
- H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \
- H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \
- H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \
- H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \
- H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \
- H5HLdbg.lo H5HLint.lo H5HLprfx.lo H5HLdblk.lo H5HP.lo H5I.lo \
- H5Itest.lo H5L.lo H5Ldeprec.lo H5Lexternal.lo H5M.lo H5MF.lo \
- H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \
- H5MPtest.lo H5O.lo H5Odeprec.lo H5Oainfo.lo H5Oalloc.lo \
- H5Oattr.lo H5Oattribute.lo H5Obogus.lo H5Obtreek.lo \
- H5Ocache.lo H5Ocache_image.lo H5Ochunk.lo H5Ocont.lo \
- H5Ocopy.lo H5Ocopy_ref.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo \
- H5Oefl.lo H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo \
- H5Oint.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \
- H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo \
- H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Otest.lo \
- H5Ounknown.lo H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo \
- H5Pdeprec.lo H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo \
- H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo \
- H5Pmapl.lo H5Pmcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo \
- H5Ptest.lo H5PB.lo H5PL.lo H5PLint.lo H5PLpath.lo \
- H5PLplugin_cache.lo H5R.lo H5Rdeprec.lo H5Rint.lo H5UC.lo \
- H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo H5Sdeprec.lo H5Shyper.lo \
- H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \
- H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo \
- H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \
- H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo \
- H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo \
- H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo H5Tref.lo \
- H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo \
- H5TS.lo H5VL.lo H5VLcallback.lo H5VLint.lo H5VLnative.lo \
- H5VLnative_attr.lo H5VLnative_blob.lo H5VLnative_dataset.lo \
+ H5FDlog.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \
+ H5FDsplitter.lo H5FDstdio.lo H5FDtest.lo H5FL.lo H5FO.lo \
+ H5FS.lo H5FScache.lo H5FSdbg.lo H5FSint.lo H5FSsection.lo \
+ H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo H5Gcache.lo \
+ H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo \
+ H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \
+ H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
+ H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
+ H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
+ H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
+ H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \
+ H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HLprfx.lo \
+ H5HLdblk.lo H5HP.lo H5I.lo H5Idbg.lo H5Iint.lo H5Itest.lo \
+ H5L.lo H5Ldeprec.lo H5Lexternal.lo H5M.lo H5MF.lo H5MFaggr.lo \
+ H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \
+ H5Odeprec.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \
+ H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \
+ H5Ocache_image.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \
+ H5Ocopy_ref.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo \
+ H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo H5Oint.lo \
+ H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \
+ H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \
+ H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Otest.lo H5Ounknown.lo \
+ H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \
+ H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \
+ H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pmapl.lo \
+ H5Pmcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo \
+ H5PB.lo H5PL.lo H5PLint.lo H5PLpath.lo H5PLplugin_cache.lo \
+ H5R.lo H5Rdeprec.lo H5Rint.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo \
+ H5Sdbg.lo H5Sdeprec.lo H5Shyper.lo H5Snone.lo H5Spoint.lo \
+ H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo \
+ H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5T.lo H5Tarray.lo \
+ H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \
+ H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \
+ H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \
+ H5Topaque.lo H5Torder.lo H5Tref.lo H5Tpad.lo H5Tprecis.lo \
+ H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VL.lo \
+ H5VLcallback.lo H5VLint.lo H5VLnative.lo H5VLnative_attr.lo \
+ H5VLnative_blob.lo H5VLnative_dataset.lo \
H5VLnative_datatype.lo H5VLnative_file.lo H5VLnative_group.lo \
H5VLnative_link.lo H5VLnative_introspect.lo \
H5VLnative_object.lo H5VLnative_token.lo H5VLpassthru.lo \
H5VM.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \
H5Znbit.lo H5Zshuffle.lo H5Zscaleoffset.lo H5Zszip.lo \
- H5Ztrans.lo $(am__objects_1) $(am__objects_2) $(am__objects_3)
+ H5Ztrans.lo $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4)
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -566,7 +573,7 @@ am__DIST_COMMON = $(srcdir)/H5config.h.in $(srcdir)/Makefile.in \
$(srcdir)/libhdf5.settings.in $(top_srcdir)/bin/depcomp \
$(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
- $(top_srcdir)/config/lt_vers.am COPYING
+ $(top_srcdir)/config/lt_vers.am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
@@ -574,7 +581,7 @@ AMTAR = @AMTAR@
# H5_CFLAGS holds flags that should be used when building hdf5,
# but which should not be exported to h5cc for building other programs.
-# AM_CFLAGS is an automake construct which should be used by Makefiles
+# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
@@ -599,6 +606,7 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
CFLAGS = @CFLAGS@
+CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
@@ -615,11 +623,54 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
-DEV_WARNINGS = @DEV_WARNINGS@
+DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -653,6 +704,7 @@ H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
+H5_IS_DARWIN = @H5_IS_DARWIN@
H5_JAVACFLAGS = @H5_JAVACFLAGS@
H5_JAVAFLAGS = @H5_JAVAFLAGS@
H5_JNIFLAGS = @H5_JNIFLAGS@
@@ -663,6 +715,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
@@ -675,6 +728,7 @@ HL = @HL@
HL_FOR = @HL_FOR@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
+IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -712,6 +766,7 @@ MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAP_API = @MAP_API@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
+MIRROR_VFD = @MIRROR_VFD@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -748,6 +803,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
+RECURSIVE_RW_LOCKS = @RECURSIVE_RW_LOCKS@
ROOT = @ROOT@
ROS3_VFD = @ROS3_VFD@
RUNPARALLEL = @RUNPARALLEL@
@@ -771,6 +827,7 @@ TIME = @TIME@
TR = @TR@
TRACE_API = @TRACE_API@
UNAME_INFO = @UNAME_INFO@
+USE_FILE_LOCKING = @USE_FILE_LOCKING@
USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
USE_FILTER_SZIP = @USE_FILTER_SZIP@
USINGMEMCHECKER = @USINGMEMCHECKER@
@@ -863,15 +920,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
-# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
-# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
-# prepended to the normal and complete install path that it precedes for the
-# purpose of installing in a temporary directory which is useful for building
-# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
-# '/' at the beginning of the normal install path. When DESTDIR is empty the
-# path then begins with '//', which is incorrect and causes problems at least for
-# Cygwin.
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by Gnu at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
@@ -896,30 +953,30 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
# See libtool versioning documentation online.
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
-LT_VERS_INTERFACE = 200
-LT_VERS_AGE = 0
+LT_VERS_INTERFACE = 201
+LT_VERS_AGE = 1
LT_VERS_REVISION = 0
-LT_CXX_VERS_INTERFACE = 200
+LT_CXX_VERS_INTERFACE = 201
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 200
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 201
LT_F_VERS_REVISION = 0
-LT_F_VERS_AGE = 0
+LT_F_VERS_AGE = 1
LT_HL_VERS_INTERFACE = 200
-LT_HL_VERS_REVISION = 0
+LT_HL_VERS_REVISION = 1
LT_HL_VERS_AGE = 0
LT_HL_CXX_VERS_INTERFACE = 200
-LT_HL_CXX_VERS_REVISION = 0
+LT_HL_CXX_VERS_REVISION = 1
LT_HL_CXX_VERS_AGE = 0
LT_HL_F_VERS_INTERFACE = 200
-LT_HL_F_VERS_REVISION = 0
+LT_HL_F_VERS_REVISION = 1
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 200
+LT_JAVA_VERS_INTERFACE = 201
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 0
-LT_TOOLS_VERS_INTERFACE = 200
+LT_JAVA_VERS_AGE = 1
+LT_TOOLS_VERS_INTERFACE = 201
LT_TOOLS_VERS_REVISION = 0
-LT_TOOLS_VERS_AGE = 0
+LT_TOOLS_VERS_AGE = 1
# Our main target, the HDF5 library
lib_LTLIBRARIES = libhdf5.la
@@ -928,7 +985,7 @@ lib_LTLIBRARIES = libhdf5.la
libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# H5Tinit.c and H5lib_settings.c are generated files and should be cleaned.
-MOSTLYCLEANFILES = H5Tinit.c H5lib_settings.c
+MOSTLYCLEANFILES = H5Tinit.c H5lib_settings.c $(DX_CLEANFILES)
# H5pubconf.h is generated by configure, and should be cleaned.
DISTCLEANFILES = H5pubconf.h
@@ -953,9 +1010,9 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5lib_settings.c \
H5Fsuper_cache.c H5Ftest.c H5FA.c H5FAcache.c H5FAdbg.c \
H5FAdblock.c H5FAdblkpage.c H5FAhdr.c H5FAint.c H5FAstat.c \
H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c \
- H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \
- H5FDtest.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c \
- H5FSint.c H5FSsection.c H5FSstat.c H5FStest.c H5G.c \
+ H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDsplitter.c \
+ H5FDstdio.c H5FDtest.c H5FL.c H5FO.c H5FS.c H5FScache.c \
+ H5FSdbg.c H5FSint.c H5FSsection.c H5FSstat.c H5FStest.c H5G.c \
H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \
H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
@@ -964,45 +1021,46 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5lib_settings.c \
H5HFman.c H5HFsection.c H5HFspace.c H5HFstat.c H5HFtest.c \
H5HFtiny.c H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HL.c \
H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c H5HP.c \
- H5I.c H5Itest.c H5L.c H5Ldeprec.c H5Lexternal.c H5M.c H5MF.c \
- H5MFaggr.c H5MFdbg.c H5MFsection.c H5MM.c H5MP.c H5MPtest.c \
- H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
- H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
- H5Ocache_image.c H5Ochunk.c H5Ocont.c H5Ocopy.c H5Ocopy_ref.c \
- H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oflush.c \
- H5Ofsinfo.c H5Oginfo.c H5Oint.c H5Olayout.c H5Olinfo.c \
- H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c H5Onull.c \
- H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c H5Oshmesg.c \
- H5Ostab.c H5Otest.c H5Ounknown.c H5P.c H5Pacpl.c H5Pdapl.c \
- H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c H5Pfapl.c \
- H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \
- H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \
- H5Ptest.c H5PB.c H5PL.c H5PLint.c H5PLpath.c \
+ H5I.c H5Idbg.c H5Iint.c H5Itest.c H5L.c H5Ldeprec.c \
+ H5Lexternal.c H5M.c H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
+ H5MM.c H5MP.c H5MPtest.c H5O.c H5Odeprec.c H5Oainfo.c \
+ H5Oalloc.c H5Oattr.c H5Oattribute.c H5Obogus.c H5Obtreek.c \
+ H5Ocache.c H5Ocache_image.c H5Ochunk.c H5Ocont.c H5Ocopy.c \
+ H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
+ H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c H5Oint.c \
+ H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
+ H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c H5Osdspace.c \
+ H5Oshared.c H5Oshmesg.c H5Ostab.c H5Otest.c H5Ounknown.c H5P.c \
+ H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c \
+ H5Pencdec.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c \
+ H5Plapl.c H5Plcpl.c H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c \
+ H5Pstrcpl.c H5Ptest.c H5PB.c H5PL.c H5PLint.c H5PLpath.c \
H5PLplugin_cache.c H5R.c H5Rdeprec.c H5Rint.c H5UC.c H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c \
H5Spoint.c H5Sselect.c H5Stest.c H5SL.c H5SM.c H5SMbtree2.c \
- H5SMcache.c H5SMmessage.c H5SMtest.c H5ST.c H5T.c H5Tarray.c \
- H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c \
- H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
- H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \
- H5Topaque.c H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c \
- H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VL.c H5VLcallback.c \
- H5VLint.c H5VLnative.c H5VLnative_attr.c H5VLnative_blob.c \
+ H5SMcache.c H5SMmessage.c H5SMtest.c H5T.c H5Tarray.c H5Tbit.c \
+ H5Tcommit.c H5Tcompound.c H5Tconv.c H5Tcset.c H5Tdbg.c \
+ H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c H5Tfloat.c \
+ H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
+ H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c \
+ H5Tvisit.c H5Tvlen.c H5TS.c H5VL.c H5VLcallback.c H5VLint.c \
+ H5VLnative.c H5VLnative_attr.c H5VLnative_blob.c \
H5VLnative_dataset.c H5VLnative_datatype.c H5VLnative_file.c \
H5VLnative_group.c H5VLnative_link.c H5VLnative_introspect.c \
H5VLnative_object.c H5VLnative_token.c H5VLpassthru.c H5VM.c \
H5WB.c H5Z.c H5Zdeflate.c H5Zfletcher32.c H5Znbit.c \
H5Zshuffle.c H5Zscaleoffset.c H5Zszip.c H5Ztrans.c \
- $(am__append_1) $(am__append_2) $(am__append_3)
+ $(am__append_1) $(am__append_2) $(am__append_3) \
+ $(am__append_4)
# Public headers
include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \
H5Apublic.h H5ACpublic.h \
H5Cpublic.h H5Dpublic.h \
H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \
- H5FDpublic.h H5FDcore.h H5FDdirect.h \
- H5FDfamily.h H5FDhdfs.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
- H5FDmulti.h H5FDros3.h H5FDsec2.h H5FDstdio.h H5FDwindows.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 H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
@@ -1027,7 +1085,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
-chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
@@ -1241,6 +1299,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDhdfs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDlog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmirror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmpi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmpio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmulti.Plo@am__quote@
@@ -1248,6 +1307,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDs3comms.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDsec2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDspace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDsplitter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDstdio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDtest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FL.Plo@am__quote@
@@ -1321,6 +1381,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLprfx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HP.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5I.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Idbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Iint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Itest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5L.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ldeprec.Plo@am__quote@
@@ -1407,7 +1469,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMmessage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMtest.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ST.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sall.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sdbg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sdeprec.Plo@am__quote@
@@ -1922,9 +1983,9 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- check-passthrough-vol install-doc lib progs tests uninstall-doc \
- _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ check-passthrough-vol install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
@@ -1974,7 +2035,6 @@ $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt
# version of the source file is saved with a tilde (~) after its name and
# tracing information is inserted. trace should have no effect on files
# without HDF5 macros.
-.PHONY: trace
trace: $(libhdf5_la_SOURCES)
@for dep in $? dummy; do \
diff --git a/src/hdf5.h b/src/hdf5.h
index 60de2a8..c13e472 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,8 +16,8 @@
* a particular header file and include that here, don't fill this file with
* lots of gunk...
*/
-#ifndef _HDF5_H
-#define _HDF5_H
+#ifndef HDF5_H
+#define HDF5_H
#include "H5public.h"
#include "H5Apublic.h" /* Attributes */
@@ -41,16 +41,18 @@
#include "H5Zpublic.h" /* Data filters */
/* Predefined file drivers */
-#include "H5FDcore.h" /* Files stored entirely in memory */
-#include "H5FDdirect.h" /* Linux direct I/O */
-#include "H5FDfamily.h" /* File families */
-#include "H5FDhdfs.h" /* Hadoop HDFS */
-#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */
-#include "H5FDmpi.h" /* MPI-based file drivers */
-#include "H5FDmulti.h" /* Usage-partitioned file family */
-#include "H5FDros3.h" /* R/O S3 "file" I/O */
-#include "H5FDsec2.h" /* POSIX unbuffered file I/O */
-#include "H5FDstdio.h" /* Standard C buffered I/O */
+#include "H5FDcore.h" /* Files stored entirely in memory */
+#include "H5FDdirect.h" /* Linux direct I/O */
+#include "H5FDfamily.h" /* File families */
+#include "H5FDhdfs.h" /* Hadoop HDFS */
+#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */
+#include "H5FDmirror.h" /* Mirror VFD and IPC definitions */
+#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5FDmulti.h" /* Usage-partitioned file family */
+#include "H5FDros3.h" /* R/O S3 "file" I/O */
+#include "H5FDsec2.h" /* POSIX unbuffered file I/O */
+#include "H5FDsplitter.h" /* Twin-channel (R/W & R/O) I/O passthrough */
+#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
#include "H5FDwindows.h" /* Win32 I/O */
#endif
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 1591bed..a4d4af6 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -73,13 +73,14 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
High-level library: @HDF5_HL@
Build HDF5 Tests: @HDF5_TESTS@
Build HDF5 Tools: @HDF5_TOOLS@
- Threadsafety: @THREADSAFE@
+ Threadsafety: @THREADSAFE@ (recursive RW locks: @RECURSIVE_RW_LOCKS@)
Default API mapping: @DEFAULT_API_VERSION@
With deprecated public symbols: @DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
MPE: @MPE@
Map (H5M) API: @MAP_API@
Direct VFD: @DIRECT_VFD@
+ Mirror VFD: @MIRROR_VFD@
(Read-Only) S3 VFD: @ROS3_VFD@
(Read-Only) HDFS VFD: @HAVE_LIBHDFS@
dmalloc: @HAVE_DMALLOC@
@@ -88,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/src/uthash.h b/src/uthash.h
new file mode 100644
index 0000000..8bdca55
--- /dev/null
+++ b/src/uthash.h
@@ -0,0 +1,1184 @@
+/*
+Copyright (c) 2003-2018, Troy D. Hanson http://troydhanson.github.com/uthash/
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef UTHASH_H
+#define UTHASH_H
+
+#define UTHASH_VERSION 2.1.0
+
+#include <string.h> /* memcmp, memset, strlen */
+#include <stddef.h> /* ptrdiff_t */
+#include <stdlib.h> /* exit */
+
+/* These macros use decltype or the earlier __typeof GNU extension.
+ As decltype is only available in newer compilers (VS2010 or gcc 4.3+
+ when compiling c++ source) this code uses whatever method is needed
+ or, for VS2008 where neither is available, uses casting workarounds. */
+#if !defined(DECLTYPE) && !defined(NO_DECLTYPE)
+#if defined(_MSC_VER) /* MS compiler */
+#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */
+#define DECLTYPE(x) (decltype(x))
+#else /* VS2008 or older (or VS2010 in C mode) */
+#define NO_DECLTYPE
+#endif
+#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__)
+#define NO_DECLTYPE
+#else /* GNU, Sun and other compilers */
+#define DECLTYPE(x) (__typeof(x))
+#endif
+#endif
+
+#ifdef NO_DECLTYPE
+#define DECLTYPE(x)
+#define DECLTYPE_ASSIGN(dst, src) \
+ do { \
+ char **_da_dst = (char **)(&(dst)); \
+ *_da_dst = (char *)(src); \
+ } while (0)
+#else
+#define DECLTYPE_ASSIGN(dst, src) \
+ do { \
+ (dst) = DECLTYPE(dst)(src); \
+ } while (0)
+#endif
+
+/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */
+#if defined(_WIN32)
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+#include <stdint.h>
+#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__)
+#include <stdint.h>
+#else
+typedef unsigned int uint32_t;
+typedef unsigned char uint8_t;
+#endif
+#elif defined(__GNUC__) && !defined(__VXWORKS__)
+#include <stdint.h>
+#else
+typedef unsigned int uint32_t;
+typedef unsigned char uint8_t;
+#endif
+
+#ifndef uthash_malloc
+#define uthash_malloc(sz) malloc(sz) /* malloc fcn */
+#endif
+#ifndef uthash_free
+#define uthash_free(ptr, sz) free(ptr) /* free fcn */
+#endif
+#ifndef uthash_bzero
+#define uthash_bzero(a, n) memset(a, '\0', n)
+#endif
+#ifndef uthash_strlen
+#define uthash_strlen(s) strlen(s)
+#endif
+
+#ifdef uthash_memcmp
+/* This warning will not catch programs that define uthash_memcmp AFTER including uthash.h. */
+#warning "uthash_memcmp is deprecated; please use HASH_KEYCMP instead"
+#else
+#define uthash_memcmp(a, b, n) memcmp(a, b, n)
+#endif
+
+#ifndef HASH_KEYCMP
+#define HASH_KEYCMP(a, b, n) uthash_memcmp(a, b, n)
+#endif
+
+#ifndef uthash_noexpand_fyi
+#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */
+#endif
+#ifndef uthash_expand_fyi
+#define uthash_expand_fyi(tbl) /* can be defined to log expands */
+#endif
+
+#ifndef HASH_NONFATAL_OOM
+#define HASH_NONFATAL_OOM 0
+#endif
+
+#if HASH_NONFATAL_OOM
+/* malloc failures can be recovered from */
+
+#ifndef uthash_nonfatal_oom
+#define uthash_nonfatal_oom(obj) \
+ do { \
+ } while (0) /* non-fatal OOM error */
+#endif
+
+#define HASH_RECORD_OOM(oomed) \
+ do { \
+ (oomed) = 1; \
+ } while (0)
+#define IF_HASH_NONFATAL_OOM(x) x
+
+#else
+/* malloc failures result in lost memory, hash tables are unusable */
+
+#ifndef uthash_fatal
+#define uthash_fatal(msg) exit(-1) /* fatal OOM error */
+#endif
+
+#define HASH_RECORD_OOM(oomed) uthash_fatal("out of memory")
+#define IF_HASH_NONFATAL_OOM(x)
+
+#endif
+
+/* initial number of buckets */
+#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */
+#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */
+#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */
+
+/* calculate the element whose hash handle address is hhp */
+#define ELMT_FROM_HH(tbl, hhp) ((void *)(((char *)(hhp)) - ((tbl)->hho)))
+/* calculate the hash handle from element address elp */
+#define HH_FROM_ELMT(tbl, elp) ((UT_hash_handle *)(void *)(((char *)(elp)) + ((tbl)->hho)))
+
+#define HASH_ROLLBACK_BKT(hh, head, itemptrhh) \
+ do { \
+ struct UT_hash_handle *_hd_hh_item = (itemptrhh); \
+ unsigned _hd_bkt; \
+ HASH_TO_BKT(_hd_hh_item->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \
+ (head)->hh.tbl->buckets[_hd_bkt].count++; \
+ _hd_hh_item->hh_next = NULL; \
+ _hd_hh_item->hh_prev = NULL; \
+ } while (0)
+
+#define HASH_VALUE(keyptr, keylen, hashv) \
+ do { \
+ HASH_FCN(keyptr, keylen, hashv); \
+ } while (0)
+
+#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out) \
+ do { \
+ (out) = NULL; \
+ if (head) { \
+ unsigned _hf_bkt; \
+ HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \
+ if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \
+ HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[_hf_bkt], keyptr, keylen, \
+ hashval, out); \
+ } \
+ } \
+ } while (0)
+
+#define HASH_FIND(hh, head, keyptr, keylen, out) \
+ do { \
+ (out) = NULL; \
+ if (head) { \
+ unsigned _hf_hashv; \
+ HASH_VALUE(keyptr, keylen, _hf_hashv); \
+ HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \
+ } \
+ } while (0)
+
+#ifdef HASH_BLOOM
+#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM)
+#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN / 8UL) + (((HASH_BLOOM_BITLEN % 8UL) != 0UL) ? 1UL : 0UL)
+#define HASH_BLOOM_MAKE(tbl, oomed) \
+ do { \
+ (tbl)->bloom_nbits = HASH_BLOOM; \
+ (tbl)->bloom_bv = (uint8_t *)uthash_malloc(HASH_BLOOM_BYTELEN); \
+ if (!(tbl)->bloom_bv) { \
+ HASH_RECORD_OOM(oomed); \
+ } \
+ else { \
+ uthash_bzero((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \
+ (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \
+ } \
+ } while (0)
+
+#define HASH_BLOOM_FREE(tbl) \
+ do { \
+ uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \
+ } while (0)
+
+#define HASH_BLOOM_BITSET(bv, idx) (bv[(idx) / 8U] |= (1U << ((idx) % 8U)))
+#define HASH_BLOOM_BITTEST(bv, idx) (bv[(idx) / 8U] & (1U << ((idx) % 8U)))
+
+#define HASH_BLOOM_ADD(tbl, hashv) \
+ HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U)))
+
+#define HASH_BLOOM_TEST(tbl, hashv) \
+ HASH_BLOOM_BITTEST((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U)))
+
+#else
+#define HASH_BLOOM_MAKE(tbl, oomed)
+#define HASH_BLOOM_FREE(tbl)
+#define HASH_BLOOM_ADD(tbl, hashv)
+#define HASH_BLOOM_TEST(tbl, hashv) (1)
+#define HASH_BLOOM_BYTELEN 0U
+#endif
+
+#define HASH_MAKE_TABLE(hh, head, oomed) \
+ do { \
+ (head)->hh.tbl = (UT_hash_table *)uthash_malloc(sizeof(UT_hash_table)); \
+ if (!(head)->hh.tbl) { \
+ HASH_RECORD_OOM(oomed); \
+ } \
+ else { \
+ uthash_bzero((head)->hh.tbl, sizeof(UT_hash_table)); \
+ (head)->hh.tbl->tail = &((head)->hh); \
+ (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
+ (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
+ (head)->hh.tbl->hho = (char *)(&(head)->hh) - (char *)(head); \
+ (head)->hh.tbl->buckets = \
+ (UT_hash_bucket *)uthash_malloc(HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \
+ (head)->hh.tbl->signature = HASH_SIGNATURE; \
+ if (!(head)->hh.tbl->buckets) { \
+ HASH_RECORD_OOM(oomed); \
+ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
+ } \
+ else { \
+ uthash_bzero((head)->hh.tbl->buckets, \
+ HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \
+ HASH_BLOOM_MAKE((head)->hh.tbl, oomed); \
+ IF_HASH_NONFATAL_OOM(if (oomed) { \
+ uthash_free((head)->hh.tbl->buckets, \
+ HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \
+ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
+ }) \
+ } \
+ } \
+ } while (0)
+
+#define HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, replaced, cmpfcn) \
+ do { \
+ (replaced) = NULL; \
+ HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
+ if (replaced) { \
+ HASH_DELETE(hh, head, replaced); \
+ } \
+ HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \
+ } while (0)
+
+#define HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add, replaced) \
+ do { \
+ (replaced) = NULL; \
+ HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
+ if (replaced) { \
+ HASH_DELETE(hh, head, replaced); \
+ } \
+ HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \
+ } while (0)
+
+#define HASH_REPLACE(hh, head, fieldname, keylen_in, add, replaced) \
+ do { \
+ unsigned _hr_hashv; \
+ HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
+ HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \
+ } while (0)
+
+#define HASH_REPLACE_INORDER(hh, head, fieldname, keylen_in, add, replaced, cmpfcn) \
+ do { \
+ unsigned _hr_hashv; \
+ HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
+ HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \
+ } while (0)
+
+#define HASH_APPEND_LIST(hh, head, add) \
+ do { \
+ (add)->hh.next = NULL; \
+ (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
+ (head)->hh.tbl->tail->next = (add); \
+ (head)->hh.tbl->tail = &((add)->hh); \
+ } while (0)
+
+#define HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn) \
+ do { \
+ do { \
+ if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) { \
+ break; \
+ } \
+ } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \
+ } while (0)
+
+#ifdef NO_DECLTYPE
+#undef HASH_AKBI_INNER_LOOP
+#define HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn) \
+ do { \
+ char *_hs_saved_head = (char *)(head); \
+ do { \
+ DECLTYPE_ASSIGN(head, _hs_iter); \
+ if (cmpfcn(head, add) > 0) { \
+ DECLTYPE_ASSIGN(head, _hs_saved_head); \
+ break; \
+ } \
+ DECLTYPE_ASSIGN(head, _hs_saved_head); \
+ } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \
+ } while (0)
+#endif
+
+#if HASH_NONFATAL_OOM
+
+#define HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, oomed) \
+ do { \
+ if (!(oomed)) { \
+ unsigned _ha_bkt; \
+ (head)->hh.tbl->num_items++; \
+ HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \
+ HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \
+ if (oomed) { \
+ HASH_ROLLBACK_BKT(hh, head, &(add)->hh); \
+ HASH_DELETE_HH(hh, head, &(add)->hh); \
+ (add)->hh.tbl = NULL; \
+ uthash_nonfatal_oom(add); \
+ } \
+ else { \
+ HASH_BLOOM_ADD((head)->hh.tbl, hashval); \
+ HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \
+ } \
+ } \
+ else { \
+ (add)->hh.tbl = NULL; \
+ uthash_nonfatal_oom(add); \
+ } \
+ } while (0)
+
+#else
+
+#define HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, oomed) \
+ do { \
+ unsigned _ha_bkt; \
+ (head)->hh.tbl->num_items++; \
+ HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \
+ HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \
+ HASH_BLOOM_ADD((head)->hh.tbl, hashval); \
+ HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \
+ } while (0)
+
+#endif
+
+#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, hashval, add, cmpfcn) \
+ do { \
+ IF_HASH_NONFATAL_OOM(int _ha_oomed = 0;) \
+ (add)->hh.hashv = (hashval); \
+ (add)->hh.key = (char *)(keyptr); \
+ (add)->hh.keylen = (unsigned)(keylen_in); \
+ if (!(head)) { \
+ (add)->hh.next = NULL; \
+ (add)->hh.prev = NULL; \
+ HASH_MAKE_TABLE(hh, add, _ha_oomed); \
+ IF_HASH_NONFATAL_OOM(if (!_ha_oomed) { ) \
+ (head) = (add); \
+ IF_HASH_NONFATAL_OOM( \
+ }) \
+ } \
+ else { \
+ void *_hs_iter = (head); \
+ (add)->hh.tbl = (head)->hh.tbl; \
+ HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn); \
+ if (_hs_iter) { \
+ (add)->hh.next = _hs_iter; \
+ if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \
+ HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \
+ } \
+ else { \
+ (head) = (add); \
+ } \
+ HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \
+ } \
+ else { \
+ HASH_APPEND_LIST(hh, head, add); \
+ } \
+ } \
+ HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \
+ HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE_INORDER"); \
+ } while (0)
+
+#define HASH_ADD_KEYPTR_INORDER(hh, head, keyptr, keylen_in, add, cmpfcn) \
+ do { \
+ unsigned _hs_hashv; \
+ HASH_VALUE(keyptr, keylen_in, _hs_hashv); \
+ HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \
+ } while (0)
+
+#define HASH_ADD_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, cmpfcn) \
+ HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn)
+
+#define HASH_ADD_INORDER(hh, head, fieldname, keylen_in, add, cmpfcn) \
+ HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn)
+
+#define HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, hashval, add) \
+ do { \
+ IF_HASH_NONFATAL_OOM(int _ha_oomed = 0;) \
+ (add)->hh.hashv = (hashval); \
+ (add)->hh.key = (char *)(keyptr); \
+ (add)->hh.keylen = (unsigned)(keylen_in); \
+ if (!(head)) { \
+ (add)->hh.next = NULL; \
+ (add)->hh.prev = NULL; \
+ HASH_MAKE_TABLE(hh, add, _ha_oomed); \
+ IF_HASH_NONFATAL_OOM(if (!_ha_oomed) { ) \
+ (head) = (add); \
+ IF_HASH_NONFATAL_OOM( \
+ }) \
+ } \
+ else { \
+ (add)->hh.tbl = (head)->hh.tbl; \
+ HASH_APPEND_LIST(hh, head, add); \
+ } \
+ HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \
+ HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE"); \
+ } while (0)
+
+#define HASH_ADD_KEYPTR(hh, head, keyptr, keylen_in, add) \
+ do { \
+ unsigned _ha_hashv; \
+ HASH_VALUE(keyptr, keylen_in, _ha_hashv); \
+ HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \
+ } while (0)
+
+#define HASH_ADD_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add) \
+ HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add)
+
+#define HASH_ADD(hh, head, fieldname, keylen_in, add) \
+ HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add)
+
+#define HASH_TO_BKT(hashv, num_bkts, bkt) \
+ do { \
+ bkt = ((hashv) & ((num_bkts)-1U)); \
+ } while (0)
+
+/* delete "delptr" from the hash table.
+ * "the usual" patch-up process for the app-order doubly-linked-list.
+ * The use of _hd_hh_del below deserves special explanation.
+ * These used to be expressed using (delptr) but that led to a bug
+ * if someone used the same symbol for the head and deletee, like
+ * HASH_DELETE(hh,users,users);
+ * We want that to work, but by changing the head (users) below
+ * we were forfeiting our ability to further refer to the deletee (users)
+ * in the patch-up process. Solution: use scratch space to
+ * copy the deletee pointer, then the latter references are via that
+ * scratch pointer rather than through the repointed (users) symbol.
+ */
+#define HASH_DELETE(hh, head, delptr) HASH_DELETE_HH(hh, head, &(delptr)->hh)
+
+#define HASH_DELETE_HH(hh, head, delptrhh) \
+ do { \
+ struct UT_hash_handle *_hd_hh_del = (delptrhh); \
+ if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \
+ HASH_BLOOM_FREE((head)->hh.tbl); \
+ uthash_free((head)->hh.tbl->buckets, \
+ (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \
+ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
+ (head) = NULL; \
+ } \
+ else { \
+ unsigned _hd_bkt; \
+ if (_hd_hh_del == (head)->hh.tbl->tail) { \
+ (head)->hh.tbl->tail = HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev); \
+ } \
+ if (_hd_hh_del->prev != NULL) { \
+ HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev)->next = _hd_hh_del->next; \
+ } \
+ else { \
+ DECLTYPE_ASSIGN(head, _hd_hh_del->next); \
+ } \
+ if (_hd_hh_del->next != NULL) { \
+ HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->next)->prev = _hd_hh_del->prev; \
+ } \
+ HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \
+ HASH_DEL_IN_BKT((head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \
+ (head)->hh.tbl->num_items--; \
+ } \
+ HASH_FSCK(hh, head, "HASH_DELETE_HH"); \
+ } while (0)
+
+/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */
+#define HASH_FIND_STR(head, findstr, out) \
+ do { \
+ unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(findstr); \
+ HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \
+ } while (0)
+#define HASH_ADD_STR(head, strfield, add) \
+ do { \
+ unsigned _uthash_hastr_keylen = (unsigned)uthash_strlen((add)->strfield); \
+ HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \
+ } while (0)
+#define HASH_REPLACE_STR(head, strfield, add, replaced) \
+ do { \
+ unsigned _uthash_hrstr_keylen = (unsigned)uthash_strlen((add)->strfield); \
+ HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \
+ } while (0)
+#define HASH_FIND_INT(head, findint, out) HASH_FIND(hh, head, findint, sizeof(int), out)
+#define HASH_ADD_INT(head, intfield, add) HASH_ADD(hh, head, intfield, sizeof(int), add)
+#define HASH_REPLACE_INT(head, intfield, add, replaced) \
+ HASH_REPLACE(hh, head, intfield, sizeof(int), add, replaced)
+#define HASH_FIND_PTR(head, findptr, out) HASH_FIND(hh, head, findptr, sizeof(void *), out)
+#define HASH_ADD_PTR(head, ptrfield, add) HASH_ADD(hh, head, ptrfield, sizeof(void *), add)
+#define HASH_REPLACE_PTR(head, ptrfield, add, replaced) \
+ HASH_REPLACE(hh, head, ptrfield, sizeof(void *), add, replaced)
+#define HASH_DEL(head, delptr) HASH_DELETE(hh, head, delptr)
+
+/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined.
+ * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined.
+ */
+#ifdef HASH_DEBUG
+#include <stdio.h> /* fprintf, stderr */
+#define HASH_OOPS(...) \
+ do { \
+ fprintf(stderr, __VA_ARGS__); \
+ exit(-1); \
+ } while (0)
+#define HASH_FSCK(hh, head, where) \
+ do { \
+ struct UT_hash_handle *_thh; \
+ if (head) { \
+ unsigned _bkt_i; \
+ unsigned _count = 0; \
+ char * _prev; \
+ for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; ++_bkt_i) { \
+ unsigned _bkt_count = 0; \
+ _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \
+ _prev = NULL; \
+ while (_thh) { \
+ if (_prev != (char *)(_thh->hh_prev)) { \
+ HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", (where), (void *)_thh->hh_prev, \
+ (void *)_prev); \
+ } \
+ _bkt_count++; \
+ _prev = (char *)(_thh); \
+ _thh = _thh->hh_next; \
+ } \
+ _count += _bkt_count; \
+ if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \
+ HASH_OOPS("%s: invalid bucket count %u, actual %u\n", (where), \
+ (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \
+ } \
+ } \
+ if (_count != (head)->hh.tbl->num_items) { \
+ HASH_OOPS("%s: invalid hh item count %u, actual %u\n", (where), (head)->hh.tbl->num_items, \
+ _count); \
+ } \
+ _count = 0; \
+ _prev = NULL; \
+ _thh = &(head)->hh; \
+ while (_thh) { \
+ _count++; \
+ if (_prev != (char *)_thh->prev) { \
+ HASH_OOPS("%s: invalid prev %p, actual %p\n", (where), (void *)_thh->prev, \
+ (void *)_prev); \
+ } \
+ _prev = (char *)ELMT_FROM_HH((head)->hh.tbl, _thh); \
+ _thh = (_thh->next ? HH_FROM_ELMT((head)->hh.tbl, _thh->next) : NULL); \
+ } \
+ if (_count != (head)->hh.tbl->num_items) { \
+ HASH_OOPS("%s: invalid app item count %u, actual %u\n", (where), (head)->hh.tbl->num_items, \
+ _count); \
+ } \
+ } \
+ } while (0)
+#else
+#define HASH_FSCK(hh, head, where)
+#endif
+
+/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to
+ * the descriptor to which this macro is defined for tuning the hash function.
+ * The app can #include <unistd.h> to get the prototype for write(2). */
+#ifdef HASH_EMIT_KEYS
+#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen) \
+ do { \
+ unsigned _klen = fieldlen; \
+ write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \
+ write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \
+ } while (0)
+#else
+#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen)
+#endif
+
+/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */
+#ifdef HASH_FUNCTION
+#define HASH_FCN HASH_FUNCTION
+#else
+#define HASH_FCN HASH_JEN
+#endif
+
+/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */
+#define HASH_BER(key, keylen, hashv) \
+ do { \
+ unsigned _hb_keylen = (unsigned)keylen; \
+ const unsigned char *_hb_key = (const unsigned char *)(key); \
+ (hashv) = 0; \
+ while (_hb_keylen-- != 0U) { \
+ (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \
+ } \
+ } while (0)
+
+/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at
+ * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */
+#define HASH_SAX(key, keylen, hashv) \
+ do { \
+ unsigned _sx_i; \
+ const unsigned char *_hs_key = (const unsigned char *)(key); \
+ hashv = 0; \
+ for (_sx_i = 0; _sx_i < keylen; _sx_i++) { \
+ hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \
+ } \
+ } while (0)
+/* FNV-1a variation */
+#define HASH_FNV(key, keylen, hashv) \
+ do { \
+ unsigned _fn_i; \
+ const unsigned char *_hf_key = (const unsigned char *)(key); \
+ (hashv) = 2166136261U; \
+ for (_fn_i = 0; _fn_i < keylen; _fn_i++) { \
+ hashv = hashv ^ _hf_key[_fn_i]; \
+ hashv = hashv * 16777619U; \
+ } \
+ } while (0)
+
+#define HASH_OAT(key, keylen, hashv) \
+ do { \
+ unsigned _ho_i; \
+ const unsigned char *_ho_key = (const unsigned char *)(key); \
+ hashv = 0; \
+ for (_ho_i = 0; _ho_i < keylen; _ho_i++) { \
+ hashv += _ho_key[_ho_i]; \
+ hashv += (hashv << 10); \
+ hashv ^= (hashv >> 6); \
+ } \
+ hashv += (hashv << 3); \
+ hashv ^= (hashv >> 11); \
+ hashv += (hashv << 15); \
+ } while (0)
+
+#define HASH_JEN_MIX(a, b, c) \
+ do { \
+ a -= b; \
+ a -= c; \
+ a ^= (c >> 13); \
+ b -= c; \
+ b -= a; \
+ b ^= (a << 8); \
+ c -= a; \
+ c -= b; \
+ c ^= (b >> 13); \
+ a -= b; \
+ a -= c; \
+ a ^= (c >> 12); \
+ b -= c; \
+ b -= a; \
+ b ^= (a << 16); \
+ c -= a; \
+ c -= b; \
+ c ^= (b >> 5); \
+ a -= b; \
+ a -= c; \
+ a ^= (c >> 3); \
+ b -= c; \
+ b -= a; \
+ b ^= (a << 10); \
+ c -= a; \
+ c -= b; \
+ c ^= (b >> 15); \
+ } while (0)
+
+#define HASH_JEN(key, keylen, hashv) \
+ do { \
+ unsigned _hj_i, _hj_j, _hj_k; \
+ unsigned const char *_hj_key = (unsigned const char *)(key); \
+ hashv = 0xfeedbeefu; \
+ _hj_i = _hj_j = 0x9e3779b9u; \
+ _hj_k = (unsigned)(keylen); \
+ while (_hj_k >= 12U) { \
+ _hj_i += (_hj_key[0] + ((unsigned)_hj_key[1] << 8) + ((unsigned)_hj_key[2] << 16) + \
+ ((unsigned)_hj_key[3] << 24)); \
+ _hj_j += (_hj_key[4] + ((unsigned)_hj_key[5] << 8) + ((unsigned)_hj_key[6] << 16) + \
+ ((unsigned)_hj_key[7] << 24)); \
+ hashv += (_hj_key[8] + ((unsigned)_hj_key[9] << 8) + ((unsigned)_hj_key[10] << 16) + \
+ ((unsigned)_hj_key[11] << 24)); \
+ \
+ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \
+ \
+ _hj_key += 12; \
+ _hj_k -= 12U; \
+ } \
+ hashv += (unsigned)(keylen); \
+ switch (_hj_k) { \
+ case 11: \
+ hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \
+ case 10: \
+ hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \
+ case 9: \
+ hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \
+ case 8: \
+ _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \
+ case 7: \
+ _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \
+ case 6: \
+ _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \
+ case 5: \
+ _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
+ case 4: \
+ _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \
+ case 3: \
+ _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \
+ case 2: \
+ _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \
+ case 1: \
+ _hj_i += _hj_key[0]; \
+ } \
+ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \
+ } while (0)
+
+/* The Paul Hsieh hash function */
+#undef get16bits
+#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) || defined(_MSC_VER) || \
+ defined(__BORLANDC__) || defined(__TURBOC__)
+#define get16bits(d) (*((const uint16_t *)(d)))
+#endif
+
+#if !defined(get16bits)
+#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) + (uint32_t)(((const uint8_t *)(d))[0]))
+#endif
+#define HASH_SFH(key, keylen, hashv) \
+ do { \
+ unsigned const char *_sfh_key = (unsigned const char *)(key); \
+ uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \
+ \
+ unsigned _sfh_rem = _sfh_len & 3U; \
+ _sfh_len >>= 2; \
+ hashv = 0xcafebabeu; \
+ \
+ /* Main loop */ \
+ for (; _sfh_len > 0U; _sfh_len--) { \
+ hashv += get16bits(_sfh_key); \
+ _sfh_tmp = ((uint32_t)(get16bits(_sfh_key + 2)) << 11) ^ hashv; \
+ hashv = (hashv << 16) ^ _sfh_tmp; \
+ _sfh_key += 2U * sizeof(uint16_t); \
+ hashv += hashv >> 11; \
+ } \
+ \
+ /* Handle end cases */ \
+ switch (_sfh_rem) { \
+ case 3: \
+ hashv += get16bits(_sfh_key); \
+ hashv ^= hashv << 16; \
+ hashv ^= (uint32_t)(_sfh_key[sizeof(uint16_t)]) << 18; \
+ hashv += hashv >> 11; \
+ break; \
+ case 2: \
+ hashv += get16bits(_sfh_key); \
+ hashv ^= hashv << 11; \
+ hashv += hashv >> 17; \
+ break; \
+ case 1: \
+ hashv += *_sfh_key; \
+ hashv ^= hashv << 10; \
+ hashv += hashv >> 1; \
+ } \
+ \
+ /* Force "avalanching" of final 127 bits */ \
+ hashv ^= hashv << 3; \
+ hashv += hashv >> 5; \
+ hashv ^= hashv << 4; \
+ hashv += hashv >> 17; \
+ hashv ^= hashv << 25; \
+ hashv += hashv >> 6; \
+ } while (0)
+
+/* iterate over items in a known bucket to find desired item */
+#define HASH_FIND_IN_BKT(tbl, hh, head, keyptr, keylen_in, hashval, out) \
+ do { \
+ if ((head).hh_head != NULL) { \
+ DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \
+ } \
+ else { \
+ (out) = NULL; \
+ } \
+ while ((out) != NULL) { \
+ if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \
+ if (HASH_KEYCMP((out)->hh.key, keyptr, keylen_in) == 0) { \
+ break; \
+ } \
+ } \
+ if ((out)->hh.hh_next != NULL) { \
+ DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \
+ } \
+ else { \
+ (out) = NULL; \
+ } \
+ } \
+ } while (0)
+
+/* add an item to a bucket */
+#define HASH_ADD_TO_BKT(head, hh, addhh, oomed) \
+ do { \
+ UT_hash_bucket *_ha_head = &(head); \
+ _ha_head->count++; \
+ (addhh)->hh_next = _ha_head->hh_head; \
+ (addhh)->hh_prev = NULL; \
+ if (_ha_head->hh_head != NULL) { \
+ _ha_head->hh_head->hh_prev = (addhh); \
+ } \
+ _ha_head->hh_head = (addhh); \
+ if ((_ha_head->count >= ((_ha_head->expand_mult + 1U) * HASH_BKT_CAPACITY_THRESH)) && \
+ !(addhh)->tbl->noexpand) { \
+ HASH_EXPAND_BUCKETS(addhh, (addhh)->tbl, oomed); \
+ IF_HASH_NONFATAL_OOM(if (oomed) { HASH_DEL_IN_BKT(head, addhh); }) \
+ } \
+ } while (0)
+
+/* remove an item from a given bucket */
+#define HASH_DEL_IN_BKT(head, delhh) \
+ do { \
+ UT_hash_bucket *_hd_head = &(head); \
+ _hd_head->count--; \
+ if (_hd_head->hh_head == (delhh)) { \
+ _hd_head->hh_head = (delhh)->hh_next; \
+ } \
+ if ((delhh)->hh_prev) { \
+ (delhh)->hh_prev->hh_next = (delhh)->hh_next; \
+ } \
+ if ((delhh)->hh_next) { \
+ (delhh)->hh_next->hh_prev = (delhh)->hh_prev; \
+ } \
+ } while (0)
+
+/* Bucket expansion has the effect of doubling the number of buckets
+ * and redistributing the items into the new buckets. Ideally the
+ * items will distribute more or less evenly into the new buckets
+ * (the extent to which this is true is a measure of the quality of
+ * the hash function as it applies to the key domain).
+ *
+ * With the items distributed into more buckets, the chain length
+ * (item count) in each bucket is reduced. Thus by expanding buckets
+ * the hash keeps a bound on the chain length. This bounded chain
+ * length is the essence of how a hash provides constant time lookup.
+ *
+ * The calculation of tbl->ideal_chain_maxlen below deserves some
+ * explanation. First, keep in mind that we're calculating the ideal
+ * maximum chain length based on the *new* (doubled) bucket count.
+ * In fractions this is just n/b (n=number of items,b=new num buckets).
+ * Since the ideal chain length is an integer, we want to calculate
+ * ceil(n/b). We don't depend on floating point arithmetic in this
+ * hash, so to calculate ceil(n/b) with integers we could write
+ *
+ * ceil(n/b) = (n/b) + ((n%b)?1:0)
+ *
+ * and in fact a previous version of this hash did just that.
+ * But now we have improved things a bit by recognizing that b is
+ * always a power of two. We keep its base 2 log handy (call it lb),
+ * so now we can write this with a bit shift and logical AND:
+ *
+ * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0)
+ *
+ */
+#define HASH_EXPAND_BUCKETS(hh, tbl, oomed) \
+ do { \
+ unsigned _he_bkt; \
+ unsigned _he_bkt_i; \
+ struct UT_hash_handle *_he_thh, *_he_hh_nxt; \
+ UT_hash_bucket * _he_new_buckets, *_he_newbkt; \
+ _he_new_buckets = \
+ (UT_hash_bucket *)uthash_malloc(2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \
+ if (!_he_new_buckets) { \
+ HASH_RECORD_OOM(oomed); \
+ } \
+ else { \
+ uthash_bzero(_he_new_buckets, 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \
+ (tbl)->ideal_chain_maxlen = \
+ ((tbl)->num_items >> ((tbl)->log2_num_buckets + 1U)) + \
+ ((((tbl)->num_items & (((tbl)->num_buckets * 2U) - 1U)) != 0U) ? 1U : 0U); \
+ (tbl)->nonideal_items = 0; \
+ for (_he_bkt_i = 0; _he_bkt_i < (tbl)->num_buckets; _he_bkt_i++) { \
+ _he_thh = (tbl)->buckets[_he_bkt_i].hh_head; \
+ while (_he_thh != NULL) { \
+ _he_hh_nxt = _he_thh->hh_next; \
+ HASH_TO_BKT(_he_thh->hashv, (tbl)->num_buckets * 2U, _he_bkt); \
+ _he_newbkt = &(_he_new_buckets[_he_bkt]); \
+ if (++(_he_newbkt->count) > (tbl)->ideal_chain_maxlen) { \
+ (tbl)->nonideal_items++; \
+ if (_he_newbkt->count > _he_newbkt->expand_mult * (tbl)->ideal_chain_maxlen) { \
+ _he_newbkt->expand_mult++; \
+ } \
+ } \
+ _he_thh->hh_prev = NULL; \
+ _he_thh->hh_next = _he_newbkt->hh_head; \
+ if (_he_newbkt->hh_head != NULL) { \
+ _he_newbkt->hh_head->hh_prev = _he_thh; \
+ } \
+ _he_newbkt->hh_head = _he_thh; \
+ _he_thh = _he_hh_nxt; \
+ } \
+ } \
+ uthash_free((tbl)->buckets, (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \
+ (tbl)->num_buckets *= 2U; \
+ (tbl)->log2_num_buckets++; \
+ (tbl)->buckets = _he_new_buckets; \
+ (tbl)->ineff_expands = \
+ ((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? ((tbl)->ineff_expands + 1U) : 0U; \
+ if ((tbl)->ineff_expands > 1U) { \
+ (tbl)->noexpand = 1; \
+ uthash_noexpand_fyi(tbl); \
+ } \
+ uthash_expand_fyi(tbl); \
+ } \
+ } while (0)
+
+/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */
+/* Note that HASH_SORT assumes the hash handle name to be hh.
+ * HASH_SRT was added to allow the hash handle name to be passed in. */
+#define HASH_SORT(head, cmpfcn) HASH_SRT(hh, head, cmpfcn)
+#define HASH_SRT(hh, head, cmpfcn) \
+ do { \
+ unsigned _hs_i; \
+ unsigned _hs_looping, _hs_nmerges, _hs_insize, _hs_psize, _hs_qsize; \
+ struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \
+ if (head != NULL) { \
+ _hs_insize = 1; \
+ _hs_looping = 1; \
+ _hs_list = &((head)->hh); \
+ while (_hs_looping != 0U) { \
+ _hs_p = _hs_list; \
+ _hs_list = NULL; \
+ _hs_tail = NULL; \
+ _hs_nmerges = 0; \
+ while (_hs_p != NULL) { \
+ _hs_nmerges++; \
+ _hs_q = _hs_p; \
+ _hs_psize = 0; \
+ for (_hs_i = 0; _hs_i < _hs_insize; ++_hs_i) { \
+ _hs_psize++; \
+ _hs_q = ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \
+ if (_hs_q == NULL) { \
+ break; \
+ } \
+ } \
+ _hs_qsize = _hs_insize; \
+ while ((_hs_psize != 0U) || ((_hs_qsize != 0U) && (_hs_q != NULL))) { \
+ if (_hs_psize == 0U) { \
+ _hs_e = _hs_q; \
+ _hs_q = \
+ ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \
+ _hs_qsize--; \
+ } \
+ else if ((_hs_qsize == 0U) || (_hs_q == NULL)) { \
+ _hs_e = _hs_p; \
+ if (_hs_p != NULL) { \
+ _hs_p = ((_hs_p->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) \
+ : NULL); \
+ } \
+ _hs_psize--; \
+ } \
+ else if ((cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \
+ DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_q)))) <= 0) { \
+ _hs_e = _hs_p; \
+ if (_hs_p != NULL) { \
+ _hs_p = ((_hs_p->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) \
+ : NULL); \
+ } \
+ _hs_psize--; \
+ } \
+ else { \
+ _hs_e = _hs_q; \
+ _hs_q = \
+ ((_hs_q->next != NULL) ? HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \
+ _hs_qsize--; \
+ } \
+ if (_hs_tail != NULL) { \
+ _hs_tail->next = ((_hs_e != NULL) ? ELMT_FROM_HH((head)->hh.tbl, _hs_e) : NULL); \
+ } \
+ else { \
+ _hs_list = _hs_e; \
+ } \
+ if (_hs_e != NULL) { \
+ _hs_e->prev = \
+ ((_hs_tail != NULL) ? ELMT_FROM_HH((head)->hh.tbl, _hs_tail) : NULL); \
+ } \
+ _hs_tail = _hs_e; \
+ } \
+ _hs_p = _hs_q; \
+ } \
+ if (_hs_tail != NULL) { \
+ _hs_tail->next = NULL; \
+ } \
+ if (_hs_nmerges <= 1U) { \
+ _hs_looping = 0; \
+ (head)->hh.tbl->tail = _hs_tail; \
+ DECLTYPE_ASSIGN(head, ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \
+ } \
+ _hs_insize *= 2U; \
+ } \
+ HASH_FSCK(hh, head, "HASH_SRT"); \
+ } \
+ } while (0)
+
+/* This function selects items from one hash into another hash.
+ * The end result is that the selected items have dual presence
+ * in both hashes. There is no copy of the items made; rather
+ * they are added into the new hash through a secondary hash
+ * hash handle that must be present in the structure. */
+#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \
+ do { \
+ unsigned _src_bkt, _dst_bkt; \
+ void * _last_elt = NULL, *_elt; \
+ UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh = NULL; \
+ ptrdiff_t _dst_hho = ((char *)(&(dst)->hh_dst) - (char *)(dst)); \
+ if ((src) != NULL) { \
+ for (_src_bkt = 0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \
+ for (_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; _src_hh != NULL; \
+ _src_hh = _src_hh->hh_next) { \
+ _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \
+ if (cond(_elt)) { \
+ IF_HASH_NONFATAL_OOM(int _hs_oomed = 0;) \
+ _dst_hh = (UT_hash_handle *)(void *)(((char *)_elt) + _dst_hho); \
+ _dst_hh->key = _src_hh->key; \
+ _dst_hh->keylen = _src_hh->keylen; \
+ _dst_hh->hashv = _src_hh->hashv; \
+ _dst_hh->prev = _last_elt; \
+ _dst_hh->next = NULL; \
+ if (_last_elt_hh != NULL) { \
+ _last_elt_hh->next = _elt; \
+ } \
+ if ((dst) == NULL) { \
+ DECLTYPE_ASSIGN(dst, _elt); \
+ HASH_MAKE_TABLE(hh_dst, dst, _hs_oomed); \
+ IF_HASH_NONFATAL_OOM(if (_hs_oomed) { \
+ uthash_nonfatal_oom(_elt); \
+ (dst) = NULL; \
+ continue; \
+ }) \
+ } \
+ else { \
+ _dst_hh->tbl = (dst)->hh_dst.tbl; \
+ } \
+ HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \
+ HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt], hh_dst, _dst_hh, _hs_oomed); \
+ (dst)->hh_dst.tbl->num_items++; \
+ IF_HASH_NONFATAL_OOM(if (_hs_oomed) { \
+ HASH_ROLLBACK_BKT(hh_dst, dst, _dst_hh); \
+ HASH_DELETE_HH(hh_dst, dst, _dst_hh); \
+ _dst_hh->tbl = NULL; \
+ uthash_nonfatal_oom(_elt); \
+ continue; \
+ }) \
+ HASH_BLOOM_ADD(_dst_hh->tbl, _dst_hh->hashv); \
+ _last_elt = _elt; \
+ _last_elt_hh = _dst_hh; \
+ } \
+ } \
+ } \
+ } \
+ HASH_FSCK(hh_dst, dst, "HASH_SELECT"); \
+ } while (0)
+
+#define HASH_CLEAR(hh, head) \
+ do { \
+ if ((head) != NULL) { \
+ HASH_BLOOM_FREE((head)->hh.tbl); \
+ uthash_free((head)->hh.tbl->buckets, \
+ (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \
+ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
+ (head) = NULL; \
+ } \
+ } while (0)
+
+#define HASH_OVERHEAD(hh, head) \
+ (((head) != NULL) ? ((size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \
+ ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \
+ sizeof(UT_hash_table) + (HASH_BLOOM_BYTELEN))) \
+ : 0U)
+
+#ifdef NO_DECLTYPE
+#define HASH_ITER(hh, head, el, tmp) \
+ for (((el) = (head)), ((*(char **)(&(tmp))) = (char *)((head != NULL) ? (head)->hh.next : NULL)); \
+ (el) != NULL; \
+ ((el) = (tmp)), ((*(char **)(&(tmp))) = (char *)((tmp != NULL) ? (tmp)->hh.next : NULL)))
+#else
+#define HASH_ITER(hh, head, el, tmp) \
+ for (((el) = (head)), ((tmp) = DECLTYPE(el)((head != NULL) ? (head)->hh.next : NULL)); (el) != NULL; \
+ ((el) = (tmp)), ((tmp) = DECLTYPE(el)((tmp != NULL) ? (tmp)->hh.next : NULL)))
+#endif
+
+/* obtain a count of items in the hash */
+#define HASH_COUNT(head) HASH_CNT(hh, head)
+#define HASH_CNT(hh, head) ((head != NULL) ? ((head)->hh.tbl->num_items) : 0U)
+
+typedef struct UT_hash_bucket {
+ struct UT_hash_handle *hh_head;
+ unsigned count;
+
+ /* expand_mult is normally set to 0. In this situation, the max chain length
+ * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If
+ * the bucket's chain exceeds this length, bucket expansion is triggered).
+ * However, setting expand_mult to a non-zero value delays bucket expansion
+ * (that would be triggered by additions to this particular bucket)
+ * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH.
+ * (The multiplier is simply expand_mult+1). The whole idea of this
+ * multiplier is to reduce bucket expansions, since they are expensive, in
+ * situations where we know that a particular bucket tends to be overused.
+ * It is better to let its chain length grow to a longer yet-still-bounded
+ * value, than to do an O(n) bucket expansion too often.
+ */
+ unsigned expand_mult;
+
+} UT_hash_bucket;
+
+/* random signature used only to find hash tables in external analysis */
+#define HASH_SIGNATURE 0xa0111fe1u
+#define HASH_BLOOM_SIGNATURE 0xb12220f2u
+
+typedef struct UT_hash_table {
+ UT_hash_bucket * buckets;
+ unsigned num_buckets, log2_num_buckets;
+ unsigned num_items;
+ struct UT_hash_handle *tail; /* tail hh in app order, for fast append */
+ ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */
+
+ /* in an ideal situation (all buckets used equally), no bucket would have
+ * more than ceil(#items/#buckets) items. that's the ideal chain length. */
+ unsigned ideal_chain_maxlen;
+
+ /* nonideal_items is the number of items in the hash whose chain position
+ * exceeds the ideal chain maxlen. these items pay the penalty for an uneven
+ * hash distribution; reaching them in a chain traversal takes >ideal steps */
+ unsigned nonideal_items;
+
+ /* ineffective expands occur when a bucket doubling was performed, but
+ * afterward, more than half the items in the hash had nonideal chain
+ * positions. If this happens on two consecutive expansions we inhibit any
+ * further expansion, as it's not helping; this happens when the hash
+ * function isn't a good fit for the key domain. When expansion is inhibited
+ * the hash will still work, albeit no longer in constant time. */
+ unsigned ineff_expands, noexpand;
+
+ uint32_t signature; /* used only to find hash tables in external analysis */
+#ifdef HASH_BLOOM
+ uint32_t bloom_sig; /* used only to test bloom exists in external analysis */
+ uint8_t *bloom_bv;
+ uint8_t bloom_nbits;
+#endif
+
+} UT_hash_table;
+
+typedef struct UT_hash_handle {
+ struct UT_hash_table * tbl;
+ void * prev; /* prev element in app order */
+ void * next; /* next element in app order */
+ struct UT_hash_handle *hh_prev; /* previous hh in bucket order */
+ struct UT_hash_handle *hh_next; /* next hh in bucket order */
+ void * key; /* ptr to enclosing struct's key */
+ unsigned keylen; /* enclosing struct's key len */
+ unsigned hashv; /* result of hash-fcn(key) */
+} UT_hash_handle;
+
+#endif /* UTHASH_H */