summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMuqun Yang <myang6@hdfgroup.org>2021-05-21 16:08:07 (GMT)
committerMuqun Yang <myang6@hdfgroup.org>2021-05-21 16:08:07 (GMT)
commitada0e3ae61d6247c24ed34f04eac50cb66f6e3aa (patch)
tree2cd06794865b5396b2c1f47c906ea68ca2e58bf6 /src
parent2f2a75aefb348dacd6ac48dcdba5f6a16232ef6d (diff)
parent7ebc6f267dd7d96953fb214005a929b7d4d881ee (diff)
downloadhdf5-ada0e3ae61d6247c24ed34f04eac50cb66f6e3aa.zip
hdf5-ada0e3ae61d6247c24ed34f04eac50cb66f6e3aa.tar.gz
hdf5-ada0e3ae61d6247c24ed34f04eac50cb66f6e3aa.tar.bz2
Merge remote-tracking branch 'upstream/feature/vfd_swmr' into feature/vfd_swmr
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt31
-rw-r--r--src/H5.c37
-rw-r--r--src/H5ACmpio.c17
-rw-r--r--src/H5Abtree2.c12
-rw-r--r--src/H5Adense.c16
-rw-r--r--src/H5Adeprec.c12
-rw-r--r--src/H5Aint.c27
-rw-r--r--src/H5Amodule.h40
-rw-r--r--src/H5Apublic.h56
-rw-r--r--src/H5B.c19
-rw-r--r--src/H5B2.c3
-rw-r--r--src/H5B2cache.c30
-rw-r--r--src/H5B2dbg.c20
-rw-r--r--src/H5B2hdr.c3
-rw-r--r--src/H5B2int.c122
-rw-r--r--src/H5B2internal.c12
-rw-r--r--src/H5B2leaf.c23
-rw-r--r--src/H5B2stat.c2
-rw-r--r--src/H5B2test.c6
-rw-r--r--src/H5Bcache.c9
-rw-r--r--src/H5Bdbg.c11
-rw-r--r--src/H5C.c211
-rw-r--r--src/H5CX.c2
-rw-r--r--src/H5Cdbg.c51
-rw-r--r--src/H5D.c290
-rw-r--r--src/H5Dbtree.c9
-rw-r--r--src/H5Dbtree2.c21
-rw-r--r--src/H5Dchunk.c178
-rw-r--r--src/H5Dcompact.c6
-rw-r--r--src/H5Dcontig.c6
-rw-r--r--src/H5Ddbg.c3
-rw-r--r--src/H5Ddeprec.c10
-rw-r--r--src/H5Dearray.c12
-rw-r--r--src/H5Defl.c5
-rw-r--r--src/H5Dfarray.c12
-rw-r--r--src/H5Dfill.c56
-rw-r--r--src/H5Dint.c60
-rw-r--r--src/H5Dio.c2
-rw-r--r--src/H5Dmodule.h38
-rw-r--r--src/H5Dmpio.c32
-rw-r--r--src/H5Dnone.c4
-rw-r--r--src/H5Doh.c2
-rw-r--r--src/H5Dpkg.h1
-rw-r--r--src/H5Dpublic.h1561
-rw-r--r--src/H5Dscatgath.c197
-rw-r--r--src/H5Dsingle.c4
-rw-r--r--src/H5Dtest.c2
-rw-r--r--src/H5Dvirtual.c16
-rw-r--r--src/H5E.c220
-rw-r--r--src/H5EA.c25
-rw-r--r--src/H5EAcache.c46
-rw-r--r--src/H5EAdbg.c39
-rw-r--r--src/H5EAdblkpage.c7
-rw-r--r--src/H5EAdblock.c9
-rw-r--r--src/H5EAhdr.c16
-rw-r--r--src/H5EAiblock.c34
-rw-r--r--src/H5EAint.c4
-rw-r--r--src/H5EAstat.c9
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5ESpublic.h83
-rw-r--r--src/H5Edeprec.c19
-rw-r--r--src/H5Eint.c39
-rw-r--r--src/H5Emodule.h29
-rw-r--r--src/H5Eprivate.h13
-rw-r--r--src/H5Epublic.h797
-rw-r--r--src/H5F.c214
-rw-r--r--src/H5FA.c3
-rw-r--r--src/H5FAcache.c22
-rw-r--r--src/H5FAdbg.c23
-rw-r--r--src/H5FAhdr.c4
-rw-r--r--src/H5FAint.c2
-rw-r--r--src/H5FAstat.c6
-rw-r--r--src/H5FD.c62
-rw-r--r--src/H5FDcore.c68
-rw-r--r--src/H5FDdirect.c300
-rw-r--r--src/H5FDfamily.c618
-rw-r--r--src/H5FDhdfs.c1
-rw-r--r--src/H5FDint.c44
-rw-r--r--src/H5FDlog.c565
-rw-r--r--src/H5FDlog.h405
-rw-r--r--src/H5FDmirror.c889
-rw-r--r--src/H5FDmirror.h291
-rw-r--r--src/H5FDmirror_priv.h317
-rw-r--r--src/H5FDmpi.h8
-rw-r--r--src/H5FDmpio.c128
-rw-r--r--src/H5FDmpio.h225
-rw-r--r--src/H5FDmulti.c893
-rw-r--r--src/H5FDmulti.h219
-rw-r--r--src/H5FDprivate.h1
-rw-r--r--src/H5FDpublic.h90
-rw-r--r--src/H5FDros3.c598
-rw-r--r--src/H5FDros3.h14
-rw-r--r--src/H5FDs3comms.c1067
-rw-r--r--src/H5FDsec2.c250
-rw-r--r--src/H5FDspace.c14
-rw-r--r--src/H5FDsplitter.c767
-rw-r--r--src/H5FDsplitter.h14
-rw-r--r--src/H5FDstdio.c140
-rw-r--r--src/H5FDstdio.h16
-rw-r--r--src/H5FDtest.c3
-rw-r--r--src/H5FDvfd_swmr.c3
-rw-r--r--src/H5FDwindows.h30
-rw-r--r--src/H5FL.c2
-rw-r--r--src/H5FS.c11
-rw-r--r--src/H5FScache.c12
-rw-r--r--src/H5FSdbg.c21
-rw-r--r--src/H5FSint.c2
-rw-r--r--src/H5FSsection.c156
-rw-r--r--src/H5Faccum.c8
-rw-r--r--src/H5Fcwfs.c2
-rw-r--r--src/H5Fdbg.c14
-rw-r--r--src/H5Fdeprec.c6
-rw-r--r--src/H5Fefc.c2
-rw-r--r--src/H5Ffake.c2
-rw-r--r--src/H5Fint.c49
-rw-r--r--src/H5Fio.c18
-rw-r--r--src/H5Fmodule.h30
-rw-r--r--src/H5Fmount.c127
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5Fquery.c1
-rw-r--r--src/H5Fsfile.c30
-rw-r--r--src/H5Fspace.c2
-rw-r--r--src/H5Fsuper.c14
-rw-r--r--src/H5Fsuper_cache.c14
-rw-r--r--src/H5Gbtree2.c154
-rw-r--r--src/H5Gcompact.c20
-rw-r--r--src/H5Gdense.c169
-rw-r--r--src/H5Gdeprec.c2
-rw-r--r--src/H5Gent.c18
-rw-r--r--src/H5Gint.c7
-rw-r--r--src/H5Glink.c48
-rw-r--r--src/H5Gloc.c17
-rw-r--r--src/H5Gmodule.h91
-rw-r--r--src/H5Gname.c1
-rw-r--r--src/H5Gnode.c102
-rw-r--r--src/H5Goh.c2
-rw-r--r--src/H5Groot.c4
-rw-r--r--src/H5Gstab.c39
-rw-r--r--src/H5Gtest.c2
-rw-r--r--src/H5Gtraverse.c15
-rw-r--r--src/H5HF.c65
-rw-r--r--src/H5HFbtree2.c18
-rw-r--r--src/H5HFcache.c48
-rw-r--r--src/H5HFdbg.c122
-rw-r--r--src/H5HFdblock.c47
-rw-r--r--src/H5HFdtable.c73
-rw-r--r--src/H5HFhdr.c255
-rw-r--r--src/H5HFhuge.c97
-rw-r--r--src/H5HFiblock.c121
-rw-r--r--src/H5HFiter.c133
-rw-r--r--src/H5HFman.c41
-rw-r--r--src/H5HFpkg.h134
-rw-r--r--src/H5HFprivate.h17
-rw-r--r--src/H5HFsection.c434
-rw-r--r--src/H5HFspace.c42
-rw-r--r--src/H5HFstat.c2
-rw-r--r--src/H5HFtest.c21
-rw-r--r--src/H5HFtiny.c86
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HGdbg.c3
-rw-r--r--src/H5HGquery.c2
-rw-r--r--src/H5HL.c8
-rw-r--r--src/H5HLcache.c10
-rw-r--r--src/H5HLdbg.c11
-rw-r--r--src/H5HLdblk.c2
-rw-r--r--src/H5HLint.c2
-rw-r--r--src/H5HLprfx.c2
-rw-r--r--src/H5HP.c72
-rw-r--r--src/H5I.c1860
-rw-r--r--src/H5Idbg.c205
-rw-r--r--src/H5Iint.c1790
-rw-r--r--src/H5Imodule.h2
-rw-r--r--src/H5Ipkg.h60
-rw-r--r--src/H5Iprivate.h6
-rw-r--r--src/H5Ipublic.h752
-rw-r--r--src/H5Itest.c10
-rw-r--r--src/H5Lexternal.c15
-rw-r--r--src/H5Lmodule.h2
-rw-r--r--src/H5M.c4
-rw-r--r--src/H5MFdbg.c26
-rw-r--r--src/H5MM.c17
-rw-r--r--src/H5MMpublic.h5
-rw-r--r--src/H5MP.c30
-rw-r--r--src/H5MPtest.c20
-rw-r--r--src/H5Mmodule.h45
-rw-r--r--src/H5Mpublic.h363
-rw-r--r--src/H5Oainfo.c75
-rw-r--r--src/H5Oalloc.c27
-rw-r--r--src/H5Oattr.c152
-rw-r--r--src/H5Oattribute.c11
-rw-r--r--src/H5Obogus.c40
-rw-r--r--src/H5Obtreek.c62
-rw-r--r--src/H5Ocache.c9
-rw-r--r--src/H5Ocache_image.c41
-rw-r--r--src/H5Ochunk.c2
-rw-r--r--src/H5Ocont.c2
-rw-r--r--src/H5Odbg.c25
-rw-r--r--src/H5Odeprec.c31
-rw-r--r--src/H5Odrvinfo.c64
-rw-r--r--src/H5Odtype.c183
-rw-r--r--src/H5Oefl.c74
-rw-r--r--src/H5Ofill.c180
-rw-r--r--src/H5Oflush.c18
-rw-r--r--src/H5Ofsinfo.c231
-rw-r--r--src/H5Oginfo.c63
-rw-r--r--src/H5Oint.c55
-rw-r--r--src/H5Olayout.c54
-rw-r--r--src/H5Olinfo.c65
-rw-r--r--src/H5Olink.c70
-rw-r--r--src/H5Omessage.c34
-rw-r--r--src/H5Omtime.c92
-rw-r--r--src/H5Oname.c55
-rw-r--r--src/H5Onull.c1
-rw-r--r--src/H5Opline.c133
-rw-r--r--src/H5Orefcount.c99
-rw-r--r--src/H5Osdspace.c132
-rw-r--r--src/H5Oshared.c9
-rw-r--r--src/H5Oshmesg.c41
-rw-r--r--src/H5Ostab.c18
-rw-r--r--src/H5Ounknown.c2
-rw-r--r--src/H5P.c30
-rw-r--r--src/H5Pdapl.c96
-rw-r--r--src/H5Pdcpl.c130
-rw-r--r--src/H5Pdeprec.c8
-rw-r--r--src/H5Pdxpl.c71
-rw-r--r--src/H5Pencdec.c2
-rw-r--r--src/H5Pfapl.c96
-rw-r--r--src/H5Pfcpl.c115
-rw-r--r--src/H5Pfmpl.c14
-rw-r--r--src/H5Pgcpl.c18
-rw-r--r--src/H5Pint.c22
-rw-r--r--src/H5Plapl.c40
-rw-r--r--src/H5Plcpl.c18
-rw-r--r--src/H5Pmapl.c8
-rw-r--r--src/H5Pmodule.h5
-rw-r--r--src/H5Pocpl.c125
-rw-r--r--src/H5Pocpypl.c18
-rw-r--r--src/H5Pstrcpl.c6
-rw-r--r--src/H5Ptest.c6
-rw-r--r--src/H5S.c95
-rw-r--r--src/H5SM.c22
-rw-r--r--src/H5SMbtree2.c6
-rw-r--r--src/H5ST.c779
-rw-r--r--src/H5STprivate.h63
-rw-r--r--src/H5Sall.c2
-rw-r--r--src/H5Sdbg.c1
-rw-r--r--src/H5Sdeprec.c1
-rw-r--r--src/H5Shyper.c56
-rw-r--r--src/H5Smpio.c28
-rw-r--r--src/H5Snone.c2
-rw-r--r--src/H5Spkg.h8
-rw-r--r--src/H5Spoint.c46
-rw-r--r--src/H5Sprivate.h3
-rw-r--r--src/H5Spublic.h1298
-rw-r--r--src/H5Sselect.c143
-rw-r--r--src/H5Stest.c2
-rw-r--r--src/H5T.c66
-rw-r--r--src/H5Tarray.c12
-rw-r--r--src/H5Tcompound.c18
-rw-r--r--src/H5Tconv.c164
-rw-r--r--src/H5Tcset.c8
-rw-r--r--src/H5Tdbg.c22
-rw-r--r--src/H5Tdeprec.c2
-rw-r--r--src/H5Tenum.c57
-rw-r--r--src/H5Tfields.c13
-rw-r--r--src/H5Tfixed.c9
-rw-r--r--src/H5Tfloat.c4
-rw-r--r--src/H5Tmodule.h4
-rw-r--r--src/H5Tnative.c26
-rw-r--r--src/H5Toffset.c20
-rw-r--r--src/H5Toh.c2
-rw-r--r--src/H5Topaque.c4
-rw-r--r--src/H5Torder.c14
-rw-r--r--src/H5Tpad.c8
-rw-r--r--src/H5Tpkg.h2
-rw-r--r--src/H5Tprecis.c12
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5Tref.c70
-rw-r--r--src/H5Tstrpad.c8
-rw-r--r--src/H5Tvisit.c2
-rw-r--r--src/H5Tvlen.c10
-rw-r--r--src/H5VLconnector.h117
-rw-r--r--src/H5VLint.c293
-rw-r--r--src/H5VLmodule.h4
-rw-r--r--src/H5VLnative.c36
-rw-r--r--src/H5VLnative.h21
-rw-r--r--src/H5VLnative_blob.c2
-rw-r--r--src/H5VLnative_dataset.c23
-rw-r--r--src/H5VLnative_file.c21
-rw-r--r--src/H5VLnative_object.c2
-rw-r--r--src/H5VLpassthru.c3
-rw-r--r--src/H5VLprivate.h16
-rw-r--r--src/H5VLpublic.h335
-rw-r--r--src/H5VM.c77
-rw-r--r--src/H5WB.c6
-rw-r--r--src/H5Z.c145
-rw-r--r--src/H5Zdeflate.c32
-rw-r--r--src/H5Zfletcher32.c39
-rw-r--r--src/H5Zmodule.h8
-rw-r--r--src/H5Znbit.c361
-rw-r--r--src/H5Zprivate.h2
-rw-r--r--src/H5Zpublic.h680
-rw-r--r--src/H5Zscaleoffset.c589
-rw-r--r--src/H5Zshuffle.c60
-rw-r--r--src/H5Zszip.c58
-rw-r--r--src/H5Ztrans.c378
-rw-r--r--src/H5err.txt27
-rw-r--r--src/H5private.h34
-rw-r--r--src/H5public.h234
-rw-r--r--src/H5system.c421
-rw-r--r--src/H5trace.c65
-rw-r--r--src/Makefile.am6
-rw-r--r--src/hdf5.h1
-rw-r--r--src/uthash.h1184
315 files changed, 19683 insertions, 12996 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index adfb755..fa42d6d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -385,6 +385,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
@@ -606,14 +608,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
@@ -807,7 +801,6 @@ set (common_SRCS
${H5S_SOURCES}
${H5SL_SOURCES}
${H5SM_SOURCES}
- ${H5ST_SOURCES}
${H5T_SOURCES}
${H5TS_SOURCES}
${H5VL_SOURCES}
@@ -898,6 +891,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
${HDF5_SRC_DIR}/H5FDvfd_swmr_private.h
@@ -932,6 +926,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
@@ -968,8 +963,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
@@ -989,6 +982,8 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5Zprivate.h
${HDF5_SRC_DIR}/H5win32defs.h
+
+ ${HDF5_SRC_DIR}/uthash.h
)
set (H5_GENERATED_HEADERS
@@ -1406,8 +1401,8 @@ endif ()
# Option to build documentation
#-----------------------------------------------------------------------------
if (DOXYGEN_FOUND)
- set (DOXYGEN_PACKAGE ${HDF5_PACKAGE})
- set (DOXYGEN_VERSION_STRING ${HDF5_VERSION_STRING})
+ 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)
@@ -1417,7 +1412,15 @@ if (DOXYGEN_FOUND)
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)
+ 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
diff --git a/src/H5.c b/src/H5.c
index 62ea257..adbd3a7 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -254,6 +254,8 @@ H5_init_library(void)
* It might not be initialized during normal file open.
* When the application does not close the file, routines in the module might
* be called via H5_term_library() when shutting down the file.
+ * The dataspace interface needs to be initialized so that future IDs for
+ * dataspaces work.
*/
if (H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
@@ -271,6 +273,8 @@ H5_init_library(void)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize link interface")
if (H5FS_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
+ if (H5S_init() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataspace interface")
/* Finish initializing interfaces that depend on the interfaces above */
if (H5VL_init_phase2() < 0)
@@ -361,21 +365,26 @@ H5_term_library(void)
/* Try to organize these so the "higher" level components get shut
* down before "lower" level components that they might rely on. -QAK
*/
- pending += DOWN(L);
- /* Close the "top" of various interfaces (IDs, etc) but don't shut
- * down the whole interface yet, so that the object header messages
- * get serialized correctly for entries in the metadata cache and the
- * symbol table entry in the superblock gets serialized correctly, etc.
- * all of which is performed in the 'F' shutdown.
- */
- pending += DOWN(A_top);
- pending += DOWN(D_top);
- pending += DOWN(G_top);
- pending += DOWN(M_top);
- pending += DOWN(R_top);
- pending += DOWN(S_top);
- pending += DOWN(T_top);
+ /* Close down the user-facing interfaces, after the event sets */
+ if (pending == 0) {
+ /* Close the interfaces dependent on others */
+ pending += DOWN(L);
+
+ /* Close the "top" of various interfaces (IDs, etc) but don't shut
+ * down the whole interface yet, so that the object header messages
+ * get serialized correctly for entries in the metadata cache and the
+ * symbol table entry in the superblock gets serialized correctly, etc.
+ * all of which is performed in the 'F' shutdown.
+ */
+ pending += DOWN(A_top);
+ pending += DOWN(D_top);
+ pending += DOWN(G_top);
+ pending += DOWN(M_top);
+ pending += DOWN(R_top);
+ pending += DOWN(S_top);
+ pending += DOWN(T_top);
+ } /* end if */
/* Don't shut down the file code until objects in files are shut down */
if (pending == 0)
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index b0b54eb..afc15d1 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -1271,7 +1271,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)))
@@ -1514,7 +1514,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.")
@@ -1848,6 +1848,8 @@ done:
* Programmer: John Mainzer
* April 28, 2010
*
+ * Changes: None.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1876,9 +1878,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) {
@@ -2075,9 +2080,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) ||
@@ -2157,6 +2166,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() */
@@ -2252,7 +2262,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/H5Abtree2.c b/src/H5Abtree2.c
index adca15a..3274dd7 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -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 a1c0de6..1575f3c 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -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.
@@ -199,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
{
@@ -211,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 */
@@ -233,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) {
@@ -254,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 */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index ba12d4c..3d4e391 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -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
@@ -209,7 +209,7 @@ H5Aopen_name(hid_t loc_id, const char *name)
/* 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 handle")
done:
/* Clean up on failure */
@@ -277,7 +277,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
/* 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 handle")
done:
/* Clean up on failure */
@@ -373,7 +373,7 @@ done:
Deprecated in favor of H5Aiterate2
--------------------------------------------------------------------------*/
herr_t
-H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
+H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, void *op_data)
{
H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
herr_t ret_value; /* Return value */
@@ -387,12 +387,12 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
/* Get the location object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+ HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
if ((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0)
- HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
+ HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Aint.c b/src/H5Aint.c
index f323494..9bbf031 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -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.
*
@@ -589,7 +589,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute*/
H5T_path_t *tpath = NULL; /* type conversion info */
- hid_t src_id = -1, dst_id = -1; /* temporary type atoms*/
+ hid_t src_id = -1, dst_id = -1; /* temporary type IDs*/
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type */
size_t buf_size; /* desired buffer size */
@@ -698,7 +698,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute */
H5T_path_t *tpath = NULL; /* conversion information*/
- hid_t src_id = -1, dst_id = -1; /* temporary type atoms */
+ hid_t src_id = -1, dst_id = -1; /* temporary type IDs */
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type*/
size_t buf_size; /* desired buffer size */
@@ -856,9 +856,9 @@ H5A_get_space(H5A_t *attr)
if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0)
@@ -906,18 +906,18 @@ H5A__get_type(H5A_t *attr)
if (H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype")
- /* Atomize */
+ /* Register */
if (H5T_is_named(dt)) {
/* If this is a committed datatype, we need to recreate the
* two level IDs, where the VOL object is a copy of the
* returned datatype
*/
if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle")
}
else {
if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
}
done:
@@ -2189,10 +2189,10 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, NULL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, NULL, "unable to register dataspace ID")
} /* end if */
/* Allocate memory for recclaim buf */
@@ -2380,7 +2380,6 @@ done:
* Failure: Negative
*
* Programmer: Peter Cao
- * xcao@hdfgroup.org
* July 20, 2007
*
*-------------------------------------------------------------------------
@@ -2498,7 +2497,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;
@@ -2601,7 +2600,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
/* Get an ID for the object */
if ((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype");
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype");
/* Call internal attribute iteration routine */
if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
diff --git a/src/H5Amodule.h b/src/H5Amodule.h
index 45172bf..c89c93f 100644
--- a/src/H5Amodule.h
+++ b/src/H5Amodule.h
@@ -30,19 +30,39 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5A H5A
- * \brief Attribute Interface
*
- * \details The Attribute Interface, H5A, provides a mechanism for attaching
- * additional information to a dataset, group, or named datatype.
+ * Use the functions in this module to manage HDF5 attributes.
*
- * 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.
+ * The Attribute Interface, H5A, provides a mechanism for attaching additional
+ * information to a dataset, group, or named datatype.
*
- * 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.
+ * 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>
*
*/
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 28a0e85..6ec9144 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -22,17 +22,40 @@
#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 */
@@ -95,9 +118,28 @@ 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);
diff --git a/src/H5B.c b/src/H5B.c
index 1650736..8a92e1a 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -13,9 +13,9 @@
/*-------------------------------------------------------------------------
*
- * 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
@@ -199,7 +199,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -283,7 +282,6 @@ done:
* UDATA is undefined).
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -336,6 +334,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
else
lt = idx + 1;
} /* end while */
+
/* Check if not found */
if (cmp)
HGOTO_DONE(FALSE)
@@ -378,7 +377,6 @@ done:
* returned through the NEW_ADDR argument). Negative on failure.
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 3 1997
*
*-------------------------------------------------------------------------
@@ -531,7 +529,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -687,7 +684,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 8 1997
*
*-------------------------------------------------------------------------
@@ -773,7 +769,6 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5
* Failure: H5B_INS_ERROR
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 9 1997
*
*-------------------------------------------------------------------------
@@ -1113,7 +1108,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -1178,7 +1172,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jun 23 1997
*
*-------------------------------------------------------------------------
@@ -1672,7 +1665,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 27 2008
*
*-------------------------------------------------------------------------
@@ -1777,7 +1769,6 @@ H5B_shared_free(void *_shared)
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Apr 18 2000
*
*-------------------------------------------------------------------------
@@ -1842,7 +1833,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jun 3 2008
*
*-------------------------------------------------------------------------
@@ -2052,7 +2042,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 26, 2008
*
*-------------------------------------------------------------------------
diff --git a/src/H5B2.c b/src/H5B2.c
index 320fe17..5453387 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -1509,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 35351d9..f38147b 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -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.
*
@@ -159,7 +159,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
*
*-------------------------------------------------------------------------
@@ -226,7 +225,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
*
*-------------------------------------------------------------------------
@@ -255,7 +253,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;
@@ -324,7 +322,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -354,7 +351,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
*
*-------------------------------------------------------------------------
@@ -424,7 +420,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
*
*-------------------------------------------------------------------------
@@ -515,7 +510,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mike McGreevy
- * mcgreevy@hdfgroup.org
* June 18, 2008
*
*-------------------------------------------------------------------------
@@ -546,7 +540,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 18, 2010
*
*-------------------------------------------------------------------------
@@ -620,7 +613,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
*
*-------------------------------------------------------------------------
@@ -659,7 +651,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;
@@ -743,7 +735,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -775,7 +766,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
*
*-------------------------------------------------------------------------
@@ -861,7 +851,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Neil Fortner
- * nfortne2@hdfgroup.org
* Apr 25 2012
*
*-------------------------------------------------------------------------
@@ -872,7 +861,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.
@@ -939,7 +928,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mike McGreevy
- * mcgreevy@hdfgroup.org
* June 18, 2008
*
*-------------------------------------------------------------------------
@@ -971,7 +959,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 18, 2010
*
*-------------------------------------------------------------------------
@@ -1044,7 +1031,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
*
*-------------------------------------------------------------------------
@@ -1081,7 +1067,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;
@@ -1142,7 +1128,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -1173,7 +1158,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
*
*-------------------------------------------------------------------------
@@ -1246,7 +1230,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Neil Fortner
- * nfortne2@hdfgroup.org
* Apr 25 2012
*
*-------------------------------------------------------------------------
@@ -1257,7 +1240,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.
@@ -1324,7 +1307,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 3832b9c..711b200 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -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 e956fb5..bdde5ba 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -564,7 +564,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 18 2015
*
*-------------------------------------------------------------------------
@@ -596,7 +595,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 2 2005
*
*-------------------------------------------------------------------------
@@ -674,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 745fd2a..610da6c 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -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 9491c55..c00f555 100644
--- a/src/H5B2internal.c
+++ b/src/H5B2internal.c
@@ -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 f60259b..20ace84 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -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,7 +1029,6 @@ 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
*
*-------------------------------------------------------------------------
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 936e356..4735276 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -11,7 +11,7 @@
* 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 ca347ee..2b84332 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -11,7 +11,7 @@
* 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 f839673..9af146e 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -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.
*
@@ -90,7 +90,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
*
*-------------------------------------------------------------------------
@@ -126,7 +125,6 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len)
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Mar 24, 2008
*
*-------------------------------------------------------------------------
@@ -169,7 +167,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;
@@ -231,7 +229,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* May 20, 2010
*
*-------------------------------------------------------------------------
@@ -266,7 +263,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
*
*-------------------------------------------------------------------------
@@ -350,7 +346,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 f8a86b7..23d0a8f 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -95,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);
@@ -110,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) {
diff --git a/src/H5C.c b/src/H5C.c
index 222b836..958f334 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -19,13 +19,7 @@
*
* 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.
- *
- * 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.
+ * unambiguously referenced by their disk addresses.
*
* For a detailed overview of the cache, please see the
* header comment for H5C_t in H5Cpkg.h.
@@ -494,13 +488,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
*
*-------------------------------------------------------------------------
*/
@@ -531,19 +525,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, old_max_cache_size, old_min_clean_size, new_max_cache_size,
- new_min_clean_size);
+ 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;
@@ -584,21 +577,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:
@@ -616,16 +608,13 @@ 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() */
/*-------------------------------------------------------------------------
@@ -807,9 +796,12 @@ H5C_dest(H5F_t *f)
#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;
@@ -1308,47 +1300,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
*
*-------------------------------------------------------------------------
*/
@@ -1474,24 +1466,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
*
*-------------------------------------------------------------------------
*/
@@ -1536,12 +1528,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
*
*-------------------------------------------------------------------------
*/
@@ -1553,8 +1545,7 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u
hbool_t insert_pinned;
hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access = FALSE; /* whether access to the cache */
- /* entry is done collectively */
+ hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
#endif /* H5_HAVE_PARALLEL */
hbool_t set_flush_marker;
hbool_t write_permitted = TRUE;
@@ -2520,16 +2511,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
@@ -2987,19 +2978,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
*
*-------------------------------------------------------------------------
*/
@@ -3122,7 +3113,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.
*/
@@ -3310,20 +3301,20 @@ 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
*
@@ -3396,11 +3387,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 */
@@ -3408,26 +3401,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
@@ -3457,6 +3459,7 @@ 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 */
@@ -3464,15 +3467,18 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
if (dirtied)
if (entry_ptr->image_up_to_date) {
+
entry_ptr->image_up_to_date = FALSE;
if (entry_ptr->flush_dep_nparents > 0)
if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
+
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
"Can't propagate serialization status to fd parents")
} /* end if */
/* 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)
@@ -3487,6 +3493,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* 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 */
@@ -3503,18 +3510,23 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* 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 */
@@ -3529,6 +3541,7 @@ 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)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
diff --git a/src/H5CX.c b/src/H5CX.c
index cff06f6..c304548 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -1371,7 +1371,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
/* Get the plist structure for the access property list */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id)))
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADID, FAIL, "can't find object for ID")
/* Get the collective metadata read flag */
if (H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0)
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 462e926..87b81dc 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -250,11 +250,12 @@ 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
*
@@ -283,41 +284,58 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn)
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;
+ i = 0;
+
node_ptr = H5SL_first(cache_ptr->slist_ptr);
- if (node_ptr != NULL)
+
+ if (node_ptr != NULL) {
+
entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- else
+ }
+ else {
+
entry_ptr = NULL;
+ }
while (entry_ptr != NULL) {
+
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDfprintf(stdout, "%s%d 0x%016" PRIxHADDR " %4zu %d/%d %d %s\n",
- cache_ptr->prefix, i, entry_ptr->addr, entry_ptr->size, (int)(entry_ptr->is_protected),
- (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), entry_ptr->type->name);
+ 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));
+ 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++;
+
} /* end while */
} /* end if */
HDfprintf(stdout, "\n\n");
FUNC_LEAVE_NOAPI(ret_value)
+
} /* H5C_dump_cache_skip_list() */
#endif /* NDEBUG */
@@ -392,13 +410,14 @@ H5C_dump_coll_write_list(H5C_t *cache_ptr, char *calling_fcn)
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++;
@@ -686,8 +705,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,
diff --git a/src/H5D.c b/src/H5D.c
index d60465e..cb2a720 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -53,6 +53,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
@@ -138,7 +141,7 @@ 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 ID for the dataset */
if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
@@ -187,9 +190,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)
@@ -222,7 +225,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t
dcpl_id, dapl_id, 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 */
+ /* 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 register dataset")
@@ -374,13 +377,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
+H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* Dataset structure */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Ds", dset_id, allocation);
+ H5TRACE2("e", "ix", dset_id, allocation);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -594,6 +597,253 @@ done:
} /* end H5Dget_offset() */
/*-------------------------------------------------------------------------
+ * Function: H5Dscatter
+ *
+ * Purpose: Scatters data provided by the callback op to the
+ * destination buffer dst_buf, where the dimensions of
+ * dst_buf and the selection to be scattered to are specified
+ * by the dataspace dst_space_id. The type of the data to be
+ * scattered is specified by type_id.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 14 Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf /*out*/)
+{
+ H5T_t * type; /* Datatype */
+ H5S_t * dst_space; /* Dataspace */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ const void * src_buf = NULL; /* Source (contiguous) data buffer */
+ size_t src_buf_nbytes = 0; /* Size of src_buf */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "DS*xiix", op, op_data, type_id, dst_space_id, dst_buf);
+
+ /* Check args */
+ if (op == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer")
+ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if (dst_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
+
+ /* Get datatype element size */
+ if (0 == (type_size = H5T_GET_SIZE(type)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
+
+ /* Get number of elements in dataspace */
+ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+
+ /* Allocate the selection iterator */
+ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
+ /* Initialize selection iterator */
+ if (H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
+ iter_init = TRUE;
+
+ /* Loop until all data has been scattered */
+ while (nelmts > 0) {
+ /* Make callback to retrieve data */
+ if (op(&src_buf, &src_buf_nbytes, op_data) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
+
+ /* Calculate number of elements */
+ nelmts_scatter = src_buf_nbytes / type_size;
+
+ /* Check callback results */
+ if (!src_buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer")
+ if (src_buf_nbytes == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0")
+ if (src_buf_nbytes % type_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size")
+ if (nelmts_scatter > (size_t)nelmts)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
+
+ /* Scatter data */
+ if (H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
+
+ nelmts -= (hssize_t)nelmts_scatter;
+ } /* end while */
+
+done:
+ /* Release selection iterator */
+ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if (iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
+
+ FUNC_LEAVE_API(ret_value)
+} /* H5Dscatter() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dgather
+ *
+ * Purpose: Gathers data provided from the source buffer src_buf to
+ * contiguous buffer dst_buf, then calls the callback op.
+ * The dimensions of src_buf and the selection to be gathered
+ * are specified by the dataspace src_space_id. The type of
+ * the data to be gathered is specified by type_id.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 16 Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size, void *dst_buf /*out*/,
+ H5D_gather_func_t op, void *op_data)
+{
+ H5T_t * type; /* Datatype */
+ H5S_t * src_space; /* Dataspace */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */
+ size_t nelmts_gathered; /* Number of elements gathered from src_buf */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*xizxDg*x", src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data);
+
+ /* Check args */
+ if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if (src_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided")
+ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if (dst_buf_size == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0")
+ if (dst_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
+
+ /* Get datatype element size */
+ if (0 == (type_size = H5T_GET_SIZE(type)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
+
+ /* Get number of elements in dst_buf_size */
+ dst_buf_nelmts = dst_buf_size / type_size;
+ if (dst_buf_nelmts == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "destination buffer is not large enough to hold one element")
+
+ /* Get number of elements in dataspace */
+ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+
+ /* If dst_buf is not large enough to hold all the elements, make sure there
+ * is a callback */
+ if (((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
+
+ /* Allocate the selection iterator */
+ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
+ /* Initialize selection iterator */
+ if (H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
+ iter_init = TRUE;
+
+ /* Loop until all data has been scattered */
+ while (nelmts > 0) {
+ /* Gather data */
+ if (0 ==
+ (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "gather failed")
+ HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
+
+ /* Make callback to process dst_buf */
+ if (op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
+
+ nelmts -= (hssize_t)nelmts_gathered;
+ HDassert(op || (nelmts == 0));
+ } /* end while */
+
+done:
+ /* Release selection iterator */
+ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if (iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
+
+ FUNC_LEAVE_API(ret_value)
+} /* H5Dgather() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Dfill
+ PURPOSE
+ Fill a selection in memory with a value
+ USAGE
+ herr_t H5Dfill(fill, fill_type, space, buf, buf_type)
+ const void *fill; IN: Pointer to fill value to use
+ hid_t fill_type_id; IN: Datatype of the fill value
+ void *buf; IN/OUT: Memory buffer to fill selection within
+ hid_t buf_type_id; IN: Datatype of the elements in buffer
+ hid_t space_id; IN: Dataspace describing memory buffer &
+ containing selection to use.
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to fill elements in a memory buffer.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ If "fill" parameter is NULL, use all zeros as fill value
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id)
+{
+ H5S_t *space; /* Dataspace */
+ H5T_t *fill_type; /* Fill-value datatype */
+ H5T_t *buf_type; /* Buffer datatype */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "*xi*xii", fill, fill_type_id, buf, buf_type_id, space_id);
+
+ /* Check args */
+ if (buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace")
+ if (NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
+ if (NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
+
+ /* Fill the selection in the memory buffer */
+ if (H5D__fill(fill, fill_type, buf, buf_type, space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Dfill() */
+
+/*-------------------------------------------------------------------------
* Function: H5Diterate
*
* Purpose: This routine iterates over all the elements selected in a memory
@@ -704,14 +954,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size)
+H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size /*out*/)
{
H5VL_object_t *vol_obj; /* Dataset for this operation */
hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size);
+ H5TRACE4("e", "iiix", dataset_id, type_id, space_id, size);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id)))
@@ -727,7 +977,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s
supported = FALSE;
if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE,
&supported) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation")
if (supported) {
/* Make the 'get_vlen_buf_size' callback */
if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT,
@@ -911,13 +1161,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
+H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/)
{
H5VL_object_t *vol_obj; /* Dataset for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Dk", dset_id, idx_type);
+ H5TRACE2("e", "ix", dset_id, idx_type);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -950,13 +1200,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
+H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes /*out*/)
{
H5VL_object_t *vol_obj; /* Dataset for this operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes);
+ H5TRACE3("e", "i*hx", dset_id, offset, chunk_nbytes);
/* Check arguments */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -1043,15 +1293,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask,
- haddr_t *addr, hsize_t *size)
+H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset /*out*/,
+ unsigned *filter_mask /*out*/, haddr_t *addr /*out*/, hsize_t *size /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
hsize_t nchunks = 0;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size);
+ H5TRACE7("e", "iihxxxx", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size);
/* Check arguments */
if (NULL == offset && NULL == filter_mask && NULL == addr && NULL == size)
@@ -1100,14 +1350,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr,
- hsize_t *size)
+H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask /*out*/,
+ haddr_t *addr /*out*/, hsize_t *size /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*h*Iu*a*h", dset_id, offset, filter_mask, addr, size);
+ H5TRACE5("e", "i*hxxx", dset_id, offset, filter_mask, addr, size);
/* Check arguments */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index cca6697..75bc23f 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -11,7 +11,7 @@
* 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
@@ -595,8 +595,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
*
*-------------------------------------------------------------------------
@@ -743,7 +742,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)
@@ -1372,7 +1371,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 35d2f94..529f735 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -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 */
@@ -442,11 +442,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)
@@ -556,13 +556,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)
@@ -815,7 +815,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
@@ -1237,13 +1237,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
@@ -1475,7 +1468,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 5783a72..5380644 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Thursday, April 24, 2008
*
* Purpose: Abstract indexed (chunked) I/O functions. The logical
@@ -278,25 +278,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);
@@ -319,6 +317,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);
/*********************/
@@ -917,7 +916,7 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for fapl ID")
/* Use the properties in dapl_id if they have been set, otherwise use the properties from the file */
if (H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0)
@@ -3605,10 +3604,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 */
@@ -4546,9 +4545,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 */
@@ -4954,7 +4952,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;
@@ -4980,9 +4978,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 */
@@ -4990,58 +4988,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 */
@@ -5074,10 +5077,12 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode")
/* free things */
- if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
- HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
- HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ if (MPI_BYTE != file_type)
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
+ if (MPI_BYTE != mem_type)
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
+ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
H5MM_xfree(chunk_disp_array);
H5MM_xfree(block_lens);
@@ -5122,8 +5127,8 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * March 26, 2002
+ * Programmer: Pedro Vicente
+ * March 26, 2002
*
*-------------------------------------------------------------------------
*/
@@ -5244,7 +5249,7 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
* Algorithm: Robb Matzke
* March 27, 2002
*
@@ -6338,10 +6343,10 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk
if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
(void)H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Set initial buffer sizes */
@@ -6576,10 +6581,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 */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 7d11b61..fe41298 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* August 5, 2002
*
* Purpose: Compact dataset I/O functions. These routines are similar
@@ -493,10 +493,10 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Allocate memory for recclaim buf */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index ed4ac93..4dc6f72 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
* Purpose:
@@ -1414,10 +1414,10 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
if (NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Set flag to do type conversion */
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 68af09d..d39d357 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -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 40104be..1c66f26 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -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")
@@ -202,9 +202,9 @@ H5Dopen1(hid_t loc_id, const char *name)
H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open 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, "can't register dataset atom")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset ID")
done:
if (H5I_INVALID_HID == ret_value)
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 64b1e20..db77a4c 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -418,8 +418,8 @@ 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() */
@@ -574,9 +574,9 @@ 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() */
@@ -1743,7 +1743,7 @@ 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() */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 2ad09ba..85c9dba 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 d9f80a6..8293ec4 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -416,8 +416,8 @@ 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() */
@@ -676,9 +676,9 @@ 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() */
@@ -1592,7 +1592,7 @@ 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() */
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 9588446..fe98487 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -15,7 +15,7 @@
*
* Created: H5Dfill.c
* Jun 19 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Fill value operations for datasets
*
@@ -85,58 +85,6 @@ H5FL_EXTERN(H5S_sel_iter_t);
/*--------------------------------------------------------------------------
NAME
- H5Dfill
- PURPOSE
- Fill a selection in memory with a value
- USAGE
- herr_t H5Dfill(fill, fill_type, space, buf, buf_type)
- const void *fill; IN: Pointer to fill value to use
- hid_t fill_type_id; IN: Datatype of the fill value
- void *buf; IN/OUT: Memory buffer to fill selection within
- hid_t buf_type_id; IN: Datatype of the elements in buffer
- hid_t space_id; IN: Dataspace describing memory buffer &
- containing selection to use.
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Use the selection in the dataspace to fill elements in a memory buffer.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- If "fill" parameter is NULL, use all zeros as fill value
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id)
-{
- H5S_t *space; /* Dataspace */
- H5T_t *fill_type; /* Fill-value datatype */
- H5T_t *buf_type; /* Buffer datatype */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "*xi*xii", fill, fill_type_id, buf, buf_type_id, space_id);
-
- /* Check args */
- if (buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace")
- if (NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
- if (NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
-
- /* Fill the selection in the memory buffer */
- if (H5D__fill(fill, fill_type, buf, buf_type, space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Dfill() */
-
-/*--------------------------------------------------------------------------
- NAME
H5D__fill
PURPOSE
Fill a selection in memory with a value (internal version)
@@ -642,7 +590,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 781e36d..d0c1ba2 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -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 */
@@ -191,7 +192,7 @@ H5D__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the dataset IDs */
+ /* Initialize the ID group for the dataset IDs */
if (H5I_register_type(H5I_DATASET_CLS) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface")
@@ -343,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");
@@ -1004,7 +1000,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
if (TRUE == use_minimized_header) {
if (H5D__prepare_minimized_oh(file, dset, oloc) == FAIL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header")
- }
+ } /* 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
@@ -1276,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 */
+
+ 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")
- /* 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 (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")
+ /* 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)))
@@ -1311,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)
@@ -1668,7 +1672,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
/* Get dataset access property list */
if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID");
/* Check if append flush property exists */
if (H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) {
@@ -2952,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);
@@ -3863,9 +3867,9 @@ H5D__get_space(const H5D_t *dset)
if (NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace")
- /* Create an atom */
+ /* Create an ID */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
if (ret_value < 0)
@@ -3910,17 +3914,17 @@ H5D__get_type(const H5D_t *dset)
if (H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
- /* Create an atom */
+ /* Create an ID */
if (H5T_is_named(dt)) {
/* If this is a committed datatype, we need to recreate the
* two-level IDs, where the VOL object is a copy of the
* returned datatype.
*/
if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype")
} /* end if */
else if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
if (ret_value < 0)
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 75727a9..e28da8c 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -926,7 +926,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_t
/* Locate the type conversion function and dataspace conversion
* functions, and set up the element numbering information. If a data
- * type conversion is necessary then register datatype atoms. Data type
+ * type conversion is necessary then register datatype IDs. Data type
* conversion is necessary if the user has set the `need_bkg' to a high
* enough value in xfer_parms since turning off datatype conversion also
* turns off background preservation.
diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h
index 292b624..595c714 100644
--- a/src/H5Dmodule.h
+++ b/src/H5Dmodule.h
@@ -29,15 +29,37 @@
#define H5_MY_PKG_ERR H5E_DATASET
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5D H5D
- * \brief Group Interface
- * \details The HDF5 Dataset Interface, H5D, provides a mechanism for managing
- * HDF5 datasets, including the transfer of data between memory and
- * disk and the description of dataset properties.
+/**\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>
*
- * A Dataset is used by other HDF5 APIs, either by name or by a handle,
- * which is obtained by either creating or opening the dataset.
*/
#endif /* H5Dmodule_H */
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 16a8221..448e92d 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -413,7 +413,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 */
@@ -1094,7 +1094,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 */
@@ -1574,7 +1574,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 */
@@ -1608,7 +1608,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];
@@ -1628,7 +1628,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
@@ -1667,7 +1667,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
@@ -2838,7 +2838,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
"unable to allocate number of assigned chunks array")
for (i = 0; i < shared_chunks_info_array_num_entries;) {
- H5D_filtered_collective_io_info_t chunk_entry;
+ H5D_filtered_collective_io_info_t *chunk_entry;
haddr_t last_seen_addr = shared_chunks_info_array[i].chunk_states.chunk_current.offset;
size_t set_begin_index = i;
size_t num_writers = 0;
@@ -2846,17 +2846,17 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
/* Process each set of duplicate entries caused by another process writing to the same chunk */
do {
- chunk_entry = shared_chunks_info_array[i];
+ chunk_entry = &shared_chunks_info_array[i];
- send_counts[chunk_entry.owners.original_owner] += (int)sizeof(chunk_entry);
+ send_counts[chunk_entry->owners.original_owner] += (int)sizeof(*chunk_entry);
/* The new owner of the chunk is determined by the process
* writing to the chunk which currently has the least amount
* of chunks assigned to it
*/
- if (num_assigned_chunks_array[chunk_entry.owners.original_owner] <
+ if (num_assigned_chunks_array[chunk_entry->owners.original_owner] <
num_assigned_chunks_array[new_chunk_owner])
- new_chunk_owner = chunk_entry.owners.original_owner;
+ new_chunk_owner = chunk_entry->owners.original_owner;
num_writers++;
} while (++i < shared_chunks_info_array_num_entries &&
@@ -2907,6 +2907,8 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
sizeof(unsigned char *))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate modification data buffer array")
+ /* Perform all the sends on the chunks that this rank doesn't own */
+ /* (Sends and recvs must be two separate loops, to avoid deadlock) */
for (i = 0, last_assigned_idx = 0; i < *local_chunk_array_num_entries; i++) {
H5D_filtered_collective_io_info_t *chunk_entry = &local_chunk_array[i];
@@ -2965,7 +2967,13 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
num_send_requests++;
} /* end if */
- else {
+ } /* end for */
+
+ /* Perform all the recvs on the chunks this rank owns */
+ for (i = 0, last_assigned_idx = 0; i < *local_chunk_array_num_entries; i++) {
+ H5D_filtered_collective_io_info_t *chunk_entry = &local_chunk_array[i];
+
+ if (mpi_rank == chunk_entry->owners.new_owner) {
/* Allocate all necessary buffers for an asynchronous receive operation */
if (chunk_entry->num_writers > 1) {
MPI_Message message;
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index 507741c..f724949 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
+/* Programmer: Vailin Choi
* September 2010
*
* Purpose: Implicit (Non Index) chunked I/O functions.
@@ -471,7 +471,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 f6245d5..a991831 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -328,7 +328,7 @@ H5O__dset_get_oloc(hid_t obj_id)
/* Get the dataset */
if (NULL == (dset = (H5D_t *)H5VL_object(obj_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID")
/* Get the dataset's object header location */
if (NULL == (ret_value = H5D_oloc(dset)))
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 0627aef..954b108 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -570,7 +570,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);
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 3c1a2de..c52bef3 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -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,1268 @@ 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,10 +1461,182 @@ 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 */
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index e8b70e3..971ddfb 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -370,7 +370,7 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tg
size_t vec_size; /* Vector length */
size_t ret_value = nelmts; /* Number of elements gathered */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(buf);
@@ -898,198 +898,3 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__compound_opt_write() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Dscatter
- *
- * Purpose: Scatters data provided by the callback op to the
- * destination buffer dst_buf, where the dimensions of
- * dst_buf and the selection to be scattered to are specified
- * by the dataspace dst_space_id. The type of the data to be
- * scattered is specified by type_id.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 14 Jan 2013
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf)
-{
- H5T_t * type; /* Datatype */
- H5S_t * dst_space; /* Dataspace */
- H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- const void * src_buf = NULL; /* Source (contiguous) data buffer */
- size_t src_buf_nbytes = 0; /* Size of src_buf */
- size_t type_size; /* Datatype element size */
- hssize_t nelmts; /* Number of remaining elements in selection */
- size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "DS*xii*x", op, op_data, type_id, dst_space_id, dst_buf);
-
- /* Check args */
- if (op == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer")
- if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if (dst_buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
-
- /* Get datatype element size */
- if (0 == (type_size = H5T_GET_SIZE(type)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
-
- /* Get number of elements in dataspace */
- if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
-
- /* Allocate the selection iterator */
- if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
-
- /* Initialize selection iterator */
- if (H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
- iter_init = TRUE;
-
- /* Loop until all data has been scattered */
- while (nelmts > 0) {
- /* Make callback to retrieve data */
- if (op(&src_buf, &src_buf_nbytes, op_data) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
-
- /* Calculate number of elements */
- nelmts_scatter = src_buf_nbytes / type_size;
-
- /* Check callback results */
- if (!src_buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer")
- if (src_buf_nbytes == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0")
- if (src_buf_nbytes % type_size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size")
- if (nelmts_scatter > (size_t)nelmts)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
-
- /* Scatter data */
- if (H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
-
- nelmts -= (hssize_t)nelmts_scatter;
- } /* end while */
-
-done:
- /* Release selection iterator */
- if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if (iter)
- iter = H5FL_FREE(H5S_sel_iter_t, iter);
-
- FUNC_LEAVE_API(ret_value)
-} /* H5Dscatter() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Dgather
- *
- * Purpose: Gathers data provided from the source buffer src_buf to
- * contiguous buffer dst_buf, then calls the callback op.
- * The dimensions of src_buf and the selection to be gathered
- * are specified by the dataspace src_space_id. The type of
- * the data to be gathered is specified by type_id.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 16 Jan 2013
- *
- *-------------------------------------------------------------------------
- */
-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)
-{
- H5T_t * type; /* Datatype */
- H5S_t * src_space; /* Dataspace */
- H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- size_t type_size; /* Datatype element size */
- hssize_t nelmts; /* Number of remaining elements in selection */
- size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */
- size_t nelmts_gathered; /* Number of elements gathered from src_buf */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*xiz*xDg*x", src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data);
-
- /* Check args */
- if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if (src_buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided")
- if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if (dst_buf_size == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0")
- if (dst_buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
-
- /* Get datatype element size */
- if (0 == (type_size = H5T_GET_SIZE(type)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
-
- /* Get number of elements in dst_buf_size */
- dst_buf_nelmts = dst_buf_size / type_size;
- if (dst_buf_nelmts == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "destination buffer is not large enough to hold one element")
-
- /* Get number of elements in dataspace */
- if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
-
- /* If dst_buf is not large enough to hold all the elements, make sure there
- * is a callback */
- if (((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
-
- /* Allocate the selection iterator */
- if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
-
- /* Initialize selection iterator */
- if (H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
- iter_init = TRUE;
-
- /* Loop until all data has been scattered */
- while (nelmts > 0) {
- /* Gather data */
- if (0 ==
- (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
- HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
- HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
-
- /* Make callback to process dst_buf */
- if (op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
-
- nelmts -= (hssize_t)nelmts_gathered;
- HDassert(op || (nelmts == 0));
- } /* end while */
-
-done:
- /* Release selection iterator */
- if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if (iter)
- iter = H5FL_FREE(H5S_sel_iter_t, iter);
-
- FUNC_LEAVE_API(ret_value)
-} /* H5Dgather() */
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index 09f7115..eba569e 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Vailin Choi <vchoi@hdfgroup.org>
+/* Programmer: Vailin Choi
* May 2011; updated 10/2015
*
* Purpose: Single Chunk I/O functions.
@@ -522,7 +522,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 4317124..f37682d 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -11,7 +11,7 @@
* 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 5f3d45e..d1c0266 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Wednesday, January 28, 2015
*
* Purpose:
@@ -395,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
@@ -895,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") */
@@ -2228,7 +2228,7 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
/* Get dataset access property list */
if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID")
/* Get view option */
if (H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0)
@@ -2277,7 +2277,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
@@ -2310,7 +2310,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);
@@ -2361,7 +2361,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 */
diff --git a/src/H5E.c b/src/H5E.c
index 7fc4559..bb90101 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -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 */
@@ -86,6 +85,7 @@ static H5E_t * H5E__get_current_stack(void);
static herr_t H5E__set_current_stack(H5E_t *estack);
static herr_t H5E__close_stack(H5E_t *err_stack);
static ssize_t H5E__get_num(const H5E_t *err_stack);
+static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack);
/*********************/
/* Package Variables */
@@ -181,17 +181,17 @@ H5E__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the error class IDs */
+ /* Initialize the ID group for the error class IDs */
if (H5I_register_type(H5I_ERRCLS_CLS) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group")
- /* Initialize the atom group for the major error IDs */
+ /* Initialize the ID group for the major error IDs */
if (H5I_register_type(H5I_ERRMSG_CLS) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group")
- /* Initialize the atom group for the error stacks */
+ /* Initialize the ID group for the error stacks */
if (H5I_register_type(H5I_ERRSTK_CLS) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group")
#ifndef H5_HAVE_THREADSAFE
H5E_stack_g[0].nused = 0;
@@ -378,7 +378,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 +390,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 +404,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 +487,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 +498,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 +555,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:
@@ -576,13 +576,13 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Eget_class_name(hid_t class_id, char *name, size_t size)
+H5Eget_class_name(hid_t class_id, char *name /*out*/, size_t size)
{
H5E_cls_t *cls; /* Pointer to error class */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE3("Zs", "i*sz", class_id, name, size);
+ H5TRACE3("Zs", "ixz", class_id, name, size);
/* Get the error class */
if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
@@ -837,13 +837,13 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size)
+H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t size)
{
H5E_msg_t *msg; /* Pointer to error message */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API_NOCLEAR((-1))
- H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size);
+ H5TRACE4("Zs", "ixxz", msg_id, type, msg_str, size);
/* Get the message object */
if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG)))
@@ -1014,9 +1014,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 +1119,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 +1254,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 +1309,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 +1319,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 +1354,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 +1365,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 +1379,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 +1423,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 +1468,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 +1518,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
@@ -1556,14 +1526,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
+H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*out*/)
{
H5E_t * estack; /* Error stack to operate on */
H5E_auto_op_t op; /* Error stack function */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*EA**x", estack_id, func, client_data);
+ H5TRACE3("e", "ixx", estack_id, func, client_data);
if (estack_id == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
@@ -1605,7 +1575,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
@@ -1663,7 +1633,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
@@ -1698,3 +1668,111 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eauto_is_v2() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Eappend_stack
+ *
+ * Purpose: Appends one error stack to another, optionally closing the
+ * source stack.
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack)
+{
+ H5E_t *dst_stack, *src_stack; /* Error stacks */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iib", dst_stack_id, src_stack_id, close_source_stack);
+
+ /* Check args */
+ if (NULL == (dst_stack = (H5E_t *)H5I_object_verify(dst_stack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst_stack_id not a error stack ID")
+ if (NULL == (src_stack = (H5E_t *)H5I_object_verify(src_stack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src_stack_id not a error stack ID")
+
+ /* Append the source stack to the destination stack */
+ if (H5E__append_stack(dst_stack, src_stack) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTAPPEND, FAIL, "can't append stack")
+
+ /* Close source error stack, if requested */
+ if (close_source_stack)
+ /* Decrement the counter on the error stack. It will be freed if the
+ * count reaches zero.
+ */
+ if (H5I_dec_app_ref(src_stack_id) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on source error stack")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Eappend_stack() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E__append_stack
+ *
+ * Purpose: Private function to append error stacks.
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(dst_stack);
+ HDassert(src_stack);
+
+ /* Copy the errors from the source stack to the destination stack */
+ for (u = 0; u < src_stack->nused; u++) {
+ const H5E_error2_t *src_error; /* Pointers to source error on stack */
+ H5E_error2_t * dst_error; /* Pointers to destination error on stack */
+
+ /* Get pointers into the current error stack location */
+ src_error = &(src_stack->slot[u]);
+ dst_error = &(dst_stack->slot[dst_stack->nused]);
+
+ /* Increment the IDs to indicate that they are used in this stack */
+ if (H5I_inc_ref(src_error->cls_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
+ dst_error->cls_id = src_error->cls_id;
+ if (H5I_inc_ref(src_error->maj_num, FALSE) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message")
+ dst_error->maj_num = src_error->maj_num;
+ if (H5I_inc_ref(src_error->min_num, FALSE) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message")
+ dst_error->min_num = src_error->min_num;
+ if (NULL == (dst_error->func_name = H5MM_xstrdup(src_error->func_name)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ if (NULL == (dst_error->file_name = H5MM_xstrdup(src_error->file_name)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ dst_error->line = src_error->line;
+ if (NULL == (dst_error->desc = H5MM_xstrdup(src_error->desc)))
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Increment # of errors in destination stack */
+ dst_stack->nused++;
+
+ /* Check for destination stack full */
+ if (dst_stack->nused >= H5E_NSLOTS)
+ break;
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5E__append_stack() */
diff --git a/src/H5EA.c b/src/H5EA.c
index 1ccc860..4d6b7c1 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -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
*
*-------------------------------------------------------------------------
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index cdabcff..7e89592 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -15,7 +15,7 @@
*
* Created: H5EAcache.c
* Aug 26 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement extensible array metadata cache methods.
*
@@ -222,7 +222,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
*
*-------------------------------------------------------------------------
@@ -284,7 +283,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 16, 2013
*
*-------------------------------------------------------------------------
@@ -314,7 +312,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;
@@ -409,7 +407,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
*
*-------------------------------------------------------------------------
@@ -437,7 +434,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
*
*-------------------------------------------------------------------------
@@ -469,7 +465,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 */
@@ -585,7 +581,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
*
*-------------------------------------------------------------------------
@@ -611,7 +606,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
*
*-------------------------------------------------------------------------
@@ -680,7 +674,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -709,7 +702,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;
@@ -786,7 +779,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
*
*-------------------------------------------------------------------------
@@ -814,7 +806,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
*
*-------------------------------------------------------------------------
@@ -900,7 +891,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
*
*-------------------------------------------------------------------------
@@ -972,7 +962,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
*
*-------------------------------------------------------------------------
@@ -998,7 +987,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
*
*-------------------------------------------------------------------------
@@ -1086,7 +1074,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -1118,7 +1105,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;
@@ -1189,7 +1176,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
*
*-------------------------------------------------------------------------
@@ -1217,7 +1203,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
*
*-------------------------------------------------------------------------
@@ -1290,7 +1275,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
*
*-------------------------------------------------------------------------
@@ -1385,7 +1369,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
*
*-------------------------------------------------------------------------
@@ -1411,7 +1394,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
*
*-------------------------------------------------------------------------
@@ -1500,7 +1482,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -1534,7 +1515,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;
@@ -1601,7 +1582,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
*
*-------------------------------------------------------------------------
@@ -1632,7 +1612,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
*
*-------------------------------------------------------------------------
@@ -1702,7 +1681,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
*
*-------------------------------------------------------------------------
@@ -1795,7 +1773,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
*
*-------------------------------------------------------------------------
@@ -1866,7 +1843,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
*
*-------------------------------------------------------------------------
@@ -1928,7 +1904,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -2001,7 +1976,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
*
*-------------------------------------------------------------------------
@@ -2029,7 +2003,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
*
*-------------------------------------------------------------------------
@@ -2080,7 +2053,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
*
*-------------------------------------------------------------------------
@@ -2139,8 +2111,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;
@@ -2175,7 +2148,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 038df1d..72d2f38 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -111,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);
@@ -126,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)
@@ -198,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 */
@@ -229,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 */
@@ -244,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 */
@@ -312,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 */
@@ -328,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 */
@@ -390,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 81380f4..b42599c 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -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 fc3e2e8..45696c7 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -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 2641b86..7f142af 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -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 0cf9f4e..1ef7980 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -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 b6e8e9d..472cfb4 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -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/H5EAstat.c b/src/H5EAstat.c
index 0a544db..47b9a86 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -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 b80f7e6..dd669fc 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -11,7 +11,7 @@
* 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 28b41fa..9cc800a 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -24,18 +24,93 @@
/* Public Macros */
/*****************/
+/* Default value for "no event set" / synchronous execution */
+#define H5ES_NONE (hid_t)0
+
+/* Special "wait" timeout values */
+#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */
+#define H5ES_WAIT_NONE \
+ (0) /* Don't wait for operations to complete, \
+ * just check their status. \
+ * (this allows H5ESwait to behave \
+ * like a 'test' operation) \
+ */
+
/*******************/
/* Public Typedefs */
/*******************/
/* Asynchronous operation status */
typedef enum H5ES_status_t {
- H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */
- H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */
- H5ES_STATUS_FAIL, /* Operation has completed, but failed */
- H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */
+ H5ES_STATUS_IN_PROGRESS, /* Operation(s) have not yet completed */
+ H5ES_STATUS_SUCCEED, /* Operation(s) have completed, successfully */
+ H5ES_STATUS_FAIL /* An operation has completed, but failed */
} H5ES_status_t;
+//! <!-- [H5ES_err_info_t_snip] -->
+/**
+ * Information about failed operations in event set
+ */
+typedef struct H5ES_err_info_t {
+ /* Operation info */
+ char * api_name; /**< Name of HDF5 API routine called */
+ char * api_args; /**< "Argument string" for arguments to HDF5 API routine called */
+ char * app_file_name; /**< Name of source file where the HDF5 API routine was called */
+ char * app_func_name; /**< Name of function where the HDF5 API routine was called */
+ unsigned app_line_num; /**< Line # of source file where the HDF5 API routine was called */
+ uint64_t op_ins_count; /**< Counter of operation's insertion into event set */
+ uint64_t op_ins_ts; /**< Timestamp for when the operation was inserted into the event set */
+
+ /* Error info */
+ hid_t err_stack_id; /**< ID for error stack from failed operation */
+} H5ES_err_info_t;
+//! <!-- [H5ES_err_info_t_snip] -->
+
+/*
+H5ES_op_info_t:
+ const char *: API name (H5Dwrite_async, ...)
+ const char *: Arg string
+ const char *: Appl. source file name
+ const char *: Appl. source function
+ unsigned: Appl. source file line
+ uint64_t: Insert Time Timestamp
+ uint64_t: "event count" - n'th event inserted into event set
+ uint64_t: Execution Time timestamp (*)
+
+More Possible Info for H5ES_op_info_t:
+ Parent Operation's request token (*) -> "parent event count"? -- Could be
+ used to "prune" child operations from reported errors, with flag
+ to H5ESget_err_info?
+
+H5ES_err_info_t:
+ H5ES_op_info_t: (above)
+ hid_t: Error stack (*)
+
+Possible debugging routines: (Should also be configured from Env Var)
+ H5ESdebug_signal(hid_t es_id, signal_t sig, uint64_t <event count>);
+ H5ESdebug_err_trace_log(hid_t es_id, const char *filename);
+ H5ESdebug_err_trace_fh(hid_t es_id, FILE *fh);
+ H5ESdebug_err_signal(hid_t es_id, signal_t sig);
+[Possibly option to allow operations to be inserted into event set with error?]
+
+ Example usage:
+ es_id = H5EScreate();
+ H5ESdebug...(es_id, ...);
+ ...
+ H5Dwrite_async(..., es_id);
+
+How to Trace Async Operations?
+ <Example of stacking Logging VOL Connector w/Async VOL Connector>
+
+"Library / wrapper developer" version of API routines: (Auto-generated)
+ H5Dwrite_async_wrap(const char *app_file, const char *app_func,
+ unsigned app_line_num, dset_id, mem_type_id, mem_space_id, ..., es_id);
+
+ vs.
+
+ H5Dwrite_async(dset_id, mem_type_id, mem_space_id, ..., es_id);
+*/
+
/********************/
/* Public Variables */
/********************/
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index cf20cfe..a5cc7aa 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -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
@@ -335,14 +334,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eget_auto1(H5E_auto1_t *func, void **client_data)
+H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/)
{
H5E_t * estack; /* Error stack to operate on */
H5E_auto_op_t auto_op; /* Error stack operator */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "*Ea**x", func, client_data);
+ H5TRACE2("e", "xx", func, client_data);
/* Retrieve default error stack */
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
@@ -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/H5Eint.c b/src/H5Eint.c
index b973f24..3fd4099 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -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.
*
@@ -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;
@@ -346,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;
@@ -650,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 */
@@ -683,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)
@@ -716,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() */
diff --git a/src/H5Emodule.h b/src/H5Emodule.h
index 1670c03..43d5d36 100644
--- a/src/H5Emodule.h
+++ b/src/H5Emodule.h
@@ -29,4 +29,33 @@
#define H5_MY_PKG_ERR H5E_ERROR
#define H5_MY_PKG_INIT YES
+/**
+ * \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/H5Eprivate.h b/src/H5Eprivate.h
index c3c440f..4cd8b70 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -168,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 */
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 685665a..ace7700 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -26,18 +26,29 @@
/* 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() */
@@ -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,498 @@ 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 Appends one error stack to another, optionally closing the source
+ * stack.
+ *
+ * \estack_id{dst_stack_id}
+ * \estack_id{src_stack_id}
+ * \param[in] close_source_stack Flag to indicate whether to close the source stack
+ * \return \herr_t
+ *
+ * \details H5Eappend_stack() appends the messages from error stack
+ * \p src_stack_id to the error stack \p dst_stack_id.
+ * If \p close_source_stack is \c TRUE, the source error stack
+ * will be closed.
+ *
+ * \since 1.13.0
+ */
+H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack);
+/**
+ * --------------------------------------------------------------------------
+ * \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,30 +670,259 @@ 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
diff --git a/src/H5F.c b/src/H5F.c
index 99e352e..19a115e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -95,8 +95,8 @@ H5FL_EXTERN(H5VL_object_t);
/*-------------------------------------------------------------------------
* Function: H5Fget_create_plist
*
- * Purpose: Get an atom for a copy of the file-creation property list for
- * this file. This function returns an atom with a copy of the
+ * Purpose: Get an ID for a copy of the file-creation property list for
+ * this file. This function returns an ID with a copy of the
* properties used to create a file.
*
* Return: Success: Object ID for a copy of the file creation
@@ -312,12 +312,12 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
+H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list /*out*/)
{
ssize_t ret_value = 0; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list);
+ H5TRACE4("Zs", "iIuzx", file_id, types, max_objs, oid_list);
/* Check arguments */
if (0 == (types & H5F_OBJ_ALL))
@@ -391,13 +391,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
+H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle);
+ H5TRACE3("e", "iix", file_id, fapl_id, file_handle);
/* Check args */
if (!file_handle)
@@ -704,7 +704,7 @@ done:
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);
@@ -715,7 +715,7 @@ H5Fclose(hid_t file_id)
/* Close the file */
if (H5I_dec_app_ref(file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -747,19 +747,19 @@ H5Fdelete(const char *filename, hid_t fapl_id)
/* Verify access property list and set up collective metadata if appropriate */
if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the VOL info from the fapl */
if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info")
/* Stash a copy of the "top-level" connector property, before any pass-through
* connectors modify or unwrap it.
*/
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context")
/* Make sure this is HDF5 storage for this VOL connector */
if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
@@ -778,6 +778,121 @@ done:
} /* end H5Fdelete() */
/*-------------------------------------------------------------------------
+ * Function: H5Fmount
+ *
+ * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and
+ * NAME using mount properties PLIST_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
+{
+ H5VL_object_t *loc_vol_obj = NULL; /* Parent object */
+ H5VL_object_t *child_vol_obj = NULL; /* Child object */
+ H5I_type_t loc_type; /* ID type of location */
+ H5I_type_t child_type; /* ID type of child */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
+
+ /* Check arguments */
+ loc_type = H5I_get_type(loc_id);
+ if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
+ child_type = H5I_get_type(child_id);
+ if (H5I_FILE != child_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID")
+ if (H5P_DEFAULT == plist_id)
+ plist_id = H5P_FILE_MOUNT_DEFAULT;
+ else if (TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Get the location object */
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+
+ /* Get the child object */
+ if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
+
+ /* Perform the mount operation */
+ if (H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fmount() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Funmount
+ *
+ * Purpose: Given a mount point, dissassociate the mount point's file
+ * from the file mounted there. Do not close either file.
+ *
+ * The mount point can either be 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's the group in the parent, but if it was opened after the
+ * mount then it's the root group of the child.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Funmount(hid_t loc_id, const char *name)
+{
+ H5VL_object_t *vol_obj = NULL; /* Parent object */
+ H5I_type_t loc_type; /* ID type of location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*s", loc_id, name);
+
+ /* Check arguments */
+ loc_type = H5I_get_type(loc_id);
+ if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+
+ /* Perform the unmount operation */
+ if (H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ (int)loc_type, name) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Funmount() */
+
+/*-------------------------------------------------------------------------
* Function: H5Freopen
*
* Purpose: Reopen a file. The new file handle which is returned points
@@ -848,12 +963,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_intent(hid_t file_id, unsigned *intent_flags)
+H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", file_id, intent_flags);
+ H5TRACE2("e", "ix", file_id, intent_flags);
/* If no intent flags were passed in, exit quietly */
if (intent_flags) {
@@ -884,12 +999,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_fileno(hid_t file_id, unsigned long *fnumber)
+H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Ul", file_id, fnumber);
+ H5TRACE2("e", "ix", file_id, fnumber);
/* If no fnumber pointer was passed in, exit quietly */
if (fnumber) {
@@ -952,13 +1067,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_filesize(hid_t file_id, hsize_t *size)
+H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", file_id, size);
+ H5TRACE2("e", "ix", file_id, size);
/* Check args */
if (!size)
@@ -1013,13 +1128,13 @@ done:
*-------------------------------------------------------------------------
*/
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 /*out*/, 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", "ixz", file_id, buf, buf_len);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1027,7 +1142,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:
@@ -1049,17 +1164,17 @@ done:
*-------------------------------------------------------------------------
*/
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 /*out*/)
{
H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Cc", file_id, config_ptr);
+ H5TRACE2("e", "ix", 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 config ptr")
/* Get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
@@ -1067,7 +1182,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:
@@ -1120,23 +1235,23 @@ done:
*-------------------------------------------------------------------------
*/
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 /*out*/)
{
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", "ix", 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:
@@ -1157,14 +1272,14 @@ done:
*-------------------------------------------------------------------------
*/
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 /*out*/, size_t *min_clean_size /*out*/,
+ size_t *cur_size /*out*/, int *cur_num_entries /*out*/)
{
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", "ixxxx", 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)))
@@ -1172,7 +1287,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:
@@ -1279,14 +1394,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
+H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/)
{
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*FI", obj_id, finfo);
+ H5TRACE2("e", "ix", obj_id, finfo);
/* Check args */
if (!finfo)
@@ -1322,13 +1437,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
+H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* File object for file ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*!", file_id, info);
+ H5TRACE2("e", "ix", file_id, info);
/* Check args */
if (!info)
@@ -1553,13 +1668,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging)
+H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *is_currently_logging /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging);
+ H5TRACE3("e", "ixx", file_id, is_enabled, is_currently_logging);
/* Sanity check */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1690,14 +1805,15 @@ done:
*-------------------------------------------------------------------------
*/
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])
+H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigned hits[2] /*out*/,
+ unsigned misses[2] /*out*/, unsigned evictions[2] /*out*/,
+ unsigned bypasses[2] /*out*/)
{
H5VL_object_t *vol_obj; /* File object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, bypasses);
+ H5TRACE6("e", "ixxxxx", file_id, accesses, hits, misses, evictions, bypasses);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1728,13 +1844,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
+H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image_len /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
+ H5TRACE3("e", "ixx", file_id, image_addr, image_len);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1761,13 +1877,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_eoa(hid_t file_id, haddr_t *eoa)
+H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*a", file_id, eoa);
+ H5TRACE2("e", "ix", file_id, eoa);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1827,13 +1943,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize)
+H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/)
{
H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*b", file_id, minimize);
+ H5TRACE2("e", "ix", file_id, minimize);
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")
diff --git a/src/H5FA.c b/src/H5FA.c
index e4da82c..05b0bd8 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -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
*
*-------------------------------------------------------------------------
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index cdfbd46..171f4e8 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -15,7 +15,7 @@
*
* Created: H5FAcache.c
* Jul 2 2009
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement fixed array metadata cache methods.
*
@@ -166,7 +166,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
*
*-------------------------------------------------------------------------
@@ -228,7 +227,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 12, 2013
*
*-------------------------------------------------------------------------
@@ -257,7 +255,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;
@@ -339,7 +337,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
*
*-------------------------------------------------------------------------
@@ -367,7 +364,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
*
*-------------------------------------------------------------------------
@@ -506,7 +502,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 12, 2013
*
*-------------------------------------------------------------------------
@@ -532,7 +527,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
*
*-------------------------------------------------------------------------
@@ -616,7 +610,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -647,7 +640,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;
@@ -715,7 +708,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
*
*-------------------------------------------------------------------------
@@ -746,7 +738,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
*
*-------------------------------------------------------------------------
@@ -893,7 +884,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -965,7 +955,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
*
*-------------------------------------------------------------------------
@@ -1028,7 +1017,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -1100,7 +1088,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
*
*-------------------------------------------------------------------------
@@ -1128,7 +1115,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -1179,7 +1165,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
*
*-------------------------------------------------------------------------
@@ -1241,7 +1226,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 1cdcf67..8c2c9a8 100644
--- a/src/H5FAdbg.c
+++ b/src/H5FAdbg.c
@@ -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/H5FAhdr.c b/src/H5FAhdr.c
index 3ff5e59..867160f 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -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 8f40e32..864c7ee 100644
--- a/src/H5FAint.c
+++ b/src/H5FAint.c
@@ -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/H5FAstat.c b/src/H5FAstat.c
index a5b9cac..1fdf47f 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -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/H5FD.c b/src/H5FD.c
index 1e9274f..fcf39f5 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -248,7 +248,7 @@ H5FDregister(const H5FD_class_t *cls)
/* Create the new class ID */
if ((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
done:
FUNC_LEAVE_API(ret_value)
@@ -298,7 +298,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref)
/* Create the new class ID */
if ((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID")
done:
if (H5I_INVALID_HID == ret_value)
@@ -371,7 +371,7 @@ H5FD_get_class(hid_t id)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID")
if (TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) {
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
@@ -504,9 +504,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 */
@@ -769,8 +769,8 @@ finish:
H5FD_t *
H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- H5FD_class_t * driver; /* VFD for file */
- H5FD_t * file;
+ H5FD_class_t * driver; /* VFD for file */
+ H5FD_t * file = NULL; /* VFD file struct */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
H5P_genplist_t * plist; /* Property list pointer */
unsigned long driver_flags = 0; /* File-inspecific driver feature flags */
@@ -1715,7 +1715,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)
@@ -1743,7 +1743,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)
@@ -1774,7 +1774,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)
@@ -1802,7 +1802,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)
@@ -1845,12 +1845,12 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
*--------------------------------------------------------------------------
*/
herr_t
-H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle)
+H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "*#i**x", file, fapl_id, file_handle);
+ H5TRACE3("e", "*#ix", file, fapl_id, file_handle);
/* Check arguments */
if (!file)
@@ -2000,10 +2000,44 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/)
/* Check for the driver to query and then query it */
if (NULL == (driver = (H5FD_class_t *)H5I_object_verify(driver_id, H5I_VFL)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a VFL ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a VFL ID")
if (H5FD_driver_query(driver, flags) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5FDdriver_query() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FDdelete
+ *
+ * Purpose: Deletes a file
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FDdelete(const char *filename, hid_t fapl_id)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "*si", filename, fapl_id);
+
+ /* Check arguments */
+ if (!filename || !*filename)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified")
+
+ if (H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+ /* Call private function */
+ if (H5FD_delete(filename, fapl_id) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5FDdelete() */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index b50f71a..f405200 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -148,6 +148,7 @@ 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_delete(const char *filename, hid_t fapl_id);
static const H5FD_class_t H5FD_core_g = {
"core", /* name */
@@ -181,6 +182,7 @@ static const H5FD_class_t H5FD_core_g = {
H5FD__core_truncate, /* truncate */
H5FD__core_lock, /* lock */
H5FD__core_unlock, /* unlock */
+ H5FD__core_delete, /* del */
NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -523,7 +525,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID")
if (H5FD_CORE != H5P_peek_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if (NULL == (old_fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist)))
@@ -558,18 +560,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_size)
+H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled /*out*/, size_t *page_size /*out*/)
{
H5P_genplist_t * plist; /* Property list pointer */
const H5FD_core_fapl_t *fa; /* Core VFD info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*b*z", plist_id, is_enabled, page_size);
+ H5TRACE3("e", "ixx", plist_id, is_enabled, page_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID")
if (H5FD_CORE != H5P_peek_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist)))
@@ -1131,23 +1133,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() */
@@ -1525,7 +1528,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
*
@@ -1708,3 +1711,36 @@ H5FD__core_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__core_unlock() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__core_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__core_delete(const char *filename, hid_t fapl_id)
+{
+ const H5FD_core_fapl_t *fa = NULL;
+ H5P_genplist_t * plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
+
+ if (fa->backing_store)
+ if (HDremove(filename) < 0)
+ HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__core_delete() */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 1233799..2a51883 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -22,15 +22,15 @@
#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
@@ -119,59 +119,61 @@ 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 herr_t H5FD__direct_delete(const char *filename, hid_t fapl_id);
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 */
+ "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__direct_delete, /* del */
NULL, /* dedup */
- H5FD_FLMAP_DICHOTOMY /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/* Declare a free list to manage the H5FD_direct_t struct */
@@ -245,7 +247,7 @@ done:
} /* end H5FD_direct_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_direct_term
+ * Function: H5FD__direct_term
*
* Purpose: Shut down the VFD
*
@@ -257,15 +259,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
@@ -365,7 +367,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
@@ -379,27 +381,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.
*
@@ -410,17 +409,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);
@@ -428,10 +425,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.
*
@@ -444,17 +441,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;
@@ -464,7 +459,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));
@@ -596,7 +591,7 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_direct_close
+ * Function: H5FD__direct_close
*
* Purpose: Closes the file.
*
@@ -607,17 +602,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")
@@ -629,7 +622,7 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5FD_direct_cmp
+ * Function: H5FD__direct_cmp
*
* Purpose: Compares two files belonging to this driver using an
* arbitrary (but consistent) ordering.
@@ -642,18 +635,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)
@@ -695,7 +686,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)
@@ -707,14 +698,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) {
@@ -731,7 +720,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
@@ -744,25 +733,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
@@ -775,19 +759,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;
@@ -795,7 +774,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
@@ -810,16 +789,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)
}
@@ -834,17 +811,15 @@ H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* Programmer: Raymond Lu
* 21 September 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle)
+H5FD__direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle)
{
H5FD_direct_t *file = (H5FD_direct_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
if (!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
@@ -855,7 +830,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
@@ -869,13 +844,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;
@@ -890,7 +863,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);
@@ -1038,7 +1011,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
@@ -1051,13 +1024,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;
@@ -1075,7 +1046,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);
@@ -1269,7 +1240,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.
@@ -1284,12 +1255,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);
@@ -1330,10 +1301,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":
@@ -1347,13 +1318,13 @@ 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_flags; /* file locking flags */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(file);
@@ -1374,10 +1345,10 @@ H5FD_direct_lock(H5FD_t *_file, hbool_t rw)
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
*
@@ -1388,12 +1359,12 @@ 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);
@@ -1410,6 +1381,31 @@ H5FD_direct_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_direct_unlock() */
+} /* end H5FD__direct_unlock() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__direct_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__direct_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ if (HDremove(filename) < 0)
+ HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__direct_delete() */
#endif /* H5_HAVE_DIRECT */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index d09d25e..2356309 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -34,15 +34,15 @@
#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,70 +73,72 @@ 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);
+static herr_t H5FD__family_delete(const char *filename, hid_t fapl_id);
/* 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 */
- NULL, /*dedup */
- 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__family_delete, /* del */
+ NULL, /* dedup */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/*--------------------------------------------------------------------------
@@ -197,9 +199,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
*
@@ -209,30 +211,30 @@ 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
*
*-------------------------------------------------------------------------
@@ -268,16 +270,16 @@ 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
*
*-------------------------------------------------------------------------
@@ -311,29 +313,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
*
*-------------------------------------------------------------------------
*/
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")
@@ -347,36 +349,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
*
*-------------------------------------------------------------------------
*/
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")
@@ -399,34 +401,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
*
*-------------------------------------------------------------------------
*/
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")
@@ -437,24 +439,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
*
*-------------------------------------------------------------------------
*/
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. */
@@ -462,29 +464,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
*
*-------------------------------------------------------------------------
*/
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);
@@ -494,41 +496,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);
@@ -557,20 +559,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
*
*-------------------------------------------------------------------------
@@ -583,7 +585,7 @@ done:
*/
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;
@@ -591,7 +593,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)
@@ -733,34 +735,34 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_family_open() */
+} /* end H5FD__family_open() */
H5_GCC_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
- * Function: H5FD_family_close
+ * Function: H5FD__family_close
*
- * Purpose: Closes a family of files.
+ * 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. */
@@ -785,32 +787,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
*
*-------------------------------------------------------------------------
*/
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]);
@@ -818,28 +820,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) {
@@ -856,44 +858,44 @@ 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
*
*-------------------------------------------------------------------------
*/
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
*
*-------------------------------------------------------------------------
@@ -906,7 +908,7 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*/
H5_GCC_DIAG_OFF("format-nonliteral")
static herr_t
-H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
+H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
H5FD_family_t *file = (H5FD_family_t *)_file;
haddr_t addr = abs_eoa;
@@ -914,7 +916,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)))
@@ -976,31 +978,31 @@ done:
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
*
*-------------------------------------------------------------------------
*/
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
@@ -1031,7 +1033,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.
*
@@ -1043,7 +1045,7 @@ 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)
+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;
@@ -1051,16 +1053,16 @@ 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)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver")
if (offset > (file->memb_size * file->nmembs))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "offset is bigger than file size")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "offset is bigger than file size")
memb = (int)(offset / file->memb_size);
ret_value = H5FD_get_vfd_handle(file->memb[memb], fapl, file_handle);
@@ -1070,24 +1072,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
*
*-------------------------------------------------------------------------
*/
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;
@@ -1098,7 +1101,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
@@ -1136,23 +1139,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
*
*-------------------------------------------------------------------------
*/
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;
@@ -1163,7 +1166,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
@@ -1201,26 +1204,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)
@@ -1231,30 +1234,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)
@@ -1265,10 +1268,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":
@@ -1282,13 +1285,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++)
@@ -1312,10 +1315,10 @@ H5FD_family_lock(H5FD_t *_file, hbool_t rw)
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
*
@@ -1326,13 +1329,13 @@ 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++)
@@ -1342,4 +1345,95 @@ H5FD_family_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_family_unlock() */
+} /* end H5FD__family_unlock() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__family_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__family_delete(const char *filename, hid_t fapl_id)
+{
+ H5P_genplist_t * plist;
+ const H5FD_family_fapl_t *fa;
+ hid_t memb_fapl_id = H5I_INVALID_HID;
+ unsigned current_member;
+ char * member_name = NULL;
+ char * temp = NULL;
+ herr_t delete_error = FAIL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ /* Get the driver info (for the member fapl)
+ * The family_open call accepts H5P_DEFAULT, so we'll accept that here, too.
+ */
+ if (H5P_FILE_ACCESS_DEFAULT == fapl_id)
+ memb_fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ else {
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad family VFD driver info")
+ memb_fapl_id = fa->memb_fapl_id;
+ }
+
+ /* Allocate space for the string buffers */
+ if (NULL == (member_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate member name")
+ if (NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate temporary member name")
+
+ /* Sanity check to make sure that generated names are unique */
+ HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0);
+ HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1);
+ if (!HDstrcmp(member_name, temp))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "provided file name cannot generate unique sub-files")
+
+ /* Delete all the family members */
+ current_member = 0;
+ while (1) {
+ /* Fix up the filename with the current member's number */
+ HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member);
+
+ /* Attempt to delete the member files. If the first file throws an error
+ * we always consider this an error. With subsequent member files, however,
+ * errors usually mean that we hit the last member file so we ignore them.
+ *
+ * Note that this means that any missing files in the family will leave
+ * undeleted members behind.
+ */
+ H5E_BEGIN_TRY
+ {
+ delete_error = H5FD_delete(member_name, memb_fapl_id);
+ }
+ H5E_END_TRY;
+ if (FAIL == delete_error) {
+ if (0 == current_member)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file")
+ else
+ H5E_clear_stack(NULL);
+ break;
+ }
+ current_member++;
+ } /* end while */
+
+done:
+ if (member_name)
+ H5MM_xfree(member_name);
+ if (temp)
+ H5MM_xfree(temp);
+
+ /* Don't close memb_fapl_id - We didn't bump its reference count since we're
+ * only using it in this call.
+ */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__family_delete() */
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index e44b575..50e02a4 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -309,6 +309,7 @@ static const H5FD_class_t H5FD_hdfs_g = {
H5FD__hdfs_truncate, /* truncate */
NULL, /* lock */
NULL, /* unlock */
+ NULL, /* del */
NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 3ab5ab7..23dfa4d 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -381,3 +381,47 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_driver_query() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_delete
+ *
+ * Purpose: Private version of H5FDdelete()
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_delete(const char *filename, hid_t fapl_id)
+{
+ H5FD_class_t * driver; /* VFD for file */
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
+ H5P_genplist_t * plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(filename);
+
+ /* Get file access property list */
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+ /* Get the VFD to open the file with */
+ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info")
+
+ /* Get driver info */
+ if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id)))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list")
+ if (NULL == driver->del)
+ HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no 'del' method")
+
+ /* Dispatch to file driver */
+ if ((driver->del)(filename, fapl_id))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "delete failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_delete() */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 09e71f1..4fd5e27 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -156,62 +156,64 @@ 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 herr_t H5FD__log_delete(const char *filename, hid_t fapl_id);
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 */
- NULL, /*dedup */
- 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__log_delete, /* del */
+ NULL, /* dedup */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/* Declare a free list to manage the H5FD_log_t struct */
@@ -282,7 +284,7 @@ done:
} /* end H5FD_log_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_log_term
+ * Function: H5FD__log_term
*
* Purpose: Shut down the VFD
*
@@ -294,15 +296,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
@@ -327,12 +329,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
@@ -353,7 +358,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
@@ -369,21 +374,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.
*
@@ -396,13 +401,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);
@@ -427,13 +432,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.
*
@@ -445,11 +450,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)
@@ -457,10 +462,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.
*
@@ -475,7 +480,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 */
@@ -485,12 +490,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
- H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */
- H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */
+ 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));
@@ -503,6 +508,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)
@@ -519,10 +528,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Start timer for open() call */
- if (fa->flags & H5FD_LOG_TIME_OPEN) {
- H5_timer_init(&open_timer);
+ if (fa->flags & H5FD_LOG_TIME_OPEN)
H5_timer_start(&open_timer);
- } /* end if */
/* Open the file */
if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) {
@@ -532,17 +539,15 @@ 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 */
+ }
/* 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) {
- H5_timer_init(&stat_timer);
+ if (fa->flags & H5FD_LOG_TIME_STAT)
H5_timer_start(&stat_timer);
- } /* end if */
/* Get the file stats */
if (HDfstat(fd, &sb) < 0)
@@ -595,15 +600,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,14 +622,14 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5_timer_get_times(open_timer, &open_times);
HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_TIME_STAT) {
H5_timevals_t stat_times; /* Elapsed time for stat() call */
H5_timer_get_times(stat_timer, &stat_times);
HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed);
- } /* end if */
- } /* end if */
+ }
+ }
/* Check the file locking flags in the fapl */
if (ignore_disabled_file_locks_s != FAIL)
@@ -646,7 +651,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;
@@ -657,13 +662,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.
*
@@ -676,22 +681,23 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_log_close(H5FD_t *_file)
+H5FD__log_close(H5FD_t *_file)
{
- H5FD_log_t *file = (H5FD_log_t *)_file;
- H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t *file = (H5FD_log_t *)_file;
+ 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);
+ /* Initialize timer */
+ H5_timer_init(&close_timer);
+
/* Start timer for close() call */
- if (file->fa.flags & H5FD_LOG_TIME_CLOSE) {
- H5_timer_init(&close_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_CLOSE)
H5_timer_start(&close_timer);
- } /* end if */
/* Close the underlying file */
if (HDclose(file->fd) < 0)
@@ -712,7 +718,7 @@ H5FD_log_close(H5FD_t *_file)
H5_timer_get_times(close_timer, &close_times);
HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed);
- } /* end if */
+ }
/* Dump the total number of seek/read/write operations */
if (file->fa.flags & H5FD_LOG_NUM_READ)
@@ -742,16 +748,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) {
@@ -761,16 +769,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) {
@@ -780,16 +790,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)
@@ -810,10 +821,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.
@@ -828,13 +839,13 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
+H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_log_t *f1 = (const H5FD_log_t *)_f1;
const H5FD_log_t *f2 = (const H5FD_log_t *)_f2;
int ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
#ifdef H5_HAVE_WIN32_API
if (f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber)
@@ -877,10 +888,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)
@@ -893,11 +904,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) {
@@ -916,13 +927,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.
*
@@ -935,13 +946,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;
@@ -955,18 +966,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
@@ -993,19 +1005,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
@@ -1020,17 +1032,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
@@ -1044,11 +1056,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 */
@@ -1060,13 +1072,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)) {
@@ -1077,22 +1090,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
@@ -1109,17 +1123,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.
*
@@ -1131,12 +1145,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")
@@ -1145,10 +1159,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
@@ -1164,26 +1178,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;
H5_timer_t read_timer; /* Timer for read operation */
H5_timevals_t read_times; /* Elapsed time for read operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ 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)
@@ -1200,17 +1213,22 @@ 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) {
+
+ 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) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1227,11 +1245,11 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
- HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr);
+ 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
@@ -1241,15 +1259,13 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for read operation */
- if (file->fa.flags & H5FD_LOG_TIME_READ) {
- H5_timer_init(&read_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_READ)
H5_timer_start(&read_timer);
- } /* end if */
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -1284,8 +1300,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, "
@@ -1294,13 +1310,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);
@@ -1308,8 +1324,7 @@ 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 */
+ }
/* Stop timer for read operation */
if (file->fa.flags & H5FD_LOG_TIME_READ)
@@ -1323,12 +1338,12 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
if (file->fa.flags & H5FD_LOG_TIME_READ) {
H5_timer_get_times(read_timer, &read_times);
file->total_read_time += read_times.elapsed;
- } /* end if */
+ }
/* Log information about the read */
if (file->fa.flags & H5FD_LOG_LOC_READ) {
- HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1,
- orig_size, flavors[type]);
+ 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) {
@@ -1337,7 +1352,7 @@ 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 */
+ }
/* Add the read time, if we're tracking that.
* Note that the read time is NOT emitted for when just H5FD_LOG_TIME_READ
@@ -1347,7 +1362,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position */
file->pos = addr;
@@ -1358,13 +1373,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
@@ -1378,34 +1393,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;
H5_timer_t write_timer; /* Timer for write operation */
H5_timevals_t write_times; /* Elapsed time for write operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ 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))
@@ -1423,16 +1437,21 @@ 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) {
+
+ 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) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1449,11 +1468,11 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
- HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr);
+ 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
@@ -1463,15 +1482,13 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for write operation */
- if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
- H5_timer_init(&write_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_WRITE)
H5_timer_start(&write_timer);
- } /* end if */
/*
* Write the data, being careful of interrupted system calls and partial
@@ -1506,8 +1523,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,12 +1555,12 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
H5_timer_get_times(write_timer, &write_times);
file->total_write_time += write_times.elapsed;
- } /* end if */
+ }
/* Log information about the write */
if (file->fa.flags & H5FD_LOG_LOC_WRITE) {
- HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1,
- orig_size, flavors[type]);
+ 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 */
@@ -1551,8 +1568,8 @@ 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 */
+ }
+ }
/* Add the write time, if we're tracking that.
* Note that the write time is NOT emitted for when just H5FD_LOG_TIME_WRITE
@@ -1562,7 +1579,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position and eof */
file->pos = addr;
@@ -1575,13 +1592,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.
@@ -1594,12 +1611,12 @@ 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);
@@ -1608,11 +1625,12 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
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) {
- H5_timer_init(&trunc_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE)
H5_timer_start(&trunc_timer);
- } /* end if */
#ifdef H5_HAVE_WIN32_API
{
@@ -1636,7 +1654,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
dwError = GetLastError();
if (dwError != NO_ERROR)
HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
- } /* end if */
+ }
if (0 == SetEndOfFile(file->hFile))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
@@ -1659,11 +1677,11 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
H5_timer_get_times(trunc_timer, &trunc_times);
file->total_truncate_time += trunc_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual truncate events. */
if (file->fa.flags & H5FD_LOG_TRUNCATE) {
- HDfprintf(file->logfp, "Truncate: To %10a", file->eoa);
+ 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
@@ -1673,7 +1691,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update the eof value */
file->eof = file->eoa;
@@ -1685,10 +1703,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
*
@@ -1700,13 +1718,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);
@@ -1728,10 +1746,10 @@ H5FD_log_lock(H5FD_t *_file, hbool_t rw)
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
*
@@ -1742,12 +1760,12 @@ 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);
@@ -1764,4 +1782,29 @@ H5FD_log_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_log_unlock() */
+} /* end H5FD__log_unlock() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__log_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__log_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ if (HDremove(filename) < 0)
+ HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__log_delete() */
diff --git a/src/H5FDlog.h b/src/H5FDlog.h
index aa1f3cb..969c091 100644
--- a/src/H5FDlog.h
+++ b/src/H5FDlog.h
@@ -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
index 2b4b158..3ea71ce 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -21,14 +21,15 @@
#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 "H5FLprivate.h" /* Free Lists */
-#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 "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;
@@ -131,72 +132,79 @@ typedef struct H5FD_mirror_t {
#define LOG_OP_CALL(name) \
do { \
HDprintf("called %s()\n", (name)); \
- fflush(stdout); \
+ HDfflush(stdout); \
} while (0)
#else
#define LOG_OP_CALL(name) /* no-op */
#endif /* MIRROR_DEBUG_OP_CALLS */
/* Prototypes */
-static herr_t H5FD_mirror_term(void);
-static void * H5FD_mirror_fapl_get(H5FD_t *_file);
-static void * H5FD_mirror_fapl_copy(const void *_old_fa);
-static herr_t H5FD_mirror_fapl_free(void *_fa);
-static haddr_t H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static H5FD_t *H5FD_mirror_open(const char *name, unsigned flags, 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_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 */
- NULL, /* dedup */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ "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 */
+ NULL, /* del */
+ NULL, /* dedup */
+ 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
*
@@ -212,11 +220,10 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD__init_package");
+ LOG_OP_CALL(FUNC);
- if (H5FD_mirror_init() < 0) {
+ if (H5FD_mirror_init() < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD");
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -237,13 +244,12 @@ H5FD_mirror_init(void)
{
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- LOG_OP_CALL("H5FD_mirror_init");
+ LOG_OP_CALL(FUNC);
- if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) {
+ 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;
@@ -252,7 +258,7 @@ done:
} /* end H5FD_mirror_init() */
/* ---------------------------------------------------------------------------
- * Function: H5FD_mirror_term
+ * Function: H5FD__mirror_term
*
* Purpose: Shut down the VFD
*
@@ -260,17 +266,17 @@ done:
* ---------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_term(void)
+H5FD__mirror_term(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Reset VFL ID */
H5FD_MIRROR_g = 0;
- LOG_OP_CALL("H5FD_mirror_term");
+ LOG_OP_CALL(FUNC);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_mirror_term() */
+} /* end H5FD__mirror_term() */
/* ---------------------------------------------------------------------------
* Function: H5FD__mirror_xmit_decode_uint16
@@ -289,10 +295,14 @@ size_t
H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf)
{
uint16_t n = 0;
- LOG_OP_CALL("H5FD__mirror_xmit_decode_uint16");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_buf && out);
- HDmemcpy(&n, _buf, sizeof(n));
+
+ H5MM_memcpy(&n, _buf, sizeof(n));
*out = (uint16_t)HDntohs(n);
+
return 2; /* number of bytes eaten */
} /* end H5FD__mirror_xmit_decode_uint16() */
@@ -313,10 +323,14 @@ size_t
H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf)
{
uint32_t n = 0;
- LOG_OP_CALL("H5FD__mirror_xmit_decode_uint32");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_buf && out);
- HDmemcpy(&n, _buf, sizeof(n));
+
+ H5MM_memcpy(&n, _buf, sizeof(n));
*out = (uint32_t)HDntohl(n);
+
return 4; /* number of bytes eaten */
} /* end H5FD__mirror_xmit_decode_uint32() */
@@ -342,12 +356,11 @@ is_host_little_endian(void)
uint8_t u8[4];
} echeck;
echeck.u32 = 0xA1B2C3D4;
- if (echeck.u8[0] == 0xD4) {
+
+ if (echeck.u8[0] == 0xD4)
return TRUE;
- }
- else {
+ else
return FALSE;
- }
} /* end is_host_little_endian() */
/* ---------------------------------------------------------------------------
@@ -369,15 +382,17 @@ size_t
H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf)
{
uint64_t n = 0;
- LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_buf && out);
- HDmemcpy(&n, _buf, sizeof(n));
- if (TRUE == is_host_little_endian()) {
+
+ H5MM_memcpy(&n, _buf, sizeof(n));
+ if (TRUE == is_host_little_endian())
*out = BSWAP_64(n);
- }
- else {
+ else
*out = n;
- }
+
return 8;
} /* end H5FD__mirror_xmit_decode_uint64() */
@@ -395,9 +410,12 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf)
size_t
H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf)
{
- LOG_OP_CALL("H5FD__mirror_xmit_decode_uint8");
+ LOG_OP_CALL(__func__);
+
HDassert(_buf && out);
- HDmemcpy(out, _buf, sizeof(uint8_t));
+
+ H5MM_memcpy(out, _buf, sizeof(uint8_t));
+
return 1; /* number of bytes eaten */
} /* end H5FD__mirror_xmit_decode_uint8() */
@@ -417,10 +435,14 @@ size_t
H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v)
{
uint16_t n = 0;
- LOG_OP_CALL("H5FD__mirror_xmit_encode_uint16");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_dest);
+
n = (uint16_t)HDhtons(v);
- HDmemcpy(_dest, &n, sizeof(n));
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
return 2;
} /* end H5FD__mirror_xmit_encode_uint16() */
@@ -440,10 +462,14 @@ size_t
H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v)
{
uint32_t n = 0;
- LOG_OP_CALL("H5FD__mirror_xmit_encode_uint32");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_dest);
+
n = (uint32_t)HDhtonl(v);
- HDmemcpy(_dest, &n, sizeof(n));
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
return 4;
} /* end H5FD__mirror_xmit_encode_uint32() */
@@ -463,12 +489,15 @@ size_t
H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v)
{
uint64_t n = v;
- LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64");
+
+ LOG_OP_CALL(__func__);
+
HDassert(_dest);
- if (TRUE == is_host_little_endian()) {
+
+ if (TRUE == is_host_little_endian())
n = BSWAP_64(v);
- }
- HDmemcpy(_dest, &n, sizeof(n));
+ H5MM_memcpy(_dest, &n, sizeof(n));
+
return 8;
} /* H5FD__mirror_xmit_encode_uint64() */
@@ -488,9 +517,12 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v)
size_t
H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v)
{
- LOG_OP_CALL("H5FD__mirror_xmit_encode_uint8");
+ LOG_OP_CALL(__func__);
+
HDassert(dest);
- HDmemcpy(dest, &v, sizeof(v));
+
+ H5MM_memcpy(dest, &v, sizeof(v));
+
return 1;
} /* end H5FD__mirror_xmit_encode_uint8() */
@@ -517,14 +549,18 @@ size_t
H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf)
{
size_t n_eaten = 0;
- LOG_OP_CALL("H5FD_mirror_xmit_decode_header");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->magic), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->version), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->session_token), &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() */
@@ -551,11 +587,15 @@ 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("H5FD_mirror_xmit_decode_lock");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->rw), &buf[n_eaten]);
HDassert(n_eaten == H5FD_MIRROR_XMIT_LOCK_SIZE);
+
return n_eaten;
} /* end H5FD_mirror_xmit_decode_lock() */
@@ -583,8 +623,11 @@ 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("H5FD_mirror_xmit_decode_open");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->flags), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]);
@@ -592,6 +635,7 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *
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() */
@@ -619,13 +663,17 @@ 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("H5FD_mirror_xmit_decode_reply");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]);
HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten);
HDstrncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1);
out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */
+
return H5FD_MIRROR_XMIT_REPLY_SIZE;
} /* end H5FD_mirror_xmit_decode_reply() */
@@ -652,12 +700,16 @@ 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("H5FD_mirror_xmit_decode_set_eoa");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->eoa_addr), &buf[n_eaten]);
HDassert(n_eaten == H5FD_MIRROR_XMIT_EOA_SIZE);
+
return n_eaten;
} /* end H5FD_mirror_xmit_decode_set_eoa() */
@@ -684,13 +736,17 @@ 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("H5FD_mirror_xmit_decode_write");
+
+ LOG_OP_CALL(__func__);
+
HDassert(out && buf);
+
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->offset), &buf[n_eaten]);
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size), &buf[n_eaten]);
HDassert(n_eaten == H5FD_MIRROR_XMIT_WRITE_SIZE);
+
return n_eaten;
} /* end H5FD_mirror_xmit_decode_write() */
@@ -712,14 +768,18 @@ size_t
H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x)
{
size_t n_writ = 0;
- LOG_OP_CALL("H5FD_mirror_xmit_encode_header");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->magic);
n_writ += H5FD__mirror_xmit_encode_uint8((dest + n_writ), x->version);
n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->session_token);
n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->xmit_count);
n_writ += H5FD__mirror_xmit_encode_uint8((dest + n_writ), x->op);
HDassert(n_writ == H5FD_MIRROR_XMIT_HEADER_SIZE);
+
return n_writ;
} /* end H5FD_mirror_xmit_encode_header() */
@@ -740,11 +800,15 @@ 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("H5FD_mirror_xmit_encode_lock");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->rw);
HDassert(n_writ == H5FD_MIRROR_XMIT_LOCK_SIZE);
+
return n_writ;
} /* end H5FD_mirror_xmit_encode_lock() */
@@ -766,19 +830,21 @@ 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("H5FD_mirror_xmit_encode_open");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
/* clear entire structure, but especially its filepath string area */
- for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_OPEN_SIZE; n_writ++) {
- *(dest + n_writ) = 0;
- }
- n_writ = 0;
+ HDmemset(dest, 0, H5FD_MIRROR_XMIT_OPEN_SIZE);
+
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->flags);
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() */
@@ -801,17 +867,19 @@ 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("H5FD_mirror_xmit_encode_reply");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
/* clear entire structure, but especially its message string area */
- for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_REPLY_SIZE; n_writ++) {
- *(dest + n_writ) = 0;
- }
- n_writ = 0;
+ HDmemset(dest, 0, H5FD_MIRROR_XMIT_REPLY_SIZE);
+
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status);
HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ);
HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX);
+
return H5FD_MIRROR_XMIT_REPLY_SIZE;
} /* end H5FD_mirror_xmit_encode_reply() */
@@ -833,12 +901,16 @@ 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("H5FD_mirror_xmit_encode_set_eoa");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type);
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->eoa_addr);
HDassert(n_writ == H5FD_MIRROR_XMIT_EOA_SIZE);
+
return n_writ;
} /* end H5FD_mirror_xmit_encode_set_eoa() */
@@ -860,13 +932,17 @@ 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("H5FD_mirror_xmit_encode_write");
+
+ LOG_OP_CALL(__func__);
+
HDassert(dest && x);
+
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type);
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->offset);
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size);
HDassert(n_writ == H5FD_MIRROR_XMIT_WRITE_SIZE);
+
return n_writ;
} /* end H5FD_mirror_xmit_encode_write() */
@@ -880,14 +956,16 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_close");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op))
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_close() */
@@ -901,14 +979,16 @@ H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_lock");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_LOCK == xmit->pub.op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_LOCK == xmit->pub.op))
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_lock() */
@@ -922,14 +1002,17 @@ H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_open");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_OPEN == xmit->pub.op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_OPEN == xmit->pub.op))
+
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_open() */
@@ -943,14 +1026,16 @@ H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_set_eoa");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op))
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_eoa() */
@@ -964,14 +1049,16 @@ H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_reply");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_REPLY == xmit->pub.op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_REPLY == xmit->pub.op))
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_reply() */
@@ -985,14 +1072,16 @@ H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_write");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_WRITE == xmit->pub.op)) {
+
+ if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_WRITE == xmit->pub.op))
return TRUE;
- }
+
return FALSE;
} /* end H5FD_mirror_xmit_is_write() */
@@ -1006,14 +1095,16 @@ H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit)
* Return: TRUE if valid; else FALSE.
* ---------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit)
{
- LOG_OP_CALL("H5FD_mirror_xmit_is_xmit");
+ LOG_OP_CALL(__func__);
+
HDassert(xmit);
- if ((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version)) {
+
+ if ((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version))
return FALSE;
- }
+
return TRUE;
} /* end H5FD_mirror_xmit_is_xmit() */
@@ -1028,57 +1119,54 @@ H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit)
* Return: SUCCEED if ok, else FAIL.
* ----------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5FD__mirror_verify_reply(H5FD_mirror_t *file)
{
- char xmit_buf[H5FD_MIRROR_XMIT_REPLY_SIZE];
+ unsigned char * xmit_buf = NULL;
struct H5FD_mirror_xmit_reply_t reply;
ssize_t read_ret = 0;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD__mirror_verify_reply");
+ LOG_OP_CALL(FUNC);
HDassert(file && file->sock_fd);
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
read_ret = HDread(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_REPLY_SIZE);
- if (read_ret < 0) {
+ if (read_ret < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to read reply");
- }
- if (read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE) {
+ if (read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unexpected read size");
- }
LOG_XMIT_BYTES("reply", xmit_buf, read_ret);
- if (H5FD_mirror_xmit_decode_reply(&reply, (const unsigned char *)xmit_buf) !=
- H5FD_MIRROR_XMIT_REPLY_SIZE) {
+ if (H5FD_mirror_xmit_decode_reply(&reply, xmit_buf) != H5FD_MIRROR_XMIT_REPLY_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unable to decode reply xmit");
- }
- if (H5FD_mirror_xmit_is_reply(&reply) != TRUE) {
+ if (H5FD_mirror_xmit_is_reply(&reply) != TRUE)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "xmit op code was not REPLY");
- }
- if (reply.pub.session_token != file->xmit.session_token) {
+ if (reply.pub.session_token != file->xmit.session_token)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "wrong session");
- }
-
- if (reply.pub.xmit_count != (file->xmit_i)++) {
+ if (reply.pub.xmit_count != (file->xmit_i)++)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "xmit out of sync");
- }
-
- if (reply.status != H5FD_MIRROR_STATUS_OK) {
+ if (reply.status != H5FD_MIRROR_STATUS_OK)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "%s", (const char *)(reply.message));
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5FD__mirror_verify_reply() */
/* -------------------------------------------------------------------------
- * Function: H5FD_mirror_fapl_get
+ * Function: H5FD__mirror_fapl_get
*
* Purpose: Get the file access propety list which could be used to create
* an identical file.
@@ -1088,36 +1176,34 @@ done:
* -------------------------------------------------------------------------
*/
static void *
-H5FD_mirror_fapl_get(H5FD_t *_file)
+H5FD__mirror_fapl_get(H5FD_t *_file)
{
H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
H5FD_mirror_fapl_t *fa = NULL;
void * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_fapl_get");
+ LOG_OP_CALL(FUNC);
fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t));
- if (NULL == fa) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "calloc failed");
- }
+ if (NULL == fa)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "calloc failed");
- HDmemcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t));
+ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t));
ret_value = fa;
done:
- if (ret_value == NULL) {
- if (fa != NULL) {
+ if (ret_value == NULL)
+ if (fa != NULL)
H5MM_xfree(fa);
- }
- }
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_fapl_get() */
+} /* end H5FD__mirror_fapl_get() */
/* -------------------------------------------------------------------------
- * Function: H5FD_mirror_fapl_copy
+ * Function: H5FD__mirror_fapl_copy
*
* Purpose: Copies the mirror vfd-specific file access properties.
*
@@ -1126,35 +1212,33 @@ done:
* -------------------------------------------------------------------------
*/
static void *
-H5FD_mirror_fapl_copy(const void *_old_fa)
+H5FD__mirror_fapl_copy(const void *_old_fa)
{
const H5FD_mirror_fapl_t *old_fa = (const H5FD_mirror_fapl_t *)_old_fa;
H5FD_mirror_fapl_t * new_fa = NULL;
void * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_fapl_copy");
+ LOG_OP_CALL(FUNC);
new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t));
- if (new_fa == NULL) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- }
+ if (new_fa == NULL)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed");
- HDmemcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t));
ret_value = new_fa;
done:
- if (ret_value == NULL) {
- if (new_fa != NULL) {
+ if (ret_value == NULL)
+ if (new_fa != NULL)
H5MM_xfree(new_fa);
- }
- }
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_fapl_copy() */
+} /* end H5FD__mirror_fapl_copy() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_fapl_free
+ * Function: H5FD__mirror_fapl_free
*
* Purpose: Frees the mirror VFD-specific file access properties.
*
@@ -1162,13 +1246,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_fapl_free(void *_fa)
+H5FD__mirror_fapl_free(void *_fa)
{
H5FD_mirror_fapl_t *fa = (H5FD_mirror_fapl_t *)_fa;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL("H5FD_mirror_fapl_free");
+ LOG_OP_CALL(FUNC);
/* sanity check */
HDassert(fa != NULL);
@@ -1178,50 +1262,45 @@ H5FD_mirror_fapl_free(void *_fa)
H5MM_xfree(fa);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_mirror_fapl_free() */
+} /* end H5FD__mirror_fapl_free() */
/* -------------------------------------------------------------------------
* Function: H5Pget_fapl_mirror
*
* Purpose: Get the configuration information for this fapl.
- * Data is memcopied into the fa_out pointer.
+ * 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_out)
+H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/)
{
- const H5FD_mirror_fapl_t *fa = NULL;
+ 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*#", fapl_id, fa_out);
+ H5TRACE2("e", "ix", fapl_id, fa_dst);
- LOG_OP_CALL("H5Pget_fapl_mirror");
+ LOG_OP_CALL(FUNC);
- if (NULL == fa_out) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL");
- }
+ 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) {
+ if (NULL == plist)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- }
-
- if (H5P_peek_driver(plist) != H5FD_MIRROR) {
+ if (H5P_peek_driver(plist) != H5FD_MIRROR)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
- }
- fa = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist);
- if (NULL == fa) {
+ 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->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */
+ HDassert(fa_src->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */
- HDmemcpy(fa_out, fa, sizeof(H5FD_mirror_fapl_t));
+ H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_mirror_fapl_t));
done:
FUNC_LEAVE_API(ret_value);
@@ -1245,21 +1324,17 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*#", fapl_id, fa);
- LOG_OP_CALL("H5Pset_fapl_mirror");
+ LOG_OP_CALL(FUNC);
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
- if (NULL == plist) {
+ if (NULL == plist)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- }
- if (NULL == fa) {
+ if (NULL == fa)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null fapl_t pointer");
- }
- if (H5FD_MIRROR_FAPL_MAGIC != fa->magic) {
+ if (H5FD_MIRROR_FAPL_MAGIC != fa->magic)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fapl_t magic");
- }
- if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) {
+ if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown fapl_t version");
- }
ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa);
@@ -1268,7 +1343,7 @@ done:
} /* end H5Pset_fapl_mirror() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_open
+ * Function: H5FD__mirror_open
*
* Purpose: Create and/or opens a file as an HDF5 file.
*
@@ -1282,61 +1357,48 @@ done:
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
+H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
-#define MIRR_OPEN_MAXBUF 16 /* local symbol to give meaning to magic number */
- /* #defined because it is needed at compile time */
- /* Large enough to hold a port number string */
- int live_socket = -1;
- struct sockaddr_in target_addr;
- socklen_t addr_size;
- char xmit_buf[H5FD_MIRROR_XMIT_OPEN_SIZE];
- H5FD_mirror_fapl_t fa;
- H5FD_mirror_t * file = NULL;
- H5FD_mirror_xmit_open_t open_xmit;
- H5FD_t * ret_value = NULL;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- LOG_OP_CALL("H5FD_mirror_open");
+ 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) {
+ if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
- }
- if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) {
+ if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "filename is too long");
- }
- if (0 == maxaddr || HADDR_UNDEF == maxaddr) {
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
- }
- if (ADDR_OVERFLOW(maxaddr)) {
+ if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr");
- }
- if (H5Pget_fapl_mirror(fapl_id, &fa) == FAIL) {
+ if (H5Pget_fapl_mirror(fapl_id, &fa) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get config info");
- }
-
- if (H5FD_MIRROR_FAPL_MAGIC != fa.magic) {
+ if (H5FD_MIRROR_FAPL_MAGIC != fa.magic)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl magic");
- }
-
- if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version) {
+ if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl version");
- }
/* --------------------- */
/* Handshake with remote */
/* --------------------- */
live_socket = HDsocket(AF_INET, SOCK_STREAM, 0);
- if (live_socket < 0) {
+ if (live_socket < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't create socket");
- }
target_addr.sin_family = AF_INET;
target_addr.sin_port = HDhtons((uint16_t)fa.handshake_port);
@@ -1344,18 +1406,16 @@ H5FD_mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
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) {
+ if (HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't connect to remote server");
- }
/* ------------- */
/* Open the file */
/* ------------- */
file = (H5FD_mirror_t *)H5FL_CALLOC(H5FD_mirror_t);
- if (NULL == file) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
- }
+ if (NULL == file)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct");
file->sock_fd = live_socket;
file->xmit_i = 0;
@@ -1366,46 +1426,52 @@ H5FD_mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
file->xmit.session_token = (uint32_t)(0x01020304 ^ file->sock_fd); /* TODO: hashing? */
/* int --> uint32_t may truncate on some systems... shouldn't matter? */
- 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);
+ 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((unsigned char *)xmit_buf,
- (const H5FD_mirror_xmit_open_t *)&open_xmit) !=
- H5FD_MIRROR_XMIT_OPEN_SIZE) {
+ if (H5FD_mirror_xmit_encode_open(xmit_buf, open_xmit) != H5FD_MIRROR_XMIT_OPEN_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to encode open");
- }
LOG_XMIT_BYTES("open", xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to transmit open");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid reply");
- }
ret_value = (H5FD_t *)file;
done:
if (NULL == ret_value) {
- if (file) {
+ if (file)
file = H5FL_FREE(H5FD_mirror_t, file);
- }
- if (live_socket >= 0 && HDclose(live_socket) < 0) {
+ if (live_socket >= 0 && HDclose(live_socket) < 0)
HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "can't close socket");
- }
}
+
+ if (open_xmit)
+ open_xmit = H5FL_FREE(H5FD_mirror_xmit_open_t, open_xmit);
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value)
-#undef MIRR_OPEN_MAXBUF
-} /* end H5FD_mirror_open() */
+} /* end H5FD__mirror_open() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_close
+ * Function: H5FD__mirror_close
*
* Purpose: Closes the HDF5 file.
*
@@ -1420,16 +1486,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_close(H5FD_t *_file)
+H5FD__mirror_close(H5FD_t *_file)
{
- H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE];
+ 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_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_close");
+ LOG_OP_CALL(FUNC);
/* Sanity check */
HDassert(file);
@@ -1438,25 +1504,24 @@ H5FD_mirror_close(H5FD_t *_file)
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_CLOSE;
- if (H5FD_mirror_xmit_encode_header(xmit_buf, (const H5FD_mirror_xmit_t *)&(file->xmit)) !=
- H5FD_MIRROR_XMIT_HEADER_SIZE) {
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
+ if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to encode close");
- }
xmit_encoded = 1;
LOG_XMIT_BYTES("close", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
- if (HDclose(file->sock_fd) < 0) {
+ if (HDclose(file->sock_fd) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket");
- }
done:
if (ret_value == FAIL) {
@@ -1467,31 +1532,30 @@ done:
*/
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) {
+ 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) {
+ else if (HDshutdown(file->sock_fd, SHUT_WR) < 0)
HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s",
HDstrerror(errno));
- } /* end else-if problem shutting down socket */
- } /* end if xmit encode failed */
+ } /* end if xmit encode failed */
- if (file->sock_fd >= 0) {
- if (HDclose(file->sock_fd) < 0) {
+ if (file->sock_fd >= 0)
+ if (HDclose(file->sock_fd) < 0)
HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket");
- }
- } /* end if socket not closed by going down hard */
- } /* end if error */
+ } /* end if error */
file = H5FL_FREE(H5FD_mirror_t, file); /* always release resources */
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_close() */
+} /* end H5FD__mirror_close() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_query
+ * Function: H5FD__mirror_query
*
* Purpose: Get the driver feature flags implemented by the driver.
*
@@ -1499,11 +1563,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
+H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR;
+ FUNC_ENTER_STATIC_NOERR;
- LOG_OP_CALL("H5FD_mirror_query");
+ LOG_OP_CALL(FUNC);
/* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as
* the underying driver -- as such, the Mirror VFD implementation copies
@@ -1513,17 +1577,16 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
* is never included.
* -- JOS 2020-01-13
*/
- if (flags) {
- *flags = 0 | H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
+ if (flags)
+ *flags = H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE |
H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE | H5FD_FEAT_SUPPORTS_SWMR_IO |
H5FD_FEAT_DEFAULT_VFD_COMPATIBLE;
- }
FUNC_LEAVE_NOAPI(SUCCEED);
-} /* end H5FD_mirror_query() */
+} /* end H5FD__mirror_query() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_get_eoa
+ * Function: H5FD__mirror_get_eoa
*
* Purpose: Gets the end-of-address marker for the file. The EOA marker
* is the first address past the last byte allocated in the
@@ -1535,21 +1598,21 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL("H5FD_mirror_get_eoa");
+ LOG_OP_CALL(FUNC);
HDassert(file);
FUNC_LEAVE_NOAPI(file->eoa)
-} /* end H5FD_mirror_get_eoa() */
+} /* end H5FD__mirror_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_set_eoa
+ * Function: H5FD__mirror_set_eoa
*
* Purpose: Set the end-of-address marker for the file. This function is
* called shortly after an existing HDF5 file is opened in order
@@ -1559,16 +1622,16 @@ H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
+H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
{
H5FD_mirror_xmit_eoa_t xmit_eoa;
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_EOA_SIZE];
+ unsigned char * xmit_buf = NULL;
H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_set_eoa");
+ LOG_OP_CALL(FUNC);
HDassert(file);
@@ -1581,27 +1644,30 @@ H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
xmit_eoa.type = (uint8_t)type;
xmit_eoa.eoa_addr = (uint64_t)addr;
- if (H5FD_mirror_xmit_encode_set_eoa(xmit_buf, (const H5FD_mirror_xmit_eoa_t *)&xmit_eoa) !=
- H5FD_MIRROR_XMIT_EOA_SIZE) {
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
+ if (H5FD_mirror_xmit_encode_set_eoa(xmit_buf, &xmit_eoa) != H5FD_MIRROR_XMIT_EOA_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode set-eoa");
- }
LOG_XMIT_BYTES("set-eoa", xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit set-eoa");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_set_eoa() */
+} /* end H5FD__mirror_set_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_get_eof
+ * Function: H5FD__mirror_get_eof
*
* Purpose: Returns the end-of-file marker, which is the greater of
* either the filesystem end-of-file or the HDF5 end-of-address
@@ -1614,43 +1680,40 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL("H5FD_mirror_get_eof");
+ LOG_OP_CALL(FUNC);
HDassert(file);
FUNC_LEAVE_NOAPI(file->eof)
-} /* end H5FD_mirror_get_eof() */
+} /* end H5FD__mirror_get_eof() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_read
+ * Function: H5FD__mirror_read
*
- * Purpose: Required to register the driver.
- * If called, MUST fail.
+ * Purpose: Required to register the driver, but if called, MUST fail.
*
* Return: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id,
- haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf)
+H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id,
+ haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf)
{
- herr_t ret_value = FAIL;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL("H5FD_mirror_read");
+ LOG_OP_CALL(FUNC);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_read() */
+ FUNC_LEAVE_NOAPI(FAIL)
+} /* end H5FD__mirror_read() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_write
+ * Function: H5FD__mirror_write
*
* Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
* from buffer BUF according to data transfer properties in
@@ -1667,17 +1730,17 @@ H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
- const void *buf)
+H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
+ const void *buf)
{
H5FD_mirror_xmit_write_t xmit_write;
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_WRITE_SIZE];
+ unsigned char * xmit_buf = NULL;
H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_write");
+ LOG_OP_CALL(FUNC);
HDassert(file);
HDassert(buf);
@@ -1690,39 +1753,40 @@ H5FD_mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
xmit_write.offset = (uint64_t)addr;
xmit_write.type = (uint8_t)type;
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
/* Notify Writer of incoming data to write. */
- if (H5FD_mirror_xmit_encode_write(xmit_buf, (const H5FD_mirror_xmit_write_t *)&xmit_write) !=
- H5FD_MIRROR_XMIT_WRITE_SIZE) {
+ if (H5FD_mirror_xmit_encode_write(xmit_buf, &xmit_write) != H5FD_MIRROR_XMIT_WRITE_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode write");
- }
LOG_XMIT_BYTES("write", xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit write");
- }
/* Check that our write xmission was received */
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
/* Send the data to be written */
- if (HDwrite(file->sock_fd, buf, size) < 0) {
+ if (HDwrite(file->sock_fd, buf, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit data");
- }
/* Writer should reply that it got the data and is still okay/ready */
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_write() */
+} /* end H5FD__mirror_write() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_truncate
+ * Function: H5FD__mirror_truncate
*
* Purpose: Makes sure that the true file size is the same (or larger)
* than the end-of-address.
@@ -1731,39 +1795,43 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
+H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE];
+ unsigned char *xmit_buf = NULL;
H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_truncate");
+ LOG_OP_CALL(FUNC);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_TRUNCATE;
- if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) {
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
+ if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode truncate");
- }
LOG_XMIT_BYTES("truncate", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit truncate");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_mirror_truncate() */
+} /* end H5FD__mirror_truncate() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_lock
+ * Function: H5FD__mirror_lock
*
* Purpose: To place an advisory lock on a file.
* The lock type to apply depends on the parameter "rw":
@@ -1774,16 +1842,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_lock(H5FD_t *_file, hbool_t rw)
+H5FD__mirror_lock(H5FD_t *_file, hbool_t rw)
{
H5FD_mirror_xmit_lock_t xmit_lock;
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_LOCK_SIZE];
+ unsigned char * xmit_buf = NULL;
H5FD_mirror_t * file = (H5FD_mirror_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_lock");
+ LOG_OP_CALL(FUNC);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_LOCK;
@@ -1791,27 +1859,30 @@ H5FD_mirror_lock(H5FD_t *_file, hbool_t rw)
xmit_lock.pub = file->xmit;
xmit_lock.rw = (uint64_t)rw;
- if (H5FD_mirror_xmit_encode_lock(xmit_buf, (const H5FD_mirror_xmit_lock_t *)&xmit_lock) !=
- H5FD_MIRROR_XMIT_LOCK_SIZE) {
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
+ if (H5FD_mirror_xmit_encode_lock(xmit_buf, &xmit_lock) != H5FD_MIRROR_XMIT_LOCK_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode lock");
- }
LOG_XMIT_BYTES("lock", xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit lock");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5FD_mirror_lock */
+} /* end H5FD__mirror_lock */
/*-------------------------------------------------------------------------
- * Function: H5FD_mirror_unlock
+ * Function: H5FD__mirror_unlock
*
* Purpose: Remove the existing lock on the file.
*
@@ -1819,35 +1890,39 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mirror_unlock(H5FD_t *_file)
+H5FD__mirror_unlock(H5FD_t *_file)
{
- unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE];
+ unsigned char *xmit_buf = NULL;
H5FD_mirror_t *file = (H5FD_mirror_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT;
+ FUNC_ENTER_STATIC
- LOG_OP_CALL("H5FD_mirror_unlock");
+ LOG_OP_CALL(FUNC);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_UNLOCK;
- if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) {
+ xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
+ if (NULL == xmit_buf)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer");
+
+ if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode unlock");
- }
LOG_XMIT_BYTES("unlock", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE);
- if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) {
+ if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit unlock");
- }
- if (H5FD__mirror_verify_reply(file) == FAIL) {
+ if (H5FD__mirror_verify_reply(file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply");
- }
done:
+ if (xmit_buf)
+ xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf);
+
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5FD_mirror_unlock */
+} /* end H5FD__mirror_unlock */
#endif /* H5_HAVE_MIRROR_VFD */
diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h
index 2ed6bbd..49e24c1 100644
--- a/src/H5FDmirror.h
+++ b/src/H5FDmirror.h
@@ -61,294 +61,21 @@ typedef struct H5FD_mirror_fapl_t {
char remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1];
} H5FD_mirror_fapl_t;
-H5_DLL hid_t H5FD_mirror_init(void);
-H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out);
-H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa);
-
-/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- * IPC - Mirror VFD and Remote Worker application.
- * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- */
-
-/* The maximum allowed size for a receiving buffer when accepting bytes to
- * write. Writes larger than this size are performed by multiple accept-write
- * steps by the Writer. */
-#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */
-
-#define H5FD_MIRROR_XMIT_CURR_VERSION 1
-#define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B
-
-#define H5FD_MIRROR_OP_OPEN 1
-#define H5FD_MIRROR_OP_CLOSE 2
-#define H5FD_MIRROR_OP_WRITE 3
-#define H5FD_MIRROR_OP_TRUNCATE 4
-#define H5FD_MIRROR_OP_REPLY 5
-#define H5FD_MIRROR_OP_SET_EOA 6
-#define H5FD_MIRROR_OP_LOCK 7
-#define H5FD_MIRROR_OP_UNLOCK 8
-
-#define H5FD_MIRROR_STATUS_OK 0
-#define H5FD_MIRROR_STATUS_ERROR 1
-#define H5FD_MIRROR_STATUS_MESSAGE_MAX 256 /* Dedicated error message size */
-
-/* Maximum length of a path/filename string, including the NULL-terminator.
- * Must not be smaller than H5FD_SPLITTER_PATH_MAX. */
-#define H5FD_MIRROR_XMIT_FILEPATH_MAX 4097
-
-/* Define the exact sizes of the various xmit blobs as sent over the wire.
- * This is used to minimize the number of bytes transmitted as well as to
- * sanity-check received bytes.
- * Any modifications to the xmit structures and/or the encode/decode functions
- * must be reflected here.
- * */
-#define H5FD_MIRROR_XMIT_HEADER_SIZE 14
-#define H5FD_MIRROR_XMIT_EOA_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 9)
-#define H5FD_MIRROR_XMIT_LOCK_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 8)
-#define H5FD_MIRROR_XMIT_OPEN_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 20 + H5FD_MIRROR_XMIT_FILEPATH_MAX)
-#define H5FD_MIRROR_XMIT_REPLY_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 4 + H5FD_MIRROR_STATUS_MESSAGE_MAX)
-#define H5FD_MIRROR_XMIT_WRITE_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 17)
+H5_DLL hid_t H5FD_mirror_init(void);
-/* 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".
+/**
+ * \ingroup FAPL
*
- * `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.
- *
- * ---------------------------------------------------------------------------
+ * \todo Add missing documentation
*/
-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;
+H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out);
-/* 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).
+/**
+ * \ingroup FAPL
*
- * All components must be packed in the order given in the structure definition.
- *
- * All components must be packed with zero padding between.
+ * \todo Add missing documentation
*/
-
-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);
+H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa);
#ifdef __cplusplus
}
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/H5FDmpi.h b/src/H5FDmpi.h
index 3af5e41..cf49301 100644
--- a/src/H5FDmpi.h
+++ b/src/H5FDmpi.h
@@ -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 9dbd443..b229207 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -86,6 +86,7 @@ static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id,
const void *buf);
static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id);
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);
@@ -94,43 +95,44 @@ static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file);
static const H5FD_class_mpi_t H5FD_mpio_g = {
{
/* Start of superclass information */
- "mpio", /*name */
- HADDR_MAX, /*maxaddr */
- H5F_CLOSE_SEMI, /*fc_degree */
- H5FD__mpio_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__mpio_open, /*open */
- H5FD__mpio_close, /*close */
- NULL, /*cmp */
- H5FD__mpio_query, /*query */
- NULL, /*get_type_map */
- NULL, /*alloc */
- NULL, /*free */
- H5FD__mpio_get_eoa, /*get_eoa */
- H5FD__mpio_set_eoa, /*set_eoa */
- H5FD__mpio_get_eof, /*get_eof */
- H5FD__mpio_get_handle, /*get_handle */
- H5FD__mpio_read, /*read */
- H5FD__mpio_write, /*write */
- H5FD__mpio_flush, /*flush */
- H5FD__mpio_truncate, /*truncate */
- NULL, /*lock */
- NULL, /*unlock */
- NULL, /* dedup */
- H5FD_FLMAP_DICHOTOMY /*fl_map */
+ "mpio", /* name */
+ HADDR_MAX, /* maxaddr */
+ H5F_CLOSE_SEMI, /* fc_degree */
+ H5FD__mpio_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__mpio_open, /* open */
+ H5FD__mpio_close, /* close */
+ NULL, /* cmp */
+ H5FD__mpio_query, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ H5FD__mpio_get_eoa, /* get_eoa */
+ H5FD__mpio_set_eoa, /* set_eoa */
+ H5FD__mpio_get_eof, /* get_eof */
+ H5FD__mpio_get_handle, /* get_handle */
+ H5FD__mpio_read, /* read */
+ H5FD__mpio_write, /* write */
+ H5FD__mpio_flush, /* flush */
+ H5FD__mpio_truncate, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD__mpio_delete, /* del */
+ NULL, /* dedup */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
}, /* End of superclass information */
- H5FD__mpio_mpi_rank, /*get_rank */
- H5FD__mpio_mpi_size, /*get_size */
- H5FD__mpio_communicator /*get_comm */
+ H5FD__mpio_mpi_rank, /* get_rank */
+ H5FD__mpio_mpi_size, /* get_size */
+ H5FD__mpio_communicator /* get_comm */
};
#ifdef H5FDmpio_DEBUG
@@ -1747,6 +1749,60 @@ done:
} /* end H5FD__mpio_truncate() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__mpio_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__mpio_delete(const char *filename, hid_t fapl_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ MPI_Comm comm = MPI_COMM_NULL;
+ MPI_Info info = MPI_INFO_NULL;
+ int mpi_rank = INT_MAX;
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ HDassert(H5FD_MPIO == H5P_peek_driver(plist));
+
+ /* Get the MPI communicator and info from the fapl */
+ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object")
+ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator")
+
+ /* Get the MPI rank of this process */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mpi_code)
+
+ /* Set up a barrier */
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
+
+ /* Delete the file */
+ if (mpi_rank == 0)
+ if (MPI_SUCCESS != (mpi_code = MPI_File_delete(filename, info)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_delete failed", mpi_code)
+
+ /* Set up a barrier (don't want processes to run ahead of the delete) */
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__mpio_delete() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD__mpio_mpi_rank
*
* Purpose: Returns the MPI rank for a process
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 79b52c7..8caf11c 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -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 e71f450..8b87319 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -15,12 +15,12 @@
* 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.
+ * 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) \
{ \
@@ -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);
@@ -134,75 +142,47 @@ static herr_t H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
static herr_t H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
static herr_t H5FD_multi_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD_multi_unlock(H5FD_t *_file);
+static herr_t H5FD_multi_delete(const char *filename, hid_t fapl_id);
/* The class struct */
static const H5FD_class_t H5FD_multi_g = {
- "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_get_handle, /*get_handle */
- H5FD_multi_read, /*read */
- H5FD_multi_write, /*write */
- H5FD_multi_flush, /*flush */
- H5FD_multi_truncate, /*truncate */
- H5FD_multi_lock, /*lock */
- H5FD_multi_unlock, /*unlock */
- NULL, /*dedup */
- H5FD_FLMAP_DEFAULT /*fl_map */
+ "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_get_handle, /* get_handle */
+ 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_multi_delete, /* del */
+ NULL, /* dedup */
+ 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
@@ -229,9 +209,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
*
@@ -250,17 +230,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
*
*-------------------------------------------------------------------------
@@ -340,77 +320,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
*
*-------------------------------------------------------------------------
@@ -436,12 +416,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);
@@ -465,19 +445,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);
}
/*
@@ -500,17 +481,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
*
*-------------------------------------------------------------------------
@@ -529,13 +510,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)
@@ -561,16 +543,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
*
*-------------------------------------------------------------------------
@@ -605,24 +587,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
*
*-------------------------------------------------------------------------
@@ -672,10 +654,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);
@@ -689,21 +671,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
*
*-------------------------------------------------------------------------
@@ -728,16 +710,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;
/*
@@ -762,9 +743,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++;
@@ -819,41 +800,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
*
*-------------------------------------------------------------------------
@@ -870,15 +850,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
*
*-------------------------------------------------------------------------
@@ -924,21 +904,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
*
*-------------------------------------------------------------------------
@@ -955,8 +935,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);
@@ -965,17 +946,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
*
*-------------------------------------------------------------------------
@@ -994,24 +975,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) {
@@ -1067,17 +1047,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
*
*-------------------------------------------------------------------------
@@ -1105,16 +1085,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);
@@ -1123,20 +1102,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
*
*-------------------------------------------------------------------------
@@ -1172,16 +1150,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
*
*-------------------------------------------------------------------------
@@ -1190,7 +1168,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) {
@@ -1205,14 +1183,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
*
*-------------------------------------------------------------------------
@@ -1229,17 +1207,17 @@ 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
*
*-------------------------------------------------------------------------
@@ -1274,7 +1252,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) {
/*
@@ -1285,7 +1265,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)
@@ -1308,7 +1288,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) {
/*
@@ -1319,7 +1301,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);
}
}
@@ -1327,18 +1309,18 @@ 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
*
*-------------------------------------------------------------------------
@@ -1385,24 +1367,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
*
*-------------------------------------------------------------------------
@@ -1431,7 +1413,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) {
/*
@@ -1442,7 +1426,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;
@@ -1465,7 +1449,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) {
/*
@@ -1476,7 +1462,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;
@@ -1504,9 +1490,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;
@@ -1514,15 +1501,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
*
*-------------------------------------------------------------------------
@@ -1549,36 +1536,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
*
*-------------------------------------------------------------------------
@@ -1602,18 +1589,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
*
*-------------------------------------------------------------------------
@@ -1649,17 +1636,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
*
*-------------------------------------------------------------------------
@@ -1695,15 +1682,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
*
*-------------------------------------------------------------------------
@@ -1717,7 +1704,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");
@@ -1725,9 +1712,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");
@@ -1737,14 +1724,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
@@ -1763,20 +1750,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
*
*-------------------------------------------------------------------------
@@ -1804,23 +1791,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
*
*-------------------------------------------------------------------------
*/
@@ -1872,16 +1859,16 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
} /* 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
*
*-------------------------------------------------------------------------
*/
@@ -1909,16 +1896,16 @@ H5FD_multi_unlock(H5FD_t *_file)
} /* 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
*
*-------------------------------------------------------------------------
@@ -1953,21 +1940,21 @@ 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
*
*-------------------------------------------------------------------------
*/
-/* Disable warning for "format not a string literal" here -QAK */
-/*
+/* Disable warning for "format not a string literal" here
+ *
* This pragma only needs to surround the snprintf() call with
* tmp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
@@ -1978,7 +1965,8 @@ open_members(H5FD_multi_t *file)
{
char tmp[H5FD_MULT_MAX_FILE_NAME_LEN];
int nerrors = 0;
- static const char *func = "(H5FD_multi)open_members"; /* Function Name for error reporting */
+ int nchars;
+ static const char *func = "(H5FD_multi)open_members"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1987,11 +1975,11 @@ open_members(H5FD_multi_t *file)
if (file->memb[mt])
continue; /*already open*/
assert(file->fa.memb_name[mt]);
- /* Note: This truncates the user's filename down to only sizeof(tmp)
- * characters. -QK & JK, 2013/01/17
- */
- sprintf(tmp, file->fa.memb_name[mt], file->name);
- tmp[sizeof(tmp) - 1] = '\0';
+
+ nchars = snprintf(tmp, sizeof(tmp), file->fa.memb_name[mt], file->name);
+ if (nchars < 0 || nchars >= (int)sizeof(tmp))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE,
+ "filename is too long and would be truncated", -1);
H5E_BEGIN_TRY
{
@@ -2005,10 +1993,57 @@ 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;
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_delete(const char *filename, hid_t fapl_id)
+{
+ char full_filename[H5FD_MULT_MAX_FILE_NAME_LEN];
+ int nchars;
+ const H5FD_multi_fapl_t *fa;
+ static const char * func = "H5FD_multi_delete"; /* Function Name for error reporting */
+
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ assert(filename);
+
+ /* Quiet compiler */
+ (void)fapl_id;
+
+ /* Get the driver info */
+ fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
+ assert(fa);
+
+ /* Delete each member file using the underlying fapl */
+ UNIQUE_MEMBERS (fa->memb_map, mt) {
+ assert(fa->memb_name[mt]);
+ assert(fa->memb_fapl[mt] >= 0);
+
+ nchars = snprintf(full_filename, sizeof(full_filename), fa->memb_name[mt], filename);
+ if (nchars < 0 || nchars >= (int)sizeof(full_filename))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE,
+ "filename is too long and would be truncated", -1);
+
+ if (H5FDdelete(full_filename, fa->memb_fapl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE, "error deleting member files", -1);
+ }
+ END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_delete() */
H5_GCC_DIAG_ON("format-nonliteral")
#ifdef H5private_H
diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h
index 9e04d8d..62cc9c8 100644
--- a/src/H5FDmulti.h
+++ b/src/H5FDmulti.h
@@ -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/H5FDprivate.h b/src/H5FDprivate.h
index adf900a..645436b 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -350,6 +350,7 @@ H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing);
H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing);
H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw);
H5_DLL herr_t H5FD_unlock(H5FD_t *file);
+H5_DLL herr_t H5FD_delete(const char *name, hid_t fapl_id);
H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle);
H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr);
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index f642f41..46f8803 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -299,6 +299,7 @@ typedef struct H5FD_class_t {
herr_t (*truncate)(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
herr_t (*lock)(H5FD_t *file, hbool_t rw);
herr_t (*unlock)(H5FD_t *file);
+ herr_t (*del)(const char *name, hid_t fapl);
H5FD_t *(*dedup)(H5FD_t *, H5FD_t *, hid_t);
H5FD_mem_t fl_map[H5FD_MEM_NTYPES];
} H5FD_class_t;
@@ -333,29 +334,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" {
@@ -382,6 +467,7 @@ H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw);
H5_DLL herr_t H5FDunlock(H5FD_t *file);
+H5_DLL herr_t H5FDdelete(const char *name, hid_t fapl_id);
/* Allows querying a VFD ID for features before the file is opened */
H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/);
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index a241180..0303b50 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -214,59 +214,59 @@ 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_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 */
+ NULL, /* lock */
+ NULL, /* unlock */
+ NULL, /* del */
NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -292,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() */
/*-------------------------------------------------------------------------
@@ -322,7 +320,7 @@ H5FD_ros3_init(void)
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");
@@ -336,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
*
@@ -361,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
@@ -407,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,
@@ -443,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
@@ -481,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 /*out*/)
{
- 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*#", fapl_id, fa_out);
+ H5TRACE2("e", "ix", 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.
@@ -538,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.
*
@@ -584,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.
*
@@ -625,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()
@@ -673,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;
@@ -697,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:
*
@@ -734,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;
@@ -744,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 */
@@ -763,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.
@@ -781,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()
@@ -915,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;
/******************
@@ -995,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++)
@@ -1006,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++)
@@ -1074,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++)
@@ -1118,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:
@@ -1129,7 +1072,7 @@ done:
/*-------------------------------------------------------------------------
*
- * Function: H5FD_ros3_close()
+ * Function: H5FD__ros3_close()
*
* Purpose:
*
@@ -1145,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:
*
@@ -1216,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;
@@ -1224,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);
@@ -1243,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' && f2->fa.aws_region[0] != '\0') {
- if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) {
- HGOTO_DONE(-1);
- }
- }
- else if (f1->fa.aws_region[0] != '\0') {
- HGOTO_DONE(-1);
- }
- else if (f2->fa.aws_region[0] != '\0') {
- HGOTO_DONE(-1);
+ if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region))
+ HGOTO_DONE(-1)
}
+ else if (f1->fa.aws_region[0] != '\0')
+ HGOTO_DONE(-1)
+ else if (f2->fa.aws_region[0] != '\0')
+ HGOTO_DONE(-1)
/* FAPL: SECRET_ID */
if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') {
- if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) {
- HGOTO_DONE(-1);
- }
- }
- else if (f1->fa.secret_id[0] != '\0') {
- HGOTO_DONE(-1);
- }
- else if (f2->fa.secret_id[0] != '\0') {
- HGOTO_DONE(-1);
+ if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id))
+ HGOTO_DONE(-1)
}
+ else if (f1->fa.secret_id[0] != '\0')
+ HGOTO_DONE(-1)
+ else if (f2->fa.secret_id[0] != '\0')
+ HGOTO_DONE(-1)
/* FAPL: SECRET_KEY */
if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') {
- if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) {
- HGOTO_DONE(-1);
- }
- }
- else if (f1->fa.secret_key[0] != '\0') {
- HGOTO_DONE(-1);
- }
- else if (f2->fa.secret_key[0] != '\0') {
- HGOTO_DONE(-1);
+ if (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)
@@ -1355,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 */
@@ -1371,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:
*
@@ -1394,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:
*
@@ -1426,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:
*
@@ -1461,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:
*
@@ -1493,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
*
@@ -1538,8 +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,
- size_t size, void *buf)
+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;
@@ -1550,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);
@@ -1562,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;
@@ -1602,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:
*
@@ -1624,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:
*
@@ -1663,76 +1564,21 @@ 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() */
-
-/*-------------------------------------------------------------------------
- *
- * Function: H5FD_ros3_lock()
- *
- * Purpose:
- *
- * Place an advisory lock on a file.
- * No effect on Read-Only S3 file.
- *
- * Suggestion: remove lock/unlock from class
- * > would result in error at H5FD_[un]lock() (H5FD.c)
- *
- * Return:
- *
- * SUCCEED (No-op always succeeds)
- *
- * Programmer: Jacob Smith
- * 2017-11-03
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(SUCCEED)
-
-} /* end H5FD_ros3_lock() */
-
-/*-------------------------------------------------------------------------
- *
- * Function: H5FD_ros3_unlock()
- *
- * Purpose:
- *
- * Remove the existing lock on the file.
- * No effect on Read-Only S3 file.
- *
- * Return:
- *
- * SUCCEED (No-op always succeeds)
- *
- * Programmer: Jacob Smith
- * 2017-11-03
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(SUCCEED)
-
-} /* end H5FD_ros3_unlock() */
+} /* end H5FD__ros3_truncate() */
#endif /* H5_HAVE_ROS3_VFD */
diff --git a/src/H5FDros3.h b/src/H5FDros3.h
index 3ef6b8a..8e42ca2 100644
--- a/src/H5FDros3.h
+++ b/src/H5FDros3.h
@@ -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 d958675..ee5b5ec 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -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/H5FDsec2.c b/src/H5FDsec2.c
index 319089c..c694190 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -98,7 +98,6 @@ typedef struct H5FD_sec2_t {
* a single file.
*/
hbool_t fam_to_single;
-
} H5FD_sec2_t;
/*
@@ -123,57 +122,59 @@ 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 herr_t H5FD__sec2_delete(const char *filename, hid_t fapl_id);
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 */
- NULL, /* dedup */
- 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__sec2_delete, /* del */
+ NULL, /* dedup */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/* Declare a free list to manage the H5FD_sec2_t struct */
@@ -244,7 +245,7 @@ done:
} /* end H5FD_sec2_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_sec2_term
+ * Function: H5FD__sec2_term
*
* Purpose: Shut down the VFD
*
@@ -256,15 +257,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
@@ -299,7 +300,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.
*
@@ -314,7 +315,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 */
@@ -326,7 +327,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
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));
@@ -427,10 +428,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.
*
@@ -443,12 +444,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);
@@ -462,10 +463,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.
@@ -480,13 +481,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)
@@ -527,10 +528,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)
@@ -543,11 +544,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */)
+H5FD__sec2_query(const H5FD_t *_file, unsigned long *flags /* out */)
{
const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; /* sec2 VFD info */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Set the VFL feature flags that this driver supports */
/* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as
@@ -575,10 +576,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
@@ -592,17 +593,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
@@ -616,19 +617,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
@@ -643,17 +644,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.
*
@@ -665,12 +666,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")
@@ -679,10 +680,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
@@ -698,14 +699,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);
@@ -718,17 +719,15 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pread) */
- if (addr != file->pos || OP_READ != file->op) {
+ if (addr != file->pos || OP_READ != file->op)
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
- }
#endif /* H5_HAVE_PREADWRITE */
/* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
*/
while (size > 0) {
-
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
@@ -791,10 +790,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
@@ -808,14 +807,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);
@@ -829,17 +828,15 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pwrite) */
- if (addr != file->pos || OP_WRITE != file->op) {
+ if (addr != file->pos || OP_WRITE != file->op)
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
- }
#endif /* H5_HAVE_PREADWRITE */
/* Write the data, being careful of interrupted system calls and partial
* results
*/
while (size > 0) {
-
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
@@ -898,10 +895,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.
@@ -914,12 +911,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);
@@ -966,10 +963,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":
@@ -983,13 +980,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);
@@ -1010,10 +1007,10 @@ H5FD_sec2_lock(H5FD_t *_file, hbool_t rw)
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
*
@@ -1024,12 +1021,12 @@ 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);
@@ -1046,4 +1043,29 @@ H5FD_sec2_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_sec2_unlock() */
+} /* end H5FD__sec2_unlock() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__sec2_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__sec2_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ if (HDremove(filename) < 0)
+ HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__sec2_delete() */
diff --git a/src/H5FDspace.c b/src/H5FDspace.c
index 5692b24..339c413 100644
--- a/src/H5FDspace.c
+++ b/src/H5FDspace.c
@@ -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
index 790b953..99d7100 100644
--- a/src/H5FDsplitter.c
+++ b/src/H5FDsplitter.c
@@ -27,8 +27,6 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5FDsec2.h" /* Generic Functions */
-#include "H5FDstdio.h" /* Generic Functions */
#include "H5Pprivate.h" /* Property lists */
/* The driver identification number, initialized at runtime */
@@ -82,9 +80,8 @@ typedef struct H5FD_splitter_t {
#define H5FD_SPLITTER_WO_ERROR(file, funcname, errmajor, errminor, ret, mesg) \
{ \
H5FD__splitter_log_error((file), (funcname), (mesg)); \
- if (FALSE == (file)->fa.ignore_wo_errs) { \
+ if (FALSE == (file)->fa.ignore_wo_errs) \
HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \
- } \
}
#define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */
@@ -93,7 +90,7 @@ typedef struct H5FD_splitter_t {
#define H5FD_SPLITTER_LOG_CALL(name) \
do { \
HDprintf("called %s()\n", (name)); \
- fflush(stdout); \
+ HDfflush(stdout); \
} while (0)
#else
#define H5FD_SPLITTER_LOG_CALL(name) /* no-op */
@@ -103,69 +100,69 @@ typedef struct H5FD_splitter_t {
/* Print error messages from W/O channel to log file */
static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg);
-
-static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr);
+static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr);
/* Prototypes */
-static herr_t H5FD_splitter_term(void);
-static hsize_t H5FD_splitter_sb_size(H5FD_t *_file);
-static herr_t H5FD_splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/);
-static herr_t H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf);
-static void * H5FD_splitter_fapl_get(H5FD_t *_file);
-static void * H5FD_splitter_fapl_copy(const void *_old_fa);
-static herr_t H5FD_splitter_fapl_free(void *_fapl);
-static H5FD_t *H5FD_splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
-static herr_t H5FD_splitter_close(H5FD_t *_file);
-static int H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
-static herr_t H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */);
-static herr_t H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map);
-static haddr_t H5FD_splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
-static herr_t H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
-static haddr_t H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type);
-static herr_t H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr);
-static haddr_t H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type);
-static herr_t H5FD_splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle);
-static herr_t H5FD_splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- void *buf);
-static herr_t H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- const void *buf);
-static herr_t H5FD_splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
-static herr_t H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
-static herr_t H5FD_splitter_lock(H5FD_t *_file, hbool_t rw);
-static herr_t H5FD_splitter_unlock(H5FD_t *_file);
+static herr_t H5FD__splitter_term(void);
+static hsize_t H5FD__splitter_sb_size(H5FD_t *_file);
+static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/);
+static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf);
+static void * H5FD__splitter_fapl_get(H5FD_t *_file);
+static void * H5FD__splitter_fapl_copy(const void *_old_fa);
+static herr_t H5FD__splitter_fapl_free(void *_fapl);
+static H5FD_t *H5FD__splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+static herr_t H5FD__splitter_close(H5FD_t *_file);
+static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
+static herr_t H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */);
+static herr_t H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map);
+static haddr_t H5FD__splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
+static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
+static haddr_t H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type);
+static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr);
+static haddr_t H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type);
+static herr_t H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle);
+static herr_t H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
+ void *buf);
+static herr_t H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
+ const void *buf);
+static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
+static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw);
+static herr_t H5FD__splitter_unlock(H5FD_t *_file);
static const H5FD_class_t H5FD_splitter_g = {
"splitter", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
- H5FD_splitter_term, /* terminate */
- H5FD_splitter_sb_size, /* sb_size */
- H5FD_splitter_sb_encode, /* sb_encode */
- H5FD_splitter_sb_decode, /* sb_decode */
+ H5FD__splitter_term, /* terminate */
+ H5FD__splitter_sb_size, /* sb_size */
+ H5FD__splitter_sb_encode, /* sb_encode */
+ H5FD__splitter_sb_decode, /* sb_decode */
sizeof(H5FD_splitter_fapl_t), /* fapl_size */
- H5FD_splitter_fapl_get, /* fapl_get */
- H5FD_splitter_fapl_copy, /* fapl_copy */
- H5FD_splitter_fapl_free, /* fapl_free */
+ H5FD__splitter_fapl_get, /* fapl_get */
+ H5FD__splitter_fapl_copy, /* fapl_copy */
+ H5FD__splitter_fapl_free, /* fapl_free */
0, /* dxpl_size */
NULL, /* dxpl_copy */
NULL, /* dxpl_free */
- H5FD_splitter_open, /* open */
- H5FD_splitter_close, /* close */
- H5FD_splitter_cmp, /* cmp */
- H5FD_splitter_query, /* query */
- H5FD_splitter_get_type_map, /* get_type_map */
- H5FD_splitter_alloc, /* alloc */
- H5FD_splitter_free, /* free */
- H5FD_splitter_get_eoa, /* get_eoa */
- H5FD_splitter_set_eoa, /* set_eoa */
- H5FD_splitter_get_eof, /* get_eof */
- H5FD_splitter_get_handle, /* get_handle */
- H5FD_splitter_read, /* read */
- H5FD_splitter_write, /* write */
- H5FD_splitter_flush, /* flush */
- H5FD_splitter_truncate, /* truncate */
- H5FD_splitter_lock, /* lock */
- H5FD_splitter_unlock, /* unlock */
+ 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 */
+ NULL, /* del */
NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -173,6 +170,9 @@ static const H5FD_class_t H5FD_splitter_g = {
/* Declare a free list to manage the H5FD_splitter_t struct */
H5FL_DEFINE_STATIC(H5FD_splitter_t);
+/* Declare a free list to manage the H5FD_splitter_fapl_t struct */
+H5FL_DEFINE_STATIC(H5FD_splitter_fapl_t);
+
/*-------------------------------------------------------------------------
* Function: H5FD__init_package
*
@@ -188,11 +188,10 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD__init_package");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
- if (H5FD_splitter_init() < 0) {
+ if (H5FD_splitter_init() < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -213,13 +212,12 @@ H5FD_splitter_init(void)
{
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_init");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
- if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) {
+ if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g))
H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g);
- }
ret_value = H5FD_SPLITTER_g;
@@ -228,7 +226,7 @@ done:
} /* end H5FD_splitter_init() */
/*---------------------------------------------------------------------------
- * Function: H5FD_splitter_term
+ * Function: H5FD__splitter_term
*
* Purpose: Shut down the splitter VFD.
*
@@ -236,17 +234,17 @@ done:
*---------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_term(void)
+H5FD__splitter_term(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_term");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Reset VFL ID */
H5FD_SPLITTER_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5FD_splitter_term() */
+} /* end H5FD__splitter_term() */
/*-------------------------------------------------------------------------
* Function: H5FD__copy_plist
@@ -263,25 +261,22 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr)
int ret_value = 0;
H5P_genplist_t *plist_ptr = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD__copy_plist");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(id_out_ptr != NULL);
- if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) {
+ if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a file access property list");
- }
plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id);
- if (NULL == plist_ptr) {
+ if (NULL == plist_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "unable to get property list");
- }
*id_out_ptr = H5P_copy_plist(plist_ptr, FALSE);
- if (H5I_INVALID_HID == *id_out_ptr) {
+ if (H5I_INVALID_HID == *id_out_ptr)
HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list");
- }
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -299,27 +294,21 @@ done:
herr_t
H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
{
- H5FD_splitter_fapl_t info;
- H5P_genplist_t * plist_ptr = NULL;
- herr_t ret_value = SUCCEED;
-
- H5Eclear2(H5E_DEFAULT);
+ H5FD_splitter_fapl_t *info = NULL;
+ H5P_genplist_t * plist_ptr = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*#", fapl_id, vfd_config);
- H5FD_SPLITTER_LOG_CALL("H5Pset_fapl_splitter");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
- if (H5FD_SPLITTER_MAGIC != vfd_config->magic) {
+ if (H5FD_SPLITTER_MAGIC != vfd_config->magic)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)")
- }
- if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invlaid config (version number mismatch)")
- }
-
- if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) {
+ if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)")
+ if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list")
- }
/* Make sure that the W/O channel supports write-only capability.
* Some drivers (e.g. family or multi) do revision of the superblock
@@ -334,47 +323,47 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
unsigned long wo_driver_flags = 0;
wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id);
- if (NULL == wo_plist_ptr) {
+ if (NULL == wo_plist_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- }
- if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) {
+ if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info")
- }
wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id);
- if (NULL == wo_driver) {
+ if (NULL == wo_driver)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list")
- }
- if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) {
+ if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags")
- }
- if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) {
+ if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver")
- }
} /* end if W/O VFD is non-default */
- info.ignore_wo_errs = vfd_config->ignore_wo_errs;
- HDstrncpy(info.wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(info.log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX);
- info.rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
- info.wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+ info = 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)) {
+ if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
- }
- info.rw_fapl_id = vfd_config->rw_fapl_id;
+ info->rw_fapl_id = vfd_config->rw_fapl_id;
}
if (H5P_DEFAULT != vfd_config->wo_fapl_id) {
- if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) {
+ if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
- }
- info.wo_fapl_id = vfd_config->wo_fapl_id;
+ info->wo_fapl_id = vfd_config->wo_fapl_id;
}
- ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, &info);
+ ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info);
done:
+ if (info)
+ info = H5FL_FREE(H5FD_splitter_fapl_t, info);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fapl_splitter() */
@@ -382,73 +371,64 @@ done:
* Function: H5Pget_fapl_splitter
*
* Purpose: Returns information about the splitter file access property
- * list through the structure config_out.
+ * list through the structure config.
*
- * Will fail if config_out is received without pre-set valid
+ * 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_out)
+H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
{
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*#", fapl_id, config_out);
+ H5TRACE2("e", "ix", fapl_id, config);
- H5FD_SPLITTER_LOG_CALL("H5Pget_fapl_splitter");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
- if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) {
+ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- }
- if (config_out == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_out pointer is null")
- }
- if (H5FD_SPLITTER_MAGIC != config_out->magic) {
+ 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_out->version) {
+ 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_out->rw_fapl_id = H5I_INVALID_HID;
- config_out->wo_fapl_id = H5I_INVALID_HID;
+ 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))) {
+ if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- }
- if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) {
+ if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
- }
- if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) {
+ if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info")
- }
- HDstrncpy(config_out->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(config_out->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
- config_out->ignore_wo_errs = fapl_ptr->ignore_wo_errs;
+ 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_out->rw_fapl_id)) < 0) {
+ 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_out->wo_fapl_id)) < 0) {
+ 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
+ * Function: H5FD__splitter_flush
*
* Purpose: Flushes all data to disk for both channels.
*
@@ -456,30 +436,27 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
+H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_flush");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Public API for dxpl "context" */
- if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) {
+ if (H5FDflush(file->rw_file, dxpl_id, closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file")
- }
- if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_flush", H5E_VFL, H5E_CANTFLUSH, FAIL,
- "unable to flush W/O file")
- }
+ if (H5FDflush(file->wo_file, dxpl_id, closing) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_flush() */
+} /* end H5FD__splitter_flush() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_read
+ * Function: H5FD__splitter_read
*
* Purpose: Reads SIZE bytes of data from the R/W channel, beginning at
* address ADDR into buffer BUF according to data transfer
@@ -493,39 +470,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr,
- size_t size, void *buf /*out*/)
+H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr,
+ size_t size, void *buf)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_read");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(file && file->pub.cls);
HDassert(buf);
/* Check for overflow conditions */
- if (!H5F_addr_defined(addr)) {
+ if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
- }
- if (REGION_OVERFLOW(addr, size)) {
+ if (REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
- }
/* Only read from R/W channel */
/* Public API for dxpl "context" */
- if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) {
+ if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_read() */
+} /* end H5FD__splitter_read() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_write
+ * Function: H5FD__splitter_write
*
* Purpose: Writes SIZE bytes of data to R/W and W/O channels, beginning
* at address ADDR from buffer BUF according to data transfer
@@ -535,36 +509,33 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf)
+H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
+ const void *buf)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
H5P_genplist_t * plist_ptr = NULL;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_write");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
- if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) {
+ if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- }
/* Write to each file */
/* Public API for dxpl "context" */
- if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) {
+ if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed")
- }
- if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_write", H5E_VFL, H5E_WRITEERROR, FAIL,
- "unable to write W/O file")
- }
+ if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_write() */
+} /* end H5FD__splitter_write() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_fapl_get
+ * Function: H5FD__splitter_fapl_get
*
* Purpose: Returns a file access property list which indicates how the
* specified file is being accessed. The return list could be
@@ -576,22 +547,22 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5FD_splitter_fapl_get(H5FD_t *_file)
+H5FD__splitter_fapl_get(H5FD_t *_file)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
void * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_get");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
- ret_value = H5FD_splitter_fapl_copy(&(file->fa));
+ ret_value = H5FD__splitter_fapl_copy(&(file->fa));
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD__splitter_fapl_get() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_fapl_copy
+ * Function: H5FD__splitter_fapl_copy
*
* Purpose: Copies the file access properties.
*
@@ -600,55 +571,44 @@ H5FD_splitter_fapl_get(H5FD_t *_file)
*-------------------------------------------------------------------------
*/
static void *
-H5FD_splitter_fapl_copy(const void *_old_fa)
+H5FD__splitter_fapl_copy(const void *_old_fa)
{
const H5FD_splitter_fapl_t *old_fa_ptr = (const H5FD_splitter_fapl_t *)_old_fa;
H5FD_splitter_fapl_t * new_fa_ptr = NULL;
void * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_copy");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(old_fa_ptr);
- new_fa_ptr = (H5FD_splitter_fapl_t *)H5MM_calloc(sizeof(H5FD_splitter_fapl_t));
- if (NULL == new_fa_ptr) {
+ new_fa_ptr = H5FL_CALLOC(H5FD_splitter_fapl_t);
+ if (NULL == new_fa_ptr)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
- }
- if (HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)) == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to shallow-copy info")
- }
- if (HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy write-only channel file path")
- }
- if (HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) {
- HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy log file path")
- }
+ 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) {
+ if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL");
- }
- if (H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) {
+ if (H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL");
- }
ret_value = (void *)new_fa_ptr;
done:
- if (NULL == ret_value) {
- if (new_fa_ptr) {
- H5MM_free(new_fa_ptr);
- }
- }
+ if (NULL == ret_value)
+ if (new_fa_ptr)
+ new_fa_ptr = H5FL_FREE(H5FD_splitter_fapl_t, new_fa_ptr);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_fapl_copy() */
+} /* end H5FD__splitter_fapl_copy() */
/*--------------------------------------------------------------------------
- * Function: H5FD_splitter_fapl_free
+ * Function: H5FD__splitter_fapl_free
*
* Purpose: Releases the file access lists
*
@@ -656,34 +616,32 @@ done:
*--------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_fapl_free(void *_fapl)
+H5FD__splitter_fapl_free(void *_fapl)
{
H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t *)_fapl;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_free");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(fapl);
- if (H5I_dec_ref(fapl->rw_fapl_id) < 0) {
+ if (H5I_dec_ref(fapl->rw_fapl_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID")
- }
- if (H5I_dec_ref(fapl->wo_fapl_id) < 0) {
+ if (H5I_dec_ref(fapl->wo_fapl_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID")
- }
/* Free the property list */
- H5MM_free(fapl);
+ fapl = H5FL_FREE(H5FD_splitter_fapl_t, fapl);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_fapl_free() */
+} /* end H5FD__splitter_fapl_free() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_open
+ * Function: H5FD__splitter_open
*
* Purpose: Create and/or opens a file as an HDF5 file.
*
@@ -694,65 +652,52 @@ done:
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr)
+H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr)
{
H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */
const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */
H5P_genplist_t * plist_ptr = NULL;
H5FD_t * ret_value = NULL;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_open");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
- if (!name || !*name) {
+ if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
- }
- if (0 == maxaddr || HADDR_UNDEF == maxaddr) {
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
- }
- if (ADDR_OVERFLOW(maxaddr)) {
+ if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
- }
- if ((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id))) {
+ if ((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)))
/* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter")
- }
file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t);
- if (NULL == file_ptr) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
- }
+ if (NULL == file_ptr)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct")
file_ptr->fa.rw_fapl_id = H5I_INVALID_HID;
file_ptr->fa.wo_fapl_id = H5I_INVALID_HID;
/* Get the driver-specific file access properties */
plist_ptr = (H5P_genplist_t *)H5I_object(splitter_fapl_id);
- if (NULL == plist_ptr) {
+ if (NULL == plist_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- }
fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr);
- if (NULL == fapl_ptr) {
+ if (NULL == fapl_ptr)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info")
- }
/* Copy simpler info */
- if (HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy write-only path")
- }
- if (HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy logfile path")
- }
+ HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs;
/* Copy R/W and W/O channel FAPLs. */
- if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) {
+ if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL");
- }
- if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) {
+ if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL");
- }
/* Prepare log file if necessary.
* If application wants to ignore the errors from W/O channel and
@@ -761,52 +706,43 @@ H5FD_splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, had
if (!file_ptr->logfp) {
if (file_ptr->fa.log_file_path[0] != '\0') {
file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w");
- if (file_ptr->logfp == NULL) {
+ if (file_ptr->logfp == NULL)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file")
- }
} /* end if logfile path given */
} /* end if logfile pointer/handle does not exist */
file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF);
- if (!file_ptr->rw_file) {
+ if (!file_ptr->rw_file)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file")
- }
file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF);
- if (!file_ptr->wo_file) {
- H5FD_SPLITTER_WO_ERROR(file_ptr, "H5FD_splitter_open", H5E_VFL, H5E_CANTOPENFILE, NULL,
- "unable to open W/O file")
- }
+ if (!file_ptr->wo_file)
+ H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file")
ret_value = (H5FD_t *)file_ptr;
done:
if (NULL == ret_value) {
if (file_ptr) {
- if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) {
+ if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id)
H5I_dec_ref(file_ptr->fa.rw_fapl_id);
- }
- if (H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) {
+ if (H5I_INVALID_HID != file_ptr->fa.wo_fapl_id)
H5I_dec_ref(file_ptr->fa.wo_fapl_id);
- }
- if (file_ptr->rw_file) {
+ if (file_ptr->rw_file)
H5FD_close(file_ptr->rw_file);
- }
- if (file_ptr->wo_file) {
+ if (file_ptr->wo_file)
H5FD_close(file_ptr->wo_file);
- }
- if (file_ptr->logfp) {
+ if (file_ptr->logfp)
HDfclose(file_ptr->logfp);
- }
H5FL_FREE(H5FD_splitter_t, file_ptr);
}
} /* end if error */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_open() */
+} /* end H5FD__splitter_open() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_close
+ * Function: H5FD__splitter_close
*
* Purpose: Closes files on both read-write and write-only channels.
*
@@ -815,36 +751,29 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_close(H5FD_t *_file)
+H5FD__splitter_close(H5FD_t *_file)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_close");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
- if (H5I_dec_ref(file->fa.rw_fapl_id) < 0) {
+ if (H5I_dec_ref(file->fa.rw_fapl_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL")
- }
- if (H5I_dec_ref(file->fa.wo_fapl_id) < 0) {
+ if (H5I_dec_ref(file->fa.wo_fapl_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL")
- }
- if (file->rw_file) {
- if (H5FD_close(file->rw_file) == FAIL) {
+ if (file->rw_file)
+ if (H5FD_close(file->rw_file) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file")
- }
- }
- if (file->wo_file) {
- if (H5FD_close(file->wo_file) == FAIL) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_close", H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
- "unable to close W/O file")
- }
- }
+ if (file->wo_file)
+ if (H5FD_close(file->wo_file) == FAIL)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file")
if (file->logfp) {
HDfclose(file->logfp);
@@ -857,10 +786,10 @@ H5FD_splitter_close(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_close() */
+} /* end H5FD__splitter_close() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_get_eoa
+ * Function: H5FD__splitter_get_eoa
*
* Purpose: Returns the end-of-address marker for the file. The EOA
* marker is the first address past the last byte allocated in
@@ -872,29 +801,28 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file;
haddr_t ret_value = HADDR_UNDEF;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eoa");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
- if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) {
+ if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_get_eoa */
+} /* end H5FD__splitter_get_eoa */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_set_eoa
+ * Function: H5FD__splitter_set_eoa
*
* Purpose: Set the end-of-address marker for the file. This function is
* called shortly after an existing HDF5 file is opened in order
@@ -904,35 +832,32 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
+H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_set_eoa";)
+ H5FD_SPLITTER_LOG_CALL(FUNC)
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
HDassert(file->wo_file);
- if (H5FD_set_eoa(file->rw_file, type, addr) < 0) {
+ if (H5FD_set_eoa(file->rw_file, type, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file")
- }
- if (H5FD_set_eoa(file->wo_file, type, addr) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_set_eoa", H5E_VFL, H5E_CANTSET, FAIL,
- "unable to set EOA for W/O file")
- }
+ if (H5FD_set_eoa(file->wo_file, type, addr) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_set_eoa() */
+} /* end H5FD__splitter_set_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_get_eof
+ * Function: H5FD__splitter_get_eof
*
* Purpose: Returns the end-of-address marker for the file. The EOA
* marker is the first address past the last byte allocated in
@@ -944,29 +869,28 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
+H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
{
const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file;
haddr_t ret_value = HADDR_UNDEF; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eof");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
- if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) {
+ if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_get_eof */
+} /* end H5FD__splitter_get_eof */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_truncate
+ * Function: H5FD__splitter_truncate
*
* Purpose: Notify driver to truncate the file back to the allocated size.
*
@@ -974,34 +898,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
+H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_truncate");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(file);
HDassert(file->rw_file);
HDassert(file->wo_file);
- if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) {
+ if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file")
- }
- if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_truncate", H5E_VFL, H5E_CANTUPDATE, FAIL,
- "unable to truncate W/O file")
- }
+ if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_truncate */
+} /* end H5FD__splitter_truncate */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_sb_size
+ * Function: H5FD__splitter_sb_size
*
* Purpose: Obtains the number of bytes required to store the driver file
* access data in the HDF5 superblock.
@@ -1015,28 +936,27 @@ done:
*-------------------------------------------------------------------------
*/
static hsize_t
-H5FD_splitter_sb_size(H5FD_t *_file)
+H5FD__splitter_sb_size(H5FD_t *_file)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
hsize_t ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_size");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
- if (file->rw_file) {
+ if (file->rw_file)
ret_value = H5FD_sb_size(file->rw_file);
- }
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_sb_size */
+} /* end H5FD__splitter_sb_size */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_sb_encode
+ * Function: H5FD__splitter_sb_encode
*
* Purpose: Encode driver-specific data into the output arguments.
*
@@ -1044,29 +964,28 @@ H5FD_splitter_sb_size(H5FD_t *_file)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/)
+H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out*/)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_encode");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
- if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) {
+ if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_sb_encode */
+} /* end H5FD__splitter_sb_encode */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_sb_decode
+ * Function: H5FD__splitter_sb_decode
*
* Purpose: Decodes the driver information block.
*
@@ -1076,29 +995,28 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
+H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_decode");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Sanity check */
HDassert(file);
HDassert(file->rw_file);
- if (H5FD_sb_load(file->rw_file, name, buf) < 0) {
+ if (H5FD_sb_load(file->rw_file, name, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_sb_decode */
+} /* end H5FD__splitter_sb_decode */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_cmp
+ * Function: H5FD__splitter_cmp
*
* Purpose: Compare the keys of two files.
*
@@ -1107,15 +1025,15 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
+H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_splitter_t *f1 = (const H5FD_splitter_t *)_f1;
const H5FD_splitter_t *f2 = (const H5FD_splitter_t *)_f2;
herr_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_cmp");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(f1);
HDassert(f2);
@@ -1123,10 +1041,10 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
ret_value = H5FD_cmp(f1->rw_file, f2->rw_file);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_cmp */
+} /* end H5FD__splitter_cmp */
/*--------------------------------------------------------------------------
- * Function: H5FD_splitter_get_handle
+ * Function: H5FD__splitter_get_handle
*
* Purpose: Returns a pointer to the file handle of low-level virtual
* file driver.
@@ -1135,14 +1053,14 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
*--------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle)
+H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_handle");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
@@ -1150,16 +1068,15 @@ H5FD_splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_h
HDassert(file_handle);
/* Only do for R/W channel */
- if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) {
+ if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_get_handle */
+} /* end H5FD__splitter_get_handle */
/*--------------------------------------------------------------------------
- * Function: H5FD_splitter_lock
+ * Function: H5FD__splitter_lock
*
* Purpose: Sets a file lock.
*
@@ -1167,35 +1084,32 @@ done:
*--------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_lock(H5FD_t *_file, hbool_t rw)
+H5FD__splitter_lock(H5FD_t *_file, hbool_t rw)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_lock");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
HDassert(file);
HDassert(file->rw_file);
/* Place the lock on each file */
- if (H5FD_lock(file->rw_file, rw) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to lock R/W file")
- }
- if (file->wo_file != NULL) {
- if (H5FD_lock(file->wo_file, rw) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_lock", H5E_VFL, H5E_CANTLOCK, FAIL,
- "unable to lock W/O file")
- }
- }
+ if (H5FD_lock(file->rw_file, rw) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock R/W file")
+
+ if (file->wo_file != NULL)
+ if (H5FD_lock(file->wo_file, rw) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_lock */
+} /* end H5FD__splitter_lock */
/*--------------------------------------------------------------------------
- * Function: H5FD_splitter_unlock
+ * Function: H5FD__splitter_unlock
*
* Purpose: Removes a file lock.
*
@@ -1203,35 +1117,33 @@ done:
*--------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_unlock(H5FD_t *_file)
+H5FD__splitter_unlock(H5FD_t *_file)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_unlock");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
HDassert(file->rw_file);
/* Remove the lock on each file */
- if (H5FD_unlock(file->rw_file) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock R/W file")
- }
- if (file->wo_file != NULL) {
- if (H5FD_unlock(file->wo_file) < 0) {
- HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock W/O file")
- }
- }
+ if (H5FD_unlock(file->rw_file) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock R/W file")
+
+ if (file->wo_file != NULL)
+ if (H5FD_unlock(file->wo_file) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_unlock */
+} /* end H5FD__splitter_unlock */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_query
+ * Function: H5FD__splitter_query
*
* Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
@@ -1240,38 +1152,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */)
+H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */)
{
const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_query");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
if (file) {
HDassert(file);
HDassert(file->rw_file);
- if (H5FDquery(file->rw_file, flags) < 0) {
+ if (H5FDquery(file->rw_file, flags) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to query R/W file");
- }
}
else {
/* There is no file. Because this is a pure passthrough VFD,
* it has no features of its own.
*/
- if (flags) {
+ if (flags)
*flags = 0;
- }
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_query() */
+} /* end H5FD__splitter_query() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_alloc
+ * Function: H5FD__splitter_alloc
*
* Purpose: Allocate file memory.
*
@@ -1279,35 +1189,32 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
+H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */
haddr_t ret_value = HADDR_UNDEF; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_alloc");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
HDassert(file->rw_file);
/* Allocate memory for each file, only return the return value for R/W file. */
- if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) {
+ if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file")
- }
- if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_alloc", H5E_VFL, H5E_CANTINIT, HADDR_UNDEF,
- "unable to alloc for W/O file")
- }
+ if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_alloc() */
+} /* end H5FD__splitter_alloc() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_get_type_map
+ * Function: H5FD__splitter_get_type_map
*
* Purpose: Retrieve the memory type mapping for this file
*
@@ -1315,30 +1222,29 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
+H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
{
const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_type_map");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
HDassert(file->rw_file);
/* Retrieve memory type mapping for R/W channel only */
- if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0) {
+ if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file")
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_get_type_map() */
+} /* end H5FD__splitter_get_type_map() */
/*-------------------------------------------------------------------------
- * Function: H5FD_splitter_free
+ * Function: H5FD__splitter_free
*
* Purpose: Free the resources for the splitter VFD.
*
@@ -1346,31 +1252,28 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
+H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size)
{
H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL("H5FD_splitter_free");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
HDassert(file->rw_file);
- if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) {
+ if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file")
- }
- if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) {
- H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_free", H5E_VFL, H5E_CANTINIT, FAIL,
- "unable to free for W/O file")
- }
+ if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0)
+ H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_splitter_free() */
+} /* end H5FD__splitter_free() */
/*-------------------------------------------------------------------------
* Function: H5FD__splitter_log_error
@@ -1383,13 +1286,11 @@ done:
static herr_t
H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg)
{
- size_t size = 0;
- char * s = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL("H5FD__splitter_log_error");
+ H5FD_SPLITTER_LOG_CALL(FUNC);
/* Check arguments */
HDassert(file);
@@ -1397,18 +1298,18 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const
HDassert(msg && *msg);
if (file->logfp != NULL) {
- size = strlen(atfunc) + strlen(msg) + 3; /* ':', ' ', '\n' */
- s = (char *)malloc(sizeof(char) * (size + 1));
- if (NULL == s) {
+ 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)) {
+ else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg))
ret_value = FAIL;
- }
- else if (size != HDfwrite(s, 1, size, file->logfp)) {
+ else if (size != HDfwrite(s, 1, size, file->logfp))
ret_value = FAIL;
- }
- HDfree(s);
+ H5MM_free(s);
}
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h
index a201116..ee6e7c5 100644
--- a/src/H5FDsplitter.h
+++ b/src/H5FDsplitter.h
@@ -87,8 +87,20 @@ typedef struct H5FD_splitter_vfd_config_t {
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_splitter_init(void);
+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
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 230f5e1..f9faf53 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -180,6 +180,7 @@ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing);
static herr_t H5FD_stdio_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD_stdio_unlock(H5FD_t *_file);
+static herr_t H5FD_stdio_delete(const char *filename, hid_t fapl_id);
static const H5FD_class_t H5FD_stdio_g = {
"stdio", /* name */
@@ -213,6 +214,7 @@ static const H5FD_class_t H5FD_stdio_g = {
H5FD_stdio_truncate, /* truncate */
H5FD_stdio_lock, /* lock */
H5FD_stdio_unlock, /* unlock */
+ H5FD_stdio_delete, /* del */
NULL, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -331,7 +333,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? */
@@ -347,21 +349,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");
@@ -374,14 +377,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)
@@ -392,14 +395,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;
@@ -463,7 +465,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;
@@ -497,9 +499,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() */
@@ -770,9 +772,9 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle)
*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() */
/*-------------------------------------------------------------------------
@@ -809,12 +811,13 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl
/* 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;
@@ -825,7 +828,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;
}
@@ -857,7 +860,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)) {
@@ -911,20 +914,19 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp
/* 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
@@ -946,7 +948,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);
@@ -1000,11 +1002,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 */
@@ -1069,13 +1071,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);
@@ -1083,11 +1085,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;
@@ -1097,7 +1099,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;
@@ -1201,6 +1203,34 @@ H5FD_stdio_unlock(H5FD_t *_file)
return 0;
} /* end H5FD_stdio_unlock() */
+/*-------------------------------------------------------------------------
+ * Function: H5FD_stdio_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_stdio_delete(const char *filename, hid_t /*UNUSED*/ fapl_id)
+{
+ static const char *func = "H5FD_stdio_delete"; /* Function Name for error reporting */
+
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ assert(filename);
+
+ /* Quiet compiler */
+ (void)fapl_id;
+
+ if (remove(filename) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTDELETEFILE, "can't delete file)", -1);
+
+ return 0;
+} /* end H5FD_stdio_delete() */
+
#ifdef H5private_H
/*
* This is not related to the functionality of the driver code.
diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h
index b3e06bb..9db92ed 100644
--- a/src/H5FDstdio.h
+++ b/src/H5FDstdio.h
@@ -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 eb3d59a..a55d34c 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -26,7 +26,7 @@
/****************/
#include "H5FDmodule.h" /* This source code file is part of the H5FD module */
-#define H5FD_TESTING /* Suppress warning about H5FD testing funcs */
+#define H5FD_TESTING /* Suppress warning about H5FD testing funcs */
/***********/
/* Headers */
@@ -106,7 +106,6 @@ 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/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c
index c409c52..316ca6d 100644
--- a/src/H5FDvfd_swmr.c
+++ b/src/H5FDvfd_swmr.c
@@ -128,7 +128,8 @@ static const H5FD_class_t H5FD_vfd_swmr_g = {
H5FD_vfd_swmr_truncate, /* truncate */
H5FD_vfd_swmr_lock, /* lock */
H5FD_vfd_swmr_unlock, /* unlock */
- H5FD_vfd_swmr_dedup, /* dedup */
+ NULL, /* del */
+ H5FD_vfd_swmr_dedup, /* dedup */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h
index c1c4654..79e73b6 100644
--- a/src/H5FDwindows.h
+++ b/src/H5FDwindows.h
@@ -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 21d3655..95188d5 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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).
diff --git a/src/H5FS.c b/src/H5FS.c
index 170d427..c85790c 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, May 2, 2006
*
* Purpose: Free space tracking functions.
@@ -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 244a3b6..8d94075 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -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.
*
@@ -151,7 +151,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
*
*-------------------------------------------------------------------------
@@ -221,7 +220,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
*
*-------------------------------------------------------------------------
@@ -252,7 +250,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;
@@ -335,7 +333,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* August 14, 2013
*
*-------------------------------------------------------------------------
@@ -785,7 +782,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
*
*-------------------------------------------------------------------------
@@ -848,7 +844,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* May 2 2006
*
*-------------------------------------------------------------------------
@@ -995,7 +990,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;
@@ -1119,7 +1114,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 fcc1fa4..3862b53 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -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 829ba75..0ab975b 100644
--- a/src/H5FSint.c
+++ b/src/H5FSint.c
@@ -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/H5FSsection.c b/src/H5FSsection.c
index 0653cbc..14870b4 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Monday, July 31, 2006
*
* Purpose: Free space tracking functions.
@@ -526,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) {
@@ -545,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);
@@ -617,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 */
@@ -676,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 */
@@ -721,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) {
@@ -861,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")
@@ -874,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:
@@ -988,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);
@@ -1005,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) {
@@ -1036,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++;
@@ -1101,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,
@@ -1154,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)
@@ -1208,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 */
@@ -1315,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 {
@@ -1331,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) {
@@ -1378,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() */
@@ -1720,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 */
@@ -1863,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);
@@ -1874,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)
@@ -1893,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 */
@@ -1912,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
@@ -1925,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);
@@ -1944,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
@@ -1960,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);
@@ -1975,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
@@ -2007,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;
@@ -2026,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 */
@@ -2115,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)) {
@@ -2131,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);
@@ -2197,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,
@@ -2218,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")
@@ -2267,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;
@@ -2326,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));
@@ -2407,7 +2283,7 @@ H5FS__sect_assert(const H5FS_t *fspace)
*
* Return: TRUE/FALSE/FAIL
*
- * Programmer: Vailin Choi
+ * Programmer: Vailin Choi
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 894da5e..aed5812 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -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 073ccb2..d689737 100644
--- a/src/H5Fcwfs.c
+++ b/src/H5Fcwfs.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 572849d..5157180 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -11,7 +11,7 @@
* 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 0bd56b3..b482961 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -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
@@ -87,7 +87,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
+H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/)
{
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
@@ -95,7 +95,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*!", obj_id, finfo);
+ H5TRACE2("e", "ix", obj_id, finfo);
/* Check args */
if (!finfo)
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 3909743..3f9a22f 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -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 c3e9257..1aae0fd 100644
--- a/src/H5Ffake.c
+++ b/src/H5Ffake.c
@@ -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 7815a47..f5dc85d 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -413,16 +413,16 @@ 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->pb_ptr != NULL) {
if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->pb_ptr->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->pb_ptr->min_meta_perc)) <
0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, 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->pb_ptr->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 */
@@ -431,9 +431,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
#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")
#endif /* H5_HAVE_PARALLEL */
if (H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) <
0)
@@ -2442,6 +2442,31 @@ done:
} /* end H5F__close() */
/*-------------------------------------------------------------------------
+ * Function: H5F_delete
+ *
+ * Purpose: Deletes a file.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_delete(const char *filename, hid_t fapl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(filename);
+
+ /* Delete the file */
+ if (H5FD_delete(filename, fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_delete() */
+
+/*-------------------------------------------------------------------------
* Function: H5F_try_close
*
* Purpose: Attempts to close a file due to one of several actions:
@@ -2559,7 +2584,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* Try to close all the open objects in this file */
for (u = 0; u < obj_count; u++)
if (H5I_dec_ref(objs[u]) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
+ HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object")
}
if (result < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)")
@@ -2577,7 +2602,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/* Try to close all the open objects in this file */
for (u = 0; u < obj_count; u++)
if (H5I_dec_ref(objs[u]) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
+ HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object")
}
if (result < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)")
@@ -2680,13 +2705,13 @@ H5F_get_id(H5F_t *file)
if (H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) {
/* resurrect the ID - Register an ID with the native connector */
if ((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
file->id_exists = TRUE;
}
else {
/* Increment reference count on existing ID */
if (H5I_inc_ref(ret_value, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed")
} /* end else */
done:
@@ -3791,7 +3816,7 @@ H5F__start_swmr_write(H5F_t *f)
/* Close the object */
if (H5I_dec_ref(obj_ids[u]) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed")
+ HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed")
} /* end for */
} /* end if */
@@ -3856,7 +3881,7 @@ H5F__start_swmr_write(H5F_t *f)
* going to sweat it, now.
*/
if (H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], NULL, vol_connector, TRUE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
+ HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't refresh-close object")
done:
if (ret_value < 0 && setup) {
@@ -4010,7 +4035,7 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
vol_wrapper_set = TRUE;
if ((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle")
} /* end if */
else {
/* Increment ref count on existing ID */
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 6265182..ca069e0 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -15,7 +15,7 @@
*
* Created: H5Fio.c
* Jan 10 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: File I/O routines.
*
@@ -74,6 +74,10 @@
* address for the file.
*
* Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Jul 10 1997
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -108,6 +112,10 @@ done:
* address for the file.
*
* Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Jul 10 1997
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -124,6 +132,10 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /
* address.
*
* Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Jul 10 1997
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -159,6 +171,10 @@ done:
* address.
*
* Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Jul 10 1997
+ *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h
index 33c302a..7f0299a 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -31,8 +31,34 @@
/**
* \defgroup H5F H5F
- * \brief File Interface
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * 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
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 5eeb341..f107c98 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -424,121 +424,6 @@ H5F_is_mount(const H5F_t *file)
} /* end H5F_is_mount() */
/*-------------------------------------------------------------------------
- * Function: H5Fmount
- *
- * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and
- * NAME using mount properties PLIST_ID.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
-{
- H5VL_object_t *loc_vol_obj = NULL; /* Parent object */
- H5VL_object_t *child_vol_obj = NULL; /* Child object */
- H5I_type_t loc_type; /* ID type of location */
- H5I_type_t child_type; /* ID type of child */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
-
- /* Check arguments */
- loc_type = H5I_get_type(loc_id);
- if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
- if (!name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
- if (!*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
- child_type = H5I_get_type(child_id);
- if (H5I_FILE != child_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID")
- if (H5P_DEFAULT == plist_id)
- plist_id = H5P_FILE_MOUNT_DEFAULT;
- else if (TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
-
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
-
- /* Get the location object */
- if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
-
- /* Get the child object */
- if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
-
- /* Check if both objects are associated with the same VOL connector */
- if (loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
-
- /* Perform the mount operation */
- if (H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Fmount() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Funmount
- *
- * Purpose: Given a mount point, dissassociate the mount point's file
- * from the file mounted there. Do not close either file.
- *
- * The mount point can either be 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's the group in the parent, but if it was opened after the
- * mount then it's the root group of the child.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Funmount(hid_t loc_id, const char *name)
-{
- H5VL_object_t *vol_obj = NULL; /* Parent object */
- H5I_type_t loc_type; /* ID type of location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*s", loc_id, name);
-
- /* Check arguments */
- loc_type = H5I_get_type(loc_id);
- if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
- if (!name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
- if (!*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
-
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(loc_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
-
- /* Get the location object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
-
- /* Perform the unmount operation */
- if (H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)loc_type, name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Funmount() */
-
-/*-------------------------------------------------------------------------
* Function: H5F__mount_count_ids_recurse
*
* Purpose: Helper routine for counting number of open IDs in mount
@@ -621,7 +506,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 +518,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 +544,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 +573,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/H5Fprivate.h b/src/H5Fprivate.h
index 0c4c51d..901ab7c 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -853,6 +853,7 @@ H5_DLL herr_t H5F_init(void);
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/);
H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref);
+H5_DLL herr_t H5F_delete(const char *filename, hid_t fapl_id);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index c2fce7e..24b25ff 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -723,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
*
*-------------------------------------------------------------------------
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
index 34bd1b4..be45e78 100644
--- a/src/H5Fsfile.c
+++ b/src/H5Fsfile.c
@@ -135,14 +135,28 @@ done:
H5F_shared_t *
H5F__sfile_search(H5FD_t *lf)
{
- H5F_sfile_node_t *curr;
-
- for (curr = H5F_sfile_head_g; curr != NULL; curr = curr->next) {
- if (curr->shared->lf == lf)
- return curr->shared;
- }
- return NULL;
-}
+ H5F_sfile_node_t *curr; /* Current shared file node */
+ H5F_shared_t * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDassert(lf);
+
+ /* Iterate through low-level files for matching low-level file info */
+ curr = H5F_sfile_head_g;
+ while (curr) {
+ /* Check for match */
+ if (0 == H5FD_cmp(curr->shared->lf, lf))
+ HGOTO_DONE(curr->shared)
+
+ /* Advance to next shared file node */
+ curr = curr->next;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F__sfile_search() */
/*-------------------------------------------------------------------------
* Function: H5F__sfile_remove
diff --git a/src/H5Fspace.c b/src/H5Fspace.c
index b92fa64..29495f1 100644
--- a/src/H5Fspace.c
+++ b/src/H5Fspace.c
@@ -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 470502b..e7a3b53 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -310,7 +310,6 @@ done:
* Failure: FAIL
*
* Programmer: Bill Wendling
- * wendling@ncsa.uiuc.edu
* Sept 12, 2003
*
*-------------------------------------------------------------------------
@@ -883,12 +882,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 */
@@ -1074,7 +1073,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 2daa34e..7d1ff86 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -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.
*
@@ -294,7 +294,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 17, 2013
*
*-------------------------------------------------------------------------
@@ -322,7 +321,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
*
*-------------------------------------------------------------------------
@@ -410,7 +408,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
*
*-------------------------------------------------------------------------
@@ -603,7 +600,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 19, 2013
*
*-------------------------------------------------------------------------
@@ -635,7 +631,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
*
*-------------------------------------------------------------------------
@@ -777,7 +772,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -811,7 +805,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -838,7 +831,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
*
*-------------------------------------------------------------------------
@@ -881,7 +873,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20 2013
*
*-------------------------------------------------------------------------
@@ -941,7 +932,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
@@ -974,7 +964,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
*
*-------------------------------------------------------------------------
@@ -1036,7 +1025,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 20, 2013
*
*-------------------------------------------------------------------------
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 747abe7..dd147ae 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -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/H5Gcompact.c b/src/H5Gcompact.c
index 7796420..af188d8 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -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 84df574..171df9e 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -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,17 +472,16 @@ 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
*
* Purpose: Look up a link within a group that uses dense link storage
*
- * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* 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 04bd2b5..45065e8 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -828,7 +828,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o
/* Get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+ HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier")
/* Call private iteration function, through VOL callback */
if ((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
diff --git a/src/H5Gent.c b/src/H5Gent.c
index d57829b..b26e308 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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
*
*-------------------------------------------------------------------------
@@ -513,7 +504,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 29 1997
*
*-------------------------------------------------------------------------
@@ -533,7 +523,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 +535,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 d11e8ed..57a6144 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -15,7 +15,7 @@
*
* Created: H5Gint.c
* April 5 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: General use, "internal" routines for groups.
*
@@ -167,7 +167,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -782,7 +781,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter
if (NULL == (grp = H5G__open_name(loc, group_name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Set up user data for callback */
udata.gid = gid;
@@ -1045,7 +1044,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o
/* Register an ID for the starting group */
if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Get the location of the starting group */
if (H5G_loc(gid, &start_loc) < 0)
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 61a8ae9..629cb11 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -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
@@ -93,15 +93,15 @@ 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)
+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
@@ -118,15 +118,15 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2)
*-------------------------------------------------------------------------
*/
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
@@ -142,11 +142,11 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2)
*-------------------------------------------------------------------------
*/
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;
@@ -156,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
@@ -175,11 +175,11 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2)
*-------------------------------------------------------------------------
*/
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;
@@ -189,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
@@ -417,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 */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 15d3cf2..7d08b54 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -235,6 +235,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"unable to get group location of a dataspace selection iterator")
+ case H5I_EVENTSET:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a event set")
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_NTYPES:
@@ -597,7 +600,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 +612,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 +634,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 +665,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 */
diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h
index 219342d..fe26bd2 100644
--- a/src/H5Gmodule.h
+++ b/src/H5Gmodule.h
@@ -31,9 +31,94 @@
/**
* \defgroup H5G H5G
- * \brief Group Interface
- * \details The HDF5 Group Interface, H5G, provides a mechanism for managing
- * HDF5 groups and their members, which are other HDF5 objects.
+ *
+ * \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 fd63cbb..2465f01 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -729,6 +729,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object")
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index fb4cd48..9a7da0f 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -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.
*
@@ -137,18 +137,18 @@ H5FL_SEQ_DEFINE(H5G_entry_t);
*-------------------------------------------------------------------------
*/
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.
*
@@ -160,11 +160,11 @@ H5G_node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata)
*-------------------------------------------------------------------------
*/
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);
@@ -173,10 +173,10 @@ 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.
*
@@ -188,11 +188,11 @@ 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)
+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);
@@ -201,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.
*
@@ -216,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);
@@ -239,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
@@ -342,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
@@ -362,7 +362,7 @@ done:
*-------------------------------------------------------------------------
*/
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;
@@ -370,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);
@@ -388,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)
@@ -415,7 +415,7 @@ done:
*-------------------------------------------------------------------------
*/
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;
@@ -423,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);
@@ -445,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.
@@ -473,7 +473,7 @@ done:
*-------------------------------------------------------------------------
*/
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;
@@ -482,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.
@@ -526,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
@@ -693,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
@@ -721,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;
@@ -733,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);
@@ -903,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
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 621456c..ada4887 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -291,7 +291,7 @@ H5O__group_get_oloc(hid_t obj_id)
/* Get the group */
if (NULL == (grp = (H5G_t *)H5VL_object(obj_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID")
/* Get the group's object header location */
if (NULL == (ret_value = H5G_oloc(grp)))
diff --git a/src/H5Groot.c b/src/H5Groot.c
index 28b94c8..997d187 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -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 834ef1f..78981be 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -11,7 +11,7 @@
* 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
*
*-------------------------------------------------------------------------
@@ -183,7 +182,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 1 1997
*
*-------------------------------------------------------------------------
@@ -240,7 +238,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@uiuc.edu
* Nov 7 2005
*
*-------------------------------------------------------------------------
@@ -294,7 +291,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 1 1997
*
*-------------------------------------------------------------------------
@@ -665,7 +661,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 +675,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 +699,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 +754,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 +790,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 +804,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 +819,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 +829,6 @@ done:
* Return: Non-negative (TRUE/FALSE) on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
@@ -870,7 +865,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 +881,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 +895,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 +918,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 +928,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Nov 7 2006
*
*-------------------------------------------------------------------------
@@ -975,7 +969,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 +1009,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 0d21f22..9f0dca2 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -607,6 +607,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type")
@@ -798,7 +799,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 d88d121..bbd8973 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -15,7 +15,7 @@
*
* Created: H5Gtraverse.c
* Sep 13 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Quincey Koziol
*
* Purpose: Functions for traversing group hierarchy
*
@@ -218,7 +218,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
} /* end if */
/* else, we really needed to open the object */
else
- HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "traversal callback returned invalid ID")
+ HGOTO_ERROR(H5E_SYM, H5E_BADID, FAIL, "traversal callback returned invalid ID")
} /* end if */
/* Get the object location information from the ID the user callback returned */
@@ -241,16 +241,16 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
* Close the open ID the user passed back.
*/
if (H5I_dec_ref(cb_return) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
cb_return = (hid_t)(-1);
done:
/* Close location given to callback. */
if (cur_grp > 0 && H5I_dec_ref(cur_grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID for current location")
if (ret_value < 0 && cb_return > 0 && H5I_dec_ref(cb_return) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__traverse_ud() */
@@ -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 fb03c06..73281a4 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -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 f8ed4fb..353d7d7 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -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 7e9384d..ea5e730 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -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.
*
@@ -212,7 +212,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;
@@ -241,7 +241,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Feb 27 2006
*
*-------------------------------------------------------------------------
@@ -290,7 +289,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
*
*-------------------------------------------------------------------------
@@ -337,7 +335,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
@@ -487,7 +485,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 */
@@ -572,7 +570,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 */
@@ -580,7 +578,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)
@@ -856,7 +854,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:
@@ -982,7 +980,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 */
@@ -997,7 +995,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;
@@ -1022,7 +1020,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")
@@ -1121,7 +1119,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)
@@ -1256,7 +1254,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 {
@@ -1271,7 +1269,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 */
@@ -1534,7 +1532,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:
@@ -1764,7 +1762,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 */
@@ -1836,7 +1834,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;
@@ -1858,7 +1856,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 */
@@ -1889,7 +1887,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)
@@ -2244,7 +2242,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 */
@@ -2299,7 +2297,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 */
@@ -2337,7 +2335,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 */
@@ -2351,7 +2349,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 */
@@ -2551,7 +2549,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 115e9d0..cc61aa1 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -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)))
@@ -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 3ad9d67..628dcc4 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -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 1f69f70..5a1f950 100644
--- a/src/H5HFdtable.c
+++ b/src/H5HFdtable.c
@@ -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 84d7d45..cd5ba23 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -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 995f400..b1043a6 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -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 3a1cf13..9b69ec1 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -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 810d489..673c543 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -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 e323d51..427be00 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -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/H5HFpkg.h b/src/H5HFpkg.h
index a18d101..893a65d 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.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
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index ed7cddd..3263b4e 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -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 */
+/* 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 d80b2f3..eec41a4 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 1994891..d62267c 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -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 cd06595..5e5d06a 100644
--- a/src/H5HFstat.c
+++ b/src/H5HFstat.c
@@ -11,7 +11,7 @@
* 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 df77926..84734d2 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -11,7 +11,7 @@
* 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 44575d0..eca177c 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -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 23dbce2..c1c574c 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index dd7d1cd..a4c55bb 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -15,7 +15,7 @@
*
* Created: H5HGcache.c
* Feb 5 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement global heap metadata cache methods.
*
@@ -123,7 +123,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 8c1ae47..51a74ec 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -11,7 +11,7 @@
* 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/H5HGquery.c b/src/H5HGquery.c
index 2239031..c24a414 100644
--- a/src/H5HGquery.c
+++ b/src/H5HGquery.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 43c6033..50d24c3 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -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() */
/*-------------------------------------------------------------------------
@@ -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 fb5c7a0..989a4f5 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -15,7 +15,7 @@
*
* Created: H5HLcache.c
* Feb 5 2008
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Implement local heap metadata cache methods.
*
@@ -163,7 +163,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;
@@ -468,11 +468,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 */
@@ -747,7 +747,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 c3bfef7..d0cfa96 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -11,7 +11,7 @@
* 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");
diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c
index b40d4d6..f771de5 100644
--- a/src/H5HLdblk.c
+++ b/src/H5HLdblk.c
@@ -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 ace6a76..069bad8 100644
--- a/src/H5HLint.c
+++ b/src/H5HLint.c
@@ -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/H5HLprfx.c b/src/H5HLprfx.c
index 3a8bcc7..90f6c74 100644
--- a/src/H5HLprfx.c
+++ b/src/H5HLprfx.c
@@ -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/H5HP.c b/src/H5HP.c
index d5bff56..d164223 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -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/H5I.c b/src/H5I.c
index c9bad09..1973354 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -12,61 +12,32 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 */
- H5I_id_info_t * last_info; /* Info for most recent ID looked up */
- H5SL_t * ids; /* Pointer to skip list that stores IDs */
-} H5I_id_type_t;
+/******************/
+/* Local Typedefs */
+/******************/
typedef struct {
H5I_search_func_t app_cb; /* Application's callback routine */
@@ -79,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
@@ -213,8 +93,8 @@ H5I_term_package(void)
H5I_type_t
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)
@@ -223,42 +103,42 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I
/* 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 */
+ HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded")
+ }
/* Allocate new ID class */
- if (NULL == (cls = H5FL_CALLOC(H5I_class_t)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed")
+ if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t))))
+ HGOTO_ERROR(H5E_ID, 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;
/* Register the new ID class */
if (H5I_register_type(cls) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_BADID, "can't initialize ID class")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class")
/* Set return value */
ret_value = new_type;
@@ -267,72 +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;
- type_ptr->last_info = NULL;
- 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
@@ -352,11 +172,11 @@ 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)
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library 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:
@@ -373,8 +193,8 @@ done:
*
* Return: SUCCEED/FAIL
*
- * Programmer: James Laird
- * Nathaniel Furrer
+ * Programmer: James Laird
+ * Nathaniel Furrer
* Friday, April 23, 2004
*
*-------------------------------------------------------------------------
@@ -382,116 +202,37 @@ 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);
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type")
/* Validate parameters. This needs to be done here, instead of letting
* 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) {
int64_t members;
if ((members = H5I_nmembers(type)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members")
+ HGOTO_ERROR(H5E_ID, 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
@@ -500,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
*
*-------------------------------------------------------------------------
@@ -515,7 +256,7 @@ H5Iclear_type(H5I_type_t type, hbool_t force)
H5TRACE2("e", "Itb", type, force);
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type")
ret_value = H5I_clear_type(type, force, TRUE);
@@ -524,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
@@ -641,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
*
*-------------------------------------------------------------------------
*/
@@ -655,7 +289,7 @@ H5Idestroy_type(H5I_type_t type)
H5TRACE1("e", "It", type);
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type")
ret_value = H5I__destroy_type(type);
@@ -664,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
@@ -735,209 +316,48 @@ 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_ID, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type")
- ret_value = H5I_register(type, object, TRUE);
+ /* Register the object */
+ if ((ret_value = H5I__register(type, object, TRUE, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iregister() */
/*-------------------------------------------------------------------------
- * Function: H5I_register
+ * Function: H5Iregister_future
*
- * 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.
+ * Purpose: Register a "future" object.
*
- * Return: Success: New object ID
+ * Return: Success: New future object ID
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
+H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb,
+ H5I_future_discard_func_t discard_cb)
{
- 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 */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE4("i", "It*xIRID", type, object, realize_cb, discard_cb);
/* 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 the most recent ID to this object */
- type_ptr->last_info = id_ptr;
+ if (NULL == realize_cb)
+ HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed")
+ if (NULL == discard_cb)
+ HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed")
- /* Set return value */
- ret_value = new_id;
+ /* Register the future object */
+ if ((ret_value = H5I__register(type, object, TRUE, realize_cb, discard_cb)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object")
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++;
-
- /* Set the most recent ID to this object */
- type_ptr->last_info = id_ptr;
-
-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() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Iregister_future() */
/*-------------------------------------------------------------------------
* Function: H5Iobject_verify
@@ -953,93 +373,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))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
- if (id_type < 1 || (int)id_type >= H5I_next_type)
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type")
+ if (H5I_IS_LIB_TYPE(type))
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type")
+ if (type < 1 || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ID, 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
@@ -1064,7 +417,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:
@@ -1072,56 +425,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
@@ -1133,145 +436,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))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
+ if (H5I_IS_LIB_TYPE(type))
+ HGOTO_ERROR(H5E_ID, 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")
-
- /* Check if this ID was the last one accessed */
- if (type_ptr->last_info == curr_id)
- type_ptr->last_info = NULL;
-
- 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.
@@ -1296,174 +484,17 @@ H5Idec_ref(hid_t id)
/* Check arguments */
if (id < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID")
/* Do actual decrement operation */
if ((ret_value = H5I_dec_app_ref(id)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count")
done:
FUNC_LEAVE_API(ret_value)
} /* 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.
@@ -1476,61 +507,24 @@ 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);
/* Check arguments */
if (id < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID")
/* Do actual increment operation */
if ((ret_value = H5I_inc_ref(id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID ref count")
done:
FUNC_LEAVE_API(ret_value)
} /* 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.
@@ -1543,56 +537,24 @@ 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);
/* Check arguments */
if (id < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID")
/* Do actual retrieve operation */
if ((ret_value = H5I_get_ref(id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID ref count")
done:
FUNC_LEAVE_API(ret_value)
} /* 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.
@@ -1605,64 +567,31 @@ 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)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type")
+ if (type <= 0 || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type")
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type")
/* Do actual increment operation */
if ((ret_value = H5I__inc_type_ref(type)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID type ref count")
done:
FUNC_LEAVE_API(ret_value)
} /* 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
+ * 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
@@ -1690,7 +619,7 @@ H5Idec_type_ref(H5I_type_t type)
H5TRACE1("e", "It", type);
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type")
ret_value = H5I_dec_type_ref(type);
@@ -1699,58 +628,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.
@@ -1763,60 +640,26 @@ 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)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type")
+ if (type <= 0 || (int)type >= H5I_next_type_g)
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type")
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type")
/* Do actual retrieve operation */
if ((ret_value = H5I__get_type_ref(type)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID type ref count")
done:
FUNC_LEAVE_API(ret_value)
} /* 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
@@ -1829,16 +672,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:
@@ -1902,15 +745,15 @@ 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", "ItIS*x", type, func, key);
/* Check arguments */
if (H5I_IS_LIB_TYPE(type))
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
+ HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type")
/* Set up udata struct */
udata.app_cb = func;
@@ -1948,9 +791,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
@@ -1994,8 +837,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", "ItII*x", type, op, op_data);
@@ -2008,161 +851,55 @@ H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data)
* here, as we can't do anything with it without revising the API.
*/
if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "can't iterate over ids")
+ HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "can't iterate over ids")
done:
FUNC_LEAVE_API(ret_value)
} /* 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)
-
- /* Check for same ID as we have looked up last time */
- if (type_ptr->last_info && type_ptr->last_info->id == id)
- ret_value = type_ptr->last_info;
- else {
- /* Locate the ID node for the ID */
- ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id);
+ /* Get the VOL object */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ID, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
- /* Remember this ID */
- type_ptr->last_info = ret_value;
- } /* end else */
+ /* Get the file ID */
+ if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ID, 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
@@ -2173,10 +910,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,
@@ -2191,16 +925,16 @@ 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);
/* Get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+ HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier")
/* Set location parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
@@ -2209,260 +943,8 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size)
/* Retrieve object's name */
if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
&ret_value, name, size) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
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%08p\n", 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..7b5eb5a
--- /dev/null
+++ b/src/H5Idbg.c
@@ -0,0 +1,205 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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_EVENTSET:
+ 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..164fafc
--- /dev/null
+++ b/src/H5Iint.c
@@ -0,0 +1,1790 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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__dec_ref(hid_t id, void **request);
+static int H5I__dec_app_ref(hid_t id, void **request);
+static int H5I__dec_app_ref_always_close(hid_t id, void **request);
+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_ID, 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_ID, 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_ID, 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 if this is an un-realized future object */
+ H5_GCC_DIAG_OFF("cast-qual")
+ if (info->is_future) {
+ /* Discard the future object */
+ if ((info->discard_cb)((void *)info->object) < 0) {
+ if (udata->force) {
+#ifdef H5I_DEBUG
+ if (H5DEBUG(I)) {
+ HDfprintf(H5DEBUG(I),
+ "H5I: discard 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;
+ }
+ }
+ else {
+ /* Check for a 'free' function and call it, if it exists */
+ if (udata->type_info->cls->free_func &&
+ (udata->type_info->cls->free_func)((void *)info->object, H5_REQUEST_NULL) < 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_ID, 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.
+ *
+ * IDs are marked as "future" if the realize_cb and discard_cb
+ * parameters are non-NULL.
+ *
+ * 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_future_realize_func_t realize_cb,
+ H5I_future_discard_func_t discard_cb)
+{
+ 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_PACKAGE
+
+ /* 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_ID, H5E_BADGROUP, H5I_INVALID_HID, "invalid type")
+ if (NULL == (info = H5FL_CALLOC(H5I_id_info_t)))
+ HGOTO_ERROR(H5E_ID, 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->is_future = (NULL != realize_cb);
+ info->realize_cb = realize_cb;
+ info->discard_cb = discard_cb;
+ 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
+ *
+ * Purpose: Library-private wrapper for H5I__register.
+ *
+ * Return: Success: New object ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
+{
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Sanity checks */
+ HDassert(type >= H5I_FILE && type < H5I_NTYPES);
+ HDassert(object);
+
+ /* Retrieve ID for object */
+ if (H5I_INVALID_HID == (ret_value = H5I__register(type, object, app_ref, NULL, NULL)))
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object")
+
+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_ID, 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_ID, H5E_BADGROUP, FAIL, "invalid type")
+
+ /* Make sure requested ID belongs to object's type */
+ if (H5I_TYPE(existing_id) != type)
+ HGOTO_ERROR(H5E_ID, 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_ID, 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;
+ /* This API call is only used by the native VOL connector, which is
+ * not asynchronous.
+ */
+ info->is_future = FALSE;
+ info->realize_cb = NULL;
+ info->discard_cb = NULL;
+ 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_ID, 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_ID, 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_ID, H5E_BADGROUP, NULL, "invalid type")
+
+ /* Remove the node from the type */
+ if (NULL == (ret_value = H5I__remove_common(type_info, id)))
+ HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_remove() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__dec_ref
+ *
+ * Purpose: 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.
+ *
+ * Note: Allows for asynchronous 'close' operation on object, with
+ * request != H5_REQUEST_NULL.
+ *
+ * Return: Success: New reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__dec_ref(hid_t id, void **request)
+{
+ H5I_id_info_t *info = NULL; /* Pointer to the ID */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* General lookup of the ID */
+ if (NULL == (info = H5I__find_id(id)))
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-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, request) >= 0) {
+ /* Remove the node from the type */
+ if (NULL == H5I__remove_common(type_info, id))
+ HGOTO_ERROR(H5E_ID, 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_ref
+ *
+ * Purpose: Decrements the number of references outstanding for an ID.
+ *
+ * Return: Success: New reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_ref(hid_t id)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* Synchronously decrement refcount on ID */
+ if ((ret_value = H5I__dec_ref(id, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+
+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.
+ *
+ * Note: Allows for asynchronous 'close' operation on object, with
+ * request != H5_REQUEST_NULL.
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__dec_app_ref(hid_t id, void **request)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* Call regular decrement reference count routine */
+ if ((ret_value = H5I__dec_ref(id, request)) < 0)
+ HGOTO_ERROR(H5E_ID, 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_ID, H5E_BADID, (-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
+ *
+ * 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);
+
+ /* Synchronously decrement refcount on ID */
+ if ((ret_value = H5I__dec_app_ref(id, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_app_ref_async
+ *
+ * Purpose: Asynchronous wrapper for case of modifying the application ref.
+ * count for an ID as well as normal reference count.
+ *
+ * Note: Allows for asynchronous 'close' operation on object, with
+ * token != H5_REQUEST_NULL.
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ * Programmer: Houjun Tang
+ * Oct 21, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_app_ref_async(hid_t id, void **token)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* [Possibly] aynchronously decrement refcount on ID */
+ if ((ret_value = H5I__dec_app_ref(id, token)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref_async() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I__dec_app_ref_always_close
+ *
+ * Purpose: Wrapper for case of always closing the ID, even when the free
+ * routine fails
+ *
+ * Note: Allows for asynchronous 'close' operation on object, with
+ * request != H5_REQUEST_NULL.
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5I__dec_app_ref_always_close(hid_t id, void **request)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* Call application decrement reference count routine */
+ ret_value = H5I__dec_app_ref(id, request);
+
+ /* 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_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I__dec_app_ref_always_close() */
+
+/*-------------------------------------------------------------------------
+ * 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);
+
+ /* Synchronously decrement refcount on ID */
+ if ((ret_value = H5I__dec_app_ref_always_close(id, H5_REQUEST_NULL)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref_always_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_dec_app_ref_always_close_async
+ *
+ * Purpose: Asynchronous wrapper for case of always closing the ID, even
+ * when the free routine fails
+ *
+ * Note: Allows for asynchronous 'close' operation on object, with
+ * token != H5_REQUEST_NULL.
+ *
+ * Return: Success: New app. reference count
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5I_dec_app_ref_always_close_async(hid_t id, void **token)
+{
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI((-1))
+
+ /* Sanity check */
+ HDassert(id >= 0);
+
+ /* [Possibly] aynchronously decrement refcount on ID */
+ if ((ret_value = H5I__dec_app_ref_always_close(id, token)) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_dec_app_ref_always_close_async() */
+
+/*-------------------------------------------------------------------------
+ * 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_ID, H5E_BADID, (-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_ID, H5E_BADID, (-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_ID, 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_ID, 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_ID, 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_ID, 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;
+ }
+
+ /* Check if this is a future ID */
+ H5_GCC_DIAG_OFF("cast-qual")
+ if (id_info && id_info->is_future) {
+ hid_t actual_id = H5I_INVALID_HID; /* ID for actual object */
+ void *future_object; /* Pointer to the future object */
+ void *actual_object; /* Pointer to the actual object */
+
+ /* Invoke the realize callback, to get the actual object */
+ if ((id_info->realize_cb)((void *)id_info->object, &actual_id) < 0)
+ HGOTO_DONE(NULL)
+
+ /* Verify that we received a valid ID, of the same type */
+ if (H5I_INVALID_HID == actual_id)
+ HGOTO_DONE(NULL)
+ if (H5I_TYPE(id) != H5I_TYPE(actual_id))
+ HGOTO_DONE(NULL)
+
+ /* Swap the actual object in for the future object */
+ future_object = (void *)id_info->object;
+ actual_object = H5I__remove_common(type_info, actual_id);
+ HDassert(actual_object);
+ id_info->object = actual_object;
+
+ /* Discard the future object */
+ if ((id_info->discard_cb)(future_object) < 0)
+ HGOTO_DONE(NULL)
+ future_object = NULL;
+
+ /* Change the ID from 'future' to 'actual' */
+ id_info->is_future = FALSE;
+ id_info->realize_cb = NULL;
+ id_info->discard_cb = NULL;
+ }
+ H5_GCC_DIAG_ON("cast-qual")
+
+ /* 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_ID, 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_ID, 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 a2174d7..8db31c8 100644
--- a/src/H5Imodule.h
+++ b/src/H5Imodule.h
@@ -26,7 +26,7 @@
*/
#define H5I_MODULE
#define H5_MY_PKG H5I
-#define H5_MY_PKG_ERR H5E_ATOM
+#define H5_MY_PKG_ERR H5E_ID
#define H5_MY_PKG_INIT NO
/**\defgroup H5I H5I
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index 5461aa2..e93ec74 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -29,7 +29,14 @@
/* 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 */
@@ -60,10 +67,61 @@
/* 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 */
+
+ /* Future ID info */
+ hbool_t is_future; /* Whether this ID represents a future object */
+ H5I_future_realize_func_t realize_cb; /* 'realize' callback for future object */
+ H5I_future_discard_func_t discard_cb; /* 'discard' callback for future object */
+
+ /* 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 hid_t H5I__register(H5I_type_t type, const void *object, hbool_t app_ref,
+ H5I_future_realize_func_t realize_cb, H5I_future_discard_func_t discard_cb);
+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);
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 78fd84d..d1b6248 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.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
@@ -70,7 +70,9 @@ H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref);
H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref);
H5_DLL int H5I_dec_ref(hid_t id);
H5_DLL int H5I_dec_app_ref(hid_t id);
+H5_DLL int H5I_dec_app_ref_async(hid_t id, void **token);
H5_DLL int H5I_dec_app_ref_always_close(hid_t id);
+H5_DLL int H5I_dec_app_ref_always_close_async(hid_t id, void **token);
H5_DLL int H5I_dec_type_ref(H5I_type_t type);
H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/);
@@ -86,7 +88,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);
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 69aa455..8e5e167 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -21,57 +21,97 @@
/* 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_EVENTSET, /**< type ID for event sets */
+ 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
* (failure) then the object will remain in the ID type.
*/
-typedef herr_t (*H5I_free_t)(void *);
+typedef herr_t (*H5I_free_t)(void *, 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] -->
+
+/**
+ * The type of the realize_cb callback for H5Iregister_future
+ */
+//! <!-- [H5I_future_realize_func_t_snip] -->
+typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id);
+//! <!-- [H5I_future_realize_func_t_snip] -->
+
+/**
+ * The type of the discard_cb callback for H5Iregister_future
+ */
+//! <!-- [H5I_future_discard_func_t_snip] -->
+typedef herr_t (*H5I_future_discard_func_t)(void *future_object);
+//! <!-- [H5I_future_discard_func_t_snip] -->
#ifdef __cplusplus
extern "C" {
@@ -79,26 +119,638 @@ 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 Registers a "future" 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 "future" object for which a new ID is created
+ * \param[in] realize_cb Function pointer to realize a future object
+ * \param[in] discard_cb Function pointer to destroy a future object
+ *
+ * \return \hid_t{object}
+ *
+ * \details H5Iregister_future() creates and returns a new ID for a "future" object.
+ * Future objects are a special kind of object and represent a
+ * placeholder for an object that has not yet been created or opened.
+ * The \p realize_cb will be invoked by the HDF5 library to 'realize'
+ * the future object as an actual object. A call to H5Iobject_verify()
+ * will invoke the \p realize_cb callback and if it successfully
+ * returns, will return the actual object, not the future object.
+ *
+ * \details The \p type parameter is the identifier for the ID type to which
+ * this new future ID will belong. This identifier may have been created
+ * by a call to H5Iregister_type() or may be one of the HDF5 pre-defined
+ * ID classes (e.g. H5I_FILE, H5I_GROUP, H5I_DATASPACE, etc).
+ *
+ * \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,
+ * but will not be returned to a call to H5Iobject_verify() until the
+ * \p realize_cb callback has returned the actual pointer for the object.
+ *
+ * A NULL value for \p object is allowed.
+ *
+ * \details The \p realize_cb parameter is a function pointer that will be
+ * invoked by the HDF5 library to convert a future object into an
+ * actual object. The \p realize_cb function may be invoked by
+ * H5Iobject_verify() to return the actual object for a user-defined
+ * ID class (i.e. an ID class registered with H5Iregister_type()) or
+ * internally by the HDF5 library in order to use or get information
+ * from an HDF5 pre-defined ID type. For example, the \p realize_cb
+ * for a future dataspace object will be called during the process
+ * of returning information from H5Sget_simple_extent_dims().
+ *
+ * Note that although the \p realize_cb routine returns
+ * an ID (as a parameter) for the actual object, the HDF5 library
+ * will swap the actual object in that ID for the future object in
+ * the future ID. This ensures that the ID value for the object
+ * doesn't change for the user when the object is realized.
+ *
+ * Note that the \p realize_cb callback could receive a NULL value
+ * for a future object pointer, if one was used when H5Iregister_future()
+ * was initially called. This is permitted as a means of allowing
+ * the \p realize_cb to act as a generator of new objects, without
+ * requiring creation of unnecessary future objects.
+ *
+ * It is an error to pass NULL for \p realize_cb.
+ *
+ * \details The \p discard_cb parameter is a function pointer that will be
+ * invoked by the HDF5 library to destroy a future object. This
+ * callback will always be invoked for _every_ future object, whether
+ * the \p realize_cb is invoked on it or not. It's possible that
+ * the \p discard_cb is invoked on a future object without the
+ * \p realize_cb being invoked, e.g. when a future ID is closed without
+ * requiring the future object to be realized into an actual one.
+ *
+ * Note that the \p discard_cb callback could receive a NULL value
+ * for a future object pointer, if one was used when H5Iregister_future()
+ * was initially called.
+ *
+ * It is an error to pass NULL for \p discard_cb.
+ *
+ * \note The H5Iregister_future() function is primarily targeted at VOL connector
+ * authors and is _not_ designed for general-purpose application use.
+ *
+ */
+H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb,
+ H5I_future_discard_func_t discard_cb);
+/**
+ * \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
}
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 6f2c03a..71ef3f8 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -82,25 +82,25 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
/* Get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier")
+ HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier")
/* Set wrapper info in API context */
if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ HGOTO_ERROR(H5E_ID, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Get object location */
if (H5G_loc(id, &loc) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object location")
/* Call internal group routine to retrieve object's name */
if ((ret_value = H5G_get_name(&loc, name, size, cached)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
done:
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+ HDONE_ERROR(H5E_ID, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context")
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 9cc8ffa..c1bd83f 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -147,7 +147,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID")
/* Get the fapl_id set for lapl_id if any */
if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0)
@@ -175,7 +175,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
/* Get file access property list */
if (NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID")
/* Make callback if it exists */
if (cb_info.func) {
@@ -239,7 +239,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
/* Get an ID for the external link's object */
if ((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object")
/* Set return value */
ret_value = ext_obj_id;
@@ -248,8 +248,8 @@ done:
/* XXX (VOL MERGE): Probably also want to consider closing ext_obj here on failures */
/* Release resources */
if (fapl_id > 0 && H5I_dec_ref(fapl_id) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID,
- "unable to close atom for file access property list")
+ HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID,
+ "unable to close ID for file access property list")
if (ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0)
HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file")
if (parent_group_name && parent_group_name != local_group_name)
@@ -257,8 +257,7 @@ done:
if (ret_value < 0) {
/* Close object if it's open and something failed */
if (ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID,
- "unable to close atom for external object")
+ HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close ID for external object")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -288,7 +287,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 54b94a4..16f1f34 100644
--- a/src/H5Lmodule.h
+++ b/src/H5Lmodule.h
@@ -35,6 +35,8 @@
*
* \defgroup TRAV Link Traversal
* \ingroup H5L
+ * \defgroup H5LA Advanced Link Functions
+ * \ingroup H5L
*/
#endif /* H5Lmodule_H */
diff --git a/src/H5M.c b/src/H5M.c
index dc85812..24f3a9a 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -108,7 +108,7 @@ H5M__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the map IDs */
+ /* Initialize the ID group for the map IDs */
if (H5I_register_type(H5I_MAP_CLS) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface")
@@ -354,7 +354,7 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id
H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
- /* Get an atom for the map */
+ /* Get an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map")
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index bede18c..7b89fd8 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -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/H5MM.c b/src/H5MM.c
index 313f900..b4447f6 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -15,7 +15,7 @@
*
* Created: H5MM.c
* Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Memory management functions
*
@@ -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)
diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h
index ebfb377..70ac644 100644
--- a/src/H5MMpublic.h
+++ b/src/H5MMpublic.h
@@ -29,8 +29,13 @@
#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" {
diff --git a/src/H5MP.c b/src/H5MP.c
index 1ce4c6d..474a995 100644
--- a/src/H5MP.c
+++ b/src/H5MP.c
@@ -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/H5MPtest.c b/src/H5MPtest.c
index df1c153..27e7bbe 100644
--- a/src/H5MPtest.c
+++ b/src/H5MPtest.c
@@ -11,7 +11,7 @@
* 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 8b4f11f..3dae3e2 100644
--- a/src/H5Mmodule.h
+++ b/src/H5Mmodule.h
@@ -26,4 +26,49 @@
#define H5_MY_PKG_ERR H5E_MAP
#define H5_MY_PKG_INIT YES
+/**
+ * \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/H5Mpublic.h b/src/H5Mpublic.h
index 004ff05..88db39a 100644
--- a/src/H5Mpublic.h
+++ b/src/H5Mpublic.h
@@ -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,374 @@ 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 ASYNC
+ * \async_variant_of{H5Mcreate}
+ */
+H5_DLL hid_t H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, 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, hid_t es_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.12.0
+ *
+ */
H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Mopen}
+ */
+H5_DLL hid_t H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *name, hid_t mapl_id, hid_t es_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.12.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.
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index cc8ac46..10c9ede 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -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 6fffd8d..bad89ae 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -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 a8c3c03..db53eaf 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -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);
@@ -264,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
@@ -283,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 */
@@ -292,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);
@@ -372,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
@@ -390,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);
@@ -405,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
@@ -424,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);
@@ -465,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
@@ -594,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.
@@ -607,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);
@@ -634,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
@@ -710,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
*
@@ -722,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);
@@ -735,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
*
@@ -750,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);
@@ -762,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
@@ -833,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 d1e25b1..4adfaf7 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -13,7 +13,7 @@
/*-------------------------------------------------------------------------
*
- * 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
*
*-------------------------------------------------------------------------
@@ -1723,7 +1715,6 @@ done:
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Dec 11 2006
*
*-------------------------------------------------------------------------
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index e1cd1b4..c7fcdb9 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -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 00a506e..a783366 100644
--- a/src/H5Obtreek.c
+++ b/src/H5Obtreek.c
@@ -11,7 +11,7 @@
* 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 a5703ae..a968f84 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -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.
*
@@ -277,7 +277,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
@@ -1055,7 +1055,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 12, 2008
*
*-------------------------------------------------------------------------
@@ -1273,7 +1272,6 @@ done:
* Failure: FAIL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* July 12, 2008
*
*-------------------------------------------------------------------------
@@ -1339,7 +1337,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 */
@@ -1619,7 +1617,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 b1b8e09..2603f71 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -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 66e11c8..6e31668 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -415,9 +415,9 @@ H5O__chunk_dest(H5O_chunk_proxy_t *chk_proxy)
if (chk_proxy->oh && H5O__dec_rc(chk_proxy->oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header")
+done:
/* Release the chunk proxy object */
chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O__chunk_dest() */
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index f61ec3f..080225a 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -258,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/H5Odbg.c b/src/H5Odbg.c
index 3911992..2826bcd 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -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
*
*-------------------------------------------------------------------------
@@ -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 9e75e61..5e13f9f 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -13,7 +13,7 @@
/*-------------------------------------------------------------------------
*
- * Purpose: Deprecated functions from the H5O interface. These
+ * Purpose: Deprecated functions from the H5O interface. These
* functions are here for compatibility purposes and may be
* removed in the future. Applications should switch to the
* newer APIs.
@@ -240,7 +240,7 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
void *vol_obj_data;
if (NULL == (vol_obj_data = H5VL_object_data(vol_obj)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object")
oinfo->fileno = dm_info.fileno;
oinfo->type = dm_info.type;
@@ -368,7 +368,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
/* Register the object's ID */
if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -385,14 +385,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo)
+H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/)
{
H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*!", loc_id, oinfo);
+ H5TRACE2("e", "ix", loc_id, oinfo);
/* Check args */
if (!oinfo)
@@ -425,14 +425,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id)
+H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, hid_t lapl_id)
{
H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*s*!i", loc_id, name, oinfo, lapl_id);
+ H5TRACE4("e", "i*sxi", loc_id, name, oinfo, lapl_id);
/* Check args */
if (!name)
@@ -480,14 +480,14 @@ done:
*/
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)
+ hsize_t n, H5O_info1_t *oinfo /*out*/, hid_t lapl_id)
{
H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIoh*!i", loc_id, group_name, idx_type, order, n, oinfo, lapl_id);
+ H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, oinfo, lapl_id);
/* Check args */
if (!group_name || !*group_name)
@@ -538,7 +538,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields)
+H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields)
{
H5VL_object_t * vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
@@ -546,7 +546,7 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*!Iu", loc_id, oinfo, fields);
+ H5TRACE3("e", "ixIu", loc_id, oinfo, fields);
/* Check args */
if (!oinfo)
@@ -593,7 +593,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, unsigned fields, hid_t lapl_id)
+H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, unsigned fields,
+ hid_t lapl_id)
{
H5VL_object_t * vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
@@ -601,7 +602,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, unsigne
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*s*!Iui", loc_id, name, oinfo, fields, lapl_id);
+ H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id);
/* Check args */
if (!name)
@@ -661,7 +662,7 @@ done:
*/
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)
+ hsize_t n, H5O_info1_t *oinfo /*out*/, unsigned fields, hid_t lapl_id)
{
H5VL_object_t * vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
@@ -669,7 +670,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "i*sIiIoh*!Iui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
+ H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
/* Check args */
if (!group_name || !*group_name)
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index 5023d3e..8bebc6d 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -11,7 +11,7 @@
* 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 a0508fd..1be9522 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -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 c39b9b6..1ecaf36 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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;
@@ -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 b3234b7..5068039 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -11,7 +11,7 @@
* 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 */
@@ -177,7 +177,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
@@ -192,14 +192,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);
@@ -228,8 +229,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);
@@ -276,11 +280,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;
@@ -293,10 +296,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.
*
@@ -309,15 +312,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);
@@ -336,8 +340,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)
@@ -372,10 +378,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
@@ -389,11 +395,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);
@@ -470,10 +476,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.
*
@@ -485,11 +491,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);
@@ -500,10 +506,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
@@ -519,13 +525,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);
@@ -618,10 +624,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
@@ -638,12 +644,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);
@@ -655,22 +661,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
@@ -685,16 +691,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
@@ -939,7 +945,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);
@@ -974,7 +980,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 336f356..e1fa5e9 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -15,7 +15,7 @@
*
* Created: H5Oflush.c
* Aug 19, 2010
- * Mike McGreevy <mamcgree@hdfgroup.org>
+ * Mike McGreevy
*
* Purpose: Object flush/refresh routines.
*
@@ -166,7 +166,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)
@@ -410,32 +410,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 b406386..44c4985 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -15,7 +15,7 @@
*
* Created: H5Ofsinfo.c
* Feb 2009
- * Vailin Choi
+ * Vailin Choi
*
* Purpose: File space info message.
*
@@ -25,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 */
@@ -78,7 +78,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.
*
@@ -90,15 +90,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);
@@ -130,7 +130,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;
@@ -177,10 +176,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;
}
@@ -193,10 +191,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.
*
@@ -207,12 +205,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);
@@ -229,17 +227,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.
@@ -252,13 +249,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);
@@ -273,10 +270,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.
@@ -290,12 +287,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 */
@@ -308,7 +305,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
@@ -334,6 +331,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.
@@ -403,74 +473,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 b87c7bd..8540cc4 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -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 6246e9a..a88a026 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -264,17 +264,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
@@ -580,7 +571,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 */
@@ -811,10 +802,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
@@ -846,7 +837,6 @@ done:
* Failure: -1
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 5 1997
*
*-------------------------------------------------------------------------
@@ -962,7 +952,6 @@ done:
* Failure: Negative
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 5 1997
*
*-------------------------------------------------------------------------
@@ -1010,7 +999,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Dec 31 2002
*
*-------------------------------------------------------------------------
@@ -1198,7 +1186,6 @@ done:
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -1244,7 +1231,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -1279,7 +1265,6 @@ done:
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Dec 31 2002
*
*-------------------------------------------------------------------------
@@ -1475,7 +1460,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * <koziol@ncsa.uiuc.edu>
* Tuesday, January 21, 2003
*
*-------------------------------------------------------------------------
@@ -1513,7 +1497,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
else if (bogus_id == H5O_BOGUS_INVALID_ID)
type = H5O_MSG_BOGUS_INVALID;
else
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "invalid ID for 'bogus' message")
/* Allocate space in the object header for bogus message */
if (H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0)
@@ -1546,7 +1530,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 19 2003
*
*-------------------------------------------------------------------------
@@ -1608,7 +1591,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Mar 19 2003
*
*-------------------------------------------------------------------------
@@ -1708,10 +1690,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() */
@@ -1892,7 +1873,6 @@ H5O_loc_reset(H5O_loc_t *loc)
* Failure: Negative
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Monday, September 19, 2005
*
*-------------------------------------------------------------------------
@@ -2232,7 +2212,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) {
@@ -2526,8 +2506,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
*
*-------------------------------------------------------------------------
*/
@@ -2542,12 +2522,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
*
*-------------------------------------------------------------------------
*/
@@ -2563,8 +2543,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
*
*-------------------------------------------------------------------------
*/
@@ -2812,7 +2792,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or
/* Get an ID for the visited object */
if ((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register visited object")
/* Make callback for starting object */
if ((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
@@ -2896,7 +2876,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -2931,7 +2910,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Jul 13 2008
*
*-------------------------------------------------------------------------
@@ -2944,7 +2922,8 @@ H5O__dec_rc(H5O_t *oh)
FUNC_ENTER_PACKAGE
/* check args */
- HDassert(oh);
+ if (!oh)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object header")
/* Decrement reference count */
oh->rc--;
@@ -2967,7 +2946,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* Oct 08 2010
*
*-------------------------------------------------------------------------
@@ -3031,7 +3009,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 2ca05e4..651e317 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -11,13 +11,13 @@
* 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 d8bc232..711f199 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -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 e8df427..75456f4 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -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,7 +106,6 @@ H5FL_DEFINE_STATIC(H5O_link_t);
* Failure: NULL
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 29 2005
*
*-------------------------------------------------------------------------
@@ -276,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);
@@ -395,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.
@@ -408,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);
@@ -461,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.
@@ -475,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));
@@ -537,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
@@ -668,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.
@@ -683,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);
@@ -701,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
@@ -792,7 +788,6 @@ done:
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
* Aug 29 2005
*
*-------------------------------------------------------------------------
@@ -803,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);
@@ -822,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")));
@@ -831,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:
@@ -848,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 dd26d21..15edf1e 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -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/H5Omtime.c b/src/H5Omtime.c
index 39bde5a..163ea32 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -11,10 +11,10 @@
* 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);
@@ -45,9 +45,9 @@ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{
sizeof(time_t), /*native message size */
0, /* messages are sharable? */
H5O__mtime_decode, /*decode message */
- H5O_mtime_encode, /*encode message */
- H5O_mtime_copy, /*copy the native value */
- H5O_mtime_size, /*raw message size */
+ H5O__mtime_encode, /*encode message */
+ H5O__mtime_copy, /*copy the native value */
+ H5O__mtime_size, /*raw message size */
NULL, /* reset method */
H5O__mtime_free, /* free method */
NULL, /* file delete method */
@@ -70,9 +70,9 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
sizeof(time_t), /*native message size */
0, /* messages are sharable? */
H5O__mtime_new_decode, /*decode message */
- H5O_mtime_new_encode, /*encode message */
- H5O_mtime_copy, /*copy the native value */
- H5O_mtime_new_size, /*raw message size */
+ H5O__mtime_new_encode, /*encode message */
+ H5O__mtime_copy, /*copy the native value */
+ H5O__mtime_new_size, /*raw message size */
NULL, /* reset method */
H5O__mtime_free, /* free method */
NULL, /* file delete method */
@@ -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,25 +365,22 @@ 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
@@ -429,7 +414,6 @@ H5O__mtime_free(void *mesg)
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 24 1998
*
*-------------------------------------------------------------------------
diff --git a/src/H5Oname.c b/src/H5Oname.c
index 12192fa..1636a0e 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -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 cc8fa08..9b377fb 100644
--- a/src/H5Onull.c
+++ b/src/H5Onull.c
@@ -15,7 +15,6 @@
*
* Created: H5Onull.c
* Aug 6 1997
- * Robb Matzke <matzke@llnl.gov>
*
* Purpose: The null message.
*
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 89183f3..221e323 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -12,78 +12,78 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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 */
@@ -101,12 +101,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
*
*-------------------------------------------------------------------------
@@ -219,8 +219,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)
@@ -242,7 +242,7 @@ done:
} /* end H5O__pline_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_pline_encode
+ * Function: H5O__pline_encode
*
* Purpose: Encodes message MESG into buffer P.
*
@@ -254,13 +254,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);
@@ -336,10 +336,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
@@ -355,14 +355,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)))
@@ -430,10 +430,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.
*
@@ -447,13 +447,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 */
@@ -471,7 +471,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;
@@ -494,7 +494,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
@@ -525,7 +525,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)
@@ -576,7 +575,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
@@ -591,14 +590,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);
@@ -615,12 +614,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
@@ -651,14 +650,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));
@@ -669,7 +668,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/H5Orefcount.c b/src/H5Orefcount.c
index 047b410..52eee14 100644
--- a/src/H5Orefcount.c
+++ b/src/H5Orefcount.c
@@ -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 37b5068..2cdf6ec 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -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 */
@@ -138,8 +138,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)
@@ -194,11 +197,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 +212,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 +251,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 +282,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 +308,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 +326,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 +349,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 +401,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 +416,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 +495,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 +505,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 f12ad59..51ea145 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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/H5Oshmesg.c b/src/H5Oshmesg.c
index 1a655c6..1c894a5 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -11,7 +11,7 @@
* 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 fd6149b..fa030bd 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -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/H5Ounknown.c b/src/H5Ounknown.c
index d086c44..2b8a7bb 100644
--- a/src/H5Ounknown.c
+++ b/src/H5Ounknown.c
@@ -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 5774f55..a2d9cfc 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
*
* Purpose: Generic Property Functions
*/
@@ -117,11 +117,11 @@ H5Pcopy(hid_t id)
if ((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class");
- /* Get an atom for the copied class */
+ /* Get an ID for the copied class */
if ((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) {
H5P__close_class(copy_class);
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID,
- "unable to atomize property list class");
+ "unable to register property list class");
} /* end if */
} /* end else */
@@ -196,9 +196,9 @@ H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create
copy_data, cls_close, close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class")
- /* Get an atom for the class */
+ /* Get an ID for the class */
if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class")
done:
if (H5I_INVALID_HID == ret_value && pclass)
@@ -756,14 +756,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Pget_size(hid_t id, const char *name, size_t *size)
+H5Pget_size(hid_t id, const char *name, size_t *size /*out*/)
{
H5P_genclass_t *pclass; /* Property class to query */
H5P_genplist_t *plist; /* Property list to query */
herr_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*s*z", id, name, size);
+ H5TRACE3("e", "i*sx", id, name, size);
/* Check arguments. */
if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
@@ -926,9 +926,9 @@ H5Pget_class(hid_t plist_id)
if (H5P__access_class(pclass, H5P_MOD_INC_REF) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count");
- /* Get an atom for the class */
+ /* Get an ID for the class */
if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class");
done:
if (H5I_INVALID_HID == ret_value && pclass)
@@ -961,14 +961,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Pget_nprops(hid_t id, size_t *nprops)
+H5Pget_nprops(hid_t id, size_t *nprops /*out*/)
{
H5P_genplist_t *plist; /* Property list to query */
H5P_genclass_t *pclass; /* Property class to query */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*z", id, nprops);
+ H5TRACE2("e", "ix", id, nprops);
/* Check arguments. */
if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
@@ -1262,13 +1262,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Pget(hid_t plist_id, const char *name, void *value)
+H5Pget(hid_t plist_id, const char *name, void *value /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*s*x", plist_id, name, value);
+ H5TRACE3("e", "i*sx", plist_id, name, value);
/* Check arguments. */
if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
@@ -1580,9 +1580,9 @@ H5Pget_class_parent(hid_t pclass_id)
if (H5P__access_class(parent, H5P_MOD_INC_REF) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count")
- /* Get an atom for the class */
+ /* Get an ID for the class */
if ((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class")
done:
if (H5I_INVALID_HID == ret_value && parent)
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index a7a541c..c8a97c2 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -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);
@@ -775,7 +775,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Set sizes */
if (H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0)
@@ -804,22 +804,23 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0)
+H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/,
+ double *rdcc_w0 /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
H5P_genplist_t *def_plist; /* Default file access property list */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*z*z*d", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0);
+ H5TRACE4("e", "ixxx", dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get default file access plist */
if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for default fapl ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for default fapl ID");
/* Get the properties. If a property is set to the default value, the value
* from the default fapl is used. */
@@ -865,11 +866,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 +925,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 +966,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 +1025,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));
@@ -1081,7 +1082,7 @@ H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist, H5D_ACS_VDS_VIEW_NAME, &view) < 0)
@@ -1103,17 +1104,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view)
+H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Dv", plist_id, view);
+ H5TRACE2("e", "ix", plist_id, view);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value from property list */
if (view)
@@ -1223,7 +1224,7 @@ H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &gap_size) < 0)
@@ -1246,17 +1247,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size)
+H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", plist_id, gap_size);
+ H5TRACE2("e", "ix", plist_id, gap_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value from property list */
if (gap_size)
@@ -1309,7 +1310,7 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set up values */
info.ndims = ndims;
@@ -1345,7 +1346,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_append_cb_t *func, void **udata)
+H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_append_cb_t *func /*out*/,
+ void **udata /*out*/)
{
H5P_genplist_t * plist; /* property list pointer */
H5D_append_flush_t info;
@@ -1353,11 +1355,11 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "iIu*h*DA**x", plist_id, ndims, boundary, func, udata);
+ H5TRACE5("e", "iIu*hxx", plist_id, ndims, boundary, func, udata);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve info for append flush */
if (H5P_get(plist, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0)
@@ -1407,7 +1409,7 @@ H5Pset_efile_prefix(hid_t plist_id, const char *prefix)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set prefix */
if (H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0)
@@ -1428,7 +1430,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size)
+H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
char * my_prefix; /* Library's copy of the prefix */
@@ -1436,11 +1438,11 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size)
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("Zs", "i*sz", plist_id, prefix, size);
+ H5TRACE3("Zs", "ixz", plist_id, prefix, size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current prefix */
if (H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0)
@@ -1495,7 +1497,7 @@ H5Pset_virtual_prefix(hid_t plist_id, const char *prefix)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set prefix */
if (H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0)
@@ -1518,7 +1520,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size)
+H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
char * my_prefix; /* Library's copy of the prefix */
@@ -1526,11 +1528,11 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix, size_t size)
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("Zs", "i*sz", plist_id, prefix, size);
+ H5TRACE3("Zs", "ixz", plist_id, prefix, size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current prefix */
if (H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0)
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 63402e2..d08d892 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -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
@@ -2002,7 +1995,7 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
/* If the compiler doesn't support C99 designated initializers, check if
@@ -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
@@ -2078,7 +2064,7 @@ H5Pget_layout(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5D_LAYOUT_ERROR, "can't find object for ID")
/* Peek at layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -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
@@ -2161,7 +2140,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set chunk information in property list */
chunk_layout.u.chunk.ndims = (unsigned)ndims;
@@ -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
@@ -2208,7 +2180,7 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Peek at the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -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 */
@@ -2293,7 +2265,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current layout */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0)
@@ -2447,7 +2419,7 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/)
if (count) {
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2492,7 +2464,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2509,7 +2481,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx)
/* Register ID */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
/* Free space on failure */
@@ -2549,7 +2521,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2600,7 +2572,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx)
/* Register ID */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
/* Free space on failure */
@@ -2652,7 +2624,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2713,7 +2685,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2773,7 +2745,7 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2813,14 +2785,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
+H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_layout_t layout; /* Layout information for setting chunk info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", plist_id, options);
+ H5TRACE2("e", "ix", plist_id, options);
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
/* If the compiler doesn't support C99 designated initializers, check if
@@ -2833,7 +2805,7 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the layout property */
if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
@@ -2896,7 +2868,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
@@ -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
@@ -2968,7 +2933,7 @@ H5Pget_external_count(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
@@ -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
@@ -3025,7 +2983,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
@@ -3088,7 +3046,7 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Always set K13 compression (and un-set CHIP compression) */
options_mask &= (unsigned)(~H5_SZIP_CHIP_OPTION_MASK);
@@ -3129,8 +3087,6 @@ done:
* Programmer: Kent Yang
* Wednesday, November 13, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3149,7 +3105,7 @@ H5Pset_shuffle(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Add the filter */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -3173,9 +3129,6 @@ done:
* Programmer: Xiaowen Wu
* Wednesday, December 22, 2004
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3194,7 +3147,7 @@ H5Pset_nbit(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Add the nbit filter */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -3234,9 +3187,6 @@ done:
* Programmer: Xiaowen Wu
* Thursday, April 14, 2005
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3261,7 +3211,7 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set parameters for the filter
* scale_type = 0: floating-point type, filter uses variable-minimum-bits method,
@@ -3315,7 +3265,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current fill value */
if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
@@ -3504,7 +3454,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the fill value */
if (H5P_get_fill_value(plist, type, value) < 0)
@@ -3613,7 +3563,7 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the fill-value status */
if (H5P_fill_value_defined(plist, status) < 0)
@@ -3635,9 +3585,6 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3657,7 +3604,7 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
/* Get the property list structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Check for resetting to default for layout type */
if (alloc_time == H5D_ALLOC_TIME_DEFAULT) {
@@ -3744,7 +3691,7 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/)
/* Get the property list structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve fill value settings */
if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
@@ -3787,7 +3734,7 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time)
/* Get the property list structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve previous fill value settings */
if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
@@ -3815,9 +3762,6 @@ done:
* Programmer: Raymond Lu
* Wednesday, January 16, 2002
*
- * Modifications:
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3835,7 +3779,7 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/)
/* Get the property list structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve fill value settings */
if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
@@ -3865,26 +3809,24 @@ done:
* Programmer: Jacob Smith
* 2018 August 14
*
- * Modifications: None.
- *
*-----------------------------------------------------------------------------
*/
herr_t
-H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize)
+H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize /*out*/)
{
hbool_t setting = FALSE;
H5P_genplist_t *plist = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*b", dcpl_id, minimize);
+ H5TRACE2("e", "ix", dcpl_id, minimize);
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL")
plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
if (NULL == plist)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value")
@@ -3911,8 +3853,6 @@ done:
* Programmer: Jacob Smith
* 2018 August 14
*
- * Modifications: None.
- *
*-----------------------------------------------------------------------------
*/
herr_t
@@ -3927,7 +3867,7 @@ H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize)
plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
if (NULL == plist)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value")
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 41eb05e..90c6c5d 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -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
@@ -459,7 +459,7 @@ H5Pget_version(hid_t plist_id, unsigned *super /*out*/, unsigned *freelist /*out
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (super)
@@ -606,7 +606,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold)
+H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy /*out*/, hsize_t *threshold /*out*/)
{
H5F_fspace_strategy_t new_strategy; /* File space strategy type */
hbool_t new_persist; /* Persisting free-space or not */
@@ -614,7 +614,7 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *thre
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Ft*h", plist_id, strategy, threshold);
+ H5TRACE3("e", "ixx", plist_id, strategy, threshold);
/* Get current file space info */
if (H5Pget_file_space_strategy(plist_id, &new_strategy, &new_persist, &new_threshold) < 0)
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 9c08727..70fc982 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -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
*
@@ -953,7 +953,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* See if a data transform is already set, and free it if it is */
if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
@@ -1015,7 +1015,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression")
@@ -1077,7 +1077,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
@@ -1117,7 +1117,7 @@ H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, 0, "can't find object for ID")
/* Return values */
if (tconv)
@@ -1166,7 +1166,7 @@ H5Pset_preserve(hid_t plist_id, hbool_t status)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
@@ -1203,7 +1203,7 @@ H5Pget_preserve(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0)
@@ -1246,7 +1246,7 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0)
@@ -1282,7 +1282,7 @@ H5Pget_edc_check(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_ERROR_EDC, "can't find object for ID")
/* Update property list */
if (H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0)
@@ -1304,8 +1304,6 @@ done:
* Programmer: Raymond Lu
* Jan 14, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1320,7 +1318,7 @@ H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
cb_struct.func = func;
@@ -1345,8 +1343,6 @@ done:
* Programmer: Raymond Lu
* April 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1361,7 +1357,7 @@ H5Pset_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t op, void *operate_dat
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
cb_struct.func = op;
@@ -1386,23 +1382,21 @@ done:
* Programmer: Raymond Lu
* April 15, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op, void **operate_data)
+H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op /*out*/, void **operate_data /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
H5T_conv_cb_t cb_struct;
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*TE**x", plist_id, op, operate_data);
+ H5TRACE3("e", "ixx", plist_id, op, operate_data);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get property */
if (H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0)
@@ -1443,7 +1437,7 @@ H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the split ratios */
if (H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0)
@@ -1498,7 +1492,7 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
split_ratio[0] = left;
@@ -1621,7 +1615,7 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func /*out*/, voi
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (alloc_func)
if (H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0)
@@ -1676,7 +1670,7 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0)
@@ -1709,7 +1703,7 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Return values */
if (vector_size)
@@ -1951,17 +1945,18 @@ H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode)
+H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id,
+ H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode /*out*/)
{
H5P_genplist_t *plist;
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Do", plist_id, actual_chunk_opt_mode);
+ H5TRACE2("e", "ix", plist_id, actual_chunk_opt_mode);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Return values */
if (actual_chunk_opt_mode)
@@ -1986,17 +1981,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode)
+H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode /*out*/)
{
H5P_genplist_t *plist;
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Di", plist_id, actual_io_mode);
+ H5TRACE2("e", "ix", plist_id, actual_io_mode);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Return values */
if (actual_io_mode)
@@ -2019,18 +2014,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause,
- uint32_t *global_no_collective_cause)
+H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause /*out*/,
+ uint32_t *global_no_collective_cause /*out*/)
{
H5P_genplist_t *plist;
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Iu*Iu", plist_id, local_no_collective_cause, global_no_collective_cause);
+ H5TRACE3("e", "ixx", plist_id, local_no_collective_cause, global_no_collective_cause);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Return values */
if (local_no_collective_cause)
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index b045210..5b0ecb6 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -11,7 +11,7 @@
* 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 f413bec..6f3884f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -869,7 +869,7 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0)
@@ -906,7 +906,7 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment /
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (threshold)
@@ -1547,7 +1547,7 @@ H5Pset_family_offset(hid_t fapl_id, hsize_t offset)
if (H5P_DEFAULT == fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0)
@@ -1585,7 +1585,7 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/)
if (H5P_DEFAULT == fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (offset) {
@@ -1625,7 +1625,7 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type)
if (H5P_DEFAULT == fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0)
@@ -1663,7 +1663,7 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/)
if (H5P_DEFAULT == fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (type) {
@@ -1714,7 +1714,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots,
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set sizes */
if (H5P_set(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0)
@@ -1756,7 +1756,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get sizes */
@@ -1802,7 +1802,7 @@ H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* validate the new configuration */
if (H5AC_validate_cache_image_config(config_ptr) < 0)
@@ -1849,7 +1849,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out*
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* validate the config ptr */
if (config == NULL)
@@ -1894,7 +1894,7 @@ H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* validate the new configuration */
if (H5AC_validate_config(config_ptr) < 0)
@@ -1941,7 +1941,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* validate the config ptr */
if (config == NULL)
@@ -1997,7 +1997,7 @@ H5Pset_gc_references(hid_t plist_id, unsigned gc_ref)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0)
@@ -2031,7 +2031,7 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (gc_ref)
@@ -2065,7 +2065,7 @@ H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_CLOSE_DEGREE_NAME, &degree) < 0)
@@ -2098,7 +2098,7 @@ H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (degree && H5P_get(plist, H5F_ACS_CLOSE_DEGREE_NAME, degree) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree")
@@ -2140,7 +2140,7 @@ H5Pset_meta_block_size(hid_t plist_id, hsize_t size)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0)
@@ -2174,7 +2174,7 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (size) {
@@ -2219,7 +2219,7 @@ H5Pset_sieve_buf_size(hid_t plist_id, size_t size)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
@@ -2253,7 +2253,7 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (size)
@@ -2297,7 +2297,7 @@ H5Pset_small_data_block_size(hid_t plist_id, hsize_t size)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0)
@@ -2331,7 +2331,7 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (size) {
@@ -2472,7 +2472,7 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0)
@@ -2507,7 +2507,7 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (low)
@@ -2549,7 +2549,7 @@ H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (H5P_set(plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0)
@@ -2586,7 +2586,7 @@ H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (efc_size)
@@ -2626,7 +2626,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len)
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get old image info */
if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0)
@@ -2719,7 +2719,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/)
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0)
@@ -2794,7 +2794,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get old info */
if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0)
@@ -2870,7 +2870,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback
/* Get the plist structure */
if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get old info */
if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0)
@@ -4198,7 +4198,7 @@ H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &attempts) < 0)
@@ -4233,7 +4233,7 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the # of read attempts set */
if (H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0)
@@ -4277,7 +4277,7 @@ H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Update property list */
flush_info.func = func;
@@ -4315,7 +4315,7 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func /*out*/, void **udat
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Retrieve the callback function and user data */
if (H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &flush_info) < 0)
@@ -4663,7 +4663,7 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_cl
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
#ifndef H5_HAVE_PARALLEL
/* Set value */
@@ -4711,7 +4711,7 @@ H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/)
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_get(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, evict_on_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property")
@@ -4756,7 +4756,7 @@ H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_USE_FILE_LOCKING_NAME, &use_file_locking) < 0)
@@ -4798,7 +4798,7 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (H5P_get(plist, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0)
@@ -4929,7 +4929,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0)
@@ -4981,7 +4981,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag")
@@ -5024,7 +5024,7 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0)
@@ -5061,7 +5061,7 @@ H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the properties */
if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0)
@@ -5104,7 +5104,7 @@ H5Pset_mpi_params(hid_t plist_id, MPI_Comm comm, MPI_Info info)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set values */
if (H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
@@ -5511,7 +5511,7 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/)
/* Get the plist structure */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag")
@@ -5546,7 +5546,7 @@ H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc,
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (min_meta_perc > 100)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -5595,7 +5595,7 @@ H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size /*out*/, unsigned *min_
/* 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")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get size */
@@ -5679,7 +5679,7 @@ H5Pset_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Validate the input configuration */
@@ -5859,7 +5859,7 @@ H5Pget_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Validate the config_ptr */
if (config_ptr == NULL)
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 47a3cf7..b33fda2 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -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
@@ -340,7 +340,7 @@ H5Pset_userblock(hid_t plist_id, hsize_t size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0)
@@ -363,25 +363,20 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_userblock(hid_t plist_id, hsize_t *size)
+H5Pget_userblock(hid_t plist_id, hsize_t *size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", plist_id, size);
+ H5TRACE2("e", "ix", plist_id, size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get value */
if (size)
@@ -427,7 +422,7 @@ H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (sizeof_addr) {
@@ -463,17 +458,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr, size_t *sizeof_size)
+H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*z*z", plist_id, sizeof_addr, sizeof_size);
+ H5TRACE3("e", "ixx", plist_id, sizeof_addr, sizeof_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (sizeof_addr) {
@@ -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
@@ -537,7 +527,7 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Set values */
if (ik > 0) {
@@ -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 */
@@ -590,7 +575,7 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */, unsigned *lk /*out */)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get values */
if (ik) {
@@ -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
@@ -644,7 +624,7 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Set value */
if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
@@ -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 */
@@ -690,7 +665,7 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get value */
if (ik) {
@@ -827,7 +802,7 @@ H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
if (H5P_set(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set number of indexes");
@@ -850,17 +825,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes)
+H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", plist_id, nindexes);
+ H5TRACE2("e", "ix", plist_id, nindexes);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
@@ -904,7 +879,7 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Read the current number of indexes */
if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
@@ -949,8 +924,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags,
- unsigned *min_mesg_size)
+H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags /*out*/,
+ unsigned *min_mesg_size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
unsigned nindexes; /* Number of SOHM indexes */
@@ -959,11 +934,11 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "iIu*Iu*Iu", plist_id, index_num, mesg_type_flags, min_mesg_size);
+ H5TRACE4("e", "iIuxx", plist_id, index_num, mesg_type_flags, min_mesg_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Read the current number of indexes */
if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
@@ -1219,7 +1194,7 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
if (H5P_set(plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &max_list) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set list maximum in property list");
@@ -1244,17 +1219,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree)
+H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list /*out*/, unsigned *min_btree /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Iu*Iu", plist_id, max_list, min_btree);
+ H5TRACE3("e", "ixx", plist_id, max_list, min_btree);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get value(s) */
if (max_list)
@@ -1297,7 +1272,7 @@ H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value(s), if non-zero */
if (H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0)
@@ -1329,18 +1304,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist,
- hsize_t *threshold)
+H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy /*out*/, hbool_t *persist /*out*/,
+ hsize_t *threshold /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "i*Ff*b*h", plist_id, strategy, persist, threshold);
+ H5TRACE4("e", "ixxx", plist_id, strategy, persist, threshold);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value(s) */
if (strategy)
@@ -1451,13 +1426,13 @@ H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (fsp_size < H5F_FILE_SPACE_PAGE_SIZE_MIN)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to less than 512")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to less than 512")
if (fsp_size > H5F_FILE_SPACE_PAGE_SIZE_MAX)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "cannot set file space page size to more than 1GB")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to more than 1GB")
/* Set the value*/
if (H5P_set(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsp_size) < 0)
@@ -1480,17 +1455,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size)
+H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", plist_id, fsp_size);
+ H5TRACE2("e", "ix", plist_id, fsp_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (fsp_size)
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index 78c4d56..b8dab90 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -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 c27ee9d..7d671c6 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -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
*
@@ -161,7 +161,7 @@ H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -204,7 +204,7 @@ H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -255,7 +255,7 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get group info */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -304,7 +304,7 @@ H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get group info */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -357,7 +357,7 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get group info */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -406,7 +406,7 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get group info */
if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
@@ -449,7 +449,7 @@ H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get link info */
if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
@@ -497,7 +497,7 @@ H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get link info */
if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 5fd811c..4215ccb 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
*
* Purpose: Generic Property Functions
*/
@@ -459,9 +459,9 @@ H5P__init_package(void)
* Initialize the Generic Property class & object groups.
*/
if (H5I_register_type(H5I_GENPROPCLS_CLS) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group")
if (H5I_register_type(H5I_GENPROPLST_CLS) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
+ HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Repeatedly pass over the list of property list classes for the library,
* initializing each class if its parent class is initialized, until no
@@ -533,7 +533,7 @@ done:
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- Release the atom group and any other resources allocated.
+ Release the ID group and any other resources allocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Can't report errors...
@@ -950,9 +950,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref)
if (H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count")
- /* Get an atom for the property list */
+ /* Get an ID for the property list */
if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list")
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback
*/
@@ -1855,9 +1855,9 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
if ((plist = H5P__create(pclass)) == NULL)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list")
- /* Get an atom for the property list */
+ /* Get an ID for the property list */
if ((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list")
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback
*/
@@ -3992,7 +3992,7 @@ H5P_object_verify(hid_t plist_id, hid_t pclass_id)
/* Get the plist structure */
if (NULL == (ret_value = (H5P_genplist_t *)H5I_object(plist_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5560,7 +5560,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
*
*-------------------------------------------------------------------------
@@ -5587,7 +5587,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 b1722bc..879e6ed 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -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
*
@@ -478,7 +478,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
/* Close the FAPL */
if (l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -604,7 +604,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE
/* Close the FAPL */
if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -919,7 +919,7 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set number of links */
if (H5P_set(plist, H5L_ACS_NLINKS_NAME, &nlinks) < 0)
@@ -946,20 +946,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_nlinks(hid_t plist_id, size_t *nlinks)
+H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*z", plist_id, nlinks);
+ H5TRACE2("e", "ix", plist_id, nlinks);
if (!nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer passed in");
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current number of links */
if (H5P_get(plist, H5L_ACS_NLINKS_NAME, nlinks) < 0)
@@ -994,7 +994,7 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set prefix */
if (H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0)
@@ -1021,7 +1021,7 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size)
+H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
char * my_prefix; /* Library's copy of the prefix */
@@ -1029,11 +1029,11 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size)
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("Zs", "i*sz", plist_id, prefix, size);
+ H5TRACE3("Zs", "ixz", plist_id, prefix, size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the current prefix */
if (H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0)
@@ -1116,7 +1116,7 @@ H5Pget_elink_fapl(hid_t lapl_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links")
@@ -1156,7 +1156,7 @@ H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set flags */
if (H5P_set(plist, H5L_ACS_ELINK_FLAGS_NAME, &flags) < 0)
@@ -1180,17 +1180,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags)
+H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", lapl_id, flags);
+ H5TRACE2("e", "ix", lapl_id, flags);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get flags */
if (flags)
@@ -1232,7 +1232,7 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Populate the callback info struct */
cb_info.func = func;
@@ -1260,18 +1260,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data)
+H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func /*out*/, void **op_data /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
H5L_elink_cb_t cb_info; /* Callback info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Lt**x", lapl_id, func, op_data);
+ H5TRACE3("e", "ixx", lapl_id, func, op_data);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get callback_info */
if (H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0)
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 9261244..92077d1 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -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
@@ -149,7 +149,7 @@ H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd_group)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
crt_intmd_group = (unsigned)(crt_intmd_group > 0 ? 1 : 0);
@@ -183,7 +183,7 @@ H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd_group /*out
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (crt_intmd_group)
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
index 8fdf610..2ce1ec0 100644
--- a/src/H5Pmapl.c
+++ b/src/H5Pmapl.c
@@ -160,7 +160,7 @@ H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_all
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Set sizes */
if (H5P_set(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, &key_prefetch_size) < 0)
@@ -182,17 +182,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_alloc_size)
+H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*z*z", mapl_id, key_prefetch_size, key_alloc_size);
+ H5TRACE3("e", "ixx", mapl_id, key_prefetch_size, key_alloc_size);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Get the properties */
if (key_prefetch_size) {
diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h
index 130cb90..18f30c6 100644
--- a/src/H5Pmodule.h
+++ b/src/H5Pmodule.h
@@ -44,7 +44,6 @@
* and compressed.
*
* \todo Describe concisely what the functions in this module are about.
- * \todo Clicking on "more" after "Property List Interface" at the top does not work
*
* \defgroup GPLO General Property List Operations
* \ingroup H5P
@@ -70,6 +69,10 @@
* \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 b977a35..edb0cca 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -15,7 +15,7 @@
*
* Created: H5Pocpl.c
* Nov 28 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Object creation property list class routines
*
@@ -226,7 +226,7 @@ H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set property values */
if (H5P_set(plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &max_compact) < 0)
@@ -251,17 +251,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense)
+H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Iu*Iu", plist_id, max_compact, min_dense);
+ H5TRACE3("e", "ixx", plist_id, max_compact, min_dense);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (max_compact) {
@@ -305,7 +305,7 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get object header flags */
if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -342,12 +342,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags)
+H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/)
{
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", plist_id, crt_order_flags);
+ H5TRACE2("e", "ix", plist_id, crt_order_flags);
/* Get values */
if (crt_order_flags) {
@@ -359,7 +359,7 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get object header flags */
if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -412,7 +412,7 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get object header flags */
if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -445,12 +445,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times)
+H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times /*out*/)
{
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*b", plist_id, track_times);
+ H5TRACE2("e", "ix", plist_id, track_times);
/* Get values */
if (track_times) {
@@ -459,7 +459,7 @@ H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get object header flags */
if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -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
@@ -597,7 +590,7 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Modify the filter parameters of the I/O pipeline */
if (H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0)
@@ -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
@@ -671,7 +652,7 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Call the private function */
if (H5P__set_filter(plist, filter, flags, cd_nelmts, cd_values) < 0)
@@ -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
@@ -785,7 +759,7 @@ H5Pget_nfilters(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the pipeline property to query */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -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
@@ -866,7 +833,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID")
/* Get the pipeline property to query */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -959,25 +926,18 @@ 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
H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
size_t *cd_nelmts /*in_out*/, unsigned cd_values[] /*out*/, size_t namelen,
- char name[] /*out*/, unsigned *filter_config)
+ char name[] /*out*/, unsigned *filter_config /*out*/)
{
H5P_genplist_t *plist; /* Property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "iZfx*zxzx*Iu", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config);
+ H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config);
/* Check args */
if (cd_nelmts || cd_values) {
@@ -1002,7 +962,7 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get filter information */
if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
@@ -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
@@ -1046,7 +999,7 @@ H5Pall_filters_avail(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the pipeline property to query */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -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
@@ -1127,7 +1073,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the pipeline property to modify */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -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
@@ -1194,7 +1128,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the pipeline property to append to */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -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
@@ -1244,7 +1171,7 @@ H5Pset_fletcher32(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the pipeline property to append to */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -1854,7 +1781,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID")
/* Get pipeline info */
if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
@@ -1933,7 +1860,7 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get filter info */
if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 3007ce6..d77e69d 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -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
*
@@ -656,7 +656,7 @@ H5Pset_copy_object(hid_t plist_id, unsigned cpy_option)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set value */
if (H5P_set(plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0)
@@ -689,7 +689,7 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get values */
if (cpy_option)
@@ -739,7 +739,7 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get dtype list */
if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0)
@@ -794,7 +794,7 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get dtype list */
if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0)
@@ -846,7 +846,7 @@ H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Populate the callback info struct */
cb_info.func = func;
@@ -878,18 +878,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data)
+H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func /*out*/, void **op_data /*out*/)
{
H5P_genplist_t * plist; /* Property list pointer */
H5O_mcdt_cb_info_t cb_info; /* Callback info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*Os**x", plist_id, func, op_data);
+ H5TRACE3("e", "ixx", plist_id, func, op_data);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get callback info */
if (H5P_get(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0)
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index fb187ad..d121d08 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -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
*
@@ -156,7 +156,7 @@ H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Set the character encoding */
if (H5P_set(plist, H5P_STRCRT_CHAR_ENCODING_NAME, &encoding) < 0)
@@ -188,7 +188,7 @@ H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/)
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get value */
if (encoding)
diff --git a/src/H5Ptest.c b/src/H5Ptest.c
index 1c1c06c..645988a 100644
--- a/src/H5Ptest.c
+++ b/src/H5Ptest.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Saturday May 31, 2003
*
* Purpose: Generic Property Testing Functions
@@ -109,9 +109,9 @@ H5P__open_class_path_test(const char *path)
if (NULL == (pclass = H5P__open_class_path(path)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path");
- /* Get an atom for the class */
+ /* Get an ID for the class */
if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class");
done:
if (H5I_INVALID_HID == ret_value && pclass)
diff --git a/src/H5S.c b/src/H5S.c
index feeefbb..747d297 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -44,6 +44,7 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5S__close_cb(void *space, void **request);
static htri_t H5S__is_simple(const H5S_t *sdim);
/*****************************/
@@ -81,23 +82,44 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
- H5I_DATASPACE, /* ID class value */
- 0, /* Class flags */
- 2, /* # of reserved IDs for class */
- (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
+ H5I_DATASPACE, /* ID class value */
+ 0, /* Class flags */
+ 2, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */
}};
/* Dataspace selection iterator ID class */
static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{
- H5I_SPACE_SEL_ITER, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */
+ H5I_SPACE_SEL_ITER, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__sel_iter_close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5S_top_package_initialize_s = FALSE;
+/*-------------------------------------------------------------------------
+ * Function: H5S_init
+ *
+ * Purpose: Initialize the interface from some other layer.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_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 H5S_init() */
+
/*--------------------------------------------------------------------------
NAME
H5S__init_package -- Initialize interface-specific information
@@ -115,11 +137,11 @@ H5S__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the dataspace IDs */
+ /* Initialize the ID group for the dataspace IDs */
if (H5I_register_type(H5I_DATASPACE_CLS) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class")
- /* Initialize the atom group for the dataspace selction iterator IDs */
+ /* Initialize the ID group for the dataspace selction iterator IDs */
if (H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to initialize dataspace selection iterator ID class")
@@ -141,7 +163,7 @@ done:
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- Release IDs for the atom group, deferring full interface shutdown
+ Release IDs for the ID group, deferring full interface shutdown
until later (in H5S_term_package).
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -185,7 +207,7 @@ H5S_top_term_package(void)
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- Release the atom group and any other resources allocated.
+ Release the ID group and any other resources allocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Can't report errors...
@@ -222,6 +244,37 @@ H5S_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5S_term_package() */
+/*-------------------------------------------------------------------------
+ * Function: H5S__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on a dataspace's ID
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__close_cb(void *_space, void H5_ATTR_UNUSED **request)
+{
+ H5S_t *space = (H5S_t *)_space; /* The dataspace to close */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(space);
+
+ /* Close the dataspace object */
+ if (H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CLOSEERROR, FAIL, "unable to close dataspace");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__close_cb() */
+
/*--------------------------------------------------------------------------
NAME
H5S_get_validiated_dataspace
@@ -382,9 +435,9 @@ H5Screate(H5S_class_t type)
if (NULL == (new_ds = H5S_create(type)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -531,9 +584,9 @@ H5Scopy(hid_t space_id)
if (NULL == (dst = H5S_copy(src, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, dst, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -1230,7 +1283,7 @@ H5Sis_simple(hid_t space_id)
/* Check args and all the boring stuff. */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
ret_value = H5S__is_simple(space);
@@ -1276,7 +1329,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
if (rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
if (rank < 0 || rank > H5S_MAX_RANK)
@@ -1432,9 +1485,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/
if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -1804,7 +1857,7 @@ H5Sset_extent_none(hid_t space_id)
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
/* Clear the previous extent from the dataspace */
if (H5S__extent_release(&space->extent) < 0)
diff --git a/src/H5SM.c b/src/H5SM.c
index 76a1428..fbf4975 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -2568,19 +2568,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 +2668,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 01c3fe3..6f71966 100644
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -187,12 +187,12 @@ 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 */
diff --git a/src/H5ST.c b/src/H5ST.c
deleted file mode 100644
index 53829b2..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://www.hdfgroup.org/licenses. *
- * 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 c9d643e..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://www.hdfgroup.org/licenses. *
- * 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 8eeebbc..35ddf3d 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
* Purpose: "All" selection dataspace I/O functions.
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index b4ead95..d20916b 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -17,7 +17,6 @@
* Quincey Koziol
* Jul 24 2007
*
- *
* Purpose: Dump debugging information about a dataspace
*
*-------------------------------------------------------------------------
diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c
index 3e3909c..d050102 100644
--- a/src/H5Sdeprec.c
+++ b/src/H5Sdeprec.c
@@ -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 f081468..e12ff93 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -1104,10 +1104,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;
@@ -1296,10 +1296,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;
@@ -2138,24 +2138,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
@@ -4766,13 +4773,13 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblo
--------------------------------------------------------------------------*/
herr_t
H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks,
- hsize_t buf[/*numblocks*/])
+ hsize_t buf[/*numblocks*/] /*out*/)
{
H5S_t *space; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "ihh*[a2]h", spaceid, startblock, numblocks, buf);
+ H5TRACE4("e", "ihhx", spaceid, startblock, numblocks, buf);
/* Check args */
if (buf == NULL)
@@ -5388,7 +5395,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);
@@ -7004,9 +7011,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);
@@ -7053,8 +7059,7 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset)
} /* end if */
}
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S__hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -9666,7 +9671,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);
@@ -10103,7 +10108,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:
@@ -10268,7 +10273,7 @@ done:
Specify a hyperslab to combine with the current hyperslab selection, and
store the result in the new hyperslab selection.
USAGE
- herr_t H5S_combine_hyperslab(new_space, old_space, op, start, stride, count, block)
+ herr_t H5S_combine_hyperslab(old_space, op, start, stride, count, block, new_space)
H5S_t *old_space; IN: The old space the selection is performed on
H5S_seloper_t op; IN: Operation to perform on current selection
const hsize_t start[]; IN: Offset of start of hyperslab
@@ -10292,7 +10297,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op, const hsize_t start[], const hsize_t *stride,
+H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t start[], const hsize_t *stride,
const hsize_t count[], const hsize_t *block, H5S_t **new_space)
{
unsigned u; /* Local index variable */
@@ -10573,9 +10578,9 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], co
if (H5S_combine_hyperslab(space, op, start, stride, count, block, &new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to set hyperslab selection")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0 && new_space)
@@ -10715,9 +10720,9 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
if (NULL == (new_space = H5S__combine_select(space1, op, space2)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create hyperslab selection")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
if (ret_value < 0 && new_space)
@@ -12353,14 +12358,15 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[])
+H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[] /*out*/, hsize_t stride[] /*out*/,
+ hsize_t count[] /*out*/, hsize_t block[] /*out*/)
{
H5S_t * space; /* Dataspace to query */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*h*h*h*h", spaceid, start, stride, count, block);
+ H5TRACE5("e", "ixxxx", spaceid, start, stride, count, block);
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 79eb64e..9a38aaa 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -697,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
@@ -729,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
@@ -754,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) {
@@ -762,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 */
@@ -777,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
@@ -809,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
@@ -950,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() */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 58f7b41..82e513e 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, November 10, 1998
*
* Purpose: "None" selection dataspace I/O functions.
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index a600c5d..c89b616 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -137,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 */
@@ -404,6 +409,9 @@ H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space, const H5
const H5S_t *src_intersect_space, H5S_t *proj_space,
hbool_t share_space);
+/* Operations on selection iterators */
+H5_DLL herr_t H5S__sel_iter_close_cb(H5S_sel_iter_t *_sel_iter, void **request);
+
/* Testing functions */
#ifdef H5S_TESTING
H5_DLL herr_t H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1,
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 21ef966..5991116 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -238,7 +238,7 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
} /* end H5S__point_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_block
+ * Function: H5S__point_iter_block
*
* Purpose: Retrieve the current block of iterator for current
* selection
@@ -843,6 +843,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;
@@ -1511,8 +1515,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
@@ -1522,14 +1527,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) {
@@ -1539,6 +1550,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() */
@@ -1572,13 +1587,14 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, hsize_t n
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t buf[/*numpoints*/])
+H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints,
+ hsize_t buf[/*numpoints*/] /*out*/)
{
H5S_t *space; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE4("e", "ihh*[a2]h", spaceid, startpoint, numpoints, buf);
+ H5TRACE4("e", "ihhx", spaceid, startpoint, numpoints, buf);
/* Check args */
if (NULL == buf)
@@ -2200,7 +2216,7 @@ done:
} /* end H5S__point_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_simple
+ * Function: H5S__point_project_simple
*
* Purpose: Projects a point selection onto/into a simple dataspace
* of a different rank
@@ -2330,6 +2346,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 76ed237..56c1646 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -201,6 +201,7 @@ struct H5O_loc_t;
typedef struct H5S_t H5S_t;
/* Operations on dataspaces */
+H5_DLL herr_t H5S_init(void);
H5_DLL H5S_t * H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max);
H5_DLL herr_t H5S_close(H5S_t *ds);
H5_DLL H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds);
@@ -275,7 +276,7 @@ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_ele
/* Operations on hyperslab selections */
H5_DLL herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block);
-H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op, const hsize_t start[],
+H5_DLL herr_t H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block,
H5S_t **new_space);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 6befa55..fd85dcc 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -120,59 +120,1220 @@ typedef enum {
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.12.0
+ *
+ */
+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.12.0
+ *
+ */
+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.12.0
+ *
+ */
+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.12.0
+ */
+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.12.0
+ *
+ */
+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.12.0
+ *
+ */
+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.12.0
+ *
+ */
+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.12.0
+ *
+ */
+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 */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index f7e4a5e..7a0ea3c 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.ued>
+/* Programmer: Quincey Koziol
* Friday, May 29, 1998
*
* Purpose: Dataspace selection functions.
@@ -51,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 */
/*****************************/
@@ -142,10 +142,10 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset)
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace")
if (space->extent.rank == 0 ||
(H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR || H5S_GET_EXTENT_TYPE(space) == H5S_NULL))
- HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace")
if (offset == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified")
@@ -602,13 +602,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[])
+H5Sget_select_bounds(hid_t spaceid, hsize_t start[] /*out*/, hsize_t end[] /*out*/)
{
H5S_t *space; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*h*h", spaceid, start, end);
+ H5TRACE3("e", "ixx", spaceid, start, end);
/* Check args */
if (start == NULL || end == NULL)
@@ -1196,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
@@ -1218,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);
@@ -1233,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 */
/*--------------------------------------------------------------------------
@@ -1276,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.
@@ -1296,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);
@@ -1309,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 */
/*--------------------------------------------------------------------------
@@ -1358,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.
@@ -1380,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);
@@ -1393,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 */
/*-------------------------------------------------------------------------
@@ -1671,7 +1671,7 @@ H5Sget_select_type(hid_t space_id)
/* Check args */
if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, H5S_SEL_ERROR, "not a dataspace")
/* Set return value */
ret_value = H5S_GET_SELECT_TYPE(space);
@@ -2851,9 +2851,9 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, hid_t src
if (H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
if (ret_value < 0)
@@ -3000,10 +3000,10 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags)
if (H5S_select_iter_init(sel_iter, space, elmt_size, flags) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize selection iterator")
- /* Atomize */
+ /* Register */
if ((ret_value = H5I_register(H5I_SPACE_SEL_ITER, sel_iter, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID,
- "unable to register dataspace selection iterator atom")
+ "unable to register dataspace selection iterator ID")
done:
FUNC_LEAVE_API(ret_value)
@@ -3056,14 +3056,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
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)
+H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq /*out*/,
+ size_t *nbytes /*out*/, hsize_t *off /*out*/, size_t *len /*out*/)
{
H5S_sel_iter_t *sel_iter; /* Dataspace selection iterator to operate on */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "izz*z*z*h*z", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len);
+ H5TRACE7("e", "izzxxxx", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len);
/* Check args */
if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER)))
@@ -3089,6 +3089,87 @@ 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_cb
+ *
+ * Purpose: Called when the ref count reaches zero on a selection iterator's ID
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S__sel_iter_close_cb(H5S_sel_iter_t *_sel_iter, void H5_ATTR_UNUSED **request)
+{
+ H5S_sel_iter_t *sel_iter = (H5S_sel_iter_t *)_sel_iter; /* The selection iterator to close */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(sel_iter);
+
+ /* Close the selection iterator object */
+ if (H5S_sel_iter_close(sel_iter) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CLOSEERROR, FAIL, "unable to close selection iterator");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__sel_iter_close_cb() */
+
/*-------------------------------------------------------------------------
* Function: H5S_sel_iter_close
*
diff --git a/src/H5Stest.c b/src/H5Stest.c
index e6ebe49..a851549 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -11,7 +11,7 @@
* 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 ce3fbd8..1a3d61f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -325,7 +325,7 @@
/* Adjust information for this type */ \
H5_GLUE3(H5T_INIT_TYPE_, GUTS, _CORE) \
\
- /* Atomize result */ \
+ /* Register result */ \
if ((GLOBAL = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \
}
@@ -802,7 +802,7 @@ H5T__init_package(void)
FUNC_ENTER_NOAPI_NOINIT
- /* Initialize the atom group for the file IDs */
+ /* Initialize the ID group for the file IDs */
if (H5I_register_type(H5I_DATATYPE_CLS) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface")
@@ -1820,7 +1820,7 @@ done:
* Errors:
* ARGS BADVALUE Invalid size.
* DATATYPE CANTINIT Can't create type.
- * DATATYPE CANTREGISTER Can't register datatype atom.
+ * DATATYPE CANTREGISTER Can't register datatype ID.
*
* Programmer: Robb Matzke
* Friday, December 5, 1997
@@ -1923,6 +1923,7 @@ H5Tcopy(hid_t obj_id)
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset")
@@ -1941,7 +1942,7 @@ done:
/* If we got a type ID from a passed-in dataset, we need to close that */
if (dset_tid != H5I_INVALID_HID)
if (H5I_dec_app_ref(dset_tid) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADATOM, FAIL, "problem freeing temporary dataset type ID")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADID, FAIL, "problem freeing temporary dataset type ID")
/* Close the new datatype on errors */
if (H5I_INVALID_HID == ret_value)
@@ -1954,12 +1955,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Tclose
*
- * Purpose: Frees a datatype and all associated memory.
+ * Purpose: Frees a datatype and all associated memory.
*
- * 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
*-------------------------------------------------------------------------
*/
herr_t
@@ -1979,7 +1980,7 @@ H5Tclose(hid_t type_id)
/* When the reference count reaches zero the resources are freed */
if (H5I_dec_app_ref(type_id) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id")
done:
FUNC_LEAVE_API(ret_value)
@@ -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
@@ -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
@@ -2910,14 +2902,14 @@ done:
*-------------------------------------------------------------------------
*/
H5T_conv_t
-H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
+H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata /*out*/)
{
H5T_t * src, *dst;
H5T_path_t *path;
H5T_conv_t ret_value; /* Return value */
FUNC_ENTER_API(NULL)
- H5TRACE3("TC", "ii**!", src_id, dst_id, pcdata);
+ H5TRACE3("TC", "iix", src_id, dst_id, pcdata);
/* Check args */
if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) ||
@@ -3006,7 +2998,7 @@ herr_t
H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background, hid_t dxpl_id)
{
H5T_path_t *tpath; /* type conversion info */
- H5T_t * src, *dst; /* unatomized types */
+ H5T_t * src, *dst; /* unregistered types */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -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 *
@@ -3422,8 +3406,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
*
*-------------------------------------------------------------------------
*/
@@ -3470,8 +3454,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 +3482,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 +3513,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
*
*-------------------------------------------------------------------------
*/
@@ -3800,8 +3784,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
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index e2f3f01..d8dc2fb 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -107,7 +107,7 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */])
if (NULL == (dt = H5T__array_create(base, ndims, dim)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype")
- /* Atomize the type */
+ /* Register the type */
if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
@@ -255,13 +255,13 @@ H5T__get_array_ndims(const H5T_t *dt)
*-------------------------------------------------------------------------
*/
int
-H5Tget_array_dims2(hid_t type_id, hsize_t dims[])
+H5Tget_array_dims2(hid_t type_id, hsize_t dims[] /*out*/)
{
H5T_t *dt; /* pointer to array data type */
int ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("Is", "i*h", type_id, dims);
+ H5TRACE2("Is", "ix", type_id, dims);
/* Check args */
if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
@@ -357,7 +357,7 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */],
if (NULL == (dt = H5T__array_create(base, (unsigned)ndims, dim)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype")
- /* Atomize the type */
+ /* Register the type */
if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype")
@@ -383,13 +383,13 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int H5_ATTR_UNUSED perm[])
+H5Tget_array_dims1(hid_t type_id, hsize_t dims[] /*out*/, int H5_ATTR_UNUSED perm[] /*out*/)
{
H5T_t *dt; /* Array datatype to query */
int ret_value; /* return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("Is", "i*h*Is", type_id, dims, perm);
+ H5TRACE3("Is", "ixx", type_id, dims, perm);
/* Check args */
if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 87eee18..8dc0582 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -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
@@ -219,7 +215,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
/* Get an ID for the datatype */
if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype ID")
done:
if (ret_value < 0)
@@ -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 9b9d34f..a33a67c 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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) \
@@ -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 */
@@ -9312,7 +9310,7 @@ 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*/
@@ -9531,14 +9529,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 c88f643..dd145c9 100644
--- a/src/H5Tcset.c
+++ b/src/H5Tcset.c
@@ -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 e9cd289..613aa60 100644
--- a/src/H5Tdbg.c
+++ b/src/H5Tdbg.c
@@ -91,6 +91,13 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i
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");
@@ -108,13 +115,15 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i
nbytes = H5T_get_size(path->dst);
else
nbytes = 0;
-
nbytes *= path->stats.nelmts;
H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed);
- HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8T %8T %8T %10s\n", path->name, path->stats.nelmts,
- path->stats.ncalls, path->stats.times.user, path->stats.times.system,
- path->stats.times.elapsed, bandwidth);
- } /* end if */
+ 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)
@@ -394,7 +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, "%02p", ((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 a3c300d..277c9a2 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -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
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index b58ad30..72705f2 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -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
@@ -62,9 +62,9 @@ H5Tenum_create(hid_t parent_id)
if (NULL == (dt = H5T__enum_create(parent)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "cannot create enum type")
- /* Atomize the type */
+ /* Register the type */
if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type atom")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type ID")
done:
FUNC_LEAVE_API(ret_value)
@@ -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 fc7cde8..baeae6d 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -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 3ff43a6..9527a5a 100644
--- a/src/H5Tfixed.c
+++ b/src/H5Tfixed.c
@@ -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 be49936..b3fa724 100644
--- a/src/H5Tfloat.c
+++ b/src/H5Tfloat.c
@@ -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 4f9edde..c489edc 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -44,12 +44,8 @@
* \ingroup H5T
* \defgroup ENUM Enumeration Datatypes
* \ingroup H5T
- * \defgroup GTO General Datatype Operations
- * \ingroup H5T
* \defgroup OPAQUE Opaque Datatypes
* \ingroup H5T
- * \defgroup STRING String Datatypes
- * \ingroup H5T
* \defgroup VLEN Variable-length Sequence Datatypes
* \ingroup H5T
*
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index b1f0581..2688b23 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -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.
@@ -922,18 +922,18 @@ done:
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 baa9d69..b206dca 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -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 de011e4..8d1ac63 100644
--- a/src/H5Toh.c
+++ b/src/H5Toh.c
@@ -209,7 +209,7 @@ H5O__dtype_get_oloc(hid_t obj_id)
/* Get the datatype */
if (NULL == (dt = (H5T_t *)H5I_object(obj_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID")
/* If this is a named datatype, get the VOL driver pointer to the datatype */
type = (H5T_t *)H5T_get_actual_type(dt);
diff --git a/src/H5Topaque.c b/src/H5Topaque.c
index 16e38d6..f097fca 100644
--- a/src/H5Topaque.c
+++ b/src/H5Topaque.c
@@ -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 d28bd9e..e0b48b3 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -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 5eaf99c..db1a2cb 100644
--- a/src/H5Tpad.c
+++ b/src/H5Tpad.c
@@ -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 d88a379..220adb3b2 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -858,6 +858,7 @@ H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
H5_DLL H5T_t *H5T__vlen_create(const H5T_t *base);
+H5_DLL herr_t H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info);
H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Array functions */
@@ -866,6 +867,7 @@ H5_DLL int H5T__get_array_ndims(const H5T_t *dt);
H5_DLL int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]);
/* Reference functions */
+H5_DLL herr_t H5T__ref_reclaim(void *elem, const H5T_t *dt);
H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc);
/* Compound functions */
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 69ccb84..f992141 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -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
@@ -191,10 +183,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived datatypes.
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index ecec597..e1d0f88 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -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 */
@@ -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);
diff --git a/src/H5Tref.c b/src/H5Tref.c
index 213176c..98389e8 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -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 */
/******************/
@@ -145,6 +161,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
htri_t ret_value = FALSE; /* Indicate success, but no location change */
FUNC_ENTER_PACKAGE
+ H5T_REF_LOG_DEBUG("loc=%d", (int)loc);
HDassert(dt);
/* f is NULL when loc == H5T_LOC_MEMORY */
@@ -331,6 +348,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);
@@ -356,6 +374,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);
@@ -383,6 +402,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
size_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC
+ H5T_REF_LOG_DEBUG("");
/* Sanity check */
HDassert(src_buf);
@@ -483,6 +503,7 @@ 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);
@@ -492,7 +513,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
/* Memory-to-memory conversion to support vlen conversion */
if (NULL == dst_file) {
- HDmemcpy(dst_buf, src_buf, dst_size);
+ H5MM_memcpy(dst_buf, src_buf, dst_size);
HGOTO_DONE(ret_value);
}
@@ -565,22 +586,25 @@ 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 = NULL;
- 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_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) {
- HDmemcpy(dst_buf, src_buf, src_size);
+ H5MM_memcpy(dst_buf, src_buf, src_size);
HGOTO_DONE(ret_value);
}
@@ -602,13 +626,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;
@@ -616,7 +640,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 */
@@ -628,11 +652,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;
@@ -644,17 +669,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")
@@ -678,6 +706,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);
@@ -720,6 +749,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);
@@ -768,6 +798,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);
@@ -816,6 +847,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);
@@ -861,6 +893,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);
@@ -919,6 +952,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);
@@ -970,6 +1004,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);
@@ -1016,6 +1051,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);
@@ -1068,6 +1104,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);
@@ -1122,6 +1159,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);
@@ -1170,6 +1208,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);
@@ -1205,7 +1244,7 @@ done:
} /* end H5T__ref_dsetreg_disk_read() */
/*-------------------------------------------------------------------------
- * Function: H5T_ref_reclaim
+ * Function: H5T__ref_reclaim
*
* Purpose: Internal routine to free reference datatypes
*
@@ -1214,11 +1253,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);
@@ -1229,4 +1269,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 d9ad791..5937f74 100644
--- a/src/H5Tstrpad.c
+++ b/src/H5Tstrpad.c
@@ -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 312d112..7974d49 100644
--- a/src/H5Tvisit.c
+++ b/src/H5Tvisit.c
@@ -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 40c208f..e220450 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -160,7 +160,7 @@ H5Tvlen_create(hid_t base_id)
if ((dt = H5T__vlen_create(base)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL location")
- /* Atomize the type */
+ /* Register the type */
if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype")
@@ -1012,7 +1012,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 +1024,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 +1133,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 +1167,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/H5VLconnector.h b/src/H5VLconnector.h
index dca2864..acebe27 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -81,7 +81,8 @@ typedef enum H5VL_dataset_get_t {
typedef enum H5VL_dataset_specific_t {
H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
H5VL_DATASET_FLUSH, /* H5Dflush */
- H5VL_DATASET_REFRESH /* H5Drefresh */
+ H5VL_DATASET_REFRESH, /* H5Drefresh */
+ H5VL_DATASET_WAIT /* H5Dwait */
} H5VL_dataset_specific_t;
/* Typedef for VOL connector dataset optional VOL operations */
@@ -120,7 +121,8 @@ typedef enum H5VL_file_specific_t {
H5VL_FILE_UNMOUNT, /* Unmount a file */
H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
H5VL_FILE_DELETE, /* Delete a file */
- H5VL_FILE_IS_EQUAL /* Check if two files are the same */
+ H5VL_FILE_IS_EQUAL, /* Check if two files are the same */
+ H5VL_FILE_WAIT /* Wait for async operations to complete */
} H5VL_file_specific_t;
/* Typedef for VOL connector file optional VOL operations */
@@ -184,11 +186,25 @@ typedef enum H5VL_object_specific_t {
/* Typedef for VOL connector object optional VOL operations */
typedef int H5VL_object_optional_t;
+/* Status values for async request operations */
+typedef enum H5VL_request_status_t {
+ H5VL_REQUEST_STATUS_IN_PROGRESS, /* Operation has not yet completed */
+ H5VL_REQUEST_STATUS_SUCCEED, /* Operation has completed, successfully */
+ H5VL_REQUEST_STATUS_FAIL, /* Operation has completed, but failed */
+ H5VL_REQUEST_STATUS_CANT_CANCEL, /* An attempt to cancel this operation was made, but it */
+ /* can't be canceled immediately. The operation has */
+ /* not completed successfully or failed, and is not yet */
+ /* in progress. Another attempt to cancel it may be */
+ /* attempted and may (or may not) succeed. */
+ H5VL_REQUEST_STATUS_CANCELED /* Operation has not completed and was canceled */
+} H5VL_request_status_t;
+
/* types for async request SPECIFIC callback */
typedef enum H5VL_request_specific_t {
- H5VL_REQUEST_WAITANY, /* Wait until any request completes */
- H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
- H5VL_REQUEST_WAITALL /* Wait until all requests complete */
+ H5VL_REQUEST_WAITANY, /* Wait until any request completes */
+ H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
+ H5VL_REQUEST_WAITALL, /* Wait until all requests complete */
+ H5VL_REQUEST_GET_ERR_STACK /* Retrieve error stack for failed operation */
} H5VL_request_specific_t;
/* Typedef and values for native VOL connector request optional VOL operations */
@@ -438,39 +454,45 @@ 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 conn_version; /**< Version # of connector */
+ 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 */
@@ -485,10 +507,53 @@ 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
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 289dfef..7b3da7a 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -453,7 +453,7 @@ H5VL__set_def_conn(void)
/* Get default file access pclass */
if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default file access property class ID")
+ HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default file access property class ID")
/* Change the default VOL for the default file access pclass */
if (H5P_reset_vol_class(def_fapclass, &H5VL_def_conn_s) < 0)
@@ -462,7 +462,7 @@ H5VL__set_def_conn(void)
/* Get default file access plist */
if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
- HGOTO_ERROR(H5E_VOL, H5E_BADATOM, FAIL, "can't find object for default fapl ID")
+ HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default fapl ID")
/* Change the default VOL for the default FAPL */
if (H5P_set_vol(def_fapl, H5VL_def_conn_s.connector_id, H5VL_def_conn_s.connector_info) < 0)
@@ -2315,24 +2315,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")
@@ -2340,3 +2341,273 @@ 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_setup_args
+ *
+ * Purpose: Set up arguments to access an object
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Get attribute pointer */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5I_object_verify(loc_id, id_type)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID")
+
+ /* Set up collective metadata (if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_loc_args
+ *
+ * Purpose: Set up arguments to access an object
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID")
+
+ /* Set up collective metadata (if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read")
+
+ /* Set location parameters */
+ loc_params->type = H5VL_OBJECT_BY_SELF;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_loc_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_acc_args
+ *
+ * Purpose: Set up arguments to access an object
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_acc_args(hid_t loc_id, const H5P_libclass_t *libclass, hbool_t is_collective, hid_t *acspl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(libclass);
+ HDassert(acspl_id);
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if (H5CX_set_apl(acspl_id, libclass, loc_id, is_collective) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params->type = H5VL_OBJECT_BY_SELF;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_acc_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_self_args
+ *
+ * Purpose: Set up arguments to access an object "by self"
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params->type = H5VL_OBJECT_BY_SELF;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_self_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_name_args
+ *
+ * Purpose: Set up arguments to access an object "by name"
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libclass, hbool_t is_collective,
+ hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Check args */
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set up location parameters */
+ loc_params->type = H5VL_OBJECT_BY_NAME;
+ loc_params->loc_data.loc_by_name.name = name;
+ loc_params->loc_data.loc_by_name.lapl_id = acspl_id;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_name_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_idx_args
+ *
+ * Purpose: Set up arguments to access an object "by idx"
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ const H5P_libclass_t *libclass, hbool_t is_collective, hid_t acspl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Check args */
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params->type = H5VL_OBJECT_BY_IDX;
+ loc_params->loc_data.loc_by_idx.name = name;
+ loc_params->loc_data.loc_by_idx.idx_type = idx_type;
+ loc_params->loc_data.loc_by_idx.order = order;
+ loc_params->loc_data.loc_by_idx.n = n;
+ loc_params->loc_data.loc_by_idx.lapl_id = acspl_id;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_idx_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_setup_token_args
+ *
+ * Purpose: Set up arguments to access an object by token
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+ HDassert(loc_params);
+
+ /* Get the location object */
+ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params->type = H5VL_OBJECT_BY_TOKEN;
+ loc_params->loc_data.loc_by_token.token = obj_token;
+ loc_params->obj_type = H5I_get_type(loc_id);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_setup_token_args() */
diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h
index 78c5986..009c0e5 100644
--- a/src/H5VLmodule.h
+++ b/src/H5VLmodule.h
@@ -32,6 +32,10 @@
* \brief Virtual Object Layer Interface
* \todo Describe concisely what the functions in this module are about.
*
+ * \defgroup ASYNC Asynchronous Functions
+ * \brief Asynchronous Functions
+ * \todo Describe concisely what the functions in this module are about.
+ *
* \defgroup H5VLDEF Definitions
* \ingroup H5VL
* \defgroup H5VLDEV VOL Developer
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 0fd220c..4d914b0 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -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,9 +47,10 @@ 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_VERSION, /* VOL class struct version */
H5VL_NATIVE_VALUE, /* value */
H5VL_NATIVE_NAME, /* name */
+ H5VL_NATIVE_VERSION, /* connector version */
0, /* capability flags */
NULL, /* initialize */
H5VL__native_term, /* terminate */
@@ -545,6 +556,7 @@ H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file)
case H5I_ERROR_MSG:
case H5I_ERROR_STACK:
case H5I_SPACE_SEL_ITER:
+ case H5I_EVENTSET:
case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index b256518..360317d 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -33,11 +33,17 @@
#define H5VL_NATIVE_VERSION 0
/* Values for VOL connector attribute optional VOL operations */
+/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
+ * routine must be updated.
+ */
#ifndef H5_NO_DEPRECATED_SYMBOLS
#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Values for native VOL connector dataset optional VOL operations */
+/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
+ * routine must be updated.
+ */
#define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */
#define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */
#define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */
@@ -50,6 +56,9 @@
#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
/* Values for native VOL connector file optional VOL operations */
+/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
+ * routine must be updated.
+ */
#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */
#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */
@@ -84,12 +93,18 @@
#define H5VL_NATIVE_FILE_VFD_SWMR_END_TICK 31
/* Values for native VOL connector group optional VOL operations */
+/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
+ * routine must be updated.
+ */
#ifndef H5_NO_DEPRECATED_SYMBOLS
#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */
#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Values for native VOL connector object optional VOL operations */
+/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
+ * routine must be updated.
+ */
#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */
#define H5VL_NATIVE_OBJECT_SET_COMMENT 1 /* H5G|H5Oset_comment, H5Oset_comment_by_name */
#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 2 /* H5Odisable_mdc_flushes */
@@ -126,7 +141,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 */
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index 4fa8a2a..170a5bc 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -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 55fc368..d78388e 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -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")
@@ -339,6 +346,13 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
break;
}
+ case H5VL_DATASET_WAIT: { /* H5Dwait */
+ /* The native VOL connector doesn't support asynchronous
+ * operations, so this is a no-op.
+ */
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
} /* end switch */
@@ -357,7 +371,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 +382,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_file.c b/src/H5VLnative_file.c
index 8a8bfc2..4f7bb90 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -387,8 +387,13 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
/* H5Fdelete */
case H5VL_FILE_DELETE: {
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL,
- "H5Fdelete() is currently not supported in the native VOL connector")
+ hid_t fapl_id = HDva_arg(arguments, hid_t);
+ const char *name = HDva_arg(arguments, const char *);
+ herr_t * ret = HDva_arg(arguments, herr_t *);
+
+ /* Call private routine */
+ if ((*ret = H5F_delete(name, fapl_id)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file check")
break;
}
@@ -404,6 +409,14 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
break;
}
+ /* H5Fwait */
+ case H5VL_FILE_WAIT: {
+ /* The native VOL connector doesn't support asynchronous
+ * operations, so this is a no-op.
+ */
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
} /* end switch */
@@ -847,11 +860,11 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U
if ((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) {
/* Get the file ID corresponding to the H5F_t struct */
if (H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "invalid ID")
/* Get the number of references outstanding for this file ID */
if ((nref = H5I_get_ref(file_id, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
+ HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count")
if (nref == 1)
if (H5F__flush(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 90bb129..c985120 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -122,7 +122,7 @@ H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, co
/* 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")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 590339d..fa59f4a 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -263,9 +263,10 @@ 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 */
+ H5VL_PASSTHRU_VERSION, /* connector version */
0, /* capability flags */
H5VL_pass_through_init, /* initialize */
H5VL_pass_through_term, /* terminate */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 75997df..e116c8f 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -114,6 +114,22 @@ H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t conne
H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector,
hbool_t app_ref, hid_t existing_id);
+/* Object access functions */
+struct H5P_libclass_t;
+H5_DLL herr_t H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj);
+H5_DLL herr_t H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_acc_args(hid_t loc_id, const struct H5P_libclass_t *libclass, hbool_t is_collective,
+ hid_t *acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_name_args(hid_t loc_id, const char *name, const struct H5P_libclass_t *libclass,
+ hbool_t is_collective, hid_t acspl_id, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, const struct H5P_libclass_t *libclass, hbool_t is_collective,
+ hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params);
+
/**********************************
* VOL connector callback wrappers
*********************************/
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 58a8045..63fea64 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -25,42 +25,97 @@
/* 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 2
+
/* 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
+
+/* Flags to return from H5VLquery_optional API and 'opt_query' callbacks */
+/* Note: Operations which access multiple objects' data or metadata in a
+ * container should be registered as file-level optional operations.
+ * (e.g. "H5Dwrite_multi" takes a list of datasets to write data to, so
+ * a VOL connector that implemented it should register it as an optional
+ * file operation, and pass-through VOL connectors that are stacked above
+ * the connector that registered it should assume that dataset elements
+ * for _any_ dataset in the file could be written to)
+ */
+#define H5VL_OPT_QUERY_SUPPORTED 0x0001 /* VOL connector supports this operation */
+#define H5VL_OPT_QUERY_READ_DATA 0x0002 /* Operation reads data for object */
+#define H5VL_OPT_QUERY_WRITE_DATA 0x0004 /* Operation writes data for object */
+#define H5VL_OPT_QUERY_QUERY_METADATA 0x0008 /* Operation reads metadata for object */
+#define H5VL_OPT_QUERY_MODIFY_METADATA 0x0010 /* Operation modifies metadata for object */
+#define H5VL_OPT_QUERY_COLLECTIVE \
+ 0x0020 /* Operation is collective (operations without this flag are assumed to be independent) */
+#define H5VL_OPT_QUERY_NO_ASYNC 0x0040 /* Operation may NOT be executed asynchronously */
+#define H5VL_OPT_QUERY_MULTI_OBJ 0x0080 /* Operation involves multiple objects */
/*******************/
/* 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] -->
-/* Enum type for each VOL subclass */
-/* (Used for various queries, etc) */
+/**
+ * \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_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;
/********************/
@@ -75,17 +130,229 @@ typedef enum H5VL_subclass_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);
-H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, hbool_t *supported);
+/**
+ * \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] flags Operation flags
+ * \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
}
diff --git a/src/H5VM.c b/src/H5VM.c
index 20b2707..49cad20 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 10, 1997
*/
@@ -32,18 +32,18 @@ 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
@@ -58,15 +58,13 @@ static void H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
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
@@ -87,7 +85,7 @@ 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
@@ -102,18 +100,13 @@ H5VM_stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, 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
@@ -237,11 +230,6 @@ H5VM_stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, co
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -338,8 +326,6 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co
* Programmer: Robb Matzke
* Friday, October 17, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -388,8 +374,6 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -425,7 +409,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);
@@ -460,11 +444,6 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -601,7 +580,7 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const
#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 =
@@ -621,8 +600,6 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -680,8 +657,6 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -748,8 +723,6 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -802,7 +775,7 @@ 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
@@ -814,8 +787,6 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -831,7 +802,7 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsiz
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);
@@ -883,8 +854,6 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsiz
* Programmer: Quincey Koziol
* Thursday, June 18, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -938,8 +907,6 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
* Programmer: Quincey Koziol
* Monday, April 28, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1017,8 +984,6 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
* Programmer: Quincey Koziol
* Tuesday, June 22, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1098,8 +1063,6 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co
* Programmer: Quincey Koziol
* Wednesday, April 16, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5WB.c b/src/H5WB.c
index 93d4080..df7627f 100644
--- a/src/H5WB.c
+++ b/src/H5WB.c
@@ -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/H5Z.c b/src/H5Z.c
index fc7b113..ea92a01 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -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 */
@@ -163,12 +170,14 @@ H5Z_term_package(void)
H5Z_stat_table_g[i].stats[dir].times.elapsed);
/* Print the statistics */
- HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8T %8T %8T %10s\n", (dir ? "<" : ">"),
- comment, H5Z_stat_table_g[i].stats[dir].total,
- H5Z_stat_table_g[i].stats[dir].errors,
- H5Z_stat_table_g[i].stats[dir].times.user,
- H5Z_stat_table_g[i].stats[dir].times.system,
- H5Z_stat_table_g[i].stats[dir].times.elapsed, 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 */
@@ -334,8 +343,8 @@ done:
*
* Purpose: This function unregisters a filter.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -452,7 +461,7 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id)
/* Get the plist structure of object creation */
if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADID, FAIL, "can't find object for ID")
/* Check if the object creation property list uses the filter */
if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0)
@@ -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));
@@ -840,11 +849,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Get ID for dataspace to pass to filter routines */
if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) {
(void)H5S_close(space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
}
/* 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 */
+ hbool_t 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 */
@@ -1263,7 +1336,7 @@ 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) {
+ 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;
@@ -1277,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
@@ -1340,7 +1413,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
failed |= (unsigned)1 << idx;
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")
@@ -1592,12 +1665,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
+H5Zget_filter_info(H5Z_filter_t filter, unsigned *filter_config_flags /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "Zf*Iu", filter, filter_config_flags);
+ H5TRACE2("e", "Zfx", filter, filter_config_flags);
/* Get the filter info */
if (H5Z_get_filter_info(filter, filter_config_flags) < 0)
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index 4cac005..d8fed41 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * 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)
/*-------------------------------------------------------------------------
- * 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 74c1b24..4b0801c 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -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 25007b3..76a2380 100644
--- a/src/H5Zmodule.h
+++ b/src/H5Zmodule.h
@@ -77,11 +77,9 @@
* Custom filters that have been registered with the library will have
* additional unique identifiers.
*
- * See \Emph{HDF5 Dynamically Loaded Filters} for more information on
- * how an HDF5 application can apply a filter that is not registered
- * with the HDF5 library.
- *
- * \todo Fix the reference.
+ * 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
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index aa7f507..b696085 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -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;
@@ -873,7 +853,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get the plist structure */
if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get the filter's current parameters */
if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL,
@@ -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/H5Zprivate.h b/src/H5Zprivate.h
index b90fafb..51690b4 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -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 e829eb1..90277cf 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -21,111 +21,231 @@
/* 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 6577f73..5310f7d 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -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,11 +944,11 @@ 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)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get datatype */
if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
@@ -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 */
@@ -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 619fe2f..df164b3 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -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,11 +65,11 @@ 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)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get datatype */
if (NULL == (type = (const H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
@@ -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 031487e..a5b544a 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -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,11 +135,11 @@ 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)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
/* Get datatype */
if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
@@ -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 9a24639..7d55efd 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -13,12 +13,12 @@
#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,20 +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
*
*-------------------------------------------------------------------------
*/
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);
@@ -418,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
@@ -436,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);
@@ -567,7 +565,7 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5Z_xform_destroy_parse_tree
+ * Function: H5Z__xform_destroy_parse_tree
* Purpose: Recursively destroys the expression tree.
* Return: Nothing
* Programmer: Bill Wendling
@@ -576,13 +574,13 @@ done:
*-------------------------------------------------------------------------
*/
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;
}
@@ -596,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
@@ -604,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?")
@@ -617,57 +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
*
*-------------------------------------------------------------------------
*/
static H5Z_node *
-H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers)
+H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers)
{
H5Z_node *expr;
H5Z_node *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
- expr = H5Z_parse_term(current, dat_val_pointers);
+ expr = H5Z__parse_term(current, dat_val_pointers);
for (;;) {
H5Z_node *new_node;
- current = H5Z_get_token(current);
+ current = H5Z__get_token(current);
switch (current->tok_type) {
case H5Z_XFORM_PLUS:
- new_node = H5Z_new_node(H5Z_XFORM_PLUS);
+ new_node = H5Z__new_node(H5Z_XFORM_PLUS);
if (!new_node) {
- H5Z_xform_destroy_parse_tree(expr);
+ H5Z__xform_destroy_parse_tree(expr);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
}
new_node->lchild = expr;
- new_node->rchild = H5Z_parse_term(current, dat_val_pointers);
+ new_node->rchild = H5Z__parse_term(current, dat_val_pointers);
if (!new_node->rchild) {
- H5Z_xform_destroy_parse_tree(new_node);
+ H5Z__xform_destroy_parse_tree(new_node);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
}
@@ -675,18 +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")
}
@@ -694,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:
@@ -708,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")
}
}
@@ -718,47 +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
*
*-------------------------------------------------------------------------
*/
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")
}
@@ -766,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:
@@ -796,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 */
@@ -812,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
@@ -822,26 +822,27 @@ done:
* '(' expr ')'
*
* Return: Success: Valid H5Z_node ptr to expression tree
- * NULLure: NULL
+ * Failure: NULL
+ *
* Programmer: Bill Wendling
* 26. August 2003
*
*-------------------------------------------------------------------------
*/
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")
@@ -849,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")
@@ -857,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")
@@ -867,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")
}
@@ -909,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")
}
@@ -938,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;
@@ -961,21 +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
*
*-------------------------------------------------------------------------
*/
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,
@@ -989,12 +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
+ * 5/1/04
*
*-------------------------------------------------------------------------
*/
@@ -1014,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,
@@ -1077,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)
@@ -1103,25 +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
+ * 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);
@@ -1146,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;
@@ -1198,22 +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
*
*-------------------------------------------------------------------------
*/
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);
@@ -1266,24 +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.
*
*-------------------------------------------------------------------------
*/
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);
@@ -1335,21 +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
*
*-------------------------------------------------------------------------
*/
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);
@@ -1361,23 +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
*
*-------------------------------------------------------------------------
*/
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);
@@ -1393,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);
}
}
}
@@ -1444,22 +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.
*
*-------------------------------------------------------------------------
*/
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(/)
@@ -1474,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.
*
@@ -1514,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
@@ -1534,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
@@ -1551,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)
@@ -1587,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);
@@ -1667,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")
@@ -1687,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);
@@ -1728,7 +1762,7 @@ 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.
*
diff --git a/src/H5err.txt b/src/H5err.txt
index 24e9b2a..64452ec 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -50,7 +50,7 @@ MAJOR, H5E_LIB, General library infrastructure
MAJOR, H5E_FILE, File accessibility
MAJOR, H5E_IO, Low-level I/O
MAJOR, H5E_FUNC, Function entry/exit
-MAJOR, H5E_ATOM, Object atom
+MAJOR, H5E_ID, Object ID
MAJOR, H5E_CACHE, Object cache
MAJOR, H5E_LINK, Links
MAJOR, H5E_BTREE, B-Tree node
@@ -80,6 +80,7 @@ MAJOR, H5E_PLUGIN, Plugin for dynamically loaded library
MAJOR, H5E_PAGEBUF, Page Buffering
MAJOR, H5E_CONTEXT, API Context
MAJOR, H5E_MAP, Map
+MAJOR, H5E_EVENTSET, Event Set
MAJOR, H5E_NONE_MAJOR, No error
# Sections (for grouping minor errors)
@@ -88,7 +89,7 @@ SECTION, RESOURCE, Resource errors
SECTION, FILEACC, File accessibility errors
SECTION, FILE, Generic low-level file I/O errors
SECTION, FUNC, Function entry/exit interface errors
-SECTION, ATOM, Object atom related errors
+SECTION, ID, Object ID related errors
SECTION, CACHE, Cache related errors
SECTION, LINK, Link related errors
SECTION, BTREE, B-tree related errors
@@ -104,6 +105,7 @@ SECTION, PIPELINE, I/O pipeline errors
SECTION, SYSTEM, System level errors
SECTION, PLUGIN, Plugin errors
SECTION, MAP, Map related errors
+SECTION, ASYNC, Asynchronous I/O errors
SECTION, NONE, No error
# Minor errors
@@ -154,13 +156,13 @@ MINOR, FUNC, H5E_CANTINIT, Unable to initialize object
MINOR, FUNC, H5E_ALREADYINIT, Object already initialized
MINOR, FUNC, H5E_CANTRELEASE, Unable to release object
-# Object atom related errors
-MINOR, ATOM, H5E_BADATOM, Unable to find atom information (already closed?)
-MINOR, ATOM, H5E_BADGROUP, Unable to find ID group information
-MINOR, ATOM, H5E_CANTREGISTER, Unable to register new atom
-MINOR, ATOM, H5E_CANTINC, Unable to increment reference count
-MINOR, ATOM, H5E_CANTDEC, Unable to decrement reference count
-MINOR, ATOM, H5E_NOIDS, Out of IDs for group
+# Object ID related errors
+MINOR, ID, H5E_BADID, Unable to find ID information (already closed?)
+MINOR, ID, H5E_BADGROUP, Unable to find ID group information
+MINOR, ID, H5E_CANTREGISTER, Unable to register new ID
+MINOR, ID, H5E_CANTINC, Unable to increment reference count
+MINOR, ID, H5E_CANTDEC, Unable to decrement reference count
+MINOR, ID, H5E_NOIDS, Out of IDs for group
# Cache related errors
MINOR, CACHE, H5E_CANTFLUSH, Unable to flush data from cache
@@ -203,6 +205,7 @@ MINOR, BTREE, H5E_CANTINSERT, Unable to insert object
MINOR, BTREE, H5E_CANTLIST, Unable to list node
MINOR, BTREE, H5E_CANTMODIFY, Unable to modify record
MINOR, BTREE, H5E_CANTREMOVE, Unable to remove object
+MINOR, BTREE, H5E_CANTFIND, Unable to check for record
# Object header related errors
MINOR, OHDR, H5E_LINKCOUNT, Bad object header link count
@@ -282,5 +285,11 @@ MINOR, SYSTEM, H5E_SYSERRSTR, System error message
# Plugin errors
MINOR, PLUGIN, H5E_OPENERROR, Can't open directory or file
+# Map related errors
+MINOR, MAP, H5E_CANTPUT, Can't put value
+
+# Asynchronous operation errors
+MINOR, ASYNC, H5E_CANTWAIT, Can't wait on operation
+
# No error, for backward compatibility */
MINOR, NONE, H5E_NONE_MINOR, No error
diff --git a/src/H5private.h b/src/H5private.h
index 0e824c8..8a9f5c9 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -890,10 +890,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 */
@@ -1229,7 +1231,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 HDpthread_attr_destroy
#define HDpthread_attr_destroy(A) pthread_attr_destroy(A)
@@ -1492,6 +1494,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 */
@@ -1547,6 +1552,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 */
@@ -1638,6 +1646,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 */
@@ -1650,9 +1665,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 */
@@ -1681,18 +1693,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 */
-
/* 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
diff --git a/src/H5public.h b/src/H5public.h
index 8aadddc..ada15a7 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -95,50 +95,130 @@ extern "C" {
#define H5_NO_EXPAND(x) (x)
/* Version numbers */
-#define H5_VERS_MAJOR 1 /* For major interface/format changes */
-#define H5_VERS_MINOR 13 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */
-#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
-/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.13.0" /* Full version string */
+/**
+ * For major interface/format changes
+ */
+#define H5_VERS_MAJOR 1
+/**
+ * For minor interface/format changes
+ */
+#define H5_VERS_MINOR 13
+/**
+ * For tweaks, bug-fixes, or development
+ */
+#define H5_VERS_RELEASE 0
+/**
+ * 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.13.0"
#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>
@@ -198,16 +278,22 @@ typedef long long int64_t;
* 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
@@ -215,20 +301,26 @@ typedef unsigned long long uint64_t;
#endif
/*
- * The sizes of file objects have their own types defined here, use a 64-bit
- * type.
- */
-typedef uint64_t hsize_t;
-typedef int64_t hssize_t;
-#define PRIXHSIZE PRIX64
-#define PRIdHSIZE PRId64
-#define PRIiHSIZE PRIi64
-#define PRIoHSIZE PRIo64
-#define PRIuHSIZE PRIu64
-#define PRIxHSIZE PRIx64
-#define H5_SIZEOF_HSIZE_T H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_HSSIZE_T H5_SIZEOF_INT64_T
-#define HSIZE_UNDEF UINT64_MAX
+ * 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")
+typedef unsigned long long hsize_t;
+typedef signed long long hssize_t;
+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
/*
* File addresses have their own types.
@@ -240,6 +332,11 @@ typedef unsigned haddr_t;
#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 ULONG_MAX
@@ -247,6 +344,11 @@ typedef unsigned long haddr_t;
#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 ULLONG_MAX
@@ -254,26 +356,13 @@ typedef unsigned long long haddr_t;
#ifdef H5_HAVE_PARALLEL
#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
#endif /* H5_HAVE_PARALLEL */
-#else
-#error "nothing appropriate for haddr_t"
-#endif
-#if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT
-#define PRIXHADDR "X"
-#define PRIoHADDR "o"
-#define PRIuHADDR "u"
-#define PRIxHADDR "x"
-#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG
-#define PRIXHADDR "lX"
-#define PRIoHADDR "lo"
-#define PRIuHADDR "lu"
-#define PRIxHADDR "lx"
-#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG
-#define PRIXHADDR H5_PRINTF_LL_WIDTH "X"
+#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 H5_PRINTF_HADDR_FMT"
+#error "nothing appropriate for haddr_t"
#endif
#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR
#define HADDR_MAX (HADDR_UNDEF - 1)
@@ -298,8 +387,7 @@ typedef unsigned long uint32_t;
#error "nothing appropriate for uint32_t"
#endif
-//! [H5_iter_order_t_snip]
-
+//! <!-- [H5_iter_order_t_snip] -->
/**
* Common iteration orders
*/
@@ -310,8 +398,7 @@ typedef enum {
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]
+//! <!-- [H5_iter_order_t_snip] -->
/* Iteration callback values */
/* (Actually, any positive value will cause the iterator to stop and pass back
@@ -321,8 +408,7 @@ typedef enum {
#define H5_ITER_CONT (0)
#define H5_ITER_STOP (1)
-//! [H5_index_t_snip]
-
+//! <!-- [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
@@ -334,18 +420,17 @@ typedef enum H5_index_t {
H5_INDEX_CRT_ORDER, /**< Index on creation order */
H5_INDEX_N /**< Number of indices defined */
} H5_index_t;
-
-//! [H5_index_t_snip]
+//! <!-- [H5_index_t_snip] -->
/**
* Storage info struct used by H5O_info_t and H5F_info_t
*/
-//! [H5_ih_info_t_snip]
+//! <!-- [H5_ih_info_t_snip] -->
typedef struct H5_ih_info_t {
hsize_t index_size; /**< btree and/or list */
hsize_t heap_size;
} H5_ih_info_t;
-//! [H5_ih_info_t_snip]
+//! <!-- [H5_ih_info_t_snip] -->
/**
* The maximum size allowed for tokens
@@ -355,28 +440,17 @@ typedef struct H5_ih_info_t {
*/
#define H5O_MAX_TOKEN_SIZE (16)
-static inline const char *
-htri_to_string(htri_t v)
-{
- if (v == 0)
- return "false";
- else if (v < 0)
- return "error";
- else
- return "true";
-}
-
-//! [H5O_token_t_snip]
-
+//! <!-- [H5O_token_t_snip] -->
/**
+ * Type for object tokens
+ *
* \internal (Hoisted here, since it's used by both the
- * H5Lpublic.h and H5Opublic.h headers) */
-/* Type for object tokens */
+ * 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]
+//! <!-- [H5O_token_t_snip] -->
/**
* Allocation statistics info struct
@@ -437,7 +511,7 @@ H5_DLL herr_t H5open(void);
* If the HDF5 library is initialized and closed more than once, the
* \p func callback must be registered within each open/close cycle.
*
- * \since 1.12.1
+ * \since 1.13.0
*/
H5_DLL herr_t H5atclose(H5_atclose_func_t func, void *ctx);
/**
@@ -661,7 +735,7 @@ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
* after it has been closed. The value of \p is_terminating is
* undefined if this routine fails.
*
- * \since 1.12.1
+ * \since 1.13.0
*/
H5_DLL herr_t H5is_library_terminating(hbool_t *is_terminating);
/**
diff --git a/src/H5system.c b/src/H5system.c
index e7fe422..52bb930 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -66,406 +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)));
- n = 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)
- n = fprintf(stream, "TRUE");
- else if (!tri_var)
- n = fprintf(stream, "FALSE");
- else
- n = fprintf(stream, "FAIL(%d)", (int)tri_var);
- } break;
-
- case 'T': /* Elapsed time, in seconds */
- {
- double seconds = HDva_arg(ap, double);
- char * time_string = H5_timer_get_time_string(seconds);
-
- if (time_string) {
- n = fprintf(stream, format_templ, time_string);
- HDfree(time_string);
- } /* end if */
- else
- n = fprintf(stream, format_templ, "(error)");
- } break;
-
- 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
@@ -1466,7 +1095,7 @@ done:
static size_t
H5__find_last_file_separator(const char *path, size_t len, hbool_t *no_separator)
{
- size_t i;
+ size_t i = len;
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5trace.c b/src/H5trace.c
index 6a570b6..d587853 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -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 */
@@ -1658,6 +1659,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
(unsigned long long)obj);
break;
+ case H5I_EVENTSET:
+ H5RS_asprintf_cat(rs, "0x%0llx (event set)", (unsigned long long)obj);
+ break;
+
case H5I_NTYPES:
H5RS_asprintf_cat(rs, "0x%0llx (ntypes - error)", (unsigned long long)obj);
break;
@@ -1672,6 +1677,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
case 'I':
switch (type[1]) {
+ case 'D': /* H5I_future_discard_func_t */
+ {
+ H5I_future_discard_func_t ifdisc =
+ (H5I_future_discard_func_t)HDva_arg(ap, H5I_future_discard_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifdisc);
+ } /* end block */
+ break;
+
case 'f': /* H5I_free_t */
{
H5I_free_t ifree = (H5I_free_t)HDva_arg(ap, H5I_free_t);
@@ -1748,6 +1762,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'R': /* H5I_future_realize_func_t */
+ {
+ H5I_future_realize_func_t ifreal =
+ (H5I_future_realize_func_t)HDva_arg(ap, H5I_future_realize_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifreal);
+ } /* end block */
+ break;
+
case 's': /* int / int32_t */
{
int is = HDva_arg(ap, int);
@@ -1838,6 +1861,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5I_SPACE_SEL_ITER");
break;
+ case H5I_EVENTSET:
+ H5RS_acat(rs, "H5I_EVENTSET");
+ break;
+
case H5I_NTYPES:
H5RS_acat(rs, "H5I_NTYPES");
break;
@@ -2958,6 +2985,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_DATASET_REFRESH");
break;
+ case H5VL_DATASET_WAIT:
+ H5RS_acat(rs, "H5VL_DATASET_WAIT");
+ break;
+
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
@@ -3082,6 +3113,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_FILE_IS_EQUAL");
break;
+ case H5VL_FILE_WAIT:
+ H5RS_acat(rs, "H5VL_FILE_WAIT");
+ break;
+
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
@@ -3294,6 +3329,34 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'r': /* H5VL_request_specific_t */
+ {
+ H5VL_request_specific_t specific = (H5VL_request_specific_t)HDva_arg(ap, int);
+
+ switch (specific) {
+ case H5VL_REQUEST_WAITANY:
+ H5RS_acat(rs, "H5VL_REQUEST_WAITANY");
+ break;
+
+ case H5VL_REQUEST_WAITSOME:
+ H5RS_acat(rs, "H5VL_REQUEST_WAITSOME");
+ break;
+
+ case H5VL_REQUEST_WAITALL:
+ H5RS_acat(rs, "H5VL_REQUEST_WAITALL");
+ break;
+
+ case H5VL_REQUEST_GET_ERR_STACK:
+ H5RS_acat(rs, "H5VL_REQUEST_GET_ERR_STACK");
+ break;
+
+ default:
+ H5RS_asprintf_cat(rs, "%ld", (long)specific);
+ break;
+ } /* end switch */
+ } /* end block */
+ break;
+
case 's': /* H5VL_attr_optional_t */
{
H5VL_attr_optional_t optional = (H5VL_attr_optional_t)HDva_arg(ap, int);
diff --git a/src/Makefile.am b/src/Makefile.am
index 08c420f..65002c1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,9 +19,6 @@
include $(top_srcdir)/config/commence.am
include $(top_srcdir)/config/lt_vers.am
-# include Doxygen rules (requires autoconf-archive >2016-03-20)
-@DX_RULES@
-
# 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
@@ -79,7 +76,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HGtrap.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 \
@@ -104,7 +101,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 \
diff --git a/src/hdf5.h b/src/hdf5.h
index 2e7caf9..ab799e2 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -24,6 +24,7 @@
#include "H5ACpublic.h" /* Metadata cache */
#include "H5Dpublic.h" /* Datasets */
#include "H5Epublic.h" /* Errors */
+#include "H5ESpublic.h" /* Event Sets */
#include "H5Fpublic.h" /* Files */
#include "H5FDpublic.h" /* File drivers */
#include "H5Gpublic.h" /* Groups */
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 */