summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt224
-rw-r--r--src/COPYING13
-rw-r--r--src/H5.c264
-rw-r--r--src/H5A.c377
-rw-r--r--src/H5AC.c40
-rw-r--r--src/H5ACmpio.c12
-rw-r--r--src/H5ACprivate.h46
-rw-r--r--src/H5ACpublic.h343
-rw-r--r--src/H5Adeprec.c35
-rw-r--r--src/H5Aint.c42
-rw-r--r--src/H5Amodule.h36
-rw-r--r--src/H5Apkg.h16
-rw-r--r--src/H5Apublic.h462
-rw-r--r--src/H5B2cache.c6
-rw-r--r--src/H5Bcache.c2
-rw-r--r--src/H5Bpkg.h30
-rw-r--r--src/H5C.c83
-rw-r--r--src/H5CS.c14
-rw-r--r--src/H5CX.c453
-rw-r--r--src/H5Cdbg.c25
-rw-r--r--src/H5Cimage.c11
-rw-r--r--src/H5Clog.h8
-rw-r--r--src/H5Clog_json.c52
-rw-r--r--src/H5Clog_trace.c52
-rw-r--r--src/H5Cmpio.c79
-rw-r--r--src/H5Cprivate.h26
-rw-r--r--src/H5Cpublic.h23
-rw-r--r--src/H5Cquery.c12
-rw-r--r--src/H5D.c454
-rw-r--r--src/H5Dchunk.c172
-rw-r--r--src/H5Dcompact.c106
-rw-r--r--src/H5Dcontig.c22
-rw-r--r--src/H5Ddeprec.c31
-rw-r--r--src/H5Dearray.c16
-rw-r--r--src/H5Dint.c27
-rw-r--r--src/H5Dio.c145
-rw-r--r--src/H5Dlayout.c17
-rw-r--r--src/H5Dmodule.h38
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Dpkg.h10
-rw-r--r--src/H5Dprivate.h11
-rw-r--r--src/H5Dpublic.h923
-rw-r--r--src/H5Dvirtual.c4
-rw-r--r--src/H5E.c117
-rw-r--r--src/H5EA.c410
-rw-r--r--src/H5EAcache.c707
-rw-r--r--src/H5EAdbg.c145
-rw-r--r--src/H5EAdblkpage.c126
-rw-r--r--src/H5EAdblock.c177
-rw-r--r--src/H5EAhdr.c317
-rw-r--r--src/H5EAiblock.c169
-rw-r--r--src/H5EAint.c32
-rw-r--r--src/H5EAsblock.c164
-rw-r--r--src/H5EAstat.c14
-rw-r--r--src/H5EAtest.c183
-rw-r--r--src/H5ES.c407
-rw-r--r--src/H5ESdevelop.h50
-rw-r--r--src/H5ESevent.c16
-rw-r--r--src/H5ESint.c434
-rw-r--r--src/H5ESmodule.h35
-rw-r--r--src/H5ESpkg.h18
-rw-r--r--src/H5ESprivate.h5
-rw-r--r--src/H5ESpublic.h227
-rw-r--r--src/H5Eint.c26
-rw-r--r--src/H5Emodule.h50
-rw-r--r--src/H5Eprivate.h92
-rw-r--r--src/H5Epublic.h808
-rw-r--r--src/H5F.c772
-rw-r--r--src/H5FA.c337
-rw-r--r--src/H5FAcache.c402
-rw-r--r--src/H5FAdbg.c79
-rw-r--r--src/H5FAdblkpage.c129
-rw-r--r--src/H5FAdblock.c155
-rw-r--r--src/H5FAhdr.c263
-rw-r--r--src/H5FAint.c32
-rw-r--r--src/H5FAstat.c16
-rw-r--r--src/H5FAtest.c129
-rw-r--r--src/H5FD.c97
-rw-r--r--src/H5FDcore.c78
-rw-r--r--src/H5FDcore.h67
-rw-r--r--src/H5FDdevelop.h287
-rw-r--r--src/H5FDdirect.c111
-rw-r--r--src/H5FDdirect.h69
-rw-r--r--src/H5FDfamily.c367
-rw-r--r--src/H5FDfamily.h55
-rw-r--r--src/H5FDhdfs.c58
-rw-r--r--src/H5FDhdfs.h35
-rw-r--r--src/H5FDint.c419
-rw-r--r--src/H5FDioc.c6
-rw-r--r--src/H5FDioc.h3
-rw-r--r--src/H5FDlog.c358
-rw-r--r--src/H5FDlog.h408
-rw-r--r--src/H5FDmirror.c48
-rw-r--r--src/H5FDmirror.h17
-rw-r--r--src/H5FDmpi.h8
-rw-r--r--src/H5FDmpio.c743
-rw-r--r--src/H5FDmpio.h225
-rw-r--r--src/H5FDmulti.c976
-rw-r--r--src/H5FDmulti.h219
-rw-r--r--src/H5FDprivate.h40
-rw-r--r--src/H5FDpublic.h417
-rw-r--r--src/H5FDros3.c6
-rw-r--r--src/H5FDros3.h20
-rw-r--r--src/H5FDsec2.c81
-rw-r--r--src/H5FDsec2.h3
-rw-r--r--src/H5FDspace.c14
-rw-r--r--src/H5FDsplitter.c505
-rw-r--r--src/H5FDsplitter.h17
-rw-r--r--src/H5FDstdio.c176
-rw-r--r--src/H5FDstdio.h16
-rw-r--r--src/H5FDsubfiling.c8
-rw-r--r--src/H5FDsubfiling.h5
-rw-r--r--src/H5FDwindows.c2
-rw-r--r--src/H5FDwindows.h30
-rw-r--r--src/H5FL.c68
-rw-r--r--src/H5FLprivate.h2
-rw-r--r--src/H5FS.c62
-rw-r--r--src/H5FScache.c4
-rw-r--r--src/H5FSsection.c56
-rw-r--r--src/H5Faccum.c2
-rw-r--r--src/H5Fdeprec.c53
-rw-r--r--src/H5Fefc.c8
-rw-r--r--src/H5Fint.c154
-rw-r--r--src/H5Fmodule.h41
-rw-r--r--src/H5Fmount.c25
-rw-r--r--src/H5Fmpi.c74
-rw-r--r--src/H5Fpkg.h33
-rw-r--r--src/H5Fprivate.h13
-rw-r--r--src/H5Fpublic.h597
-rw-r--r--src/H5Fquery.c23
-rw-r--r--src/H5Fsuper.c7
-rw-r--r--src/H5G.c95
-rw-r--r--src/H5Gcache.c2
-rw-r--r--src/H5Gcompact.c18
-rw-r--r--src/H5Gdense.c39
-rw-r--r--src/H5Gdeprec.c306
-rw-r--r--src/H5Gent.c13
-rw-r--r--src/H5Gint.c1
-rw-r--r--src/H5Gloc.c62
-rw-r--r--src/H5Gmodule.h116
-rw-r--r--src/H5Gname.c55
-rw-r--r--src/H5Gobj.c21
-rw-r--r--src/H5Gpkg.h104
-rw-r--r--src/H5Gprivate.h83
-rw-r--r--src/H5Gpublic.h826
-rw-r--r--src/H5Gstab.c31
-rw-r--r--src/H5Gtest.c6
-rw-r--r--src/H5HF.c12
-rw-r--r--src/H5HFcache.c6
-rw-r--r--src/H5HFdbg.c4
-rw-r--r--src/H5HFdblock.c2
-rw-r--r--src/H5HFpkg.h1
-rw-r--r--src/H5HGcache.c2
-rw-r--r--src/H5HL.c428
-rw-r--r--src/H5HLcache.c26
-rw-r--r--src/H5HLdbg.c30
-rw-r--r--src/H5HLdblk.c82
-rw-r--r--src/H5HLint.c60
-rw-r--r--src/H5HLpkg.h2
-rw-r--r--src/H5HLprfx.c33
-rw-r--r--src/H5HLprivate.h4
-rw-r--r--src/H5I.c20
-rw-r--r--src/H5Idbg.c21
-rw-r--r--src/H5Idevelop.h139
-rw-r--r--src/H5Iint.c197
-rw-r--r--src/H5Imodule.h81
-rw-r--r--src/H5Ipkg.h31
-rw-r--r--src/H5Iprivate.h3
-rw-r--r--src/H5Ipublic.h133
-rw-r--r--src/H5Itest.c10
-rw-r--r--src/H5L.c2615
-rw-r--r--src/H5Ldeprec.c146
-rw-r--r--src/H5Ldevelop.h314
-rw-r--r--src/H5Lexternal.c14
-rw-r--r--src/H5Lint.c2285
-rw-r--r--src/H5Lmodule.h27
-rw-r--r--src/H5Lpkg.h43
-rw-r--r--src/H5Lprivate.h48
-rw-r--r--src/H5Lpublic.h335
-rw-r--r--src/H5M.c356
-rw-r--r--src/H5MF.c129
-rw-r--r--src/H5MFaggr.c15
-rw-r--r--src/H5MFdbg.c10
-rw-r--r--src/H5MFpkg.h6
-rw-r--r--src/H5MFprivate.h3
-rw-r--r--src/H5MFsection.c24
-rw-r--r--src/H5MM.c15
-rw-r--r--src/H5MMpublic.h5
-rw-r--r--src/H5Mmodule.h45
-rw-r--r--src/H5Mpkg.h2
-rw-r--r--src/H5Mprivate.h7
-rw-r--r--src/H5Mpublic.h485
-rw-r--r--src/H5O.c473
-rw-r--r--src/H5Oalloc.c6
-rw-r--r--src/H5Ocache.c23
-rw-r--r--src/H5Odeprec.c155
-rw-r--r--src/H5Oefl.c8
-rw-r--r--src/H5Ofill.c27
-rw-r--r--src/H5Oflush.c31
-rw-r--r--src/H5Ofsinfo.c15
-rw-r--r--src/H5Oint.c10
-rw-r--r--src/H5Olayout.c29
-rw-r--r--src/H5Omodule.h41
-rw-r--r--src/H5Opkg.h5
-rw-r--r--src/H5Oprivate.h7
-rw-r--r--src/H5Opublic.h904
-rw-r--r--src/H5Osdspace.c23
-rw-r--r--src/H5Oshared.h16
-rw-r--r--src/H5PBprivate.h2
-rw-r--r--src/H5PL.c2
-rw-r--r--src/H5PLint.c71
-rw-r--r--src/H5PLmodule.h30
-rw-r--r--src/H5PLpath.c29
-rw-r--r--src/H5PLplugin_cache.c88
-rw-r--r--src/H5PLprivate.h31
-rw-r--r--src/H5PLpublic.h16
-rw-r--r--src/H5Pdapl.c6
-rw-r--r--src/H5Pdcpl.c20
-rw-r--r--src/H5Pdxpl.c287
-rw-r--r--src/H5Pencdec.c2
-rw-r--r--src/H5Pfapl.c638
-rw-r--r--src/H5Pint.c77
-rw-r--r--src/H5Plapl.c2
-rw-r--r--src/H5Pmodule.h161
-rw-r--r--src/H5Ppkg.h3
-rw-r--r--src/H5Pprivate.h13
-rw-r--r--src/H5Ppublic.h3331
-rw-r--r--src/H5R.c205
-rw-r--r--src/H5RS.c10
-rw-r--r--src/H5RSprivate.h2
-rw-r--r--src/H5Rdeprec.c135
-rw-r--r--src/H5Rint.c13
-rw-r--r--src/H5Rmodule.h29
-rw-r--r--src/H5Rpublic.h502
-rw-r--r--src/H5S.c6
-rw-r--r--src/H5SL.c4
-rw-r--r--src/H5SM.c61
-rw-r--r--src/H5SMcache.c4
-rw-r--r--src/H5SMprivate.h2
-rw-r--r--src/H5ST.c779
-rw-r--r--src/H5STprivate.h63
-rw-r--r--src/H5Shyper.c18
-rw-r--r--src/H5Smodule.h45
-rw-r--r--src/H5Smpio.c19
-rw-r--r--src/H5Spkg.h12
-rw-r--r--src/H5Sprivate.h2
-rw-r--r--src/H5Spublic.h126
-rw-r--r--src/H5T.c32
-rw-r--r--src/H5TS.c81
-rw-r--r--src/H5TSdevelop.h (renamed from src/H5TSpublic.h)14
-rw-r--r--src/H5TSprivate.h4
-rw-r--r--src/H5Tbit.c12
-rw-r--r--src/H5Tcommit.c123
-rw-r--r--src/H5Tconv.c150
-rw-r--r--src/H5Tdevelop.h227
-rw-r--r--src/H5Tmodule.h40
-rw-r--r--src/H5Tpkg.h3
-rw-r--r--src/H5Tprivate.h25
-rw-r--r--src/H5Tpublic.h285
-rw-r--r--src/H5Tref.c125
-rw-r--r--src/H5Tvlen.c50
-rw-r--r--src/H5VL.c180
-rw-r--r--src/H5VLcallback.c1714
-rw-r--r--src/H5VLconnector.h891
-rw-r--r--src/H5VLconnector_passthru.h101
-rw-r--r--src/H5VLdyn_ops.c334
-rw-r--r--src/H5VLint.c342
-rw-r--r--src/H5VLmodule.h10
-rw-r--r--src/H5VLnative.c45
-rw-r--r--src/H5VLnative.h403
-rw-r--r--src/H5VLnative_attr.c244
-rw-r--r--src/H5VLnative_blob.c34
-rw-r--r--src/H5VLnative_dataset.c407
-rw-r--r--src/H5VLnative_datatype.c77
-rw-r--r--src/H5VLnative_file.c384
-rw-r--r--src/H5VLnative_group.c160
-rw-r--r--src/H5VLnative_introspect.c38
-rw-r--r--src/H5VLnative_link.c166
-rw-r--r--src/H5VLnative_object.c207
-rw-r--r--src/H5VLnative_private.h72
-rw-r--r--src/H5VLnative_token.c4
-rw-r--r--src/H5VLpassthru.c682
-rw-r--r--src/H5VLpkg.h12
-rw-r--r--src/H5VLprivate.h116
-rw-r--r--src/H5VLpublic.h22
-rw-r--r--src/H5VLtest.c96
-rw-r--r--src/H5VM.c386
-rw-r--r--src/H5VMprivate.h26
-rw-r--r--src/H5Zdeflate.c2
-rw-r--r--src/H5Zdevelop.h421
-rw-r--r--src/H5Zmodule.h109
-rw-r--r--src/H5Znbit.c36
-rw-r--r--src/H5Zprivate.h3
-rw-r--r--src/H5Zpublic.h348
-rw-r--r--src/H5Zscaleoffset.c381
-rw-r--r--src/H5Ztrans.c21
-rw-r--r--src/H5detect.c165
-rw-r--r--src/H5err.txt4
-rw-r--r--src/H5module.h27
-rw-r--r--src/H5mpi.c2
-rw-r--r--src/H5private.h1531
-rw-r--r--src/H5public.h486
-rw-r--r--src/H5system.c513
-rw-r--r--src/H5timer.c40
-rw-r--r--src/H5trace.c200
-rw-r--r--src/H5win32defs.h195
-rw-r--r--src/Makefile.am22
-rw-r--r--src/hdf5.h15
-rw-r--r--src/mercury/include/mercury_log.h10
-rw-r--r--src/mercury/src/util/mercury_log.h10
-rw-r--r--src/uthash.h1184
311 files changed, 33381 insertions, 18344 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 96acac7..b18aed7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -180,6 +180,7 @@ set (H5ES_SOURCES
${HDF5_SRC_DIR}/H5ESlist.c
)
set (H5ES_HDRS
+ ${HDF5_SRC_DIR}/H5ESdevelop.h
${HDF5_SRC_DIR}/H5ESpublic.h
)
IDE_GENERATED_PROPERTIES ("H5ES" "${H5ES_HDRS}" "${H5ES_SOURCES}" )
@@ -284,6 +285,7 @@ set (H5FD_SOURCES
set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDcore.h
+ ${HDF5_SRC_DIR}/H5FDdevelop.h
${HDF5_SRC_DIR}/H5FDdirect.h
${HDF5_SRC_DIR}/H5FDfamily.h
${HDF5_SRC_DIR}/H5FDhdfs.h
@@ -422,6 +424,7 @@ set (H5I_SOURCES
${HDF5_SRC_DIR}/H5Itest.c
)
set (H5I_HDRS
+ ${HDF5_SRC_DIR}/H5Idevelop.h
${HDF5_SRC_DIR}/H5Ipublic.h
)
IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" )
@@ -431,8 +434,10 @@ set (H5L_SOURCES
${HDF5_SRC_DIR}/H5L.c
${HDF5_SRC_DIR}/H5Ldeprec.c
${HDF5_SRC_DIR}/H5Lexternal.c
+ ${HDF5_SRC_DIR}/H5Lint.c
)
set (H5L_HDRS
+ ${HDF5_SRC_DIR}/H5Ldevelop.h
${HDF5_SRC_DIR}/H5Lpublic.h
)
IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" )
@@ -633,14 +638,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
@@ -669,6 +666,7 @@ set (H5T_SOURCES
)
set (H5T_HDRS
+ ${HDF5_SRC_DIR}/H5Tdevelop.h
${HDF5_SRC_DIR}/H5Tpublic.h
)
IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" )
@@ -678,7 +676,7 @@ set (H5TS_SOURCES
${HDF5_SRC_DIR}/H5TS.c
)
set (H5TS_HDRS
- ${HDF5_SRC_DIR}/H5TSpublic.h
+ ${HDF5_SRC_DIR}/H5TSdevelop.h
)
IDE_GENERATED_PROPERTIES ("H5TS" "${H5TS_HDRS}" "${H5TS_SOURCES}" )
@@ -694,6 +692,7 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" )
set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VL.c
${HDF5_SRC_DIR}/H5VLcallback.c
+ ${HDF5_SRC_DIR}/H5VLdyn_ops.c
${HDF5_SRC_DIR}/H5VLint.c
${HDF5_SRC_DIR}/H5VLnative.c
${HDF5_SRC_DIR}/H5VLnative_attr.c
@@ -707,6 +706,7 @@ set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VLnative_object.c
${HDF5_SRC_DIR}/H5VLnative_token.c
${HDF5_SRC_DIR}/H5VLpassthru.c
+ ${HDF5_SRC_DIR}/H5VLtest.c
)
set (H5VL_HDRS
${HDF5_SRC_DIR}/H5VLconnector.h
@@ -750,6 +750,7 @@ endif ()
set (H5Z_HDRS
+ ${HDF5_SRC_DIR}/H5Zdevelop.h
${HDF5_SRC_DIR}/H5Zpublic.h
)
IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" )
@@ -841,7 +842,6 @@ set (common_SRCS
${H5S_SOURCES}
${H5SL_SOURCES}
${H5SM_SOURCES}
- ${H5ST_SOURCES}
${H5T_SOURCES}
${H5TS_SOURCES}
${H5VL_SOURCES}
@@ -1004,8 +1004,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
@@ -1025,6 +1023,8 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5Zprivate.h
${HDF5_SRC_DIR}/H5win32defs.h
+
+ ${HDF5_SRC_DIR}/uthash.h
)
set (H5_GENERATED_HEADERS
@@ -1045,8 +1045,7 @@ set (H5_PUBLIC_GENERATED_HEADERS
option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON)
if (HDF5_GENERATE_HEADERS)
set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
- find_package (Perl)
- if (PERL_FOUND)
+ if (H5_PERL_FOUND)
execute_process (
COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt OUTPUT_VARIABLE SCRIPT_OUTPUT
)
@@ -1099,6 +1098,7 @@ if (LOCAL_BATCH_TEST)
endif ()
endif ()
+set (lib_prog_deps)
if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
@@ -1106,8 +1106,11 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
TARGET_C_PROPERTIES (H5detect STATIC)
target_link_libraries (H5detect
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
- PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
+ target_compile_options(H5detect
+ PRIVATE "$<$<PLATFORM_ID:Emscripten>:-O0>"
+ )
+ set (lib_prog_deps ${lib_prog_deps} H5detect)
if (HDF5_BATCH_H5DETECT)
configure_file (
@@ -1115,77 +1118,68 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY
)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- COMMAND ${HDF5_BATCH_CMD}
- ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
- COMMAND ${CMAKE_COMMAND}
- ARGS -E echo "Executed batch command to create H5Tinit.c"
+ OUTPUT gen_SRCS.stamp1
+ COMMAND ${HDF5_BATCH_CMD}
+ ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
+ BYPRODUCTS H5Tinit.c gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ ARGS -E echo "Executed batch command to create H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
add_custom_target (gen_H5Tinit
COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake
)
- if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
- COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
- WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
- )
- set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
- endif ()
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
else ()
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5detect>
- ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ add_custom_command (TARGET H5detect POST_BUILD
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5detect>
+ ARGS H5Tinit.c
+ BYPRODUCTS H5Tinit.c gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ ARGS -E touch gen_SRCS.stamp1
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Create H5Tinit.c"
)
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ add_custom_command (TARGET H5detect POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c
+ BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch shared/shared_gen_SRCS.stamp1
+ DEPENDS H5detect H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Copy H5Tinit.c to shared folder"
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
- set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
else ()
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ OUTPUT gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch gen_SRCS.stamp1
+ DEPENDS H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Touch existing H5Tinit.c"
)
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ OUTPUT shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c
+ BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ARGS -E touch shared/shared_gen_SRCS.stamp1
+ DEPENDS H5Tinit.c
WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ COMMENT "Copy existing H5Tinit.c to shared folder"
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
@@ -1204,8 +1198,11 @@ target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_
TARGET_C_PROPERTIES (H5make_libsettings STATIC)
target_link_libraries (H5make_libsettings
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
- PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
+target_compile_options(H5make_libsettings
+ PRIVATE "$<$<PLATFORM_ID:Emscripten>:-O0>"
+)
+set (lib_prog_deps ${lib_prog_deps} H5make_libsettings)
#-----------------------------------------------------------------------------
# Add Target to clang-format
@@ -1214,27 +1211,27 @@ if (HDF5_ENABLE_FORMATTERS)
clang_format (HDF5_SRC_LIBSETTINGS_FORMAT H5make_libsettings)
endif ()
-add_custom_command (
- OUTPUT ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
- ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5make_libsettings>
- ARGS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+add_custom_command (TARGET H5make_libsettings POST_BUILD
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5make_libsettings>
+ ARGS H5lib_settings.c
+ BYPRODUCTS H5lib_settings.c gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2
+ ARGS -E touch gen_SRCS.stamp2
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR}
+ COMMENT "Create H5lib_settings.c"
)
set_source_files_properties (${HDF5_SRC_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c
- ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
+ add_custom_command (TARGET H5make_libsettings POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_SRC_BINARY_DIR}/H5lib_settings.c" "${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c"
+ ARGS -E copy_if_different H5lib_settings.c shared/H5lib_settings.c
+ BYPRODUCTS shared/H5lib_settings.c shared/shared_gen_SRCS.stamp2
COMMAND ${CMAKE_COMMAND}
- ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2
- DEPENDS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+ ARGS -E touch shared/shared_gen_SRCS.stamp2
+ DEPENDS H5make_libsettings H5lib_settings.c
WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR}
+ COMMENT "Copy H5lib_settings.c to shared folder"
)
set_source_files_properties (${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
endif ()
@@ -1248,7 +1245,10 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
#-----------------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c)
- add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2)
+ add_custom_target (gen_${HDF5_LIB_TARGET} ALL
+ DEPENDS ${lib_prog_deps} ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2
+ COMMENT "Generation target files"
+ )
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS})
target_include_directories (${HDF5_LIB_TARGET}
@@ -1262,7 +1262,7 @@ if (NOT ONLY_SHARED_LIBS)
${HDF_EXTRA_FLAGS}
PRIVATE
$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
- $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
+ $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
)
TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_LIB_TARGET}
@@ -1284,7 +1284,10 @@ endif ()
if (BUILD_SHARED_LIBS)
set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c)
- add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2)
+ add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL
+ DEPENDS ${lib_prog_deps} ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
+ COMMENT "Shared generation target files"
+ )
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS})
target_include_directories (${HDF5_LIBSH_TARGET}
@@ -1301,7 +1304,7 @@ if (BUILD_SHARED_LIBS)
PRIVATE
$<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE>
$<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API
- $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
+ $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG>
)
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_LIBSH_TARGET}
@@ -1393,17 +1396,21 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE)
configure_file (
${HDF_CONFIG_DIR}/libhdf5.pc.in
- ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc
@ONLY
)
install (
- FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}.pc
DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
COMPONENT libraries
)
if (NOT WIN32)
- set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5cc
@@ -1415,42 +1422,49 @@ if (NOT WIN32)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT libraries
)
+ if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
+ #legacy requires a different name
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT libraries
+ )
+ endif ()
endif ()
#-----------------------------------------------------------------------------
# Option to build documentation
#-----------------------------------------------------------------------------
if (DOXYGEN_FOUND)
- set (DOXYGEN_PACKAGE ${HDF5_PACKAGE})
- set (DOXYGEN_VERSION_STRING ${HDF5_VERSION_STRING})
- set (DOXYGEN_INCLUDE_ALIASES ${HDF5_DOXYGEN_DIR}/aliases)
- set (DOXYGEN_PROJECT_LOGO ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png)
- set (DOXYGEN_PROJECT_BRIEF "C-API Reference")
- set (DOXYGEN_INPUT_DIRECTORY ${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}/shared)
- set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
- set (DOXYGEN_MACRO_EXPANSION YES)
- set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs)
-
+# This cmake function requires that the non-default doxyfile settings are provided with set (DOXYGEN_xxx) commands
+# In addition the doxyfile aliases @INCLUDE option is not supported and would need to be provided in a set (DOXYGEN_ALIASES) command.
+# doxygen_add_docs (hdf5lib_doc
+## ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox
+# ${DOXYGEN_INPUT_DIRECTORY}
+# ALL
+# WORKING_DIRECTORY ${HDF5_SRC_DIR}
+# COMMENT "Generating HDF5 library Source Documentation"
+# )
+
+# This custom target and doxygen/configure work together
# Replace variables inside @@ with the current values
- configure_file(${HDF5_DOXYGEN_DIR}/Doxyfile.in Doxyfile @ONLY)
-
- doxygen_add_docs(hdf5lib_doc
-# ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${HDF5_DOXYGEN_DIR}/dox
- ${DOXYGEN_INPUT_DIRECTORY}
- ALL
- WORKING_DIRECTORY ${HDF5_SRC_DIR}
- COMMENT "Generating HDF5 library Source Documentation"
- )
- install(
- DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs/html
- DESTINATION ${HDF5_INSTALL_DATA_DIR}
- COMPONENT Documents
- )
-
- if(NOT TARGET doxygen)
- add_custom_target(doxygen)
- endif()
+ add_custom_target (hdf5lib_doc ALL
+ COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_SRC_DIR}
+ COMMENT "Generating HDF5 library Source API documentation with Doxygen"
+ VERBATIM )
+
+ if (NOT TARGET doxygen)
+ add_custom_target (doxygen)
+ endif ()
- add_dependencies(doxygen hdf5lib_doc)
+ add_dependencies (doxygen hdf5lib_doc)
endif ()
diff --git a/src/COPYING b/src/COPYING
deleted file mode 100644
index 97969da..0000000
--- a/src/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are part of HDF5.
- The full HDF5 copyright notice, including terms governing use,
- modification, and redistribution, is contained in the COPYING file
- which can be found at the root of the source code distribution tree
- or in https://www.hdfgroup.org/licenses. If you do
- not have access to either file, you may request a copy from
- help@hdfgroup.org.
-
diff --git a/src/H5.c b/src/H5.c
index f97fe31..af090fd 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -70,9 +70,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
-/* HDF5 API Entered variable */
-/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */
-hbool_t H5_api_entered_g = FALSE;
+/* Library incompatible release versions */
+const unsigned VERS_RELEASE_EXCEPTIONS[] = {0};
+const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 0;
/* statically initialize block for pthread_once call used in initializing */
/* the first global mutex */
@@ -264,7 +264,7 @@ H5_init_library(void)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
if (H5VL_init_phase1() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
- if (H5P_init() < 0)
+ if (H5P_init_phase1() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface")
if (H5AC_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface")
@@ -276,6 +276,8 @@ H5_init_library(void)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataspace interface")
/* Finish initializing interfaces that depend on the interfaces above */
+ if (H5P_init_phase2() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface")
if (H5VL_init_phase2() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
@@ -296,13 +298,13 @@ done:
} /* end H5_init_library() */
/*-------------------------------------------------------------------------
- * Function: H5_term_library
+ * Function: H5_term_library
*
- * Purpose: Terminate interfaces in a well-defined order due to
- * dependencies among the interfaces, then terminate
- * library-specific data.
+ * Purpose: Terminate interfaces in a well-defined order due to
+ * dependencies among the interfaces, then terminate
+ * library-specific data.
*
- * Return: void
+ * Return: void
*
*-------------------------------------------------------------------------
*/
@@ -520,22 +522,22 @@ done:
} /* end H5_term_library() */
/*-------------------------------------------------------------------------
- * Function: H5dont_atexit
+ * Function: H5dont_atexit
*
- * Purpose: Indicates that the library is not to clean up after itself
- * when the application exits by calling exit() or returning
- * from main(). This function must be called before any other
- * HDF5 function or constant is used or it will have no effect.
+ * Purpose: Indicates that the library is not to clean up after itself
+ * when the application exits by calling exit() or returning
+ * from main(). This function must be called before any other
+ * HDF5 function or constant is used or it will have no effect.
*
- * If this function is used then certain memory buffers will not
- * be de-allocated nor will open files be flushed automatically.
- * The application may still call H5close() explicitly to
- * accomplish these things.
+ * If this function is used then certain memory buffers will not
+ * be de-allocated nor will open files be flushed automatically.
+ * The application may still call H5close() explicitly to
+ * accomplish these things.
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative if this function is called more than
- * once or if it is called too late.
+ * Failure: negative if this function is called more than
+ * once or if it is called too late.
*
*-------------------------------------------------------------------------
*/
@@ -556,19 +558,19 @@ H5dont_atexit(void)
} /* end H5dont_atexit() */
/*-------------------------------------------------------------------------
- * Function: H5garbage_collect
+ * Function: H5garbage_collect
*
- * Purpose: Walks through all the garbage collection routines for the
- * library, which are supposed to free any unused memory they have
- * allocated.
+ * Purpose: Walks through all the garbage collection routines for the
+ * library, which are supposed to free any unused memory they have
+ * allocated.
*
* These should probably be registered dynamically in a linked list of
* functions to call, but there aren't that many right now, so we
* hard-wire them...
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
*-------------------------------------------------------------------------
*/
@@ -589,9 +591,9 @@ done:
} /* end H5garbage_collect() */
/*-------------------------------------------------------------------------
- * Function: H5set_free_list_limits
+ * Function: H5set_free_list_limits
*
- * Purpose: Sets limits on the different kinds of free lists. Setting a value
+ * Purpose: Sets limits on the different kinds of free lists. Setting a value
* of -1 for a limit means no limit of that type. These limits are global
* for the entire library. Each "global" limit only applies to free lists
* of that type, so if an application sets a limit of 1 MB on each of the
@@ -609,9 +611,9 @@ done:
* int blk_global_lim; IN: The limit on all "block" free list memory used
* int blk_list_lim; IN: The limit on memory used in each "block" free list
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
*-------------------------------------------------------------------------
*/
@@ -635,11 +637,11 @@ done:
} /* end H5set_free_list_limits() */
/*-------------------------------------------------------------------------
- * Function: H5get_free_list_sizes
+ * Function: H5get_free_list_sizes
*
- * Purpose: Gets the current size of the different kinds of free lists that
- * the library uses to manage memory. The free list sizes can be set with
- * H5set_free_list_limits and garbage collected with H5garbage_collect.
+ * Purpose: Gets the current size of the different kinds of free lists that
+ * the library uses to manage memory. The free list sizes can be set with
+ * H5set_free_list_limits and garbage collected with H5garbage_collect.
* These lists are global for the entire library.
*
* Parameters:
@@ -648,8 +650,8 @@ done:
* size_t *blk_size; OUT: The current size of all "block" free list memory used
* size_t *fac_size; OUT: The current size of all "factory" free list memory used
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
* Programmer: Quincey Koziol
* Friday, March 6, 2020
@@ -674,23 +676,23 @@ done:
} /* end H5get_free_list_sizes() */
/*-------------------------------------------------------------------------
- * Function: H5get_alloc_stats
+ * Function: H5get_alloc_stats
*
- * Purpose: Gets the memory allocation statistics for the library, if the
- * --enable-memory-alloc-sanity-check option was given when building the
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * --enable-memory-alloc-sanity-check option was given when building the
* library. Applications can check whether this option was enabled by
- * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
- * option is enabled by default for debug builds of the library and
- * disabled by default for non-debug builds. If the option is not enabled,
- * all the values returned with be 0. These statistics are global for the
- * entire library, but don't include allocations from chunked dataset I/O
- * filters or non-native VOL connectors.
+ * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
+ * option is enabled by default for debug builds of the library and
+ * disabled by default for non-debug builds. If the option is not enabled,
+ * all the values returned with be 0. These statistics are global for the
+ * entire library, but don't include allocations from chunked dataset I/O
+ * filters or non-native VOL connectors.
*
* Parameters:
* H5_alloc_stats_t *stats; OUT: Memory allocation statistics
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
* Programmer: Quincey Koziol
* Saturday, March 7, 2020
@@ -818,20 +820,17 @@ H5__debug_mask(const char *s)
s++;
} /* end if-else */
} /* end while */
-
- return;
-
} /* end H5__debug_mask() */
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5__mpi_delete_cb
+ * Function: H5__mpi_delete_cb
*
- * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5
+ * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5
* library when the communicator is destroyed, i.e. on MPI_Finalize.
*
- * Return: MPI_SUCCESS
+ * Return: MPI_SUCCESS
*
*-------------------------------------------------------------------------
*/
@@ -845,18 +844,18 @@ H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void
#endif /*H5_HAVE_PARALLEL*/
/*-------------------------------------------------------------------------
- * Function: H5get_libversion
+ * Function: H5get_libversion
*
- * Purpose: Returns the library version numbers through arguments. MAJNUM
- * will be the major revision number of the library, MINNUM the
- * minor revision number, and RELNUM the release revision number.
+ * Purpose: Returns the library version numbers through arguments. MAJNUM
+ * will be the major revision number of the library, MINNUM the
+ * minor revision number, and RELNUM the release revision number.
*
- * Note: When printing an HDF5 version number it should be printed as
+ * Note: When printing an HDF5 version number it should be printed as
*
- * printf("%u.%u.%u", maj, min, rel) or
- * printf("version %u.%u release %u", maj, min, rel)
+ * printf("%u.%u.%u", maj, min, rel) or
+ * printf("version %u.%u release %u", maj, min, rel)
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -881,17 +880,20 @@ done:
} /* end H5get_libversion() */
/*-------------------------------------------------------------------------
- * Function: H5check_version
+ * Function: H5check_version
*
- * Purpose: Verifies that the arguments match the version numbers
- * compiled into the library. This function is intended to be
- * called from user to verify that the versions of header files
- * compiled into the application match the version of the hdf5
- * library.
+ * Purpose: Verifies that the arguments match the version numbers
+ * compiled into the library. This function is intended to be
+ * called from user to verify that the versions of header files
+ * compiled into the application match the version of the hdf5
+ * library.
+ * Within major.minor.release version, the expectation
+ * is that all release versions are compatible, exceptions to
+ * this rule must be added to the VERS_RELEASE_EXCEPTIONS list.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: abort()
+ * Failure: abort()
*
*-------------------------------------------------------------------------
*/
@@ -904,6 +906,15 @@ done:
"linked with a different version of static or shared HDF5 library.\n" \
"You should recompile the application or check your shared library related\n" \
"settings such as 'LD_LIBRARY_PATH'.\n"
+#define RELEASE_MISMATCH_WARNING \
+ "Warning! ***HDF5 library release mismatched error***\n" \
+ "The HDF5 header files used to compile this application are not compatible with\n" \
+ "the version used by the HDF5 library to which this application is linked.\n" \
+ "Data corruption or segmentation faults may occur if the application continues.\n" \
+ "This can happen when an application was compiled by one version of HDF5 but\n" \
+ "linked with an incompatible version of static or shared HDF5 library.\n" \
+ "You should recompile the application or check your shared library related\n" \
+ "settings such as 'LD_LIBRARY_PATH'.\n"
herr_t
H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
@@ -932,7 +943,11 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
disable_version_check = (unsigned int)HDstrtol(s, NULL, 0);
}
- if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE != relnum) {
+ /* H5_VERS_MAJOR and H5_VERS_MINOR must match */
+ /* Cast relnum to int to avoid warning for unsigned < 0 comparison
+ * in first release versions */
+ if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > (int)relnum) {
+
switch (disable_version_check) {
case 0:
HDfprintf(stderr, "%s%s", version_mismatch_warning,
@@ -967,7 +982,51 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
break;
} /* end switch */
- } /* end if */
+ } /* end if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) */
+
+ /* H5_VERS_RELEASE should be compatible, we will only add checks for exceptions */
+ if (H5_VERS_RELEASE != relnum) {
+ for (unsigned i = 0; i < VERS_RELEASE_EXCEPTIONS_SIZE; i++) {
+ /* Check for incompatible headers or incompatible library */
+ if (VERS_RELEASE_EXCEPTIONS[i] == relnum || VERS_RELEASE_EXCEPTIONS[i] == H5_VERS_RELEASE) {
+ switch (disable_version_check) {
+ case 0:
+ HDfprintf(
+ stderr, "%s%s", version_mismatch_warning,
+ "You can, at your own risk, disable this warning by setting the environment\n"
+ "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
+ "Setting it to 2 or higher will suppress the warning messages totally.\n");
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum,
+ relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR,
+ (unsigned)H5_VERS_RELEASE);
+
+ /* Bail out now. */
+ HDfputs("Bye...\n", stderr);
+ HDabort();
+ case 1:
+ /* continue with a warning */
+ /* Note that the warning message is embedded in the format string.*/
+ HDfprintf(stderr,
+ "%s'HDF5_DISABLE_VERSION_CHECK' "
+ "environment variable is set to %d, application will\n"
+ "continue at your own risk.\n",
+ version_mismatch_warning, disable_version_check);
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum,
+ relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR,
+ (unsigned)H5_VERS_RELEASE);
+ break;
+ default:
+ /* 2 or higher: continue silently */
+ break;
+ } /* end switch */
+
+ } /* end if */
+
+ } /* end for */
+
+ } /* end if (H5_VERS_RELEASE != relnum) */
/* Indicate that the version check has been performed */
checked = 1;
@@ -978,13 +1037,10 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
* Check only the first sizeof(lib_str) char. Assume the information
* will fit within this size or enough significance.
*/
- HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR,
- H5_VERS_RELEASE);
- if (*substr) {
- HDstrncat(lib_str, "-", (size_t)1);
- HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
- } /* end if */
- if (HDstrcmp(lib_str, H5_lib_vers_info_g)) {
+ HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR,
+ H5_VERS_MINOR, H5_VERS_RELEASE, (*substr ? "-" : ""), substr);
+
+ if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) {
HDfputs("Warning! Library version information error.\n"
"The HDF5 library version information are not "
"consistent in its source code.\nThis is NOT a fatal error "
@@ -1012,7 +1068,7 @@ done:
* is failing inexplicably, then try calling this function
* first.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1031,12 +1087,12 @@ done:
} /* end H5open() */
/*-------------------------------------------------------------------------
- * Function: H5atclose
+ * Function: H5atclose
*
- * Purpose: Register a callback for the library to invoke when it's
- * closing. Callbacks are invoked in LIFO order.
+ * Purpose: Register a callback for the library to invoke when it's
+ * closing. Callbacks are invoked in LIFO order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1070,11 +1126,11 @@ done:
} /* end H5atclose() */
/*-------------------------------------------------------------------------
- * Function: H5close
+ * Function: H5close
*
- * Purpose: Terminate the library and release all resources.
+ * Purpose: Terminate the library and release all resources.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1095,9 +1151,9 @@ H5close(void)
} /* end H5close() */
/*-------------------------------------------------------------------------
- * Function: H5allocate_memory
+ * Function: H5allocate_memory
*
- * Purpose: Allocate a memory buffer with the semantics of malloc().
+ * Purpose: Allocate a memory buffer with the semantics of malloc().
*
* NOTE: This function is intended for use with filter
* plugins so that all allocation and free operations
@@ -1135,9 +1191,9 @@ H5allocate_memory(size_t size, hbool_t clear)
} /* end H5allocate_memory() */
/*-------------------------------------------------------------------------
- * Function: H5resize_memory
+ * Function: H5resize_memory
*
- * Purpose: Resize a memory buffer with the semantics of realloc().
+ * Purpose: Resize a memory buffer with the semantics of realloc().
*
* NOTE: This function is intended for use with filter
* plugins so that all allocation and free operations
@@ -1172,14 +1228,14 @@ H5resize_memory(void *mem, size_t size)
} /* end H5resize_memory() */
/*-------------------------------------------------------------------------
- * Function: H5free_memory
+ * Function: H5free_memory
*
- * Purpose: Frees memory allocated by the library that it is the user's
+ * Purpose: Frees memory allocated by the library that it is the user's
* responsibility to free. Ensures that the same library
* that was used to allocate the memory frees it. Passing
* NULL pointers is allowed.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1196,12 +1252,12 @@ H5free_memory(void *mem)
} /* end H5free_memory() */
/*-------------------------------------------------------------------------
- * Function: H5is_library_threadsafe
+ * Function: H5is_library_threadsafe
*
- * Purpose: Checks to see if the library was built with thread-safety
+ * Purpose: Checks to see if the library was built with thread-safety
* enabled.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1227,16 +1283,16 @@ H5is_library_threadsafe(hbool_t *is_ts /*out*/)
} /* end H5is_library_threadsafe() */
/*-------------------------------------------------------------------------
- * Function: H5is_library_terminating
+ * Function: H5is_library_terminating
*
- * Purpose: Checks to see if the library is shutting down.
+ * Purpose: Checks to see if the library is shutting down.
*
- * Note: Useful for plugins to detect when the library is terminating.
- * For example, a VOL connector could check if a "file close"
- * callback was the result of the library shutdown process, or
- * an API action from the application.
+ * Note: Useful for plugins to detect when the library is terminating.
+ * For example, a VOL connector could check if a "file close"
+ * callback was the result of the library shutdown process, or
+ * an API action from the application.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5A.c b/src/H5A.c
index a6b4350..c986d1f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -276,7 +276,7 @@ H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) {
+ H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID")
@@ -320,7 +320,7 @@ H5A__create_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -425,7 +425,7 @@ H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE12(FUNC, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) {
+ H5ARG_TRACE12(__func__, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID")
@@ -588,7 +588,7 @@ H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID")
@@ -630,7 +630,7 @@ H5A__open_by_name_api_common(hid_t loc_id, const char *obj_name, const char *att
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -719,7 +719,7 @@ H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_l
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) {
+ H5ARG_TRACE9(__func__, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID")
@@ -764,8 +764,8 @@ H5A__open_by_idx_api_common(hid_t loc_id, const char *obj_name, H5_index_t idx_t
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, obj_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ if (H5VL_setup_idx_args(loc_id, obj_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr, &loc_params) <
+ 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -859,7 +859,7 @@ H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) {
+ H5ARG_TRACE11(__func__, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID")
@@ -971,7 +971,7 @@ H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1057,7 +1057,7 @@ done:
*--------------------------------------------------------------------------*/
herr_t
H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t dtype_id,
- void *buf, hid_t es_id)
+ void *buf /*out*/, hid_t es_id)
{
H5VL_object_t *vol_obj = NULL; /* Object for attr_id */
void * token = NULL; /* Request token for async operation */
@@ -1065,7 +1065,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id);
+ H5TRACE7("e", "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id);
/* Set up request token pointer for asynchronous operation */
if (H5ES_NONE != es_id)
@@ -1079,7 +1079,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1106,8 +1106,9 @@ done:
hid_t
H5Aget_space(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
@@ -1116,11 +1117,17 @@ H5Aget_space(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) <
- 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_space.space_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -1144,8 +1151,9 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
@@ -1154,10 +1162,17 @@ H5Aget_type(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_TYPE;
+ vol_cb_args.args.get_type.type_id = H5I_INVALID_HID;
+
/* Get the datatype */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_type.type_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
@@ -1184,8 +1199,9 @@ done:
hid_t
H5Aget_create_plist(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
@@ -1196,11 +1212,18 @@ H5Aget_create_plist(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_ACPL;
+ vol_cb_args.args.get_acpl.acpl_id = H5I_INVALID_HID;
+
/* Get the acpl */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID,
"unable to get creation property list for attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_acpl.acpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_create_plist() */
@@ -1229,9 +1252,10 @@ done:
ssize_t
H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t attr_name_len = 0; /* Length of attribute name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "izx", attr_id, buf_size, buf);
@@ -1242,15 +1266,21 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/)
if (!buf && buf_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero")
- /* Set location struct parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(attr_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_NAME;
+ vol_cb_args.args.get_name.loc_params.type = H5VL_OBJECT_BY_SELF;
+ vol_cb_args.args.get_name.loc_params.obj_type = H5I_get_type(attr_id);
+ vol_cb_args.args.get_name.buf_size = buf_size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.attr_name_len = &attr_name_len;
/* Get the attribute name */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- buf_size, buf, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
+ /* Set the return value */
+ ret_value = (ssize_t)attr_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_name() */
@@ -1276,9 +1306,10 @@ ssize_t
H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t attr_name_len = 0; /* Length of attribute name */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, obj_name, idx_type, order, n, name, size, lapl_id);
@@ -1303,19 +1334,26 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_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 = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_NAME;
+ vol_cb_args.args.get_name.loc_params.type = H5VL_OBJECT_BY_IDX;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.name = obj_name;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.idx_type = idx_type;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.order = order;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.n = n;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ vol_cb_args.args.get_name.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.attr_name_len = &attr_name_len;
/* Get the name */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- size, name, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
+ /* Set the return value */
+ ret_value = (ssize_t)attr_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_name_by_idx() */
@@ -1340,8 +1378,10 @@ done:
hsize_t
H5Aget_storage_size(hid_t attr_id)
{
- H5VL_object_t *vol_obj;
- hsize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hsize_t storage_size = 0; /* Storage size of attribute */
+ hsize_t ret_value; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", attr_id);
@@ -1350,10 +1390,16 @@ H5Aget_storage_size(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_STORAGE_SIZE;
+ vol_cb_args.args.get_storage_size.data_size = &storage_size;
+
/* Get the storage size */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl")
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get storage size")
+
+ /* Set the return value */
+ ret_value = storage_size;
done:
FUNC_LEAVE_API(ret_value)
@@ -1375,9 +1421,9 @@ done:
herr_t
H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", attr_id, ainfo);
@@ -1388,12 +1434,15 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/)
if (!ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL")
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(attr_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_SELF;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(attr_id);
+ vol_cb_args.args.get_info.attr_name = NULL;
+ vol_cb_args.args.get_info.ainfo = ainfo;
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1417,9 +1466,9 @@ herr_t
H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5A_info_t *ainfo /*out*/,
hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*sxi", loc_id, obj_name, attr_name, ainfo, lapl_id);
@@ -1438,18 +1487,21 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.loc_data.loc_by_name.name = obj_name;
- loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_name.name = obj_name;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_info.attr_name = attr_name;
+ vol_cb_args.args.get_info.ainfo = ainfo;
+
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo, attr_name) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1474,9 +1526,9 @@ herr_t
H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5A_info_t *ainfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, obj_name, idx_type, order, n, ainfo, lapl_id);
@@ -1497,21 +1549,24 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_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 = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_IDX;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.name = obj_name;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.idx_type = idx_type;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.order = order;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.n = n;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_info.attr_name = NULL;
+ vol_cb_args.args.get_info.ainfo = ainfo;
+
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1541,12 +1596,19 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
HDassert(new_name);
/* Avoid thrashing things if the names are the same */
- if (HDstrcmp(old_name, new_name))
+ if (HDstrcmp(old_name, new_name) != 0) {
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_RENAME;
+ vol_cb_args.args.rename.old_name = old_name;
+ vol_cb_args.args.rename.new_name = new_name;
+
/* Rename the attribute */
- if (H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, token_ptr,
- old_name, new_name) < 0)
+ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute from '%s' to '%s'", old_name,
new_name)
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1657,7 +1719,7 @@ H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1700,7 +1762,7 @@ H5A__rename_by_name_api_common(hid_t loc_id, const char *obj_name, const char *o
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments")
/* Rename the attribute */
@@ -1777,7 +1839,7 @@ H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0)
+ H5ARG_TRACE9(__func__, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1830,14 +1892,15 @@ herr_t
H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx /*in,out */,
H5A_operator2_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIo*hAO*x", loc_id, idx_type, order, idx, op, op_data);
- /* check arguments */
+ /* Check arguments */
if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1845,16 +1908,25 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *i
if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ /* Get the loc object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the loc object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_ITER;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx = idx;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
/* Iterate over attributes */
- if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
@@ -1908,9 +1980,10 @@ herr_t
H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx /*in,out */, H5A_operator2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object location */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hAO*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, lapl_id);
@@ -1929,18 +2002,27 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* get the loc object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the loc object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_ITER;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx = idx;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
/* Iterate over attributes */
- if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
@@ -1964,9 +2046,10 @@ done:
herr_t
H5Adelete(hid_t loc_id, const char *name)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
@@ -1983,17 +2066,20 @@ H5Adelete(hid_t loc_id, const char *name)
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Fill in location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set the location access parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE;
+ vol_cb_args.args.del.name = name;
+
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2019,9 +2105,10 @@ done:
herr_t
H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
@@ -2038,19 +2125,22 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Fill in location struct fields */
+ /* Get the object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* Get the object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE;
+ vol_cb_args.args.del.name = attr_name;
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- attr_name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2085,9 +2175,10 @@ herr_t
H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id);
@@ -2106,21 +2197,24 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_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 = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set the location access parameters */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE_BY_IDX;
+ vol_cb_args.args.delete_by_idx.idx_type = idx_type;
+ vol_cb_args.args.delete_by_idx.order = order;
+ vol_cb_args.args.delete_by_idx.n = n;
+
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- NULL) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2210,7 +2304,7 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -2233,7 +2327,8 @@ static herr_t
H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const char *attr_name,
hbool_t *attr_exists, void **token_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2245,9 +2340,13 @@ H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_EXISTS;
+ vol_cb_args.args.exists.name = attr_name;
+ vol_cb_args.args.exists.exists = attr_exists;
+
/* Check if the attribute exists */
- if (H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, token_ptr,
- attr_name, attr_exists) < 0)
+ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@@ -2361,7 +2460,7 @@ H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -2400,7 +2499,7 @@ H5A__exists_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments")
/* Check if the attribute exists */
@@ -2480,7 +2579,7 @@ H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0)
+ H5ARG_TRACE9(__func__, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
diff --git a/src/H5AC.c b/src/H5AC.c
index ffdca78..1c75aff 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -43,7 +43,6 @@
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip Lists */
@@ -61,8 +60,8 @@
/********************/
static herr_t H5AC__check_if_write_permitted(const H5F_t *f, hbool_t *write_permitted_ptr);
-static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr,
- H5C_auto_size_ctl_t *int_conf_ptr);
+static herr_t H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr,
+ H5C_auto_size_ctl_t * int_conf_ptr);
#if H5AC_DO_TAGGING_SANITY_CHECKS
static herr_t H5AC__verify_tag(const H5AC_class_t *type);
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
@@ -350,19 +349,14 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list")
- if (aux_ptr != NULL)
- if (aux_ptr->mpi_rank == 0)
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE,
- (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted,
- TRUE, H5AC__log_flushed_entry, (void *)aux_ptr);
- else
- f->shared->cache =
- H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr);
+ if (aux_ptr->mpi_rank == 0)
+ f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE,
+ (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted,
+ TRUE, H5AC__log_flushed_entry, (void *)aux_ptr);
else
f->shared->cache =
H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL);
+ H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr);
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
@@ -1802,14 +1796,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
- uint32_t *cur_num_entries_ptr)
+H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5C_get_cache_size((H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr,
+ if (H5C_get_cache_size((const H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr,
cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed")
@@ -1856,13 +1850,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr)
+H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5C_get_cache_hit_rate((H5C_t *)cache_ptr, hit_rate_ptr) < 0)
+ if (H5C_get_cache_hit_rate((const H5C_t *)cache_ptr, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed")
done:
@@ -1908,7 +1902,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
+H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2009,7 +2003,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_validate_config(H5AC_cache_config_t *config_ptr)
+H5AC_validate_config(const H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2190,7 +2184,7 @@ H5AC__check_if_write_permitted(const H5F_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, H5C_auto_size_ctl_t *int_conf_ptr)
+H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr, H5C_auto_size_ctl_t *int_conf_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2751,13 +2745,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
+H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5C_get_mdc_image_info((H5C_t *)cache_ptr, image_addr, image_len) < 0)
+ if (H5C_get_mdc_image_info((const H5C_t *)cache_ptr, image_addr, image_len) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index 140fd96..7d2ba25 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.")
@@ -1900,28 +1900,22 @@ H5AC__rsp__p0_only__flush(H5F_t *f)
/* Check for error on the write operation */
if (result < 0)
-
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.")
/* this code exists primarily for the test bed -- it allows us to
* enforce POSIX semantics on the server that pretends to be a
* file system in our parallel tests.
*/
- if (aux_ptr->write_done) {
-
+ if (aux_ptr->write_done)
(aux_ptr->write_done)();
- }
} /* end if */
/* Propagate cleaned entries to other ranks. */
if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0)
-
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC__rsp__p0_only__flush() */
/*-------------------------------------------------------------------------
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 12e5bb2..d252d85 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -234,27 +234,27 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.3f, \
+ /* double min_clean_fraction = */ 0.3, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ (1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
+ /* double lower_hr_threshold = */ 0.9, \
+ /* double increment = */ 2.0, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.0f, \
- /* double flash_threshold = */ 0.25f, \
+ /* double flash_multiple = */ 1.0, \
+ /* double flash_threshold = */ 0.25, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
+ /* double upper_hr_threshold = */ 0.999, \
+ /* double decrement = */ 0.9, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
+ /* double empty_reserve = */ 0.1, \
/* size_t dirty_bytes_threshold = */ (256 * 1024), \
/* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
@@ -270,29 +270,29 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.01f, \
+ /* double min_clean_fraction = */ 0.01, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ ( 1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
+ /* double lower_hr_threshold = */ 0.9, \
+ /* double increment = */ 2.0, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.4f, \
- /* double flash_threshold = */ 0.25f, \
+ /* double flash_multiple = */ 1.4, \
+ /* double flash_threshold = */ 0.25, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
+ /* double upper_hr_threshold = */ 0.999, \
+ /* double decrement = */ 0.9, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
+ /* double empty_reserve = */ 0.1, \
/* size_t dirty_bytes_threshold = */ (256 * 1024), \
- /* int metadata_write_strategy = */ \
+ /* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
}
#endif /* H5_HAVE_PARALLEL */
@@ -404,20 +404,20 @@ H5_DLL herr_t H5AC_evict(H5F_t *f);
H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned flags);
H5_DLL herr_t H5AC_remove_entry(void *entry);
H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+H5_DLL herr_t H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr);
H5_DLL herr_t H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr);
-H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr);
+H5_DLL herr_t H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr);
H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr);
-H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5AC_validate_config(const H5AC_cache_config_t *config_ptr);
/* Cache image routines */
H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw);
H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr);
H5_DLL hbool_t H5AC_cache_image_pending(const H5F_t *f);
H5_DLL herr_t H5AC_force_cache_image_load(H5F_t *f);
-H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
+H5_DLL herr_t H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
/* Tag & Ring routines */
H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag);
@@ -458,4 +458,4 @@ H5_DLL hbool_t H5AC_get_serialization_in_progress(H5F_t *f);
H5_DLL hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring);
#endif /* NDEBUG */ /* end debugging functions */
-#endif /* !_H5ACprivate_H */
+#endif /* H5ACprivate_H */
diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h
index e6cebff..f8f4f28 100644
--- a/src/H5ACpublic.h
+++ b/src/H5ACpublic.h
@@ -442,124 +442,347 @@ extern "C" {
#define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0
#define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1
+/**
+ * H5AC_cache_config_t is a public structure intended for use in public APIs.
+ * At least in its initial incarnation, it is basically a copy of \c struct
+ * \c H5C_auto_size_ctl_t, minus the \c report_fcn field, and plus the
+ * \c dirty_bytes_threshold field.
+ *
+ * The \c report_fcn field is omitted, as including it would require us to make
+ * \c H5C_t structure public.
+ *
+ * The \c dirty_bytes_threshold field does not appear in \c H5C_auto_size_ctl_t,
+ * as synchronization between caches on different processes is handled at the \c
+ * H5AC level, not at the level of \c H5C. Note however that there is
+ * considerable interaction between this value and the other fields in this
+ * structure.
+ *
+ * Similarly, the \c open_trace_file, \c close_trace_file, and \c
+ * trace_file_name fields do not appear in \c H5C_auto_size_ctl_t, as most trace
+ * file issues are handled at the \c H5AC level. The one exception is storage
+ * of the pointer to the trace file, which is handled by \c H5C.
+ *
+ * The structure is in H5ACpublic.h as we may wish to allow different
+ * configuration options for metadata and raw data caches.
+ */
+
+//! <!-- [H5AC_cache_config_t_snip] -->
typedef struct H5AC_cache_config_t {
/* general configuration fields: */
+ //! <!-- [H5AC_cache_config_t_general_snip] -->
int version;
+ /**< Integer field indicating the the version of the H5AC_cache_config_t
+ * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION
+ * (defined in H5ACpublic.h). */
hbool_t rpt_fcn_enabled;
+ /**< Boolean flag indicating whether the adaptive cache resize report
+ * function is enabled. This field should almost always be set to disabled
+ * (0). Since resize algorithm activity is reported via stdout, it MUST be
+ * set to disabled (0) on Windows machines.\n
+ * The report function is not supported code, and can be expected to change
+ * between versions of the library. Use it at your own risk. */
hbool_t open_trace_file;
+ /**< Boolean field indicating whether the
+ * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
+ * field should be used to open a trace file for the cache.\n
+ * The trace file is a debugging feature that allows the capture
+ * of top level metadata cache requests for purposes of debugging
+ * and/or optimization. This field should normally be set to 0, as
+ * trace file collection imposes considerable overhead.\n
+ * This field should only be set to 1 when the
+ * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
+ * contains the full path of the desired trace file, and either
+ * there is no open trace file on the cache, or the
+ * \ref H5AC_cache_config_t.close_trace_file "close_trace_file"
+ * field is also 1.\n
+ * The trace file feature is unsupported unless used at the
+ * direction of The HDF Group. It is intended to allow The HDF
+ * Group to collect a trace of cache activity in cases of occult
+ * failures and/or poor performance seen in the field, so as to aid
+ * in reproduction in the lab. If you use it absent the direction
+ * of The HDF Group, you are on your own. */
+
hbool_t close_trace_file;
- char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
+ /**< Boolean field indicating whether the current trace file
+ *(if any) should be closed.\n
+ * See the above comments on the \ref H5AC_cache_config_t.open_trace_file
+ * "open_trace_file" field. This field should be set to 0 unless there is
+ * an open trace file on the cache that you wish to close.\n
+ * The trace file feature is unsupported unless used at the direction of
+ * The HDF Group. It is intended to allow The HDF Group to collect a trace
+ * of cache activity in cases of occult failures and/or poor performance
+ * seen in the field, so as to aid in reproduction in the lab. If you use
+ * it absent the direction of The HDF Group, you are on your own. */
+
+ char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
+ /**< Full path of the trace file to be opened if the
+ * \ref H5AC_cache_config_t.open_trace_file "open_trace_file" field is set
+ * to 1.\n
+ * In the parallel case, an ascii representation of the MPI rank of the
+ * process will be appended to the file name to yield a unique trace file
+ * name for each process.\n
+ * The length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN
+ * characters.\n
+ * The trace file feature is unsupported unless used at the direction of
+ * The HDF Group. It is intended to allow The HDF Group to collect a trace
+ * of cache activity in cases of occult failures and/or poor performance
+ * seen in the field, so as to aid in reproduction in the lab. If you use
+ * it absent the direction of The HDF Group, you are on your own. */
hbool_t evictions_enabled;
+ /**< A boolean flag indicating whether evictions from the metadata cache
+ * are enabled. This flag is initially set to enabled (1).\n
+ * In rare circumstances, the raw data throughput quirements may be so high
+ * that the user wishes to postpone metadata writes so as to reserve I/O
+ * throughput for raw data. The \p evictions_enabled field exists to allow
+ * this. However, this is an extreme step, and you have no business doing
+ * it unless you have read the User Guide section on metadata caching, and
+ * have considered all other options carefully.\n
+ * The \p evictions_enabled field may not be set to disabled (0)
+ * unless all adaptive cache resizing code is disabled via the
+ * \ref H5AC_cache_config_t.incr_mode "incr_mode",
+ * \ref H5AC_cache_config_t.flash_incr_mode "flash_incr_mode",
+ * \ref H5AC_cache_config_t.decr_mode "decr_mode" fields.\n
+ * When this flag is set to disabled (\c 0), the metadata cache will not
+ * attempt to evict entries to make space for new entries, and thus will
+ * grow without bound.\n
+ * Evictions will be re-enabled when this field is set back to \c 1.
+ * This should be done as soon as possible. */
hbool_t set_initial_size;
- size_t initial_size;
+ /**< Boolean flag indicating whether the cache should be created
+ * with a user specified initial size. */
+
+ size_t initial_size;
+ /**< If \ref H5AC_cache_config_t.set_initial_size "set_initial_size"
+ * is set to 1, \p initial_size must contain he desired initial size in
+ * bytes. This value must lie in the closed interval
+ * [ \p min_size, \p max_size ]. (see below) */
double min_clean_fraction;
+ /**< This field specifies the minimum fraction of the cache
+ * that must be kept either clean or empty.\n
+ * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to
+ * start in the serial case. In the parallel case, a larger value is needed
+ * -- see the overview of the metadata cache in the
+ * “Metadata Caching in HDF5” section of the -- <em>HDF5 User’s Guide</em>
+ * for details. */
size_t max_size;
+ /**< Upper bound (in bytes) on the range of values that the
+ * adaptive cache resize code can select as the maximum cache size. */
+
size_t min_size;
+ /**< Lower bound (in bytes) on the range of values that the
+ * adaptive cache resize code can select as the mininum cache * size. */
long int epoch_length;
+ /**< Number of cache accesses between runs of the adaptive cache resize
+ * code. 50,000 is a good starting number. */
+ //! <!-- [H5AC_cache_config_t_general_snip] -->
/* size increase control fields: */
+ //! <!-- [H5AC_cache_config_t_incr_snip] -->
enum H5C_cache_incr_mode incr_mode;
+ /**< Enumerated value indicating the operational mode of the automatic
+ * cache size increase code. At present, only two values listed in
+ * #H5C_cache_incr_mode are legal. */
double lower_hr_threshold;
+ /**< Hit rate threshold used by the hit rate threshold cache size
+ * increment algorithm.\n
+ * When the hit rate over an epoch is below this threshold and the cache
+ * is full, the maximum size of the cache is multiplied by increment
+ * (below), and then clipped as necessary to stay within \p max_size, and
+ * possibly \p max_increment.\n
+ * This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good
+ * place to start. */
double increment;
+ /**< Factor by which the hit rate threshold cache size increment
+ * algorithm multiplies the current cache max size to obtain a tentative
+ * new cache size.\n
+ * The actual cache size increase will be clipped to satisfy the \p max_size
+ * specified in the general configuration, and possibly max_increment
+ * below.\n
+ * The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable
+ * value.\n
+ * If you set it to 1.0, you will effectively disable cache size increases.
+ */
hbool_t apply_max_increment;
- size_t max_increment;
+ /**< Boolean flag indicating whether an upper limit should be applied to
+ * the size of cache size increases. */
+
+ size_t max_increment;
+ /**< Maximum number of bytes by which cache size can be increased in a
+ * single step -- if applicable. */
enum H5C_cache_flash_incr_mode flash_incr_mode;
- double flash_multiple;
- double flash_threshold;
+ /**< Enumerated value indicating the operational mode of the flash cache
+ * size increase code. At present, only two listed values in
+ * #H5C_cache_flash_incr_mode are legal.*/
+
+ double flash_multiple;
+ /**< The factor by which the size of the triggering entry / entry size
+ * increase is multiplied to obtain the initial cache size increment. This
+ * increment may be reduced to reflect existing free space in the cache and
+ * the \p max_size field above.\n
+ * The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good
+ * place to start.\n
+ * At present, this field must lie in the range [0.1, 10.0]. */
+
+ double flash_threshold;
+ /**< The factor by which the current maximum cache size is multiplied to
+ * obtain the minimum size entry / entry size increase which may trigger a
+ * flash cache size increase. \n
+ * At present, this value must lie in the range [0.1, 1.0]. */
+ //! <!-- [H5AC_cache_config_t_incr_snip] -->
/* size decrease control fields: */
+ //! <!-- [H5AC_cache_config_t_decr_snip] -->
enum H5C_cache_decr_mode decr_mode;
+ /**< Enumerated value indicating the operational mode of the tomatic
+ * cache size decrease code. At present, the values listed in
+ * #H5C_cache_decr_mode are legal.*/
double upper_hr_threshold;
+ /**< Hit rate threshold for the hit rate threshold and ageout with hit
+ * rate threshold cache size decrement algorithms.\n
+ * When \p decr_mode is #H5C_decr__threshold, and the hit rate over a given
+ * epoch exceeds the supplied threshold, the current maximum cache
+ * size is multiplied by decrement to obtain a tentative new (and smaller)
+ * maximum cache size.\n
+ * When \p decr_mode is #H5C_decr__age_out_with_threshold, there is
+ * no attempt to find and evict aged out entries unless the hit rate in
+ * the previous epoch exceeded the supplied threshold.\n
+ * This field must lie in the interval [0.0, 1.0].\n
+ * For #H5C_incr__threshold, .9995 or .99995 is a good place to start.\n
+ * For #H5C_decr__age_out_with_threshold, .999 might be more useful.*/
double decrement;
+ /**< In the hit rate threshold cache size decrease algorithm, this
+ * parameter contains the factor by which the current max cache size is
+ * multiplied to produce a tentative new cache size.\n
+ * The actual cache size decrease will be clipped to satisfy the
+ * \ref H5AC_cache_config_t.min_size "min_size" specified in the general
+ * configuration, and possibly \ref H5AC_cache_config_t.max_decrement
+ * "max_decrement".\n
+ * The parameter must be be in the interval [0.0, 1.0].\n
+ * If you set it to 1.0, you will effectively
+ * disable cache size decreases. 0.9 is a reasonable starting point. */
hbool_t apply_max_decrement;
- size_t max_decrement;
+ /**< Boolean flag indicating ether an upper limit should be applied to
+ * the size of cache size decreases. */
+
+ size_t max_decrement;
+ /**< Maximum number of bytes by which the maximum cache size can be
+ * decreased in any single step -- if applicable.*/
int epochs_before_eviction;
+ /**< In the ageout based cache size reduction algorithms, this field
+ * contains the minimum number of epochs an entry must remain unaccessed in
+ * cache before the cache size reduction algorithm tries to evict it. 3 is a
+ * reasonable value. */
hbool_t apply_empty_reserve;
- double empty_reserve;
+ /**< Boolean flag indicating whether the ageout based decrement
+ * algorithms will maintain a empty reserve when decreasing cache size. */
+
+ double empty_reserve;
+ /**< Empty reserve as a fraction maximum cache size if applicable.\n When
+ * so directed, the ageout based algorithms will not decrease the maximum
+ * cache size unless the empty reserve can be met.\n The parameter must lie
+ * in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to start. */
+ //! <!-- [H5AC_cache_config_t_decr_snip] -->
/* parallel configuration fields: */
+ //! <!-- [H5AC_cache_config_t_parallel_snip] -->
size_t dirty_bytes_threshold;
- int metadata_write_strategy;
-
+ /**< Threshold number of bytes of dirty metadata generation for
+ * triggering synchronizations of the metadata caches serving the target
+ * file in the parallel case.\n Synchronization occurs whenever the number
+ * of bytes of dirty metadata created since the last synchronization exceeds
+ * this limit.\n This field only applies to the parallel case. While it is
+ * ignored elsewhere, it can still draw a value out of bounds error.\n It
+ * must be consistant across all caches on any given file.\n By default,
+ * this field is set to 256 KB. It shouldn't be more than half the current
+ * max cache size times the min clean fraction. */
+
+ int metadata_write_strategy;
+ /**< Desired metadata write strategy. The valid values for this field
+ * are:\n #H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: Specifies tha only
+ * process zero is allowed to write dirty metadata to disk.\n
+ * #H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: Specifies that process zero
+ * still makes the decisions as to what entries should be flushed, but the
+ * actual flushes are distributed across the processes in the computation to
+ * the extent possible.\n The src/H5ACpublic.h include file in the HDF5
+ * library has detailed information on each strategy. */
+ //! <!-- [H5AC_cache_config_t_parallel_snip] -->
} H5AC_cache_config_t;
-
-/****************************************************************************
- *
- * structure H5AC_cache_image_config_t
- *
- * H5AC_cache_image_ctl_t is a public structure intended for use in public
- * APIs. At least in its initial incarnation, it is a copy of struct
- * H5C_cache_image_ctl_t.
- *
- * The fields of the structure are discussed individually below:
- *
- * version: Integer field containing the version number of this version
- * of the H5C_image_ctl_t structure. Any instance of
- * H5C_image_ctl_t passed to the cache must have a known
- * version number, or an error will be flagged.
- *
- * generate_image: Boolean flag indicating whether a cache image should
- * be created on file close.
- *
- * save_resize_status: Boolean flag indicating whether the cache image
- * should include the adaptive cache resize configuration and status.
- * Note that this field is ignored at present.
- *
- * entry_ageout: Integer field indicating the maximum number of
- * times a prefetched entry can appear in subsequent cache images.
- * This field exists to allow the user to avoid the buildup of
- * infrequently used entries in long sequences of cache images.
- *
- * The value of this field must lie in the range
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100).
- *
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit
- * is imposed on number of times a prefeteched entry can appear
- * in subsequent cache images.
- *
- * A value of 0 prevents prefetched entries from being included
- * in cache images.
- *
- * Positive integers restrict prefetched entries to the specified
- * number of appearances.
- *
- * Note that the number of subsequent cache images that a prefetched
- * entry has appeared in is tracked in an 8 bit field. Thus, while
- * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its
- * current value, any value in excess of 255 will be the functional
- * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
- *
- ****************************************************************************/
+//! <!-- [H5AC_cache_config_t_snip] -->
#define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1
#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1
#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100
+//! <!-- [H5AC_cache_image_config_t_snip] -->
+/**
+ * H5AC_cache_image_config_t is a public structure intended for use in public
+ * APIs. At least in its initial incarnation, it is a copy of \c struct \c
+ * H5C_cache_image_ctl_t.
+ */
+
typedef struct H5AC_cache_image_config_t {
- int version;
+ int version;
+ /**< Integer field containing the version number of this version of the \c
+ * H5C_image_ctl_t structure. Any instance of \c H5C_image_ctl_t passed
+ * to the cache must have a known version number, or an error will be
+ * flagged.
+ */
hbool_t generate_image;
+ /**< Boolean flag indicating whether a cache image should be created on file
+ * close.
+ */
hbool_t save_resize_status;
- int entry_ageout;
+ /**< Boolean flag indicating whether the cache image should include the
+ * adaptive cache resize configuration and status. Note that this field
+ * is ignored at present.
+ */
+ int entry_ageout;
+ /**< Integer field indicating the maximum number of times a
+ * prefetched entry can appear in subsequent cache images. This field
+ * exists to allow the user to avoid the buildup of infrequently used
+ * entries in long sequences of cache images.
+ *
+ * The value of this field must lie in the range \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100).
+ *
+ * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit is
+ * imposed on number of times a prefeteched entry can appear in subsequent
+ * cache images.
+ *
+ * A value of 0 prevents prefetched entries from being included in cache
+ * images.
+ *
+ * Positive integers restrict prefetched entries to the specified number
+ * of appearances.
+ *
+ * Note that the number of subsequent cache images that a prefetched entry
+ * has appeared in is tracked in an 8 bit field. Thus, while \ref
+ * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its current
+ * value, any value in excess of 255 will be the functional equivalent of
+ * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
+ */
} H5AC_cache_image_config_t;
+//! <!-- [H5AC_cache_image_config_t_snip] -->
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 3d4e391..8ae4e41 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -309,10 +309,11 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_info2_t oinfo;
- int ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5O_info2_t oinfo;
+ int ret_value = -1;
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
@@ -324,9 +325,13 @@ H5Aget_num_attrs(hid_t loc_id)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = &oinfo;
+ vol_cb_args.args.get_info.fields = H5O_INFO_NUM_ATTRS;
+
/* Get the number of attributes for the object */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object")
H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t);
@@ -375,8 +380,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_attr_optional_args_t attr_opt_args; /* Arguments for optional operation */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*IuAo*x", loc_id, attr_num, op, op_data);
@@ -389,9 +396,17 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, voi
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ attr_opt_args.iterate_old.loc_id = loc_id;
+ attr_opt_args.iterate_old.attr_num = attr_num;
+ attr_opt_args.iterate_old.op = op;
+ attr_opt_args.iterate_old.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_ATTR_ITERATE_OLD;
+ vol_cb_args.args = &attr_opt_args;
+
/* 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)
+ if ((ret_value = H5VL_attr_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) <
+ 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index f6b955e..300d686 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -844,7 +844,6 @@ done:
const void *buf; IN: Buffer of data to write
RETURNS
Non-negative on success/Negative on failure
-
DESCRIPTION
This function writes a complete attribute to disk.
--------------------------------------------------------------------------*/
@@ -949,31 +948,33 @@ done:
NAME
H5A__get_name
PURPOSE
- Private function for H5Aget_name. Gets a copy of the name for an
- attribute
+ Gets a copy of the name for an attribute
RETURNS
- This function returns the length of the attribute's name (which may be
- longer than 'buf_size') on success or negative for failure.
+ Non-negative on success/Negative on failure
DESCRIPTION
This function retrieves the name of an attribute for an attribute ID.
Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string
terminator. If the name of the attribute is longer than 'buf_size'-1,
the string terminator is stored in the last position of the buffer to
properly terminate the string.
+ This function returns the length of the attribute's name (which may be
+ longer than 'buf_size') in the 'attr_name_len' parameter.
--------------------------------------------------------------------------*/
-ssize_t
-H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
+herr_t
+H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len)
{
- size_t copy_len, nbytes;
- ssize_t ret_value = -1; /* Return value */
+ size_t copy_len, nbytes;
FUNC_ENTER_PACKAGE_NOERR
- /* get the real attribute length */
+ /* Sanity checks */
+ HDassert(attr);
+ HDassert(attr_name_len);
+
+ /* Get the real attribute length */
nbytes = HDstrlen(attr->shared->name);
- HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/
- /* compute the string length which will fit into the user's buffer */
+ /* Compute the string length which will fit into the user's buffer */
copy_len = MIN(buf_size - 1, nbytes);
/* Copy all/some of the name */
@@ -984,10 +985,10 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
buf[copy_len] = '\0';
} /* end if */
- /* Set return value */
- ret_value = (ssize_t)nbytes;
+ /* Set actual attribute name length */
+ *attr_name_len = nbytes;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__get_name() */
/*-------------------------------------------------------------------------
@@ -1091,13 +1092,10 @@ done:
NAME
H5A__get_create_plist
PURPOSE
- private version of H5Aget_create_plist
+ Private version of H5Aget_create_plist
RETURNS
This function returns the ID of a copy of the attribute's creation
property list, or negative on failure.
-
- ERRORS
-
DESCRIPTION
This function returns a copy of the creation property list for
an attribute. The resulting ID must be closed with H5Pclose() or
@@ -1304,7 +1302,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj, void **request)
HDassert(attr_vol_obj);
/* Close the attribute */
- if ((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request)) < 0)
+ if (H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
/* Free the VOL object */
@@ -2661,7 +2659,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;
@@ -2768,7 +2766,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
/* Call internal attribute iteration routine */
if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
+ HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
/* Release resources */
diff --git a/src/H5Amodule.h b/src/H5Amodule.h
index 45172bf..9f86ddd 100644
--- a/src/H5Amodule.h
+++ b/src/H5Amodule.h
@@ -30,19 +30,35 @@
#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.
+ * Like HDF5 datasets, HDF5 attributes are array variables which have an element
+ * datatype and a shape (dataspace). However, they perform a different function:
+ * Attributes decorate other HDF5 objects, and are typically used to
+ * represent application metadata. Unlike datasets, the HDF5 library does not
+ * support partial I/O operations for attributes and they cannot be compressed
+ * or extended.
*
- * 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{lineno} H5A_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5A_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5A_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5A_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
*/
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index a349f9f..b50cbc4 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -200,14 +200,14 @@ H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_
#ifndef H5_NO_DEPRECATED_SYMBOLS
H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
-H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
- hbool_t *attr_exists);
-H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
-H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
-H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf);
+H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
+H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
+ hbool_t *attr_exists);
+H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
+H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
+H5_DLL herr_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len);
/* Attribute "dense" storage routines */
H5_DLL herr_t H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo);
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 68d8a8a..b78ae05 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -22,19 +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]
+//! <!-- [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]
+//! <!-- [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 */
@@ -57,17 +78,24 @@ extern "C" {
*
* \return \herr_t
*
- * \details H5Aclose() terminates access to the attribute specified by
- * \p attr_id by releasing the identifier.
+ * \details H5Aclose() terminates access to the attribute through
+ * \p attr_id and releases the identifier.
*
- * \attention Further use of a released attribute identifier is illegal; a
- * function using such an identifier will generate an error.
+ * \par Example
+ * \snippet H5A_examples.c create
*
* \since 1.0.0
*
* \see H5Acreate(), H5Aopen()
*/
H5_DLL herr_t H5Aclose(hid_t attr_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aclose}
+ */
+H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
+ hid_t es_id);
/* --------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -89,27 +117,19 @@ H5_DLL herr_t H5Aclose(hid_t attr_id);
* The attribute name, \p attr_name, must be unique for the object.
*
* The attribute is created with the specified datatype and dataspace,
- * \p type_id and \p space_id, which are created with the H5T and
- * H5S interfaces, respectively.
- *
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the
- * datatype. String datatypes are derived from #H5T_C_S1 (or
- * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
- * size. See H5Tset_size() and Creating variable-length string
- * datatypes.
+ * \p type_id and \p space_id.
*
- * The access property list is currently unused, but will be used in
- * the future. This property list should currently be #H5P_DEFAULT.
+ * \plist_unused{acpl}
*
* The attribute identifier returned by this function must be released
* with H5Aclose() resource leaks will develop.
*
- * \note The \p acpl and \p aapl parameters are currently not used; specify
- * #H5P_DEFAULT.
* \note If \p loc_id is a file identifier, the attribute will be attached
* that file’s root group.
*
+ * \par Example
+ * \snippet H5A_examples.c create
+ *
* \since 1.8.0
*
* \see H5Aclose()
@@ -117,6 +137,11 @@ H5_DLL herr_t H5Aclose(hid_t attr_id);
*/
H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Acreate}
+ */
H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id,
hid_t aapl_id, hid_t es_id);
@@ -142,33 +167,33 @@ H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigne
* attached to the object specified by \p loc_id and \p obj_name.
*
* \p loc_id is a location identifier; \p obj_name is the object
- * name relative to \p loc_id. If \p loc_id fully specifies the
- * object to which the attribute is to be attached, \p obj_name
- * should be '.' (a dot).
+ * name relative to \p loc_id.
*
* The attribute name, \p attr_name, must be unique for the object.
*
* The attribute is created with the specified datatype and
- * dataspace, \p type_id and \p space_id, which are created with
- * the H5T and H5S interfaces respectively.
+ * dataspace, \p type_id and \p space_id.
*
- * The attribute creation and access property lists are currently
- * unused, but will be used in the future for optional attribute
- * creation and access properties. These property lists should
- * currently be #H5P_DEFAULT.
+ * \plist_unused{aapl}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
*
- * The attribute identifier returned by this function must be
- * released with H5close() or resource leaks will develop.
- *
* \since 1.8.0
*
*/
H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Acreate_by_name}
+ */
+H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
+ hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id,
+ hid_t es_id);
/*-------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -182,10 +207,14 @@ H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *a
*
* \details H5Adelete() removes the attribute specified by its name,
* \p attr_name, from a file, dataset, group, or named datatype.
- * This function should not be used when attribute identifiers
- * are open on \p loc_id as it may cause the internal indexes of
- * the attributes to change and future writes to the open
- * attributes to produce incorrect results.
+ *
+ * \attention This function should not be used when other attribute identifiers
+ * are open on \p loc_id. This may cause the internal indexes of
+ * the attributes to change and future writes to the open
+ * attributes to produce incorrect results.
+ *
+ * \par Example
+ * \snippet H5A_examples.c delete
*
* \since 1.0.0
*
@@ -212,27 +241,16 @@ H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name);
*
* The object from which the attribute is to be removed is
* specified by a location identifier and name, \p loc_id and
- * \p obj_name, respectively. If \p loc_id fully specifies the
- * object from which the attribute is to be removed, \p obj_name
- * should be '.' (a dot).
+ * \p obj_name, respectively.
*
* The attribute to be removed is specified by a position in an
- * index, \p n. The type of index is specified by \p idx_type and
- * may be #H5_INDEX_NAME, for an alpha-numeric index by name, or
- * #H5_INDEX_CRT_ORDER, for an index by creation order. The order
- * in which the index is to be traversed is specified by \p order
- * and may be #H5_ITER_INC (increment) for top-down iteration,
- * #H5_ITER_DEC (decrement) for bottom-up iteration, or
- * #H5_ITER_NATIVE, in which case HDF5 will iterate in the
- * fastest-available order. For example, if \p idx_type, \p order,
+ * index, \p n. The type of index is specified by \p idx_type.
+ * The order in which the index is to be traversed is specified by
+ * \p order. For example, if \p idx_type, \p order,
* and \p n are set to #H5_INDEX_NAME, #H5_ITER_INC, and 5,
- * respectively, the fifth attribute by alpha-numeric order of
+ * respectively, the fifth attribute in lexicographic order of
* attribute names will be removed.
*
- * For a discussion of \p idx_type and \p order, the valid values
- * of those parameters, and the use of \p n, see the description
- * of H5Aiterate2().
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
@@ -260,9 +278,6 @@ H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t id
* from an object specified by location and name, \p loc_id and
* \p obj_name, respectively.
*
- * If \p loc_id fully specifies the object from which the
- * attribute is to be removed, \p obj_name should be '.' (a dot).
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to
* access the object, \p obj_name.
@@ -290,6 +305,13 @@ H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *
*
*/
H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aexists}
+ */
+H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id,
+ const char *attr_name, hbool_t *exists, hid_t es_id);
/*-------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -311,9 +333,7 @@ H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
* \p loc_id specifies a location in the file containing the object.
* \p obj_name is the name of the object to which the attribute is
* attached and can be a relative name, relative to \p loc_id,
- * or an absolute name, based in the root group of the file. If
- * \p loc_id fully specifies the object, \p obj_name should be '.'
- * (a dot).
+ * or an absolute name, based in the root group of the file.
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -323,6 +343,14 @@ H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
*
*/
H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aexists_by_name}
+ */
+H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *obj_name, const char *attr_name,
+ hbool_t *exists, hid_t lapl_id, hid_t es_id);
/*-------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -337,9 +365,6 @@ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *
* creation property list associated with the attribute specified
* by \p attr_id.
*
- * The creation property list identifier should be released with
- * H5Pclose().
- *
* \since 1.8.0
*
*/
@@ -356,32 +381,9 @@ H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
* \return \herr_t
*
* \details H5Aget_info() retrieves attribute information, locating the
- * attribute with an attribute identifier, \p attr_id, which is
- * the identifier returned by H5Aopen() or H5Aopen_by_idx(). The
+ * attribute with an attribute identifier, \p attr_id. The
* attribute information is returned in the \p ainfo struct.
*
- * The \p ainfo struct is defined as follows:
- * \snippet this H5A_info_t_snip
- *
- * \p corder_valid indicates whether the creation order data is
- * valid for this attribute. Note that if creation order is not
- * being tracked, no creation order data will be valid. Valid
- * values are \c TRUE and \c FALSE.
- *
- * \p corder is a positive integer containing the creation
- * order of the attribute. This value is 0-based, so, for
- * example, the third attribute created will have a \p corder
- * value of 2.
- *
- * \p cset indicates the character set used for the attribute’s
- * name; valid values are defined in H5Tpublic.h and include
- * the following:
- * \csets
- * This value is set with H5Pset_char_encoding().
- *
- * \p data_size indicates the size, in the number of characters,
- * of the attribute.
- *
* \since 1.8.0
*
*/
@@ -409,16 +411,9 @@ H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/);
* The attribute is located by its index position and the attribute
* information is returned in the \p ainfo struct.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
* The attribute is located by means of an index type, an index
* traversal order, and a position in the index, \p idx_type,
- * \p order and \p n, respectively. These parameters and their
- * valid values are discussed in the description of H5Aiterate2().
- *
- * The \p ainfo struct, which will contain the returned attribute
- * information, is described in H5Aget_info().
+ * \p order and \p n, respectively.
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -436,8 +431,7 @@ H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t
* \brief Retrieves attribute information, by attribute name
*
* \fgdt_loc_id
- *
- * \param[in] obj_name Name of object to which attribute is attached,
+ * \param[in] obj_name Name of the object to which an attribute is attached,
* relative to location
* \param[in] attr_name Attribute name
* \param[out] ainfo Struct containing returned attribute information
@@ -450,11 +444,6 @@ H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t
* location and name, \p loc_id and \p obj_name, respectively.
* The attribute information is returned in the \p ainfo struct.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
- * The \p ainfo struct is described in H5Aget_info().
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to
* access the object, \p obj_name.
@@ -485,8 +474,8 @@ H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char
* string terminator is stored in the last position of the buffer
* to properly terminate the string.
*
- * If the user only wants to find out the size of this name, the
- * values 0 and NULL can be passed in for the parameters
+ * If the user only wants to retrieve the name length, the
+ * values 0 and NULL should be passed for the parameters
* \p bufsize and \p buf.
*
* \since 1.0.0
@@ -497,7 +486,7 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
/**
* \ingroup H5A
*
- * \brief Gets an attribute name, by attribute index position
+ * \brief Gets an attribute name by attribute index position
*
* \fgdt_loc_id
* \param[in] obj_name Name of object to which attribute is attached,
@@ -518,13 +507,9 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
* located by its index position, the size of the name is specified
* in \p size, and the attribute name is returned in \p name.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
* The attribute is located by means of an index type, an index
* traversal order, and a position in the index, \p idx_type,
- * \p order and \p n, respectively. These parameters and their
- * valid values are discussed in the description of H5Aiterate2().
+ * \p order and \p n, respectively.
*
* If the attribute name’s size is unknown, the values 0 and NULL
* can be passed in for the parameters \p size and \p name. The
@@ -564,7 +549,7 @@ H5_DLL hid_t H5Aget_space(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Returns the amount of storage required for an attribute
+ * \brief Returns the amount of storage used to store an attribute
*
* \attr_id
*
@@ -582,17 +567,16 @@ H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Gets an attribute datatype
+ * \brief Gets an attribute's datatype
*
* \attr_id
*
* \return \hid_t{datatype}
*
- * \details H5Aget_type() retrieves a copy of the datatype for an attribute.
+ * \details H5Aget_type() retrieves a copy of the attribute's datatype.
* The datatype is reopened if it is a named type before returning
* it to the application. The datatypes returned by this function
- * are always read-only. If an error occurs when atomizing the
- * return datatype, then the datatype is closed.
+ * are always read-only.
*
* The datatype identifier returned from this function must be
* released with H5Tclose() or resource leaks will develop.
@@ -605,7 +589,7 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Calls user-defined function for each attribute on an object
+ * \brief Calls a user-defined function for each attribute on an object
*
* \fgdt_loc_id
* \param[in] idx_type Type of index
@@ -632,17 +616,6 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
* are specified by three parameters: the index type,
* \p idx_type; the order in which the index is to be traversed,
* \p order; and the attribute’s position in the index, \p idx.
- *
- * The type of index specified by \p idx_type can be one of the
- * following:
- *
- * \indexes
- *
- * The order in which the index is to be traversed, as specified
- * by \p order, can be one of the following:
- *
- * \orders
- *
* The next attribute to be operated on is specified by \p idx,
* a position in the index.
*
@@ -659,30 +632,7 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
* the value returned identifies the parameter to be operated on
* in the next step of the iteration.
*
- * The #H5A_operator2_t prototype for the \p op parameter is a
- * user defined function where:
- * The operation receives the location identifier for the group or
- * dataset being iterated over, \p location_id; the name of the
- * current object attribute, \p attr_name; the attribute’s info
- * struct, \p ainfo; and a pointer to the operator data passed
- * into H5Aiterate2(), \p op_data.
- *
- * Valid return values from an operator and the resulting
- * H5Aiterate2() and \p op behavior are as follows:
- *
- * \li Zero causes the iterator to continue, returning zero when
- * all attributes have been processed.
- * \li A positive value causes the iterator to immediately return
- * that positive value, indicating short-circuit success. The
- * iterator can be restarted at the next attribute, as
- * indicated by the return value of \p idx.
- * \li A negative value causes the iterator to immediately return
- * that value, indicating failure. The iterator can be
- * restarted at the next attribute, as indicated by the return
- * value of \p idx.
- *
* \note This function is also available through the H5Aiterate() macro.
- * \todo Add snippet for H5A_operator2_t
*
* \since 1.8.0
*
@@ -717,24 +667,10 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord
* additional information as defined below, is passed to a
* user-defined function, \p op, which operates on that attribute.
*
- * If \p loc_id fully specifies the object to which these
- * attributes are attached, \p obj_name should be '.' (a dot).
- *
* The order of the iteration and the attributes iterated over
* are specified by three parameters: the index type, \p idx_type;
* the order in which the index is to be traversed, \p order;
* and the attribute’s position in the index, \p idx.
- *
- * The type of index specified by \p idx_type can be one of the
- * following:
- *
- * \indexes
- *
- * The order in which the index is to be traversed, as specified
- * by \p order, can be one of the following:
- *
- * \orders
- *
* The next attribute to be operated on is specified by \p idx,
* a position in the index.
*
@@ -751,43 +687,16 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord
* the value returned identifies the parameter to be operated on in
* the next step of the iteration.
*
- * The #H5A_operator2_t prototype for the \p op parameter is a
- * user defined function where:
- * The operation receives the location identifier for the group or
- * dataset being iterated over, \p location_id; the name of the
- * current object attribute, \p attr_name; the attribute’s info
- * struct, \p ainfo; and a pointer to the operator data passed
- * into H5Aiterate_by_name(), \p op_data.
- *
- * Valid return values from an operator and the resulting
- * H5Aiterate_by_name() and \p op behavior are as follows:
- *
- * \li Zero causes the iterator to continue, returning zero when
- * all attributes have been processed.
- * \li A positive value causes the iterator to immediately return
- * that positive value, indicating short-circuit success.
- * The iterator can be restarted at the next attribute, as
- * indicated by the return value of \p idx.
- * \li A negative value causes the iterator to immediately return
- * that value, indicating failure. The iterator can be
- * restarted at the next attribute, as indicated by the return
- * value of \p idx.
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
*
- * \todo Add snippet to show H5Aoperator2_t.
* \since 1.8.0
*
*/
H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
hid_t lapl_id);
-H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
- hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
- hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id,
- hid_t es_id);
/*--------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -804,8 +713,7 @@ H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func
* \details H5Aopen() opens an existing attribute, \p attr_name, that is
* attached to object specified by an object identifier, \p obj_id.
*
- * The attribute access property list, \p aapl_id, is currently unused
- * and should be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* This function, H5Aopen_by_idx() or H5Aopen_by_name() must be called
* before the attribute can be accessed for any further purpose,
@@ -814,11 +722,19 @@ H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func
* The attribute identifier returned by this function must be released
* with H5Aclose() or resource leaks will develop.
*
+ * \par Example
+ * \snippet H5A_examples.c read
+ *
* \since 1.8.0
*
* \see H5Aclose(), H5Acreate()
*/
H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aopen}
+ */
H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id,
const char *attr_name, hid_t aapl_id, hid_t es_id);
/*--------------------------------------------------------------------------*/
@@ -840,17 +756,13 @@ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned
*
* \details H5Aopen_by_idx() opens an existing attribute that is attached
* to an object specified by location and name, \p loc_id and
- * \p obj_name, respectively. If \p loc_id fully specifies the
- * object to which the attribute is attached, \p obj_name, should
- * be '.' (a dot).
+ * \p obj_name, respectively.
*
* The attribute is identified by an index type, an index traversal
* order, and a position in the index, \p idx_type, \p order and
- * \p n, respectively. These parameters and their valid values are
- * discussed in the description of H5Aiterate2().
+ * \p n, respectively.
*
- * The attribute access property list, \p aapl_id, is currently
- * unused and should currently be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -868,6 +780,11 @@ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned
*/
H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, hid_t aapl_id, hid_t lapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aopen_by_idx}
+ */
H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
hid_t aapl_id, hid_t lapl_id, hid_t es_id);
@@ -892,11 +809,9 @@ H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, un
*
* \p loc_id specifies a location from which the target object can
* be located and \p obj_name is an object name relative to
- * \p loc_id. If \p loc_id fully specifies the object to which the
- * attribute is attached, \p obj_name should be '.' (a dot).
+ * \p loc_id.
*
- * The attribute access property list, \p aapl_id, is currently
- * unused and should currently be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -914,6 +829,11 @@ H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, un
*/
H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id,
hid_t lapl_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aopen_by_name}
+ */
H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id,
hid_t lapl_id, hid_t es_id);
@@ -936,6 +856,9 @@ H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, u
* Datatype conversion takes place at the time of a read or write and
* is automatic.
*
+ * \par Example
+ * \snippet H5A_examples.c read
+ *
* \version 1.8.8 Fortran updated to Fortran2003.
* \version 1.4.2 The \p dims parameter was added to the Fortran API in this
* release.
@@ -945,6 +868,13 @@ H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, u
*
*/
H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Aread}
+ */
+H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
+ hid_t dtype_id, void *buf, hid_t es_id);
/*-------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -967,8 +897,21 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
*
*/
H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name);
-H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
- hid_t dtype_id, void *buf, hid_t es_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Arename}
+ */
+H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *old_name, const char *new_name, hid_t es_id);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Arename_by_name}
+ */
+H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *obj_name, const char *old_attr_name,
+ const char *new_attr_name, hid_t lapl_id, hid_t es_id);
/*--------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -985,15 +928,12 @@ H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned
* attribute's in-memory datatype is specified with \p type_id.
* The entire attribute is written from \p buf to the file.
*
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the datatype.
- * String datatypes are derived from #H5T_C_S1 (or #H5T_FORTRAN_S1 for
- * Fortran codes), which defaults to 1 character in size.
- * See H5Tset_size() and Creating variable-length string datatypes.
- *
* Datatype conversion takes place at the time of a read or write and
* is automatic.
*
+ * \par Example
+ * \snippet H5A_examples.c update
+ *
* \version 1.8.8 Fortran updated to Fortran2003.
* \version 1.4.2 Fortran \p dims parameter added in this release
* \since 1.0.0
@@ -1001,18 +941,13 @@ H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned
*
*/
H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf);
+/*--------------------------------------------------------------------------*/
+/**
+ * \ingroup ASYNC
+ * \async_variant_of{H5Awrite}
+ */
H5_DLL herr_t H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
hid_t type_id, const void *buf, hid_t es_id);
-H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
- const char *old_name, const char *new_name, hid_t es_id);
-H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
- hid_t loc_id, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name, hid_t lapl_id, hid_t es_id);
-H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id,
- const char *attr_name, hbool_t *exists, hid_t es_id);
-H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
- hid_t loc_id, const char *obj_name, const char *attr_name,
- hbool_t *exists, hid_t lapl_id, hid_t es_id);
/*-------------------------------------------------------------------------*/
/**
* \ingroup H5A
@@ -1038,9 +973,8 @@ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func
*/
H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
const char *new_attr_name, hid_t lapl_id);
-H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
- hid_t es_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1074,6 +1008,7 @@ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigne
#define H5Aexists_by_name_async_wrap H5_NO_EXPAND(H5Aexists_by_name_async)
#define H5Aclose_async_wrap H5_NO_EXPAND(H5Aclose_async)
#endif /* H5A_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -1085,9 +1020,28 @@ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigne
/* 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 */
/* --------------------------------------------------------------------------*/
@@ -1104,9 +1058,9 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam
*
* \return \hid_tv{attribute}
*
- * \note The \p acpl parameters is currently not used; specify #H5P_DEFAULT.
+ * \deprecation_note{H5Acreate2()}
*
- * \deprecated Deprecated in favor of H5Acreate2()
+ * \plist_unused{acpl}
*
* \details H5Acreate1() creates an attribute, \p name, which is attached
* to the object specified by the identifier \p loc_id.
@@ -1114,18 +1068,7 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam
* The attribute name, \p name, must be unique for the object.
*
* The attribute is created with the specified datatype and dataspace,
- * \p type_id and \p space_id, which are created with the H5T and
- * H5S interfaces, respectively.
- *
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the
- * datatype. String datatypes are derived from #H5T_C_S1 (or
- * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
- * size. See H5Tset_size() and Creating variable-length string
- * datatypes.
- *
- * The attribute identifier returned by this function must be released
- * with H5Aclose() resource leaks will develop.
+ * \p type_id and \p space_id.
*
* \since 1.8.0
*
@@ -1147,8 +1090,7 @@ H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t spa
* \return Returns the number of attributes if successful; otherwise returns
* a negative value.
*
- * \deprecated This function is deprecated in favor of the functions
- * H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx().
+ * \deprecation_note{H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx()}
*
* \details H5Aget_num_attrs() returns the number of attributes attached to
* the object specified by its identifier, \p loc_id.
@@ -1163,8 +1105,6 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
*
* \brief Calls a user’s function for each attribute on an object
*
- * \todo make prototype parameter match function (idx vs attr_num)
- *
* \loc_id
* \param[in,out] idx Starting (in) and ending (out) attribute index
* \param[in] op User's function to pass each attribute to
@@ -1173,8 +1113,7 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
*
* \return \herr_t
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aiterate2().
+ * \deprecation_note{H5Aiterate2()}
*
* \details H5Aiterate1() iterates over the attributes of the object
* specified by its identifier, \p loc_id. The object can be a
@@ -1186,29 +1125,8 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
* \p op, is returned in \p idx. If \p idx is the null pointer,
* then all attributes are processed.
*
- * The prototype for #H5A_operator1_t is a user defined function
- * where:
- * The operation receives the identifier for the group, dataset
- * or named datatype being iterated over, \p loc_id, the name of
- * the current object attribute, \p attr_name, and the pointer to
- * the operator data passed in to H5Aiterate1(), \p op_data.
- *
- * 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.
- *
- * \todo Add snippet to show H5A_operator1_t.
- *
* \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1()
* and deprecated in this release.
- *
* \since 1.0.0
*
*/
@@ -1224,8 +1142,7 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void
*
* \return \hid_tv{attribute}
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aopen_by_idx().
+ * \deprecation_note{H5Aopen_by_idx()}
*
* \details H5Aopen_idx() opens an attribute which is attached to the
* object specified with \p loc_id . The location object may be
@@ -1251,8 +1168,7 @@ H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
*
* \return \hid_tv{attribute}
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aopen_by_name().
+ * \deprecation_note{H5Aopen_by_name()}
*
* \details H5Aopen_name() opens an attribute specified by its name,
* \p name, which is attached to the object specified with
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index d70816d..e333d61 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -250,7 +250,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Magic number */
- if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature")
image += H5_SIZEOF_MAGIC;
@@ -648,7 +648,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
internal->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature")
image += H5_SIZEOF_MAGIC;
@@ -1064,7 +1064,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void
leaf->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 6ccdc11..ec7457f 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -166,7 +166,7 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses")
/* magic number */
- if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index ac28ee6..0a79628 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol
- * Thursday, May 15, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, May 15, 2003
*
- * Purpose: This file contains declarations which are visible only within
- * the H5B package. Source files outside the H5B package should
- * include H5Bprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5B package. Source files outside the H5B package should
+ * include H5Bprivate.h instead.
*/
#if !(defined H5B_FRIEND || defined H5B_MODULE)
#error "Do not include this file outside the H5B package!"
@@ -30,7 +30,7 @@
#include "H5Bprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5FLprivate.h" /* Free Lists */
/**************************/
@@ -49,20 +49,20 @@
typedef struct H5B_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions */
/* _must_ be first field in structure */
- H5UC_t * rc_shared; /*ref-counted shared info */
- unsigned level; /*node level */
- unsigned nchildren; /*number of child pointers */
- haddr_t left; /*address of left sibling */
- haddr_t right; /*address of right sibling */
+ H5UC_t * rc_shared; /*ref-counted shared info */
+ unsigned level; /*node level */
+ unsigned nchildren; /*number of child pointers */
+ haddr_t left; /*address of left sibling */
+ haddr_t right; /*address of right sibling */
uint8_t *native; /*array of keys in native format */
- haddr_t *child; /*2k child pointers */
+ haddr_t *child; /*2k child pointers */
} H5B_t;
/* Callback info for loading a B-tree node into the cache */
typedef struct H5B_cache_ud_t {
H5F_t * f; /* File that B-tree node is within */
- const struct H5B_class_t *type; /* Type of tree */
- H5UC_t * rc_shared; /* Ref-counted shared info */
+ const struct H5B_class_t *type; /* Type of tree */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
} H5B_cache_ud_t;
/*****************************/
@@ -86,4 +86,4 @@ H5_DLL herr_t H5B__node_dest(H5B_t *bt);
herr_t H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata);
#endif
-#endif /*_H5Bpkg_H*/
+#endif /*H5Bpkg_H*/
diff --git a/src/H5C.c b/src/H5C.c
index 9369506..7853933 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -21,14 +21,8 @@
* 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.
- *
- * For a detailed overview of the cache, please see the
- * header comment for H5C_t in H5Cpkg.h.
+ * For a detailed overview of the cache, please see the
+ * header comment for H5C_t in H5Cpkg.h.
*
*-------------------------------------------------------------------------
*/
@@ -39,9 +33,7 @@
*
* Code Changes:
*
- * - Remove extra functionality in H5C__flush_single_entry()?
- *
- * - Change protect/unprotect to lock/unlock.
+ * - Change protect/unprotect to lock/unlock.
*
* - Flush entries in increasing address order in
* H5C__make_space_in_cache().
@@ -53,18 +45,9 @@
* I/O overhead. Can't do this just yet as some entries are not
* contiguous. Do this in parallel only or in serial as well?
*
- * - Create MPI type for dirty objects when flushing in parallel.
- *
- * - Now that TBBT routines aren't used, fix nodes in memory to
- * point directly to the skip list node from the LRU list, eliminating
- * skip list lookups when evicting objects from the cache.
- *
- * Tests:
- *
- * - Trim execution time. (This is no longer a major issue with the
- * shift from the TBBT to a hash table for indexing.)
- *
- * - Add random tests.
+ * - Fix nodes in memory to point directly to the skip list node from
+ * the LRU list, eliminating skip list lookups when evicting objects
+ * from the cache.
*
**************************************************************************/
@@ -462,17 +445,17 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
(cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT;
(cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off;
- (cache_ptr->resize_ctl).flash_multiple = (double)1.0f;
- (cache_ptr->resize_ctl).flash_threshold = (double)0.25f;
+ (cache_ptr->resize_ctl).flash_multiple = 1.0;
+ (cache_ptr->resize_ctl).flash_threshold = 0.25;
(cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
- (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD;
- (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT;
+ (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD;
+ (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT;
(cache_ptr->resize_ctl).apply_max_decrement = TRUE;
(cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT;
(cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT;
(cache_ptr->resize_ctl).apply_empty_reserve = TRUE;
- (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE;
+ (cache_ptr->resize_ctl).empty_reserve = H5C__DEF_AR_EMPTY_RESERVE;
cache_ptr->epoch_markers_active = 0;
@@ -689,9 +672,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr,
HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix);
break;
}
-
- return;
-
} /* H5C_def_auto_resize_rpt_fcn() */
/*-------------------------------------------------------------------------
@@ -2725,7 +2705,7 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_incr__threshold:
- if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) ||
+ if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) ||
((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
cache_ptr->size_increase_possible = FALSE;
break;
@@ -2745,21 +2725,21 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_p
break;
case H5C_decr__threshold:
- if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) ||
+ if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out_with_threshold:
- if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
- (config_ptr->upper_hr_threshold >= (double)1.0f))
+ (config_ptr->upper_hr_threshold >= 1.0))
cache_ptr->size_decrease_possible = FALSE;
break;
@@ -3740,8 +3720,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"initial_size must be in the interval [min_size, max_size]")
- if ((config_ptr->min_clean_fraction < (double)0.0f) ||
- (config_ptr->min_clean_fraction > (double)1.0f))
+ if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]")
if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH)
@@ -3756,12 +3735,11 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
if (config_ptr->incr_mode == H5C_incr__threshold) {
- if ((config_ptr->lower_hr_threshold < (double)0.0f) ||
- (config_ptr->lower_hr_threshold > (double)1.0f))
+ if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"lower_hr_threshold must be in the range [0.0, 1.0]")
- if (config_ptr->increment < (double)1.0f)
+ if (config_ptr->increment < 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0")
/* no need to check max_increment, as it is a size_t,
@@ -3775,12 +3753,10 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
break;
case H5C_flash_incr__add_space:
- if ((config_ptr->flash_multiple < (double)0.1f) ||
- (config_ptr->flash_multiple > (double)10.0f))
+ if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_multiple must be in the range [0.1, 10.0]")
- if ((config_ptr->flash_threshold < (double)0.1f) ||
- (config_ptr->flash_threshold > (double)1.0f))
+ if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"flash_threshold must be in the range [0.1, 1.0]")
break;
@@ -3801,10 +3777,10 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
}
if (config_ptr->decr_mode == H5C_decr__threshold) {
- if (config_ptr->upper_hr_threshold > (double)1.0f)
+ if (config_ptr->upper_hr_threshold > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
- if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f))
+ if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
/* no need to check max_decrement as it is a size_t
@@ -3821,7 +3797,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
if ((config_ptr->apply_empty_reserve) &&
- ((config_ptr->empty_reserve > (double)1.0f) || (config_ptr->empty_reserve < (double)0.0f)))
+ ((config_ptr->empty_reserve > 1.0) || (config_ptr->empty_reserve < 0.0)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]")
/* no need to check max_decrement as it is a size_t
@@ -3830,8 +3806,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests)
} /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
- if ((config_ptr->upper_hr_threshold > (double)1.0f) ||
- (config_ptr->upper_hr_threshold < (double)0.0f))
+ if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"upper_hr_threshold must be in the interval [0.0, 1.0]")
} /* H5C_decr__age_out_with_threshold */
@@ -4299,8 +4274,8 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted)
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length);
- HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction);
- HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f);
+ HDassert(0.0 <= (cache_ptr->resize_ctl).min_clean_fraction);
+ HDassert((cache_ptr->resize_ctl).min_clean_fraction <= 100.0);
/* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
* is a re-entrant call via a client callback called in the resize
@@ -4323,7 +4298,7 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted)
if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
- HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f));
+ HDassert((0.0 <= hit_rate) && (hit_rate <= 1.0));
switch ((cache_ptr->resize_ctl).incr_mode) {
case H5C_incr__off:
@@ -6653,9 +6628,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
}
if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0)
-
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file")
-
#ifdef H5_HAVE_PARALLEL
}
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5CS.c b/src/H5CS.c
index 6510c25..d7cb6f1 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -262,9 +262,9 @@ H5CS_copy_stack(void)
if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records")
- /* Copy old stack to new one, duplicating the strings */
- for (u = 0; u < old_stack->nused; u++)
- new_stack->rec[u] = HDstrdup(old_stack->rec[u]);
+ /* Copy pointers on old stack to new one */
+ /* (Strings don't need to be duplicated, they are statically allocated) */
+ HDmemcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused);
new_stack->nused = new_stack->nalloc = old_stack->nused;
/* Set the return value */
@@ -298,11 +298,9 @@ H5CS_close_stack(H5CS_t *stack)
HDassert(stack);
/* Free stack */
- for (u = 0; u < stack->nused; u++) {
- if (stack->rec[u])
- HDfree((void *)stack->rec[u]);
- stack->rec[u] = NULL;
- } /* end for */
+ /* The function name string are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
if (stack->rec) {
HDfree(stack->rec);
stack->rec = NULL;
diff --git a/src/H5CX.c b/src/H5CX.c
index c304548..01bf435 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -761,13 +761,14 @@ H5CX__get_context(void)
static void
H5CX__push_common(H5CX_node_t *cnode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(cnode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head);
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
@@ -834,7 +835,7 @@ done:
void
H5CX_push_special(void)
{
- H5CX_node_t *cnode; /* Context node */
+ H5CX_node_t *cnode = NULL; /* Context node */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -868,13 +869,13 @@ H5CX_push_special(void)
herr_t
H5CX_retrieve_state(H5CX_state_t **api_state)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(api_state);
@@ -975,6 +976,16 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
#endif /* H5_HAVE_PARALLEL */
done:
+ /* Cleanup on error */
+ if (ret_value < 0) {
+ if (*api_state) {
+ /* Release the (possibly partially allocated) API state struct */
+ if (H5CX_free_state(*api_state) < 0)
+ HDONE_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release API state")
+ *api_state = NULL;
+ } /* end if */
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_retrieve_state() */
@@ -998,12 +1009,12 @@ done:
herr_t
H5CX_restore_state(const H5CX_state_t *api_state)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(api_state);
@@ -1066,22 +1077,22 @@ H5CX_free_state(H5CX_state_t *api_state)
HDassert(api_state);
/* Release the DCPL */
- if (api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if (0 != api_state->dcpl_id && H5P_DATASET_CREATE_DEFAULT != api_state->dcpl_id)
if (H5I_dec_ref(api_state->dcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
/* Release the DXPL */
- if (api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if (0 != api_state->dxpl_id && H5P_DATASET_XFER_DEFAULT != api_state->dxpl_id)
if (H5I_dec_ref(api_state->dxpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL")
/* Release the LAPL */
- if (api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
+ if (0 != api_state->lapl_id && H5P_LINK_ACCESS_DEFAULT != api_state->lapl_id)
if (H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
/* Release the LCPL */
- if (api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
+ if (0 != api_state->lcpl_id && H5P_LINK_CREATE_DEFAULT != api_state->lcpl_id)
if (H5I_dec_ref(api_state->lcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
@@ -1124,15 +1135,19 @@ done:
hbool_t
H5CX_is_def_dxpl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t is_def_dxpl = FALSE; /* Flag to indicate DXPL is default */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
+ /* Set return value */
+ is_def_dxpl = ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
+
+ FUNC_LEAVE_NOAPI(is_def_dxpl)
} /* end H5CX_is_def_dxpl() */
/*-------------------------------------------------------------------------
@@ -1150,13 +1165,13 @@ H5CX_is_def_dxpl(void)
void
H5CX_set_dxpl(hid_t dxpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's DXPL to a new value */
(*head)->ctx.dxpl_id = dxpl_id;
@@ -1179,13 +1194,13 @@ H5CX_set_dxpl(hid_t dxpl_id)
void
H5CX_set_dcpl(hid_t dcpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's DCPL to a new value */
(*head)->ctx.dcpl_id = dcpl_id;
@@ -1209,13 +1224,13 @@ H5CX_set_dcpl(hid_t dcpl_id)
herr_t
H5CX_set_libver_bounds(H5F_t *f)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1245,13 +1260,13 @@ done:
void
H5CX_set_lcpl(hid_t lcpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's LCPL to a new value */
(*head)->ctx.lcpl_id = lcpl_id;
@@ -1274,12 +1289,12 @@ H5CX_set_lcpl(hid_t lcpl_id)
void
H5CX_set_lapl(hid_t lapl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context's LAPL to a new value */
@@ -1314,15 +1329,15 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
#endif /* H5_HAVE_PARALLEL */
is_collective)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(acspl_id);
HDassert(libclass);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set access plist to the default property list of the appropriate class if it's the generic default */
@@ -1437,13 +1452,13 @@ H5CX_set_loc(hid_t
loc_id)
{
#ifdef H5_HAVE_PARALLEL
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set collective metadata read flag */
@@ -1491,13 +1506,13 @@ done:
herr_t
H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1525,13 +1540,13 @@ done:
herr_t
H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1559,15 +1574,19 @@ done:
hid_t
H5CX_get_dxpl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hid_t dxpl_id = H5I_INVALID_HID; /* DXPL ID for API operation */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id)
+ /* Set return value */
+ dxpl_id = (*head)->ctx.dxpl_id;
+
+ FUNC_LEAVE_NOAPI(dxpl_id)
} /* end H5CX_get_dxpl() */
/*-------------------------------------------------------------------------
@@ -1585,15 +1604,19 @@ H5CX_get_dxpl(void)
hid_t
H5CX_get_lapl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hid_t lapl_id = H5I_INVALID_HID; /* LAPL ID for API operation */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.lapl_id)
+ /* Set return value */
+ lapl_id = (*head)->ctx.lapl_id;
+
+ FUNC_LEAVE_NOAPI(lapl_id)
} /* end H5CX_get_lapl() */
/*-------------------------------------------------------------------------
@@ -1611,14 +1634,14 @@ H5CX_get_lapl(void)
herr_t
H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_wrap_ctx);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for value that was set */
@@ -1647,14 +1670,14 @@ done:
herr_t
H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_connector_prop);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for value that was set */
@@ -1683,15 +1706,19 @@ done:
haddr_t
H5CX_get_tag(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ haddr_t tag = HADDR_UNDEF; /* Current object's tag (ohdr chunk #0 address) */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.tag)
+ /* Set return value */
+ tag = (*head)->ctx.tag;
+
+ FUNC_LEAVE_NOAPI(tag)
} /* end H5CX_get_tag() */
/*-------------------------------------------------------------------------
@@ -1709,15 +1736,19 @@ H5CX_get_tag(void)
H5AC_ring_t
H5CX_get_ring(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5AC_ring_t ring = H5AC_RING_INV; /* Current metadata cache ring for entries */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.ring)
+ /* Set return value */
+ ring = (*head)->ctx.ring;
+
+ FUNC_LEAVE_NOAPI(ring)
} /* end H5CX_get_ring() */
#ifdef H5_HAVE_PARALLEL
@@ -1737,15 +1768,19 @@ H5CX_get_ring(void)
hbool_t
H5CX_get_coll_metadata_read(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t coll_md_read = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.coll_metadata_read)
+ /* Set return value */
+ coll_md_read = (*head)->ctx.coll_metadata_read;
+
+ FUNC_LEAVE_NOAPI(coll_md_read)
} /* end H5CX_get_coll_metadata_read() */
/*-------------------------------------------------------------------------
@@ -1765,15 +1800,15 @@ H5CX_get_coll_metadata_read(void)
herr_t
H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(btype);
HDassert(ftype);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context values */
@@ -1799,15 +1834,19 @@ done:
hbool_t
H5CX_get_mpi_file_flushing(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t flushing = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
+ /* Set return value */
+ flushing = (*head)->ctx.mpi_file_flushing;
+
+ FUNC_LEAVE_NOAPI(flushing)
} /* end H5CX_get_mpi_file_flushing() */
/*-------------------------------------------------------------------------
@@ -1826,15 +1865,19 @@ H5CX_get_mpi_file_flushing(void)
hbool_t
H5CX_get_mpio_rank0_bcast(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t do_rank0_bcast = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast)
+ /* Set return value */
+ do_rank0_bcast = (*head)->ctx.rank0_bcast;
+
+ FUNC_LEAVE_NOAPI(do_rank0_bcast)
} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -1853,14 +1896,14 @@ H5CX_get_mpio_rank0_bcast(void)
herr_t
H5CX_get_btree_split_ratios(double split_ratio[3])
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(split_ratio);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1889,14 +1932,14 @@ done:
herr_t
H5CX_get_max_temp_buf(size_t *max_temp_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(max_temp_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1924,14 +1967,14 @@ done:
herr_t
H5CX_get_tconv_buf(void **tconv_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(tconv_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1959,14 +2002,14 @@ done:
herr_t
H5CX_get_bkgr_buf(void **bkgr_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(bkgr_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1994,14 +2037,14 @@ done:
herr_t
H5CX_get_bkgr_buf_type(H5T_bkg_t *bkgr_buf_type)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(bkgr_buf_type);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2029,14 +2072,14 @@ done:
herr_t
H5CX_get_vec_size(size_t *vec_size)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vec_size);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2066,14 +2109,14 @@ done:
herr_t
H5CX_get_io_xfer_mode(H5FD_mpio_xfer_t *io_xfer_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(io_xfer_mode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2101,14 +2144,14 @@ done:
herr_t
H5CX_get_mpio_coll_opt(H5FD_mpio_collective_opt_t *mpio_coll_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_coll_opt);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2136,14 +2179,14 @@ done:
herr_t
H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_local_no_coll_cause);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2172,14 +2215,14 @@ done:
herr_t
H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_global_no_coll_cause);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2208,14 +2251,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_mode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2244,14 +2287,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_num);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2280,14 +2323,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_ratio);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2317,14 +2360,14 @@ done:
herr_t
H5CX_get_err_detect(H5Z_EDC_t *err_detect)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(err_detect);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2352,14 +2395,14 @@ done:
herr_t
H5CX_get_filter_cb(H5Z_cb_t *filter_cb)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(filter_cb);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2387,14 +2430,14 @@ done:
herr_t
H5CX_get_data_transform(H5Z_data_xform_t **data_transform)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(data_transform);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2445,14 +2488,14 @@ done:
herr_t
H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vl_alloc_info);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2510,14 +2553,14 @@ done:
herr_t
H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(dt_conv_cb);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2545,14 +2588,14 @@ done:
herr_t
H5CX_get_encoding(H5T_cset_t *encoding)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(encoding);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
@@ -2580,14 +2623,14 @@ done:
herr_t
H5CX_get_intermediate_group(unsigned *crt_intermed_group)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(crt_intermed_group);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
@@ -2616,14 +2659,14 @@ done:
herr_t
H5CX_get_nlinks(size_t *nlinks)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(nlinks);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2651,15 +2694,15 @@ done:
herr_t
H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(low_bound);
HDassert(high_bound);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id);
@@ -2690,14 +2733,14 @@ done:
herr_t
H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(dset_min_ohdr_flag);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
@@ -2726,14 +2769,14 @@ done:
herr_t
H5CX_get_ext_file_prefix(const char **extfile_prefix)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(extfile_prefix);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
@@ -2784,14 +2827,14 @@ done:
herr_t
H5CX_get_vds_prefix(const char **vds_prefix)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vds_prefix);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
@@ -2842,12 +2885,12 @@ done:
void
H5CX_set_tag(haddr_t tag)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.tag = tag;
@@ -2870,12 +2913,12 @@ H5CX_set_tag(haddr_t tag)
void
H5CX_set_ring(H5AC_ring_t ring)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.ring = ring;
@@ -2900,12 +2943,12 @@ H5CX_set_ring(H5AC_ring_t ring)
void
H5CX_set_coll_metadata_read(hbool_t cmdr)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.coll_metadata_read = cmdr;
@@ -2930,14 +2973,14 @@ H5CX_set_coll_metadata_read(hbool_t cmdr)
herr_t
H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context values */
@@ -2963,13 +3006,13 @@ done:
herr_t
H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -2997,13 +3040,13 @@ done:
herr_t
H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3031,12 +3074,12 @@ done:
void
H5CX_set_mpi_file_flushing(hbool_t flushing)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.mpi_file_flushing = flushing;
@@ -3060,12 +3103,12 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
void
H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.rank0_bcast = rank0_bcast;
@@ -3089,13 +3132,13 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
herr_t
H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3126,13 +3169,13 @@ done:
herr_t
H5CX_set_nlinks(size_t nlinks)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3162,12 +3205,12 @@ done:
void
H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3193,12 +3236,12 @@ H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chun
void
H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3224,12 +3267,12 @@ H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
void
H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
@@ -3258,12 +3301,12 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
void
H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
@@ -3296,13 +3339,13 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
herr_t
H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3329,13 +3372,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3362,13 +3405,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_link_num_true)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3396,13 +3439,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3430,13 +3473,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3464,13 +3507,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3497,13 +3540,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3530,14 +3573,14 @@ done:
herr_t
H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(ohdr_flags);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
@@ -3565,9 +3608,8 @@ done:
static H5CX_node_t *
H5CX__pop_common(hbool_t update_dxpl_props)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- H5CX_node_t *ret_value = NULL; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5CX_node_t * ret_value = NULL; /* Return value */
#ifdef H5_HAVE_PARALLEL
FUNC_ENTER_STATIC
@@ -3576,6 +3618,7 @@ H5CX__pop_common(hbool_t update_dxpl_props)
#endif
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for cached DXPL properties to return to application */
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 478cc1d..104f1af 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -429,11 +429,11 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
int32_t aggregate_max_pins = 0;
double hit_rate;
double prefetch_use_rate;
- double average_successful_search_depth = 0.0f;
- double average_failed_search_depth = 0.0f;
- double average_entries_skipped_per_calls_to_msic = 0.0f;
- double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
- double average_entries_scanned_per_calls_to_msic = 0.0f;
+ double average_successful_search_depth = 0.0;
+ double average_failed_search_depth = 0.0;
+ double average_entries_skipped_per_calls_to_msic = 0.0;
+ double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0;
+ double average_entries_scanned_per_calls_to_msic = 0.0;
#endif /* H5C_COLLECT_CACHE_STATS */
herr_t ret_value = SUCCEED; /* Return value */
@@ -492,9 +492,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->successful_ht_searches > 0)
average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) /
@@ -630,10 +630,9 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
(long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]));
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate);
@@ -658,10 +657,10 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name,
((cache_ptr->class_table_ptr))[i]->name);
if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
- hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) /
+ hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) /
((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
(long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate);
@@ -832,8 +831,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr)
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
#endif /* H5C_COLLECT_CACHE_STATS */
-
- return;
} /* H5C_stats__reset() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index b366a94..f17ff48 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -933,15 +933,14 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
} /* end for */
if ((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
+ hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
- hit_rate = 0.0f;
+ hit_rate = 0.0;
if (cache_ptr->prefetches > 0)
- prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
+ prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
- prefetch_use_rate = 0.0f;
+ prefetch_use_rate = 0.0;
if (print_header) {
HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n");
@@ -1773,7 +1772,7 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t *
p = *buf;
/* Check signature */
- if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN))
+ if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature")
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;
diff --git a/src/H5Clog.h b/src/H5Clog.h
index bd5c413..790a073 100644
--- a/src/H5Clog.h
+++ b/src/H5Clog.h
@@ -79,10 +79,10 @@ typedef struct H5C_log_class_t {
/* Logging information */
struct H5C_log_info_t {
- hbool_t enabled; /* Was the logging set up? */
- hbool_t logging; /* Are we currently logging? */
- H5C_log_class_t *cls; /* Callbacks for writing log messages */
- void * udata; /* Log-specific data */
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ const H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void * udata; /* Log-specific data */
};
/*****************************/
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index 731d741..18323ca 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -118,32 +118,32 @@ static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_json_log_class_g = {"json",
- H5C__json_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- H5C__json_write_start_log_msg,
- H5C__json_write_stop_log_msg,
- H5C__json_write_create_cache_log_msg,
- H5C__json_write_destroy_cache_log_msg,
- H5C__json_write_evict_cache_log_msg,
- H5C__json_write_expunge_entry_log_msg,
- H5C__json_write_flush_cache_log_msg,
- H5C__json_write_insert_entry_log_msg,
- H5C__json_write_mark_entry_dirty_log_msg,
- H5C__json_write_mark_entry_clean_log_msg,
- H5C__json_write_mark_unserialized_entry_log_msg,
- H5C__json_write_mark_serialized_entry_log_msg,
- H5C__json_write_move_entry_log_msg,
- H5C__json_write_pin_entry_log_msg,
- H5C__json_write_create_fd_log_msg,
- H5C__json_write_protect_entry_log_msg,
- H5C__json_write_resize_entry_log_msg,
- H5C__json_write_unpin_entry_log_msg,
- H5C__json_write_destroy_fd_log_msg,
- H5C__json_write_unprotect_entry_log_msg,
- H5C__json_write_set_cache_config_log_msg,
- H5C__json_write_remove_entry_log_msg};
+static const H5C_log_class_t H5C_json_log_class_g = {"json",
+ H5C__json_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ H5C__json_write_start_log_msg,
+ H5C__json_write_stop_log_msg,
+ H5C__json_write_create_cache_log_msg,
+ H5C__json_write_destroy_cache_log_msg,
+ H5C__json_write_evict_cache_log_msg,
+ H5C__json_write_expunge_entry_log_msg,
+ H5C__json_write_flush_cache_log_msg,
+ H5C__json_write_insert_entry_log_msg,
+ H5C__json_write_mark_entry_dirty_log_msg,
+ H5C__json_write_mark_entry_clean_log_msg,
+ H5C__json_write_mark_unserialized_entry_log_msg,
+ H5C__json_write_mark_serialized_entry_log_msg,
+ H5C__json_write_move_entry_log_msg,
+ H5C__json_write_pin_entry_log_msg,
+ H5C__json_write_create_fd_log_msg,
+ H5C__json_write_protect_entry_log_msg,
+ H5C__json_write_resize_entry_log_msg,
+ H5C__json_write_unpin_entry_log_msg,
+ H5C__json_write_destroy_fd_log_msg,
+ H5C__json_write_unprotect_entry_log_msg,
+ H5C__json_write_set_cache_config_log_msg,
+ H5C__json_write_remove_entry_log_msg};
/*-------------------------------------------------------------------------
* Function: H5C__json_write_log_message
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index c30f79e..d33d1b0 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -113,32 +113,32 @@ static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_trace_log_class_g = {"trace",
- H5C__trace_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- NULL, /* write start message */
- NULL, /* write stop message */
- NULL, /* write create cache message */
- NULL, /* write destroy cache message */
- NULL, /* write evict cache message */
- H5C__trace_write_expunge_entry_log_msg,
- H5C__trace_write_flush_cache_log_msg,
- H5C__trace_write_insert_entry_log_msg,
- H5C__trace_write_mark_entry_dirty_log_msg,
- H5C__trace_write_mark_entry_clean_log_msg,
- H5C__trace_write_mark_unserialized_entry_log_msg,
- H5C__trace_write_mark_serialized_entry_log_msg,
- H5C__trace_write_move_entry_log_msg,
- H5C__trace_write_pin_entry_log_msg,
- H5C__trace_write_create_fd_log_msg,
- H5C__trace_write_protect_entry_log_msg,
- H5C__trace_write_resize_entry_log_msg,
- H5C__trace_write_unpin_entry_log_msg,
- H5C__trace_write_destroy_fd_log_msg,
- H5C__trace_write_unprotect_entry_log_msg,
- H5C__trace_write_set_cache_config_log_msg,
- H5C__trace_write_remove_entry_log_msg};
+static const H5C_log_class_t H5C_trace_log_class_g = {"trace",
+ H5C__trace_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ NULL, /* write start message */
+ NULL, /* write stop message */
+ NULL, /* write create cache message */
+ NULL, /* write destroy cache message */
+ NULL, /* write evict cache message */
+ H5C__trace_write_expunge_entry_log_msg,
+ H5C__trace_write_flush_cache_log_msg,
+ H5C__trace_write_insert_entry_log_msg,
+ H5C__trace_write_mark_entry_dirty_log_msg,
+ H5C__trace_write_mark_entry_clean_log_msg,
+ H5C__trace_write_mark_unserialized_entry_log_msg,
+ H5C__trace_write_mark_serialized_entry_log_msg,
+ H5C__trace_write_move_entry_log_msg,
+ H5C__trace_write_pin_entry_log_msg,
+ H5C__trace_write_create_fd_log_msg,
+ H5C__trace_write_protect_entry_log_msg,
+ H5C__trace_write_resize_entry_log_msg,
+ H5C__trace_write_unpin_entry_log_msg,
+ H5C__trace_write_destroy_fd_log_msg,
+ H5C__trace_write_unprotect_entry_log_msg,
+ H5C__trace_write_set_cache_config_log_msg,
+ H5C__trace_write_remove_entry_log_msg};
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_log_message
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index 7a5c630..35d8dd0 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -154,19 +154,12 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned
* Programmer: John Mainzer
* 3/17/10
*
- * Changes: Updated sanity checks to allow for the possibility that
- * the slist is disabled.
- * JRM -- 8/3/20
- *
*-------------------------------------------------------------------------
*/
herr_t
H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr,
int mpi_rank, int mpi_size)
{
- int i;
- int m;
- unsigned n;
unsigned first_entry_to_flush;
unsigned last_entry_to_flush;
unsigned total_entries_to_clear = 0;
@@ -176,15 +169,13 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
unsigned entries_to_clear[H5C_RING_NTYPES];
haddr_t addr;
H5C_cache_entry_t *entry_ptr = NULL;
-
#if H5C_DO_SANITY_CHECKS
haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
-
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
char tbl_buf[1024];
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
-
+ unsigned m, n;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -204,7 +195,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
HDmemset(entries_to_clear, 0, sizeof(entries_to_clear));
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", FUNC, mpi_rank);
+ HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", __func__, mpi_rank);
HDmemset(tbl_buf, 0, sizeof(tbl_buf));
@@ -226,9 +217,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
} /* end if */
n = num_candidates / (unsigned)mpi_size;
- if (num_candidates % (unsigned)mpi_size > INT_MAX)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow")
- m = (int)(num_candidates % (unsigned)mpi_size);
+ m = num_candidates % (unsigned)mpi_size;
if (NULL ==
(candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
@@ -239,31 +228,31 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
candidate_assignment_table[mpi_size] = num_candidates;
if (m == 0) { /* mpi_size is an even divisor of num_candidates */
- for (i = 1; i < mpi_size; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
+ for (u = 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end if */
else {
- for (i = 1; i <= m; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;
+ for (u = 1; u <= m; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n + 1;
if (num_candidates < (unsigned)mpi_size) {
- for (i = m + 1; i < mpi_size; i++)
- candidate_assignment_table[i] = num_candidates;
+ for (u = m + 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = num_candidates;
} /* end if */
else {
- for (i = m + 1; i < mpi_size; i++)
- candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
+ for (u = m + 1; u < (unsigned)mpi_size; u++)
+ candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n;
} /* end else */
} /* end else */
HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates);
#if H5C_DO_SANITY_CHECKS
/* Verify that the candidate assignment table has the expected form */
- for (i = 1; i < mpi_size - 1; i++) {
+ for (u = 1; u < (unsigned)(mpi_size - 1); u++) {
unsigned a, b;
- a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
- b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];
+ a = candidate_assignment_table[u] - candidate_assignment_table[u - 1];
+ b = candidate_assignment_table[u + 1] - candidate_assignment_table[u];
HDassert(n + 1 >= a);
HDassert(a >= b);
@@ -275,18 +264,18 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- for (i = 0; i < 1024; i++)
- tbl_buf[i] = '\0';
+ for (u = 0; u < 1024; u++)
+ tbl_buf[u] = '\0';
HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
- for (i = 0; i <= mpi_size; i++)
- HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]);
+ for (u = 0; u <= (unsigned)mpi_size; u++)
+ HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]);
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
- HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", FUNC, mpi_rank, first_entry_to_flush,
+ HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush,
last_entry_to_flush);
- HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank);
+ HDfprintf(stdout, "%s:%d: marking entries.\n", __func__, mpi_rank);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
for (u = 0; u < num_candidates; u++) {
@@ -354,9 +343,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#if H5C_DO_SANITY_CHECKS
m = 0;
n = 0;
- for (i = 0; i < H5C_RING_NTYPES; i++) {
- m += (int)entries_to_flush[i];
- n += entries_to_clear[i];
+ for (u = 0; u < H5C_RING_NTYPES; u++) {
+ m += entries_to_flush[u];
+ n += entries_to_clear[u];
} /* end if */
HDassert((unsigned)m == total_entries_to_flush);
@@ -364,8 +353,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", FUNC, mpi_rank, num_candidates,
- total_entries_to_clear, total_entries_to_flush);
+ HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", __func__, mpi_rank,
+ num_candidates, total_entries_to_clear, total_entries_to_flush);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
/* We have now marked all the entries on the candidate list for
@@ -930,7 +919,9 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial)
entry_ptr = prev_ptr;
} /* end while */
+#ifdef H5C_DO_SANITY_CHECKS
done:
+#endif /* H5C_DO_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_clear_coll_entries */
@@ -957,10 +948,8 @@ H5C__collective_write(H5F_t *f)
int * length_array = NULL;
MPI_Aint * buf_array = NULL;
MPI_Aint * offset_array = NULL;
- MPI_Datatype btype;
- hbool_t btype_created = FALSE;
- MPI_Datatype ftype;
- hbool_t ftype_created = FALSE;
+ MPI_Datatype btype = MPI_BYTE;
+ MPI_Datatype ftype = MPI_BYTE;
int mpi_code;
char unused = 0; /* Unused, except for non-NULL pointer value */
size_t buf_count;
@@ -1032,7 +1021,6 @@ H5C__collective_write(H5F_t *f)
if (MPI_SUCCESS !=
(mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- btype_created = TRUE;
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -1040,7 +1028,6 @@ H5C__collective_write(H5F_t *f)
if (MPI_SUCCESS !=
(mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- ftype_created = TRUE;
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -1048,10 +1035,6 @@ H5C__collective_write(H5F_t *f)
buf_count = 1;
} /* end if */
else {
- /* Pass trivial buf type, file type to the file driver */
- btype = MPI_BYTE;
- ftype = MPI_BYTE;
-
/* Set non-NULL pointer for I/O operation */
base_buf = &unused;
@@ -1074,9 +1057,9 @@ done:
offset_array = (MPI_Aint *)H5MM_xfree(offset_array);
/* Free MPI Types */
- if (btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
+ if (MPI_BYTE != btype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if (ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
+ if (MPI_BYTE != ftype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
/* Reset transfer mode in API context, if changed */
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 623e52f..78d6f35 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -115,20 +115,20 @@
#define H5C__CURR_CACHE_IMAGE_CTL_VER 1
/* Default configuration settings */
-#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
-#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
+#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999
+#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9
#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
#define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
-#define H5C__DEF_AR_INCREMENT 2.0f
+#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5
+#define H5C__DEF_AR_INCREMENT 2.0
#define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024))
-#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
-#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
-#define H5C__DEF_AR_DECREMENT 0.9f
+#define H5C__DEF_AR_FLASH_MULTIPLE 1.0
+#define H5C__DEV_AR_FLASH_THRESHOLD 0.25
+#define H5C__DEF_AR_DECREMENT 0.9
#define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024))
#define H5C__DEF_AR_EPCHS_B4_EVICT 3
-#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
+#define H5C__DEF_AR_EMPTY_RESERVE 0.05
#define H5C__MIN_AR_EPOCH_LENGTH 100
#define H5C__DEF_AR_EPOCH_LENGTH 50000
#define H5C__MAX_AR_EPOCH_LENGTH 1000000
@@ -2242,10 +2242,10 @@ herr_t H5C_verify_tag(int id, haddr_t tag);
H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f);
H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr);
H5_DLL herr_t H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr);
-H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+H5_DLL herr_t H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr);
-H5_DLL herr_t H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr);
-H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr);
+H5_DLL herr_t H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr);
+H5_DLL herr_t H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr);
H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr,
hbool_t *is_dirty_ptr, hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr,
hbool_t *is_corked_ptr, hbool_t *is_flush_dep_parent_ptr,
@@ -2290,7 +2290,7 @@ H5_DLL herr_t H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring);
H5_DLL herr_t H5C_remove_entry(void *thing);
H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr);
H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
-H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
+H5_DLL herr_t H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
/* Logging functions */
H5_DLL herr_t H5C_start_logging(H5C_t *cache);
@@ -2321,4 +2321,4 @@ H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_c
H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr);
#endif /* NDEBUG */
-#endif /* !_H5Cprivate_H */
+#endif /* H5Cprivate_H */
diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h
index 0e6fb84..79ece10 100644
--- a/src/H5Cpublic.h
+++ b/src/H5Cpublic.h
@@ -31,15 +31,34 @@
extern "C" {
#endif
-enum H5C_cache_incr_mode { H5C_incr__off, H5C_incr__threshold };
+enum H5C_cache_incr_mode {
+ H5C_incr__off,
+ /**<Automatic cache size increase is disabled, and the remaining increment fields are ignored.*/
-enum H5C_cache_flash_incr_mode { H5C_flash_incr__off, H5C_flash_incr__add_space };
+ H5C_incr__threshold
+ /**<Automatic cache size increase is enabled using the hit rate threshold algorithm.*/
+};
+
+enum H5C_cache_flash_incr_mode {
+ H5C_flash_incr__off,
+ /**<Flash cache size increase is disabled.*/
+
+ H5C_flash_incr__add_space
+ /**<Flash cache size increase is enabled using the add space algorithm.*/
+};
enum H5C_cache_decr_mode {
H5C_decr__off,
+ /**<Automatic cache size decrease is disabled.*/
+
H5C_decr__threshold,
+ /**<Automatic cache size decrease is enabled using the hit rate threshold algorithm.*/
+
H5C_decr__age_out,
+ /**<Automatic cache size decrease is enabled using the ageout algorithm. */
+
H5C_decr__age_out_with_threshold
+ /**<Automatic cache size decrease is enabled using the ageout with hit rate threshold algorithm.*/
};
#ifdef __cplusplus
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index d8e2a72..710ce2a 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -114,8 +114,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
- uint32_t *cur_num_entries_ptr)
+H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -151,7 +151,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr)
+H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -184,7 +184,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr)
+H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -201,7 +201,7 @@ H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr)
if (cache_ptr->cache_accesses > 0)
*hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses));
else
- *hit_rate_ptr = 0.0f;
+ *hit_rate_ptr = 0.0;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -405,7 +405,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
+H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5D.c b/src/H5D.c
index 2f0daaf..7153c7d 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -228,7 +228,7 @@ H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) {
+ H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID")
@@ -437,7 +437,7 @@ H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID")
@@ -531,7 +531,7 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -557,8 +557,9 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_
{
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
- (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -566,11 +567,17 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_
if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace */
- if (H5VL_dataset_get(*vol_obj_ptr, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, token_ptr,
- &ret_value) < 0)
+ if (H5VL_dataset_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_space.space_id;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_space_api_common() */
@@ -591,7 +598,7 @@ done:
hid_t
H5Dget_space(hid_t dset_id)
{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -640,7 +647,7 @@ H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) {
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID,
@@ -664,8 +671,9 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dset_id, allocation);
@@ -674,9 +682,12 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE_STATUS;
+ vol_cb_args.args.get_space_status.status = allocation;
+
/* Get dataspace status */
- if ((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, allocation)) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
@@ -699,8 +710,9 @@ done:
hid_t
H5Dget_type(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -709,11 +721,17 @@ H5Dget_type(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_TYPE;
+ vol_cb_args.args.get_type.type_id = H5I_INVALID_HID;
+
/* Get the datatype */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_type.type_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_type() */
@@ -737,8 +755,9 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -747,11 +766,17 @@ H5Dget_create_plist(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_DCPL;
+ vol_cb_args.args.get_dcpl.dcpl_id = H5I_INVALID_HID;
+
/* Get the dataset creation property list */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_dcpl.dcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_create_plist() */
@@ -792,8 +817,9 @@ done:
hid_t
H5Dget_access_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -802,11 +828,17 @@ H5Dget_access_plist(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_DAPL;
+ vol_cb_args.args.get_dapl.dapl_id = H5I_INVALID_HID;
+
/* Get the dataset access property list */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_dapl.dapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_access_plist() */
@@ -829,8 +861,10 @@ done:
hsize_t
H5Dget_storage_size(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- hsize_t ret_value = 0; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hsize_t storage_size = 0; /* Storage size of dataset */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", dset_id);
@@ -839,11 +873,17 @@ H5Dget_storage_size(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_STORAGE_SIZE;
+ vol_cb_args.args.get_storage_size.storage_size = &storage_size;
+
/* Get the storage size */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
+ /* Set return value */
+ ret_value = storage_size;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_storage_size() */
@@ -862,8 +902,11 @@ done:
haddr_t
H5Dget_offset(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- haddr_t ret_value = HADDR_UNDEF; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ haddr_t dset_offset = HADDR_UNDEF; /* Dataset's offset */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE1("a", "i", dset_id);
@@ -872,11 +915,18 @@ H5Dget_offset(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_offset.offset = &dset_offset;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_OFFSET;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the offset */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
+ /* Set return value */
+ ret_value = dset_offset;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_offset() */
@@ -941,7 +991,11 @@ done:
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
* the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * defined when the dataset was created. The MEM_SPACE_ID can
+ * also be the constant H5S_BLOCK, which indicates that the
+ * buffer provided is a single contiguous block of memory, with
+ * the same # of elements as specified in the FILE_SPACE_ID
+ * selection.
*
* The number of elements in the memory dataspace must match
* the number of elements in the file dataspace.
@@ -1011,7 +1065,7 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1032,13 +1086,15 @@ done:
*---------------------------------------------------------------------------
*/
herr_t
-H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf)
+H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
+ H5TRACE5("e", "ii*h*Iux", dset_id, dxpl_id, offset, filters, buf);
/* Check arguments */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -1056,11 +1112,20 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_read.offset = offset;
+ dset_opt_args.chunk_read.filters = 0;
+ dset_opt_args.chunk_read.buf = buf;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_READ;
+ vol_cb_args.args = &dset_opt_args;
+
/* Read the raw chunk */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset,
- filters, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
+ /* Set return value */
+ *filters = dset_opt_args.chunk_read.filters;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dread_chunk() */
@@ -1126,7 +1191,11 @@ done:
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
* the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * defined when the dataset was created. The MEM_SPACE_ID can
+ * also be the constant H5S_BLOCK, which indicates that the
+ * buffer provided is a single contiguous block of memory, with
+ * the same # of elements as specified in the FILE_SPACE_ID
+ * selection.
*
* The number of elements in the memory dataspace must match
* the number of elements in the file dataspace.
@@ -1198,7 +1267,7 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1222,9 +1291,11 @@ 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)
{
- H5VL_object_t *vol_obj = NULL;
- uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
@@ -1250,9 +1321,16 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_write.offset = offset;
+ dset_opt_args.chunk_write.filters = filters;
+ dset_opt_args.chunk_write.size = data_size_32;
+ dset_opt_args.chunk_write.buf = buf;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_WRITE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Write chunk */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters,
- offset, data_size_32, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
@@ -1348,7 +1426,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_
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")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator")
if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
@@ -1447,7 +1525,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf
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")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator")
if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
@@ -1642,9 +1720,18 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s
&supported) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation")
if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_vlen_buf_size.type_id = type_id;
+ dset_opt_args.get_vlen_buf_size.space_id = space_id;
+ dset_opt_args.get_vlen_buf_size.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Make the 'get_vlen_buf_size' callback */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id, space_id, size) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
} /* end if */
else {
@@ -1673,7 +1760,8 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1687,9 +1775,12 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_SET_EXTENT;
+ vol_cb_args.args.set_extent.size = size;
+
/* Set the extent */
- if ((ret_value = H5VL_dataset_specific(*vol_obj_ptr, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
- token_ptr, size)) < 0)
+ if (H5VL_dataset_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
@@ -1755,7 +1846,7 @@ H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_lin
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE6(FUNC, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0)
+ H5ARG_TRACE6(__func__, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1775,8 +1866,9 @@ done:
herr_t
H5Dflush(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1789,12 +1881,15 @@ H5Dflush(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_FLUSH;
+ vol_cb_args.args.flush.dset_id = dset_id;
+
/* Flush dataset information cached in memory
* XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t
* callback needs it and that's in the public API.
*/
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
@@ -1802,41 +1897,6 @@ done:
} /* H5Dflush */
/*-------------------------------------------------------------------------
- * Function: H5Dwait
- *
- * Purpose: Wait for all operations on a dataset.
- * Tang: added for async
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Dwait(hid_t dset_id)
-{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", dset_id);
-
- /* Check args */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
-
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(dset_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
-
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_WAIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "unable to wait dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Dwait*/
-
-/*-------------------------------------------------------------------------
* Function: H5Drefresh
*
* Purpose: Refreshes all buffers associated with a dataset.
@@ -1848,8 +1908,9 @@ done:
herr_t
H5Drefresh(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1862,9 +1923,12 @@ H5Drefresh(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_REFRESH;
+ vol_cb_args.args.refresh.dset_id = dset_id;
+
/* Refresh the dataset object */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
@@ -1891,8 +1955,9 @@ done:
herr_t
H5Dformat_convert(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1905,9 +1970,12 @@ H5Dformat_convert(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_FORMAT_CONVERT;
+ vol_cb_args.args = NULL;
+
/* Convert the dataset */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
@@ -1929,8 +1997,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dset_id, idx_type);
@@ -1941,9 +2011,13 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/)
if (NULL == idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_idx_type.idx_type = idx_type;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the chunk indexing type */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, idx_type) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
@@ -1968,8 +2042,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*hx", dset_id, offset, chunk_nbytes);
@@ -1982,9 +2058,14 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n
if (NULL == chunk_nbytes)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_storage_size.offset = offset;
+ dset_opt_args.get_chunk_storage_size.size = chunk_nbytes;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the dataset creation property list */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, offset, chunk_nbytes) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
@@ -2015,8 +2096,10 @@ done:
herr_t
H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iix", dset_id, fspace_id, nchunks);
@@ -2027,10 +2110,15 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/)
if (NULL == nchunks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_num_chunks.space_id = fspace_id;
+ dset_opt_args.get_num_chunks.nchunks = nchunks;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the number of written chunks */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, nchunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
done:
FUNC_LEAVE_API(ret_value);
@@ -2062,9 +2150,11 @@ herr_t
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;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ hsize_t nchunks = 0; /* Number of chunks */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "iihxxxx", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size);
@@ -2076,19 +2166,33 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_num_chunks.space_id = fspace_id;
+ dset_opt_args.get_num_chunks.nchunks = &nchunks;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the number of written chunks to check range */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, &nchunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
/* Check range for chunk index */
if (chk_index >= nchunks)
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_info_by_idx.space_id = fspace_id;
+ dset_opt_args.get_chunk_info_by_idx.chk_index = chk_index;
+ dset_opt_args.get_chunk_info_by_idx.offset = offset;
+ dset_opt_args.get_chunk_info_by_idx.filter_mask = filter_mask;
+ dset_opt_args.get_chunk_info_by_idx.addr = addr;
+ dset_opt_args.get_chunk_info_by_idx.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX;
+ vol_cb_args.args = &dset_opt_args;
+
/* Call private function to get the chunk info given the chunk's index */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index")
done:
FUNC_LEAVE_API(ret_value);
@@ -2119,8 +2223,10 @@ herr_t
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;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*hxxx", dset_id, offset, filter_mask, addr, size);
@@ -2134,11 +2240,99 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte
if (NULL == offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_info_by_coord.offset = offset;
+ dset_opt_args.get_chunk_info_by_coord.filter_mask = filter_mask;
+ dset_opt_args.get_chunk_info_by_coord.addr = addr;
+ dset_opt_args.get_chunk_info_by_coord.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD;
+ vol_cb_args.args = &dset_opt_args;
+
/* Call private function to get the chunk info given the chunk's index */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_chunk_info_by_coord() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dchunk_iter
+ *
+ * Purpose: Iterates over all chunks in dataset with given callback and user data.
+ *
+ * Parameters:
+ * hid_t dset_id; IN: Chunked dataset ID
+ * hid_t dxpl_id; IN: Dataset transfer property list ID
+ * H5D_chunk_iter_op_t cb IN: User callback function, called for every chunk.
+ * void *op_data IN/OUT: Optional user data passed on to user callback.
+ *
+ * Callback information:
+ * H5D_chunk_iter_op_t is defined as:
+ *
+ * typedef int (*H5D_chunk_iter_op_t)(
+ * const hsize_t *offset,
+ * uint32_t filter_mask,
+ * haddr_t addr,
+ * uint32_t nbytes,
+ * void *op_data);
+ *
+ * H5D_chunk_iter_op_t parameters:
+ * hsize_t *offset; IN/OUT: Array of starting logical coordinates of chunk.
+ * uint32_t filter_mask; IN: Filter mask of chunk.
+ * haddr_t addr; IN: Offset in file of chunk data.
+ * uint32_t nbytes; IN: Size in number of bytes of chunk data in file.
+ * void *op_data; IN/OUT: Pointer to any user-defined data
+ * associated with the operation.
+ *
+ * The return values from an operator are:
+ * Zero (H5_ITER_CONT) causes the iterator to continue, returning zero when all
+ * elements have been processed.
+ * Positive (H5_ITER_STOP) causes the iterator to immediately return that positive
+ * value, indicating short-circuit success.
+ * Negative (H5_ITER_ERROR) causes the iterator to immediately return that value,
+ * indicating failure.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Gaute Hope
+ * August 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_data)
+{
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "iix*x", dset_id, dxpl_id, op, op_data);
+
+ /* Check arguments */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ if (NULL == op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration")
+
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_iter.op = op;
+ dset_opt_args.chunk_iter.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_ITER;
+ vol_cb_args.args = &dset_opt_args;
+
+ /* Iterate over the chunks */
+ if ((ret_value = H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_BADITER, H5E_BADITER, "error iterating over dataset chunks");
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dchunk_iter() */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 56f80f0..0cc1681 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -109,9 +109,9 @@
/*#define H5D_CHUNK_DEBUG */
/* Flags for the "edge_chunk_state" field below */
-#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */
+#define H5D_RDCC_DISABLE_FILTERS 0x01U /* Disable filters on this chunk */
#define H5D_RDCC_NEWLY_DISABLED_FILTERS \
- 0x02u /* Filters have been disabled since \
+ 0x02U /* Filters have been disabled since \
* the last flush */
/******************/
@@ -247,6 +247,11 @@ typedef struct H5D_chunk_coll_info_t {
} H5D_chunk_coll_info_t;
#endif /* H5_HAVE_PARALLEL */
+typedef struct H5D_chunk_iter_ud_t {
+ H5D_chunk_iter_op_t op; /* User defined callback */
+ void * op_data; /* User data for user defined callback */
+} H5D_chunk_iter_ud_t;
+
/********************/
/* Local Prototypes */
/********************/
@@ -270,6 +275,7 @@ static herr_t H5D__chunk_dest(H5D_t *dset);
static int H5D__get_num_chunks_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
+static int H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata);
/* "Nonexistent" layout operation callback */
static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq,
@@ -598,8 +604,6 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
HDassert(offset);
HDassert(storage_size);
- *storage_size = 0;
-
/* Allocate dataspace and initialize it if it hasn't been. */
if (!(*layout->ops->is_space_alloc)(&layout->storage))
HGOTO_DONE(SUCCEED)
@@ -713,10 +717,8 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize
} /* end for */
/* Get the "down" sizes for each dimension */
- if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
- if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
+ H5VM_array_down(ndims, layout->chunks, layout->down_chunks);
+ H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2649,8 +2651,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_
/* Issue selection I/O call (we can skip the page buffer because we've
* already verified it won't be used, and the metadata accumulator
* because this is raw data) */
- if (num_chunks > 0 &&
- H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks,
+ if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks,
(const H5S_t *const *)chunk_mem_spaces,
(const H5S_t *const *)chunk_file_spaces, chunk_addrs, element_sizes,
bufs) < 0)
@@ -2985,8 +2986,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize
/* Issue selection I/O call (we can skip the page buffer because we've
* already verified it won't be used, and the metadata accumulator
* because this is raw data) */
- if (num_chunks > 0 &&
- H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks,
+ if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks,
(const H5S_t *const *)chunk_mem_spaces,
(const H5S_t *const *)chunk_file_spaces, chunk_addrs, element_sizes,
bufs) < 0)
@@ -4645,7 +4645,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
+H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[])
{
const H5D_t * dset = io_info->dset; /* the dataset pointer */
H5D_chk_idx_info_t idx_info; /* Chunked index info */
@@ -5374,7 +5374,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
* order of offset in the file.
*/
if (need_addr_sort)
- HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
+ HDqsort(chunk_disp_array, (size_t)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,
@@ -6409,6 +6409,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
if (udata->chunk_in_cache) {
HDassert(H5F_addr_defined(chunk_rec->chunk_addr));
+ HDassert(ent);
HDassert(H5F_addr_defined(ent->chunk_block.offset));
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
@@ -7840,3 +7841,146 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_chunk_info_by_coord() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_iter_cb
+ *
+ * Purpose: Call the user-defined function with the chunk data. The iterator continues if
+ * the user-defined function returns H5_ITER_CONT, and stops if H5_ITER_STOP is
+ * returned.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ * Failure: Negative (H5_ITER_ERROR)
+ *
+ * Programmer: Gaute Hope
+ * August 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
+{
+ const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata;
+ int ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check for callback failure and pass along return value */
+ if ((ret_value = (data->op)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
+ chunk_rec->nbytes, data->op_data)) < 0)
+ HERROR(H5E_DATASET, H5E_CANTNEXT, "iteration operator failed");
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_iter_cb */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_iter
+ *
+ * Purpose: Iterate over all the chunks in the dataset with given callbak.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Gaute Hope
+ * August 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data)
+{
+ const H5O_layout_t *layout = NULL; /* Dataset layout */
+ const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */
+ H5D_rdcc_ent_t * ent; /* Cache entry index */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+
+ /* Check args */
+ HDassert(dset);
+ HDassert(dset->shared);
+
+ /* Get dataset layout and raw data chunk cache */
+ layout = &(dset->shared->layout);
+ rdcc = &(dset->shared->cache.chunk);
+ HDassert(layout);
+ HDassert(rdcc);
+ HDassert(H5D_CHUNKED == layout->type);
+
+ /* Search for cached chunks that haven't been written out */
+ for (ent = rdcc->head; ent; ent = ent->next)
+ /* Flush the chunk out to disk, to make certain the size is correct later */
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "cannot flush indexed storage buffer")
+
+ /* Compose chunked index info struct */
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.storage = &dset->shared->layout.storage.u.chunk;
+
+ /* If the dataset is not written, return without errors */
+ if (H5F_addr_defined(idx_info.storage->idx_addr)) {
+ H5D_chunk_iter_ud_t ud;
+
+ /* Set up info for iteration callback */
+ ud.op = op;
+ ud.op_data = op_data;
+
+ /* Iterate over the allocated chunks calling the iterator callback */
+ if ((ret_value =
+ (dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_iter_cb, &ud)) < 0)
+ HERROR(H5E_DATASET, H5E_CANTNEXT, "chunk iteration failed");
+ } /* end if H5F_addr_defined */
+
+done:
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5D__chunk_iter() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_get_offset_copy
+ *
+ * Purpose: Copies an offset buffer and performs bounds checks on the
+ * values.
+ *
+ * This helper function ensures that the offset buffer given
+ * by the user is suitable for use with the rest of the library.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
+{
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(dset);
+ HDassert(offset);
+ HDassert(offset_copy);
+
+ /* The library's chunking code requires the offset to terminate with a zero.
+ * So transfer the offset array to an internal offset array that we
+ * can properly terminate (handled via the memset call).
+ */
+ HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t));
+
+ for (u = 0; u < dset->shared->ndims; u++) {
+ /* Make sure the offset doesn't exceed the dataset's dimensions */
+ if (offset[u] > dset->shared->curr_dims[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset exceeds dimensions of dataset")
+
+ /* Make sure the offset fall right on a chunk's boundary */
+ if (offset[u] % dset->shared->layout.u.chunk.dim[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset doesn't fall on chunks's boundary")
+
+ offset_copy[u] = offset[u];
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_get_offset_copy() */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index f68a93a..c79bae0 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -47,6 +47,15 @@
/* Local Typedefs */
/******************/
+/* Callback info for I/O operation when file driver
+ * wishes to do its own memory management
+ */
+typedef struct H5D_compact_iovv_memmanage_ud_t {
+ H5F_shared_t *f_sh; /* Shared file for dataset */
+ void * dstbuf; /* Pointer to buffer to be read into/written into */
+ const void * srcbuf; /* Pointer to buffer to be read from/written from */
+} H5D_compact_iovv_memmanage_ud_t;
+
/********************/
/* Local Prototypes */
/********************/
@@ -56,6 +65,7 @@ static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm);
+static herr_t H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata);
static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
@@ -239,6 +249,48 @@ H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSE
} /* end H5D__compact_io_init() */
/*-------------------------------------------------------------------------
+ * Function: H5D__compact_iovv_memmanage_cb
+ *
+ * Purpose: Callback operator for H5D__compact_readvv()/_writevv() to
+ * send a memory copy request to the underlying file driver.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
+{
+ H5D_compact_iovv_memmanage_ud_t *udata = (H5D_compact_iovv_memmanage_ud_t *)_udata;
+ H5FD_ctl_memcpy_args_t op_args;
+ uint64_t op_flags;
+ H5FD_t * file_handle = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Retrieve pointer to file driver structure for ctl call */
+ if (H5F_shared_get_file_driver(udata->f_sh, &file_handle) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle")
+
+ /* Setup operation flags and arguments */
+ op_flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL__FAIL_IF_UNKNOWN_FLAG;
+
+ op_args.dstbuf = udata->dstbuf;
+ op_args.dst_off = dst_off;
+ op_args.srcbuf = udata->srcbuf;
+ op_args.src_off = src_off;
+ op_args.len = len;
+
+ /* Make request to file driver */
+ if (H5FD_ctl(file_handle, H5FD_CTL__MEM_COPY, op_flags, &op_args, NULL) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__compact_iovv_memmanage_cb() */
+
+/*-------------------------------------------------------------------------
* Function: H5D__compact_readvv
*
* Purpose: Reads some data vectors from a dataset into a buffer.
@@ -267,11 +319,28 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *
HDassert(io_info);
- /* Use the vectorized memory copy routine to do actual work */
- if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr,
- io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr,
- dset_offset_arr)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ /* Check if file driver wishes to do its own memory management */
+ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) {
+ H5D_compact_iovv_memmanage_ud_t udata;
+
+ /* Set up udata for memory copy operation */
+ udata.f_sh = io_info->f_sh;
+ udata.dstbuf = io_info->u.rbuf;
+ udata.srcbuf = io_info->store->compact.buf;
+
+ /* Request that file driver does the memory copy */
+ if ((ret_value = H5VM_opvv(mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, dset_max_nseq,
+ dset_curr_seq, dset_size_arr, dset_offset_arr,
+ H5D__compact_iovv_memmanage_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ }
+ else {
+ /* Use the vectorized memory copy routine to do actual work */
+ if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr,
+ mem_offset_arr, io_info->store->compact.buf, dset_max_nseq,
+ dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -309,11 +378,28 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t
HDassert(io_info);
- /* Use the vectorized memory copy routine to do actual work */
- if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr,
- dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr,
- mem_offset_arr)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ /* Check if file driver wishes to do its own memory management */
+ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) {
+ H5D_compact_iovv_memmanage_ud_t udata;
+
+ /* Set up udata for memory copy operation */
+ udata.f_sh = io_info->f_sh;
+ udata.dstbuf = io_info->store->compact.buf;
+ udata.srcbuf = io_info->u.wbuf;
+
+ /* Request that file driver does the memory copy */
+ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, mem_max_nseq,
+ mem_curr_seq, mem_size_arr, mem_offset_arr, H5D__compact_iovv_memmanage_cb,
+ &udata)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ }
+ else {
+ /* Use the vectorized memory copy routine to do actual work */
+ if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq,
+ dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq,
+ mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
+ }
/* Mark the compact dataset's buffer as dirty */
*io_info->store->compact.dirty = TRUE;
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index b9edbef..d7ebbee 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -640,8 +640,7 @@ herr_t
H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- htri_t use_selection_io = FALSE; /* Whether to use selection I/O */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -657,10 +656,10 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize
/* Issue selection I/O call (we can skip the page buffer because we've
* already verified it won't be used, and the metadata accumulator
- * because this is raw data) Only call funciton if nelmts > 0. */
- if (nelmts > 0 && H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, 1,
- &mem_space, &file_space, &(io_info->store->contig.dset_addr),
- &dst_type_size, &(io_info->u.rbuf)) < 0)
+ * because this is raw data) */
+ if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0,
+ &mem_space, &file_space, &(io_info->store->contig.dset_addr),
+ &dst_type_size, &(io_info->u.rbuf)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous selection read failed")
} /* end if */
else
@@ -688,8 +687,7 @@ herr_t
H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- htri_t use_selection_io = FALSE; /* Whether to use selection I/O */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -705,10 +703,10 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz
/* Issue selection I/O call (we can skip the page buffer because we've
* already verified it won't be used, and the metadata accumulator
- * because this is raw data). Only call funciton if nelmts > 0. */
- if (nelmts > 0 && H5F_shared_select_write(
- H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, 1, &mem_space, &file_space,
- &(io_info->store->contig.dset_addr), &dst_type_size, &(io_info->u.wbuf)) < 0)
+ * because this is raw data) */
+ if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0,
+ &mem_space, &file_space, &(io_info->store->contig.dset_addr),
+ &dst_type_size, &(io_info->u.wbuf)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous selection write failed")
} /* end if */
else
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 1c66f26..61ecab26 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -233,13 +233,15 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- H5S_t * ds = NULL; /* Dataspace struct */
- int ndims; /* Dataset/space rank */
- hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_get_cb_args; /* Arguments to VOL callback */
+ H5VL_dataset_specific_args_t vol_spec_cb_args; /* Arguments to VOL callback */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ H5S_t * ds = NULL; /* Dataspace struct */
+ int ndims; /* Dataset/space rank */
+ hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
@@ -250,10 +252,14 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
if (!size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ /* Set up VOL callback arguments */
+ vol_get_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_get_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace pointer for the dataset */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) <
- 0)
+ if (H5VL_dataset_get(vol_obj, &vol_get_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
+ sid = vol_get_cb_args.args.get_space.space_id;
if (H5I_INVALID_HID == sid)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset")
if (NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
@@ -281,9 +287,12 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_spec_cb_args.op_type = H5VL_DATASET_SET_EXTENT;
+ vol_spec_cb_args.args.set_extent.size = dset_dims;
+
/* Increase size */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_dims)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_spec_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 24e8df2..abce233 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -1160,9 +1160,7 @@ done:
static herr_t
H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(layout);
@@ -1182,8 +1180,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
+ H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks);
/* Get the swizzled max number of chunks in each dimension */
H5MM_memcpy(swizzled_max_chunks, layout->max_chunks,
@@ -1191,13 +1188,10 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
- if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks,
- layout->u.earray.swizzled_max_down_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
- } /* end if */
+ H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks);
+ }
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_resize() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 207181a..6d3f4a3 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2853,13 +2853,14 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id
{
H5D_vlen_bufsize_generic_t vlen_bufsize = {
NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}};
- H5P_genplist_t * dxpl = NULL; /* DXPL for operation */
- H5S_t * mspace = NULL; /* Memory dataspace */
- char bogus; /* Bogus value to pass to H5Diterate() */
- H5S_t * space; /* Dataspace for iteration */
- H5T_t * type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * dxpl = NULL; /* DXPL for operation */
+ H5S_t * mspace = NULL; /* Memory dataspace */
+ char bogus; /* Bogus value to pass to H5Diterate() */
+ H5S_t * space; /* Dataspace for iteration */
+ H5T_t * type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2874,10 +2875,14 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id
/* Save the dataset */
vlen_bufsize.dset_vol_obj = vol_obj;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get a copy of the dataset's dataspace */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &vlen_bufsize.fspace_id) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace")
+ vlen_bufsize.fspace_id = vol_cb_args.args.get_space.space_id;
if (NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace")
@@ -3943,7 +3948,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__refresh(hid_t dset_id, H5D_t *dset)
+H5D__refresh(H5D_t *dset, hid_t dset_id)
{
H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */
hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
@@ -3968,7 +3973,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset)
} /* end if */
/* Refresh dataset object */
- if ((H5O_refresh_metadata(dset_id, dset->oloc)) < 0)
+ if ((H5O_refresh_metadata(&dset->oloc, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset")
done:
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 51c8e18..c245a5c 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -69,55 +69,6 @@ H5FL_BLK_DEFINE(type_conv);
H5FL_DEFINE(H5D_chunk_map_t);
/*-------------------------------------------------------------------------
- * Function: H5D__get_offset_copy
- *
- * Purpose: Copies an offset buffer and performs bounds checks on the
- * values.
- *
- * This helper function ensures that the offset buffer given
- * by the user is suitable for use with the rest of the library.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
-{
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(dset);
- HDassert(offset);
- HDassert(offset_copy);
-
- /* The library's chunking code requires the offset to terminate with a zero.
- * So transfer the offset array to an internal offset array that we
- * can properly terminate (handled via the calloc call).
- */
-
- HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t));
-
- for (u = 0; u < dset->shared->ndims; u++) {
- /* Make sure the offset doesn't exceed the dataset's dimensions */
- if (offset[u] > dset->shared->curr_dims[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
-
- /* Make sure the offset fall right on a chunk's boundary */
- if (offset[u] % dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
-
- offset_copy[u] = offset[u];
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* end H5D__get_offset_copy() */
-
-/*-------------------------------------------------------------------------
* Function: H5D__read
*
* Purpose: Reads (part of) a DATASET into application memory BUF. See
@@ -161,12 +112,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
/* check args */
HDassert(dataset && dataset->oloc.file);
-
- if (!file_space)
- file_space = dataset->shared->space;
- if (!mem_space)
- mem_space = file_space;
- nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
+ HDassert(file_space);
+ HDassert(mem_space);
/* Set up datatype info for operation */
if (H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0)
@@ -189,11 +136,12 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected")
- /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
+ /* Check for a NULL buffer */
if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
if (nelmts > 0)
@@ -225,7 +173,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
* Note that in general, this requires us to touch up the memory buffer as
* well.
*/
- if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
@@ -377,6 +325,8 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
/* check args */
HDassert(dataset && dataset->oloc.file);
+ HDassert(file_space);
+ HDassert(mem_space);
/* All filters in the DCPL must have encoding enabled. */
if (!dataset->shared->checked_filters) {
@@ -418,20 +368,13 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
} /* end else */
#endif /*H5_HAVE_PARALLEL*/
- /* Initialize dataspace information */
- if (!file_space)
- file_space = dataset->shared->space;
- if (!mem_space)
- mem_space = file_space;
-
- nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
-
/* Make certain that the number of elements in each selection is the same */
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected")
- /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
+ /* Check for a NULL buffer */
if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
if (nelmts > 0)
@@ -463,7 +406,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
* Note that in general, this requires us to touch up the memory buffer
* as well.
*/
- if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
@@ -845,11 +788,8 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
H5CX_set_mpio_actual_io_mode(H5D_MPIO_NO_COLLECTIVE);
} /* end if */
- /* Make any parallel I/O adjustments. Do not use collective code path if
- * we're using selection I/O - in this case the file driver will handle it.
- */
- /* Check for selection/vector support in file driver? -NAF */
- if (io_info->using_mpi_vfd /*&& !H5_use_selection_io_g*/) {
+ /* Make any parallel I/O adjustments */
+ if (io_info->using_mpi_vfd) {
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */
htri_t opt; /* Flag whether a selection is optimizable */
@@ -867,18 +807,31 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
/* Check if we can use the optimized parallel I/O routines */
if (opt == TRUE) {
- /* Override the I/O op pointers to the MPI-specific routines */
- io_info->io_ops.multi_read = dset->shared->layout.ops->par_read;
- io_info->io_ops.multi_write = dset->shared->layout.ops->par_write;
- io_info->io_ops.single_read = H5D__mpio_select_read;
- io_info->io_ops.single_write = H5D__mpio_select_write;
- } /* end if */
+ /* Override the I/O op pointers to the MPI-specific routines, unless
+ * selection I/O is to be used - in this case the file driver will
+ * handle collective I/O */
+ /* Check for selection/vector support in file driver? -NAF */
+ if (!io_info->use_select_io) {
+ io_info->io_ops.multi_read = dset->shared->layout.ops->par_read;
+ io_info->io_ops.multi_write = dset->shared->layout.ops->par_write;
+ io_info->io_ops.single_read = H5D__mpio_select_read;
+ io_info->io_ops.single_write = H5D__mpio_select_write;
+ } /* end if */
+ } /* end if */
else {
+ int comm_size = 0;
+
+ /* Retrieve size of MPI communicator used for file */
+ if ((comm_size = H5F_shared_mpi_get_size(io_info->f_sh)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator size")
+
/* Check if there are any filters in the pipeline. If there are,
- * we cannot break to independent I/O if this is a write operation;
- * otherwise there will be metadata inconsistencies in the file.
+ * we cannot break to independent I/O if this is a write operation
+ * with multiple ranks involved; otherwise, there will be metadata
+ * inconsistencies in the file.
*/
- if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) {
+ if (comm_size > 1 && io_info->op_type == H5D_IO_OP_WRITE &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0) {
H5D_mpio_no_collective_cause_t cause;
uint32_t local_no_collective_cause;
uint32_t global_no_collective_cause;
@@ -912,28 +865,40 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
for (cause = 1, idx = 0;
(cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len);
cause <<= 1, idx++) {
- size_t cause_strlen = HDstrlen(cause_strings[idx]);
-
if (cause & local_no_collective_cause) {
+ size_t local_buffer_space = sizeof(local_no_collective_cause_string) -
+ HDstrlen(local_no_collective_cause_string) - 1;
+
/* Check if there were any previous error messages included. If so, prepend a
* semicolon to separate the messages.
*/
- if (local_error_message_previously_written)
- HDstrncat(local_no_collective_cause_string, "; ", 2);
+ if (local_buffer_space && local_error_message_previously_written) {
+ HDstrncat(local_no_collective_cause_string, "; ", local_buffer_space);
+ local_buffer_space -= MIN(local_buffer_space, 2);
+ }
- HDstrncat(local_no_collective_cause_string, cause_strings[idx], cause_strlen);
+ if (local_buffer_space)
+ HDstrncat(local_no_collective_cause_string, cause_strings[idx],
+ local_buffer_space);
local_error_message_previously_written = TRUE;
} /* end if */
if (cause & global_no_collective_cause) {
+ size_t global_buffer_space = sizeof(global_no_collective_cause_string) -
+ HDstrlen(global_no_collective_cause_string) - 1;
+
/* Check if there were any previous error messages included. If so, prepend a
* semicolon to separate the messages.
*/
- if (global_error_message_previously_written)
- HDstrncat(global_no_collective_cause_string, "; ", 2);
-
- HDstrncat(global_no_collective_cause_string, cause_strings[idx], cause_strlen);
+ if (global_buffer_space && global_error_message_previously_written) {
+ HDstrncat(global_no_collective_cause_string, "; ", global_buffer_space);
+ global_buffer_space -= MIN(global_buffer_space, 2);
+ }
+
+ if (global_buffer_space)
+ HDstrncat(global_no_collective_cause_string, cause_strings[idx],
+ global_buffer_space);
global_error_message_previously_written = TRUE;
} /* end if */
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 86c0bf6..6c4fc12 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -504,6 +504,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
H5HL_t * heap; /* Pointer to local heap for EFL file names */
size_t heap_size = H5HL_ALIGN(1);
size_t u;
+ size_t name_offset;
/* Determine size of heap needed to stored the file names */
for (u = 0; u < efl->nused; ++u)
@@ -518,24 +519,22 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
+ if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
for (u = 0; u < efl->nused; ++u) {
- size_t offset; /* Offset of file name in heap */
-
/* Insert file name into heap */
- if (UFAIL ==
- (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
+ if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) <
+ 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
- } /* end if */
+ }
/* Store EFL file name offset */
- efl->slot[u].name_offset = offset;
- } /* end for */
+ efl->slot[u].name_offset = name_offset;
+ }
/* Release the heap */
if (H5HL_unprotect(heap) < 0)
diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h
index 292b624..596fd48 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{lineno} H5D_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5D_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5D_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} 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 5f8a586..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 */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 22712ee..e6b6143 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -565,6 +565,7 @@ H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_
unsigned *filter_mask, haddr_t *offset, hsize_t *size);
H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask,
haddr_t *addr, hsize_t *size);
+H5_DLL herr_t H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data);
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,
@@ -574,7 +575,7 @@ H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags);
-H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
+H5_DLL herr_t H5D__refresh(H5D_t *dataset, hid_t dset_id);
/* To convert a dataset's chunk indexing type to v1 B-tree */
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
@@ -631,7 +632,8 @@ H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata);
H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
-H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite,
+ const hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
@@ -648,7 +650,7 @@ H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5
H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size);
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store);
-H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
+H5_DLL herr_t H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
uint32_t data_size, const void *buf);
H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, void *buf);
@@ -739,4 +741,4 @@ H5_DLL herr_t H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type);
H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused);
#endif /* H5D_TESTING */
-#endif /*_H5Dpkg_H*/
+#endif /*H5Dpkg_H*/
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index f9ef772..ad9794d 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -79,11 +79,12 @@
#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \
"local_no_collective_cause" /* cause of broken collective I/O in each process */
#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \
- "global_no_collective_cause" /* cause of broken collective I/O in all processes */
-#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
-#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
-#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
-#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
+ "global_no_collective_cause" /* cause of broken collective I/O in all processes */
+#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
+#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
+#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
+#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
+#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
/* Collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index ce4ce84..c496414 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -28,99 +28,220 @@
/*****************/
/* Macros used to "unset" chunk cache configuration parameters */
-#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1)
-#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1)
-#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
+#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT SIZE_MAX
+#define H5D_CHUNK_CACHE_NBYTES_DEFAULT SIZE_MAX
+#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0)
-/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
+/**
+ * Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts()
+ */
#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
/*******************/
/* 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_LAYOUT_ERROR = -1, /**< error */
+ H5D_COMPACT = 0, /**< raw data is small (< 64KB) */
+ H5D_CONTIGUOUS = 1, /**< contiguous layout */
+ H5D_CHUNKED = 2, /**< chunked or tiled layout */
+ 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,
- H5D_ALLOC_TIME_EARLY = 1,
- H5D_ALLOC_TIME_LATE = 2,
- H5D_ALLOC_TIME_INCR = 3
+ H5D_ALLOC_TIME_ERROR = -1, /**< Error */
+ H5D_ALLOC_TIME_DEFAULT = 0, /**< \todo Define this! */
+ H5D_ALLOC_TIME_EARLY = 1, /**< Allocate on creation */
+ H5D_ALLOC_TIME_LATE = 2, /**< Allocate on first write */
+ H5D_ALLOC_TIME_INCR = 3 /**< Allocate incrementally (by chunk) */
} 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_ERROR = -1, /**< Error */
+ H5D_SPACE_STATUS_NOT_ALLOCATED = 0, /**< Space has not been allocated for this dataset. */
+ H5D_SPACE_STATUS_PART_ALLOCATED = 1, /**< Space has been allocated for this dataset. */
+ H5D_SPACE_STATUS_ALLOCATED = 2 /**< Space has been partially allocated for this dataset. (Used only for
+ datasets with chunked storage.) */
} 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_ERROR = -1, /**< Error */
+ H5D_FILL_TIME_ALLOC = 0, /**< Fill on allocation */
+ H5D_FILL_TIME_NEVER = 1, /**< Never write fill values */
+ H5D_FILL_TIME_IFSET = 2 /**< Fill if fill-value was set */
} 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_ERROR = -1, /**< Error */
+ H5D_FILL_VALUE_UNDEFINED = 0, /**< No fill value defined */
+ H5D_FILL_VALUE_DEFAULT = 1, /**< Default fill-value */
+ H5D_FILL_VALUE_USER_DEFINED = 2 /**< User-defined fill-value */
} 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_ERROR = -1, /**< Error */
+ H5D_VDS_FIRST_MISSING = 0, /**< \todo Define this! */
+ H5D_VDS_LAST_AVAILABLE = 1 /**< \todo Define this! */
} 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] -->
+/**
+ * \brief Callback for H5Pset_append_flush()
+ *
+ * \dset_id{dataset_id}
+ * \param[in] cur_dims The current extent of the dataset's dimensions
+ * \param[in,out] op_data User context
+ *
+ * \return \herr_t
+ *
+ */
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]
+//! <!-- [H5D_operator_t_snip] -->
+/**
+ * \brief Callback for H5Diterate()
+ *
+ * \param[in,out] elem Pointer to the memory buffer containing the current dataset
+ * element
+ * \param[in] type_id Datatype identifier of the elements stored in \p elem
+ * \param[in] ndim Number of dimensions for the \p point array
+ * \param[in] point Array containing the location of the element within
+ * the original dataspace
+ * \param[in,out] operator_data Pointer to any user-defined data associated with
+ * the operation
+ * \return \herr_t_iter
+ *
+ */
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]
+//! <!-- [H5D_operator_t_snip] -->
-/** Define the operator function pointer for H5Dscatter() */
-//! [H5D_scatter_func_t_snip]
+//! <!-- [H5D_scatter_func_t_snip] -->
+/**
+ * \brief Callback for H5Dscatter()
+ *
+ * \param[out] src_buf Pointer to the buffer holding the next set of elements to
+ * scatter. On entry, the value of where \p src_buf points to
+ * is undefined. The callback function should set \p src_buf
+ * to point to the next set of elements.
+ * \param[out] src_buf_bytes_used Pointer to the number of valid bytes in \p src_buf.
+ * On entry, the value where \p src_buf_bytes_used points
+ * to is undefined. The callback function should set
+ * \p src_buf_bytes_used to the of valid bytes in \p src_buf.
+ * This number must be a multiple of the datatype size.
+ * \param[in,out] op_data User-defined pointer to data required by the callback
+ * function. A pass-through of the \p op_data pointer provided
+ * with the H5Dscatter() function call.
+ * \return herr_t
+ *
+ * \details 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.
+ *
+ */
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]
+//! <!-- [H5D_scatter_func_t_snip] -->
-/** Define the operator function pointer for H5Dgather() */
-//! [H5D_gather_func_t_snip]
+//! <!-- [H5D_gather_func_t_snip] -->
+/**
+ * \brief Callback for H5Dgather()
+ *
+ * \param[in] dst_buf 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()
+ * \param[in] dst_buf_bytes_used Pointer to the number of valid bytes in
+ * \p dst_buf. This number must be a multiple of
+ * the datatype size.
+ * \param[in,out] op_data 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.
+ * \returns \herr_t
+ *
+ * \details The callback function should process, store, or otherwise make use
+ * of the data returned in 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 dst_buf. The callback
+ * function should return zero (0) to indicate success, and a negative
+ * value to indicate failure.
+ *
+ */
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]
+//! <!-- [H5D_gather_func_t_snip] -->
+
+//! <!-- [H5D_chunk_iter_op_t_snip] -->
+/**
+ * \brief Callback for H5Dchunk_iter()
+ *
+ * \param[in] offset Array of starting logical coordinates of chunk.
+ * \param[in] filter_mask Filter mask of chunk.
+ * \param[in] addr Offset in file of chunk data.
+ * \param[in] nbytes Size in bytes of chunk data in file.
+ * \param[in,out] op_data Pointer to any user-defined data associated with
+ * the operation.
+ * \returns \li Zero (#H5_ITER_CONT) causes the iterator to continue, returning
+ * zero when all elements have been processed.
+ * \li A positive value (#H5_ITER_STOP) causes the iterator to
+ * immediately return that value, indicating short-circuit success.
+ * \li A negative (#H5_ITER_ERROR) causes the iterator to immediately
+ * return that value, indicating failure.
+ */
+typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes,
+ void *op_data);
+//! <!-- [H5D_chunk_iter_op_t_snip] -->
/********************/
/* Public Variables */
@@ -140,7 +261,7 @@ extern "C" {
* \brief Creates a new dataset and links it into the file
*
* \fgdta_loc_id
- * \param[in] name Name of the dataset to create
+ * \param[in] name Name of the dataset to create
* \type_id
* \space_id
* \lcpl_id
@@ -165,13 +286,6 @@ extern "C" {
* \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
@@ -179,7 +293,7 @@ extern "C" {
*
* 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.
+ * 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
@@ -190,8 +304,8 @@ extern "C" {
* 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.
+ * \par Example
+ * \snippet H5D_examples.c create
*
* \since 1.8.0
*
@@ -203,26 +317,8 @@ H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t spa
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dcreate2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] name Name of the dataset to create
- * \type_id
- * \space_id
- * \lcpl_id
- * \dcpl_id
- * \dapl_id
- * \es_id
- *
- * \return \hid_t{dataset}
- *
- * \see H5Dcreate2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dcreate}
*/
H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id,
@@ -257,34 +353,14 @@ H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigne
* 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.
+ * when the file is closed.
*
* \since 1.8.0
*
- * \see H5Olink(), H5Dcreate(), Using Identifiers
+ * \see H5Olink(), H5Dcreate()
*
*/
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);
@@ -310,12 +386,6 @@ H5_DLL hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t d
* 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()
@@ -325,22 +395,8 @@ H5_DLL hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dopen2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] name Name of the dataset to open
- * \dapl_id
- * \es_id
- *
- * \return \hid_t{dataset}
- *
- * \see H5Dopen2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dopen}
*/
H5_DLL hid_t H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t dapl_id, hid_t es_id);
@@ -363,6 +419,9 @@ H5_DLL hid_t H5Dopen_async(const char *app_file, const char *app_func, unsigned
* be released with H5Sclose() when the identifier is no longer
* needed so that resource leaks will not occur.
*
+ * \par Example
+ * \snippet H5D_examples.c update
+ *
* \see H5Sclose()
*
*/
@@ -370,24 +429,29 @@ H5_DLL hid_t H5Dget_space(hid_t dset_id);
/**
* --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dget_space}
+ */
+H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
+ hid_t es_id);
+
+/**
+ * --------------------------------------------------------------------------
* \ingroup H5D
*
- * \brief Asynchronous version of H5Dget_space()
+ * \brief Determines whether space has been allocated for a dataset
*
- * \app_file
- * \app_func
- * \app_line
* \dset_id
- * \es_id
+ * \param[out] allocation Space allocation status
*
- * \return \hid_t{dataspace}
+ * \return \herr_t
*
- * \see H5Dget_space()
+ * \details H5Dget_space_status() determines whether space has been allocated
+ * for the dataset \p dset_id.
+ *
+ * \since 1.6.0
*
*/
-H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
- hid_t es_id);
-
H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
/**
@@ -405,27 +469,7 @@ H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
*
* 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.
+ * is read-only.
*
*/
H5_DLL hid_t H5Dget_type(hid_t dset_id);
@@ -445,9 +489,6 @@ H5_DLL hid_t H5Dget_type(hid_t dset_id);
* 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);
@@ -481,10 +522,6 @@ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
* 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
*
*/
@@ -503,11 +540,8 @@ H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
* \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.
- *
+ * H5Dget_storage_size() reports only the space required to store
+ * the dataset elements, excluding any metadata.
* \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
@@ -517,21 +551,19 @@ H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
* 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.
+ * \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 dataset
+ * element. H5Sget_simple_extent_npoints() and H5Tget_size()
+ * can be used to calculate that amount.
*
- * \attention H5Dget_storage_size() does not differentiate between 0 (zero),
+ * \warning 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);
@@ -588,7 +620,7 @@ H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hs
* 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.
+ * in for \p fspace_id. This will be fixed in a future release.
*
* \since 1.10.5
*
@@ -614,7 +646,7 @@ H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks
* 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 #HADDR_UNDEF, and the buffer \p
+ * 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
@@ -631,6 +663,35 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u
* --------------------------------------------------------------------------
* \ingroup H5D
*
+ * \brief Iterate over all chunks of a chunked dataset
+ *
+ * \dset_id
+ * \param[in] dxpl_id Identifier of a transfer property list
+ * \param[in] cb User callback function, called for every chunk.
+ * \param[in] op_data User-defined pointer to data required by op
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_chunk_iter iterates over all chunks in the dataset, calling the
+ * user supplied callback with the details of the chunk and the supplied
+ * context \p op_data.
+ *
+ * \par Example
+ * For each chunk, print the allocated chunk size (0 for un-allocated chunks).
+ * \snippet H5D_examples.c H5Dchunk_iter_cb
+ * Iterate over all chunked datasets and chunks in a file.
+ * \snippet H5D_examples.c H5Ovisit_cb
+ *
+ * \version 1.?.?
+ * \todo When was this function introduced?
+ *
+ */
+H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb, void *op_data);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5D
+ *
* \brief Retrieves information about a chunk specified by its index
*
* \dset_id
@@ -643,16 +704,16 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u
*
* \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
+ * \details H5Dget_chunk_info() retrieves the offset coordinates,
+ * \p offset, filter mask, \p filter_mask, size, \p size, and address
+ * \p addr for the dataset specified by the identifier \p dset_id and the chunk
+ * specified by the index \p index. The chunk belongs to a set of
+ * chunks in the selection specified by \p fspace_id. If the queried
* chunk does not exist in the file, the size will be set to 0 and
* address to #HADDR_UNDEF. The value pointed to by filter_mask will
- * not be modified. NULL can be passed in for any \p out parameters.
+ * not be modified. \c NULL can be passed in for any \p out parameters.
*
- * \p chk_idx is the chunk index in the selection. Index value
+ * \p chk_idx is the chunk index in the selection. The 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
@@ -666,9 +727,9 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u
* \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
+ * macro correctly. As a workaround, an 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.
+ * in for \p fspace_id. This will be fixed in a future release.
*
* \since 1.10.5
*
@@ -733,9 +794,8 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
* 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 number of elements selected in the memory dataspace \Emph{must}
+ * be equal to the number of elements selected in the file dataspace.
*
* The behavior of the library for the various combinations of
* valid dataspace identifiers and #H5S_ALL for the \p mem_space_id
@@ -780,14 +840,12 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
* </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.
+ * \note If no storage space was allocated for the dataset
+ * and a fill value is defined, the returned buffer \p buf
+ * is filled with the fill value.
*
- * \p dxpl_id can be the constant #H5P_DEFAULT, in which case the
- * default data transfer properties are used.
+ * \par Example
+ * \snippet H5D_examples.c read
*
*/
H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
@@ -795,25 +853,8 @@ H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dread()
- *
- * \app_file
- * \app_func
- * \app_line
- * \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
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Dread()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dread}
*/
H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
@@ -917,6 +958,8 @@ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned
* time if the dataset's fill time is set to #H5D_FILL_TIME_IFSET
* or #H5D_FILL_TIME_ALLOC.
*
+ * \par_compr_note
+ *
* \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
@@ -924,6 +967,9 @@ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned
* applications should always attempt to write identical data to
* the dataset from all processes.
*
+ * \par Example
+ * \snippet H5D_examples.c update
+ *
* \see H5Pset_fill_time(), H5Pset_alloc_time()
*
*/
@@ -932,25 +978,8 @@ H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dwrite()
- *
- * \app_file
- * \app_func
- * \app_line
- * \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
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Dwrite()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dwrite}
*/
H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
@@ -981,11 +1010,6 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne
* 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
@@ -1013,11 +1037,10 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne
* 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.
+ * with these processes before using this function.
*
- * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under
- * parallel and do not support variable length types.
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are currently not supported
+ * with parallel HDF5 and do not support variable-length types.
*
* \since 1.10.2
*
@@ -1055,10 +1078,10 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con
* 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
+ * The mask \p filters indicates which filters were used when the
+ * chunk was written. A zero value (all bits 0) 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
@@ -1072,8 +1095,8 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con
* 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.
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are currently not supported
+ * with parallel HDF5 and do not support variable-length datatypes.
*
* \since 1.10.2
*
@@ -1103,52 +1126,9 @@ H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset,
* 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.
+ * \attention 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
@@ -1198,30 +1178,25 @@ H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dset_id, hid_t type_id, hid_t space_id,
*
* \return \herr_t
*
- * \details H5Dfill() fills the dataspace selection in memory, \p space_id,
+ * \details H5Dfill() fills the dataspace selection, \p space_id, in memory
* 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.
+ * \p buf specifies the buffer in which the fill 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.
+ * 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()
+ * allocated dataset. It is often useful in such cases to fill
+ * the unused space with a known fill value.
+ *
+ * \see H5Pset_fill_value(), H5Pget_fill_value(), H5Pfill_value_defined(),
+ * H5Pset_fill_time(), H5Pget_fill_time(), H5Pcreate(), H5Dcreate_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);
@@ -1268,22 +1243,21 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf
* - 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.
+ * \note 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.
+ * \note 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.
+ * \note 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
*
@@ -1292,22 +1266,8 @@ H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dset_extent()
- *
- * \app_file
- * \app_func
- * \app_line
- * \dset_id
- * \param[in] size[] Array containing the new magnitude of each dimension
- * of the dataset
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Dset_extent()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dset_extent}
*/
H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t dset_id, const hsize_t size[], hid_t es_id);
@@ -1332,11 +1292,11 @@ H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, un
* open files. After that, the OS is responsible for ensuring
* that the data is actually flushed to disk.
*
+ * \since 1.10.0
+ *
*/
H5_DLL herr_t H5Dflush(hid_t dset_id);
-H5_DLL herr_t H5Dwait(hid_t dset_id);
-
/**
* --------------------------------------------------------------------------
* \ingroup H5D
@@ -1392,40 +1352,7 @@ H5_DLL herr_t H5Drefresh(hid_t dset_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.
+ * enough data to fill the selection has been retrieved.
*
* \since 1.10.2
*
@@ -1477,27 +1404,9 @@ H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hi
* 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,
+ * bytes to process the serialized data.
+ *
+ * The callback function \p op 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
@@ -1521,11 +1430,11 @@ H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
*
* \return \herr_t
*
- * \details H5Dclose() ends access to a dataset specified by \p dset_id
- * and releases resources used by it.
+ * \details H5Dclose() terminates access to a dataset via the identifier
+ * \p dset_id and releases the underlying resources.
*
- * \attention Further use of a released dataset identifier is illegal; a
- * function using such an identifier will generate an error.
+ * \par Example
+ * \snippet H5D_examples.c read
*
* \since 1.8.0
*
@@ -1536,29 +1445,19 @@ H5_DLL herr_t H5Dclose(hid_t dset_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5D
- *
- * \brief Asynchronous version of H5Dclose()
- *
- * \app_file
- * \app_func
- * \app_line
- * \dset_id
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Dclose()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Dclose}
*/
H5_DLL herr_t H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
hid_t es_id);
-
+/// \cond DEV
/* 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);
+/// \endcond
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1582,6 +1481,7 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
#define H5Dset_extent_async_wrap H5_NO_EXPAND(H5Dset_extent_async)
#define H5Dclose_async_wrap H5_NO_EXPAND(H5Dclose_async)
#endif /* H5D_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -1608,9 +1508,178 @@ 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 loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
-H5_DLL hid_t H5Dopen1(hid_t loc_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}
+ *
+ * \deprecation_note{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}
+ *
+ * \deprecation_note{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
+ *
+ * \deprecation_note{H5Dset_extent()}
+ *
+ * \details H5Dextend() verifies that the dataset is at least of size \p size,
+ * extending it if necessary. The length of \p 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 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[]);
+/**
+ * --------------------------------------------------------------------------
+ * \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
+ *
+ * \deprecation_note{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 Function 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/H5Dvirtual.c b/src/H5Dvirtual.c
index ea38e0a..4012188 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -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") */
@@ -3151,7 +3151,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
- if (H5D__refresh(temp_id, *dset) < 0)
+ if (H5D__refresh(*dset, temp_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
diff --git a/src/H5E.c b/src/H5E.c
index 6d6dfd3..a5a9a2e 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -85,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, void **request);
static ssize_t H5E__get_num(const H5E_t *err_stack);
+static herr_t H5E__print2(hid_t err_stack, FILE *stream);
static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack);
/*********************/
@@ -245,6 +246,20 @@ H5E_term_package(void)
nstk = H5I_nmembers(H5I_ERROR_STACK);
if ((ncls + nmsg + nstk) > 0) {
+ /* Clear the default error stack. Note that
+ * the following H5I_clear_type calls do not
+ * force the clears and will not be able to
+ * clear any error message IDs that are still
+ * in use by the default error stack unless we
+ * clear that stack manually.
+ *
+ * Error message IDs will typically still be
+ * in use by the default error stack when the
+ * application does H5E_BEGIN/END_TRY cleanup
+ * at the very end.
+ */
+ H5E_clear_stack(NULL);
+
/* Clear any outstanding error stacks */
if (nstk > 0)
(void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE);
@@ -312,10 +327,10 @@ H5E__set_default_auto(H5E_t *stk)
#endif /* H5_USE_16_API_DEFAULT */
stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1;
- stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2;
+ stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2;
stk->auto_op.is_default = TRUE;
#else /* H5_NO_DEPRECATED_SYMBOLS */
- stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2;
+ stk->auto_op.func2 = (H5E_auto2_t)H5E__print2;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
stk->auto_data = NULL;
@@ -624,7 +639,7 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
/* Set the user's buffer, if provided */
if (name) {
- HDstrncpy(name, cls->cls_name, MIN((size_t)(len + 1), size));
+ HDstrncpy(name, cls->cls_name, size);
if ((size_t)len >= size)
name[size - 1] = '\0';
} /* end if */
@@ -981,11 +996,12 @@ H5E__get_current_stack(void)
if (H5I_inc_ref(current_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message")
new_error->min_num = current_error->min_num;
- if (NULL == (new_error->func_name = H5MM_xstrdup(current_error->func_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if (NULL == (new_error->file_name = H5MM_xstrdup(current_error->file_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- new_error->line = current_error->line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ new_error->func_name = current_error->func_name;
+ new_error->file_name = current_error->file_name;
+ new_error->line = current_error->line;
if (NULL == (new_error->desc = H5MM_xstrdup(current_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end for */
@@ -1101,11 +1117,12 @@ H5E__set_current_stack(H5E_t *estack)
if (H5I_inc_ref(new_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
current_error->min_num = new_error->min_num;
- if (NULL == (current_error->func_name = H5MM_xstrdup(new_error->func_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if (NULL == (current_error->file_name = H5MM_xstrdup(new_error->file_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- current_error->line = new_error->line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ current_error->func_name = new_error->func_name;
+ current_error->file_name = new_error->file_name;
+ current_error->line = new_error->line;
if (NULL == (current_error->desc = H5MM_xstrdup(new_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end for */
@@ -1433,13 +1450,37 @@ done:
herr_t
H5Eprint2(hid_t err_stack, FILE *stream)
{
- H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/
+ /* Print error stack */
+ if ((ret_value = H5E__print2(err_stack, stream)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Eprint2() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E__print2
+ *
+ * Purpose: Internal helper routine for H5Eprint2.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E__print2(hid_t err_stack, FILE *stream)
+{
+ H5E_t *estack; /* Error stack to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
@@ -1459,8 +1500,8 @@ H5Eprint2(hid_t err_stack, FILE *stream)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Eprint2() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5E__print2() */
/*-------------------------------------------------------------------------
* Function: H5Ewalk2
@@ -1532,7 +1573,8 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou
H5E_auto_op_t op; /* Error stack function */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(FAIL)
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE3("e", "ixx", estack_id, func, client_data);
if (estack_id == H5E_DEFAULT) {
@@ -1540,8 +1582,13 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
/* Get the automatic error reporting information */
if (H5E__get_auto(estack, &op, client_data) < 0)
@@ -1598,8 +1645,13 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Get the automatic error reporting information */
@@ -1646,7 +1698,8 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(FAIL)
+ /* Don't clear the error stack! :-) */
+ FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE2("e", "i*Iu", estack_id, is_stack);
if (estack_id == H5E_DEFAULT) {
@@ -1654,8 +1707,13 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else {
+ /* Only clear the error stack if it's not the default stack */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ } /* end else */
/* Check if the error stack reporting function is the "newer" stack type */
if (is_stack)
@@ -1757,11 +1815,12 @@ H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack)
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;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ dst_error->func_name = src_error->func_name;
+ dst_error->file_name = src_error->file_name;
+ 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")
diff --git a/src/H5EA.c b/src/H5EA.c
index 4d6b7c1..8f9a4b6 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -116,39 +116,40 @@ H5FL_BLK_DEFINE(ea_native_elmt);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL,
- H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata))
+static H5EA_t *
+H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata)
+{
+ H5EA_t * ea = NULL; /* Pointer to new extensible array */
+ H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
+ H5EA_t * ret_value = NULL;
- /* Local variables */
- H5EA_t * ea = NULL; /* Pointer to new extensible array */
- H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
+ FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Allocate extensible array wrapper */
if (NULL == (ea = H5FL_CALLOC(H5EA_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for extensible array info")
/* Lock the array header into memory */
if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to load extensible array header")
/* Check for pending array deletion */
if (from_open && hdr->pending_delete)
- H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTOPENOBJ, NULL, "can't open extensible array pending deletion")
/* Point extensible array wrapper at header and bump it's ref count */
ea->hdr = hdr;
if (H5EA__hdr_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
/* Increment # of files using this array header */
if (H5EA__hdr_fuse_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared array header")
/* Set file pointer for this array open context */
ea->f = f;
@@ -156,15 +157,16 @@ BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL,
/* Set the return value */
ret_value = ea;
- CATCH
+done:
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to release extensible array header")
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(STATIC) /* end H5EA__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__new() */
/*-------------------------------------------------------------------------
* Function: H5EA_create
@@ -179,16 +181,16 @@ END_FUNC(STATIC) /* end H5EA__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL,
- H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
-
- /* Local variables */
+H5EA_t *
+H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)
+{
H5EA_t *ea = NULL; /* Pointer to new extensible array */
haddr_t ea_addr; /* Array header address */
+ H5EA_t *ret_value = NULL;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(cparam);
@@ -197,22 +199,23 @@ BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL,
/* Create extensible array header */
if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create extensible array header")
/* Allocate and initialize new extensible array wrapper */
if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for extensible array wrapper")
/* Set the return value */
ret_value = ea;
- CATCH
-
+done:
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_create() */
/*-------------------------------------------------------------------------
* Function: H5EA_open
@@ -227,31 +230,33 @@ END_FUNC(PRIV) /* end H5EA_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
+H5EA_t *
+H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata)
+{
+ H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
+ H5EA_t *ret_value = NULL;
- /* Local variables */
- H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
+ FUNC_ENTER_NOAPI(NULL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Allocate and initialize new extensible array wrapper */
if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for extensible array wrapper")
/* Set the return value */
ret_value = ea;
- CATCH
-
+done:
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_open() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_open() */
/*-------------------------------------------------------------------------
* Function: H5EA_get_nelmts
@@ -265,20 +270,20 @@ END_FUNC(PRIV) /* end H5EA_open() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts))
-
- /* Local variables */
+herr_t
+H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(nelmts);
/* Retrieve the max. index set */
*nelmts = ea->hdr->stats.stored.max_idx_set;
-END_FUNC(PRIV) /* end H5EA_get_nelmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_nelmts() */
/*-------------------------------------------------------------------------
* Function: H5EA_get_addr
@@ -292,13 +297,12 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, haddr_t *addr))
-
- /* Local variables */
+herr_t
+H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(ea->hdr);
HDassert(addr);
@@ -306,7 +310,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, hadd
/* Retrieve the address of the extensible array's header */
*addr = ea->hdr->addr;
-END_FUNC(PRIV) /* end H5EA_get_addr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_addr() */
/*-------------------------------------------------------------------------
* Function: H5EA__lookup_elmt
@@ -321,12 +326,11 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc,
- void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
- H5EA__unprotect_func_t *thing_unprot_func))
-
- /* Local variables */
+static herr_t
+H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc, void **thing,
+ uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
+ H5EA__unprotect_func_t *thing_unprot_func)
+{
H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */
H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */
H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */
@@ -336,10 +340,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */
hbool_t stats_changed = FALSE; /* Whether array statistics changed */
hbool_t hdr_dirty = FALSE; /* Whether the array header changed */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
HDassert(thing);
@@ -365,17 +370,18 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Create the index block */
hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed);
if (!H5F_addr_defined(hdr->idx_blk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create index block")
hdr_dirty = TRUE;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
- (unsigned long long)hdr->idx_blk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Check if element is in index block */
if (idx < hdr->cparam.idx_blk_elmts) {
@@ -416,21 +422,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off,
hdr->sblk_info[sblk_idx].dblk_nelmts);
if (!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array data block")
/* Set data block address in index block */
iblock->dblk_addrs[dblk_idx] = dblk_addr;
iblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx],
hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)iblock->dblk_addrs[dblk_idx])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)iblock->dblk_addrs[dblk_idx])
/* Adjust index to offset in data block */
elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts;
@@ -438,9 +446,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check if there is already a dependency on the header */
if (will_extend && !dblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block and header, index = %llu",
- (unsigned long long)idx)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block and header, index = %llu",
+ (unsigned long long)idx)
dblock->has_hdr_depend = TRUE;
} /* end if */
@@ -465,21 +474,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Create super block */
sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx);
if (!H5F_addr_defined(sblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array super block")
/* Set super block address in index block */
iblock->sblk_addrs[sblk_off] = sblk_addr;
iblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect super block */
if (NULL == (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx,
thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)iblock->sblk_addrs[sblk_off])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)iblock->sblk_addrs[sblk_off])
/* Compute the data block index in super block */
dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts);
@@ -498,7 +509,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
dblk_addr =
H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts);
if (!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array data block")
/* Set data block address in index block */
sblock->dblk_addrs[dblk_idx] = dblk_addr;
@@ -508,8 +520,8 @@ 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,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between super block and header, address "
"= %llu",
(unsigned long long)sblock->addr)
@@ -517,7 +529,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
} /* end if */
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Adjust index to offset in data block */
@@ -548,29 +560,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
/* Create the data block page */
if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0)
- H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page")
/* Mark data block page as initialized in super block */
H5VM_bit_set(sblock->page_init, page_init_idx, TRUE);
sblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect data block page */
if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Check if there is already a dependency on the header */
if (will_extend && !dblk_page->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block page and header, "
- "index = %llu",
- (unsigned long long)idx)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block page and header, "
+ "index = %llu",
+ (unsigned long long)idx)
dblk_page->has_hdr_depend = TRUE;
} /* end if */
@@ -584,15 +596,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx],
sblock->dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect extensible array data block, address = %llu",
- (unsigned long long)sblock->dblk_addrs[dblk_idx])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)sblock->dblk_addrs[dblk_idx])
/* Check if there is already a dependency on the header */
if (will_extend && !dblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block and header, index = %llu",
(unsigned long long)idx)
dblock->has_hdr_depend = TRUE;
@@ -611,7 +623,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
HDassert(*thing != NULL);
HDassert(*thing_unprot_func != NULL);
- CATCH
+done:
/* Reset 'thing' info on error */
if (ret_value < 0) {
*thing = NULL;
@@ -627,20 +639,22 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check for header modified */
if (hdr_dirty)
if (H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL,
+ "unable to mark extensible array header as modified")
/* Release resources */
if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block")
/* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */
if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block")
if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block")
if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block page")
-END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__lookup_elmt() */
/*-------------------------------------------------------------------------
* Function: H5EA_set
@@ -654,9 +668,9 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
-
- /* Local variables */
+herr_t
+H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt)
+{
H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
@@ -664,10 +678,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
hbool_t will_extend; /* Flag indicating if setting the element will extend the array */
unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
@@ -678,7 +693,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
will_extend = (idx >= hdr->stats.stored.max_idx_set);
if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx,
&thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata")
/* Sanity check */
HDassert(thing);
@@ -695,15 +710,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
/* Update the max index for the array */
hdr->stats.stored.max_idx_set = idx + 1;
if (H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
- } /* end if */
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL,
+ "unable to mark extensible array header as modified")
+ }
- CATCH
+done:
/* Release resources */
if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_set() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_set() */
/*-------------------------------------------------------------------------
* Function: H5EA_get
@@ -717,17 +734,18 @@ END_FUNC(PRIV) /* end H5EA_set() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
-
- /* Local variables */
+herr_t
+H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt)
+{
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 =
NULL; /* Function pointer for unprotecting the array metadata */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
@@ -735,7 +753,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
if (idx >= hdr->stats.stored.max_idx_set) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else {
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
@@ -747,13 +765,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
/* Look up the array metadata containing the element we want to set */
if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx,
&thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata")
/* Check if the thing holding the element has been created yet */
if (NULL == thing) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else
/* Get element from thing's element buffer */
@@ -761,12 +779,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
hdr->cparam.cls->nat_elmt_size);
} /* end else */
- CATCH
+done:
/* Release thing */
if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_get() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_get() */
/*-------------------------------------------------------------------------
* Function: H5EA_depend
@@ -781,14 +800,15 @@ END_FUNC(PRIV) /* end H5EA_get() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent))
+herr_t
+H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent)
+{
+ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
HDassert(parent);
@@ -807,13 +827,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_
/* Add the extensible array as a child of the parent (proxy) */
if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "unable to add extensible array as child of proxy")
hdr->parent = parent;
- } /* end if */
-
- CATCH
+ }
-END_FUNC(PRIV) /* end H5EA_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_depend() */
/*-------------------------------------------------------------------------
* Function: H5EA_close
@@ -827,15 +847,16 @@ END_FUNC(PRIV) /* end H5EA_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
-
- /* Local variables */
+herr_t
+H5EA_close(H5EA_t *ea)
+{
hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
/* Close the header, if it was set */
@@ -868,8 +889,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
/* Check the header's status in the metadata cache */
if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET,
- "unable to check metadata cache status for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for extensible array header")
/* Sanity checks on header */
HDassert(hdr_status & H5AC_ES__IN_CACHE);
@@ -881,7 +902,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
/* Lock the array header into memory */
/* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTLOAD, FAIL, "unable to load extensible array header")
/* Set the shared array header's file context for this operation */
hdr->f = ea->f;
@@ -891,11 +912,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
* immediately -QAK)
*/
if (H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
/* Delete array, starting with header (unprotects header) */
if (H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array")
} /* end if */
else {
/* Decrement the reference count on the array header */
@@ -903,16 +925,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
* immediately -QAK)
*/
if (H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
} /* end else */
} /* end if */
/* Release the extensible array wrapper */
ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea);
- CATCH
-
-END_FUNC(PRIV) /* end H5EA_close() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_close() */
/*-------------------------------------------------------------------------
* Function: H5EA_delete
@@ -926,21 +949,22 @@ END_FUNC(PRIV) /* end H5EA_close() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
+herr_t
+H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata)
+{
+ H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Lock the array header into memory */
if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
- (unsigned long long)ea_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
/* Check for files using shared array header */
if (hdr->file_rc)
@@ -951,17 +975,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_ad
/* Delete array now, starting with header (unprotects header) */
if (H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array")
hdr = NULL;
- } /* end if */
+ }
- CATCH
-
- /* Unprotect the header, if an error occurred */
+done:
+ /* Unprotect the header if an error occurred */
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PRIV) /* end H5EA_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA_iterate
@@ -975,13 +999,14 @@ END_FUNC(PRIV) /* end H5EA_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
- H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
-
- /* Local variables */
+int
+H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)
+{
uint8_t *elmt = NULL;
hsize_t u;
- int cb_ret = H5_ITER_CONT; /* Return value from callback */
+ int ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_NOAPI(H5_ITER_ERROR)
/* Check arguments */
HDassert(ea);
@@ -990,27 +1015,28 @@ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
/* Allocate space for a native array element */
if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, H5_ITER_ERROR,
+ "memory allocation failed for extensible array element")
/* Iterate over all elements in array */
- for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
+ for (u = 0; u < ea->hdr->stats.stored.max_idx_set && ret_value == H5_ITER_CONT; u++) {
/* Get array element */
if (H5EA_get(ea, u, elmt) < 0)
- H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array")
/* Make callback */
- if ((cb_ret = (*op)(u, elmt, udata)) < 0) {
- H5E_PRINTF(H5E_BADITER, "iterator function failed");
- H5_LEAVE(cb_ret)
- } /* end if */
- } /* end for */
-
- CATCH
+ if ((ret_value = (*op)(u, elmt, udata)) < 0) {
+ HERROR(H5E_EARRAY, H5E_BADITER, "iteration callback error");
+ break;
+ }
+ }
+done:
if (elmt)
elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
-END_FUNC(PRIV) /* end H5EA_iterate() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_iterate() */
/*-------------------------------------------------------------------------
* Function: H5EA_patch_file
@@ -1024,17 +1050,17 @@ END_FUNC(PRIV) /* end H5EA_iterate() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_patch_file(H5EA_t *ea, H5F_t *f))
-
- /* Local variables */
+herr_t
+H5EA_patch_file(H5EA_t *ea, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(f);
if (ea->f != f || ea->hdr->f != f)
ea->f = ea->hdr->f = f;
-END_FUNC(PRIV) /* end H5EA_patch_file() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_patch_file() */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 550627e..eeac1a2 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -221,12 +221,13 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->f);
@@ -235,7 +236,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f);
-END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_verify_chksum
@@ -250,13 +252,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -267,7 +271,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5EA__cache_hdr_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_deserialize
@@ -282,16 +287,17 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_cls_id_t id; /* ID of extensible array class, as found in file */
H5EA_hdr_t * hdr = NULL; /* Extensible array info */
H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata;
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(image);
@@ -301,24 +307,25 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate space for the extensible array data structure */
if (NULL == (hdr = H5EA__hdr_alloc(udata->f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array shared header")
/* Set the extensible array header's address */
hdr->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature")
+ if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_HDR_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array header version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version")
/* Extensible array class */
id = (H5EA_cls_id_t)*image++;
if (id >= H5EA_NUM_CLS_ID)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
hdr->cparam.cls = H5EA_client_class_g[id];
/* General array creation/configuration information */
@@ -379,20 +386,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Finish initializing extensible array header */
if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header")
HDassert(hdr->size == len);
/* Set return value */
ret_value = hdr;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header")
-END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_image_len
@@ -406,12 +413,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -419,7 +427,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = hdr->size;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_serialize
@@ -433,14 +442,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ FUNC_ENTER_STATIC_NOERR
+
/* check arguments */
HDassert(f);
HDassert(image);
@@ -488,7 +498,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_notify
@@ -502,11 +513,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(hdr);
@@ -538,23 +551,24 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on object header proxy */
if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent,
(void *)hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between extensible array and proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between extensible array and proxy")
hdr->parent = NULL;
} /* end if */
/* Detach from 'top' proxy for extensible array */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between header and "
+ "extensible array 'top' proxy")
/* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
} /* end if */
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
@@ -563,9 +577,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
else
HDassert(NULL == hdr->parent);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_free_icr
@@ -580,18 +594,23 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing))
+static herr_t
+H5EA__cache_hdr_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array header */
if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_get_initial_load_size
@@ -605,13 +624,14 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
H5EA_iblock_t iblock; /* Fake index block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -626,7 +646,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock);
-END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_iblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_verify_chksum
@@ -641,13 +662,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -658,7 +681,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_deserialize
@@ -673,17 +697,18 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_iblock_t *iblock = NULL; /* Index block info */
H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
size_t u; /* Local index variable */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(image);
@@ -691,28 +716,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array index block */
if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array index block")
/* Set the extensible array index block's address */
iblock->addr = hdr->idx_blk_addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature")
+ if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_IBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array index block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version")
/* Extensible array type */
if (*image++ != (uint8_t)hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Internal information */
@@ -721,7 +747,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) <
0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements")
image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size);
} /* end if */
@@ -757,14 +783,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = iblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block")
-END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_image_len
@@ -778,12 +804,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(iblock);
HDassert(image_len);
@@ -791,7 +818,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = iblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_iblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_serialize
@@ -805,14 +833,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(f);
@@ -843,7 +872,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts,
iblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements")
image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -874,9 +903,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_notify
@@ -890,11 +919,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(iblock);
@@ -905,9 +936,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on extensible array header */
if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between index block and header, address = %llu",
- (unsigned long long)iblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
@@ -923,30 +955,32 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on extensible array header */
if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between index block and header, address = %llu",
- (unsigned long long)iblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
/* Detach from 'top' proxy for extensible array */
if (iblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between index block and "
+ "extensible array 'top' proxy")
iblock->top_proxy = NULL;
} /* end if */
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_free_icr
@@ -961,18 +995,23 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_iblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array index block */
if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_get_initial_load_size
@@ -986,13 +1025,14 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
H5EA_sblock_t sblock; /* Fake super block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1026,7 +1066,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock);
-END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_verify_chksum
@@ -1041,13 +1082,15 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1058,7 +1101,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_deserialize
@@ -1073,17 +1117,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_sblock_t * sblock = NULL; /* Super block info */
H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
size_t u; /* Local index variable */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -1094,28 +1139,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array super block */
if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array super block")
/* Set the extensible array super block's address */
sblock->addr = udata->sblk_addr;
/* Magic number */
- if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature")
+ if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_SBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array super block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version")
/* Extensible array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Offset of block within the array's address space */
UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size);
@@ -1154,14 +1200,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = sblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block")
-END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_image_len
@@ -1175,12 +1221,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(sblock);
HDassert(image_len);
@@ -1188,7 +1235,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = sblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_serialize
@@ -1202,16 +1250,16 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
size_t u; /* Local index variable */
+ FUNC_ENTER_STATIC_NOERR
+
/* check arguments */
HDassert(f);
HDassert(image);
@@ -1260,7 +1308,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_notify
@@ -1274,11 +1323,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(sblock);
@@ -1289,8 +1340,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on index block */
if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between super block and index block, address = %llu",
(unsigned long long)sblock->addr)
break;
@@ -1299,8 +1350,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on extensible array header, if set */
if (sblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and header, address = %llu",
(unsigned long long)sblock->addr)
sblock->has_hdr_depend = FALSE;
@@ -1310,16 +1361,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on index block */
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and index block, address = %llu",
(unsigned long long)sblock->addr)
/* Destroy flush dependency on extensible array header, if set */
if (sblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and header, address = %llu",
(unsigned long long)sblock->addr)
sblock->has_hdr_depend = FALSE;
@@ -1328,8 +1379,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for extensible array */
if (sblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between super block and "
+ "extensible array 'top' proxy")
sblock->top_proxy = NULL;
} /* end if */
break;
@@ -1345,15 +1397,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_free_icr
@@ -1368,18 +1420,23 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_sblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array super block */
if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_get_initial_load_size
@@ -1393,13 +1450,14 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
H5EA_dblock_t dblock; /* Fake data block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1434,7 +1492,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock);
-END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_verify_chksum
@@ -1449,13 +1508,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1466,7 +1527,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_deserialize
@@ -1481,16 +1543,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_dblock_t * dblock = NULL; /* Data block info */
H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(udata);
@@ -1501,7 +1565,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array data block */
if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block")
HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) ||
(len == H5EA_DBLOCK_PREFIX_SIZE(dblock)));
@@ -1510,22 +1575,22 @@ 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))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature")
+ if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_DBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array data block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version")
/* Extensible array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Offset of block within the array's address space */
UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size);
@@ -1537,7 +1602,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Decode elements in data block */
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements")
image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1560,14 +1625,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblock;
- CATCH
+done:
/* Release resources */
if (!ret_value)
if (dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block")
-END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5EA__cache_dblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_image_len
@@ -1581,12 +1647,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(image_len);
@@ -1597,7 +1664,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock);
-END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_serialize
@@ -1611,14 +1679,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(f);
@@ -1651,7 +1720,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements")
image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1664,9 +1733,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_notify
@@ -1680,11 +1749,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(dblock);
@@ -1695,17 +1766,17 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block and parent, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Destroy flush dependency on extensible array header, if set */
if (dblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between direct block and header, address = %llu",
(unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
@@ -1715,15 +1786,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block and parent, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
/* Destroy flush dependency on extensible array header, if set */
if (dblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between data block and header, address = %llu",
(unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
@@ -1732,8 +1804,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for extensible array */
if (dblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block and "
+ "extensible array 'top' proxy")
dblock->top_proxy = NULL;
} /* end if */
break;
@@ -1749,15 +1822,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_free_icr
@@ -1772,18 +1845,23 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_dblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array data block */
if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_fsf_size
@@ -1814,12 +1892,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)
+{
const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -1828,7 +1907,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
*fsf_size = dblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_fsf_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_get_initial_load_size
@@ -1842,12 +1922,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1856,7 +1937,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr);
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblk_page_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_verify_chksum
@@ -1871,13 +1953,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1888,7 +1972,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_deserialize
@@ -1903,16 +1988,17 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */
H5EA_dblk_page_cache_ud_t *udata =
(H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -1922,7 +2008,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array data block page */
if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block page")
/* Set the extensible array data block page's information */
dblk_page->addr = udata->dblk_page_addr;
@@ -1933,7 +2020,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts,
udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements")
image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size);
/* Sanity check */
@@ -1954,14 +2041,13 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblk_page;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_image_len
@@ -1975,12 +2061,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblk_page);
HDassert(image_len);
@@ -1988,7 +2075,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = dblk_page->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblk_page_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_serialize
@@ -2002,14 +2090,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image,
- size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing)
+{
H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(f);
@@ -2024,7 +2114,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts,
dblk_page->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements")
image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size);
/* Compute metadata checksum */
@@ -2036,9 +2126,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_notify
@@ -2052,11 +2142,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)
+{
H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblk_page);
@@ -2067,8 +2159,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block page and parent, address = %llu",
(unsigned long long)dblk_page->addr)
break;
@@ -2077,10 +2169,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on extensible array header, if set */
if (dblk_page->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block page and header, "
- "address = %llu",
- (unsigned long long)dblk_page->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and header, "
+ "address = %llu",
+ (unsigned long long)dblk_page->addr)
dblk_page->has_hdr_depend = FALSE;
} /* end if */
break;
@@ -2088,27 +2180,27 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between data block page and parent, address = %llu",
(unsigned long long)dblk_page->addr)
/* Destroy flush dependency on extensible array header, if set */
if (dblk_page->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block page and header, "
- "address = %llu",
- (unsigned long long)dblk_page->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and header, "
+ "address = %llu",
+ (unsigned long long)dblk_page->addr)
dblk_page->has_hdr_depend = FALSE;
} /* end if */
/* 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")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and "
+ "extensible array 'top' proxy")
dblk_page->top_proxy = NULL;
} /* end if */
break;
@@ -2124,15 +2216,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_free_icr
@@ -2147,15 +2239,20 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing))
+static herr_t
+H5EA__cache_dblk_page_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array data block page */
if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page")
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_free_icr() */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 72d2f38..b0e564c 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -79,13 +79,16 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t obj_addr))
-
+herr_t
+H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- void * dbg_ctx = NULL; /* Extensible array debugging context */
+ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ void * dbg_ctx = NULL; /* Extensible array debugging context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Header...\n", indent, "");
@@ -137,13 +140,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Index Block Address:", hdr->idx_blk_addr);
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_debug
@@ -157,14 +161,17 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
-
+herr_t
+H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- void * dbg_ctx = NULL; /* Extensible array context */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -180,19 +187,20 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Sanity check */
HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr));
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
- (unsigned long long)hdr->idx_blk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, "");
@@ -216,7 +224,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) <
0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
} /* end if */
@@ -250,15 +258,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
} /* end for */
} /* end if */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block")
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__iblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_debug
@@ -272,14 +281,17 @@ END_FUNC(PKG) /* end H5EA__iblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr))
-
+herr_t
+H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- void * dbg_ctx = NULL; /* Extensible array context */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -295,18 +307,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Protect super block */
/* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */
if (NULL ==
(sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, "");
@@ -334,15 +347,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
} /* end for */
} /* end if */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block")
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__sblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_debug
@@ -356,16 +370,18 @@ END_FUNC(PKG) /* end H5EA__sblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts,
- haddr_t obj_addr))
-
+herr_t
+H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- void * dbg_ctx = NULL; /* Extensible array context */
- size_t u; /* Local index variable */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -382,17 +398,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* 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 = %" PRIuHADDR,
- addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %" PRIuHADDR, addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, "");
@@ -407,15 +423,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Call the class's 'debug' callback */
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block")
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__dblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_debug() */
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index b42599c..c0a92f0 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -84,22 +84,25 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
- H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent))
-
- /* Local variables */
+H5EA_dblk_page_t *
+H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent)
+{
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
+ H5EA_dblk_page_t *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the data block */
if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block page")
/* Share common array information */
if (H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblk_page->hdr = hdr;
/* Set non-zero internal fields */
@@ -107,17 +110,19 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
/* Allocate buffer for elements in data block page */
if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block page element buffer")
/* Set the return value */
ret_value = dblk_page;
- CATCH
+done:
if (!ret_value)
if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page")
-END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_create
@@ -131,19 +136,22 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr))
-
- /* Local variables */
+herr_t
+H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr)
+{
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Allocate the data block page */
if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for extensible array data block page")
/* Set info about data block page on disk */
dblk_page->addr = addr;
@@ -151,34 +159,39 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Clear any elements in data block page to fill value */
if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL,
+ "can't set extensible array data block page elements to class's fill value")
/* Cache the new extensible array data block page */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, FAIL, "can't add extensible array data block page to cache")
inserted = TRUE;
/* Add data block page as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL,
+ "unable to add extensible array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
- CATCH
+done:
if (ret_value < 0)
if (dblk_page) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblk_page) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, FAIL,
+ "unable to remove extensible array data block page from cache")
/* Destroy data block page */
if (H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to destroy extensible array data block page")
} /* end if */
-END_FUNC(PKG) /* end H5EA__dblk_page_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_protect
@@ -193,13 +206,14 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
- H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr,
- unsigned flags))
-
- /* Local variables */
+H5EA_dblk_page_t *
+H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr, unsigned flags)
+{
H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */
H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
+ H5EA_dblk_page_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -216,32 +230,34 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
/* Protect the data block page */
if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr,
&udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblk_page->top_proxy) {
/* Add data block page as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block page, if it was protected */
if (dblk_page &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT,
- "unable to unprotect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
} /* end if */
-
-END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_unprotect
@@ -256,22 +272,25 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags))
+herr_t
+H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
/* Unprotect the data block page */
if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
-END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_dest
@@ -285,7 +304,12 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page))
+herr_t
+H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
@@ -297,13 +321,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_
if (dblk_page->elmts) {
/* Free buffer for data block page elements */
if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to free extensible array data block element buffer")
dblk_page->elmts = NULL;
} /* end if */
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(dblk_page->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblk_page->hdr = NULL;
} /* end if */
@@ -313,6 +339,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_
/* Free the data block page itself */
dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__dblk_page_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_dest() */
diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c
index 45696c7..f17aae3 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -85,11 +85,13 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
- H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts))
+H5EA_dblock_t *
+H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ H5EA_dblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -98,11 +100,12 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
/* Allocate memory for the data block */
if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block")
/* Share common array information */
if (H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -118,18 +121,20 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
else {
/* Allocate buffer for elements in data block */
if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block element buffer")
} /* end else */
/* Set the return value */
ret_value = dblock;
- CATCH
+done:
if (!ret_value)
if (dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block")
-END_FUNC(PKG) /* end H5EA__dblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_create
@@ -143,14 +148,15 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off,
- size_t nelmts))
+haddr_t
+H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ haddr_t dblock_addr; /* Extensible array data block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- haddr_t dblock_addr; /* Extensible array data block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -159,7 +165,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the data block */
if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array data block")
/* Set size of data block on disk */
dblock->size = H5EA_DBLOCK_SIZE(dblock);
@@ -169,24 +176,27 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate space for the data block on disk */
if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array data block")
dblock->addr = dblock_addr;
/* Don't initialize elements if paged */
if (!dblock->npages)
/* Clear any elements in data block to fill value */
if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set extensible array data block elements to class's fill value")
/* Cache the new extensible array data block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array data block to cache")
inserted = TRUE;
/* Add data block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -203,25 +213,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of data block to return */
ret_value = dblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (dblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array data block from cache")
/* Release data block's disk space */
if (H5F_addr_defined(dblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release extensible array data block")
/* Destroy data block */
if (H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array data block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__dblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_sblk_idx
@@ -236,10 +250,12 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx))
+unsigned
+H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)
+{
+ unsigned sblk_idx = 0; /* Which superblock does this index fall in? */
- /* Local variables */
- unsigned sblk_idx; /* Which superblock does this index fall in? */
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -252,10 +268,8 @@ BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *h
H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t);
sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1));
- /* Set return value */
- ret_value = sblk_idx;
-
-END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
+ FUNC_LEAVE_NOAPI(sblk_idx)
+} /* end H5EA__dblock_sblk_idx() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_protect
@@ -269,13 +283,14 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
- H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts,
- unsigned flags))
-
- /* Local variables */
+H5EA_dblock_t *
+H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts, unsigned flags)
+{
H5EA_dblock_t * dblock; /* Extensible array data block */
H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ H5EA_dblock_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -294,32 +309,36 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
/* Protect the data block */
if (NULL ==
(dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblock->top_proxy) {
/* Add data block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
- } /* end if */
+ }
/* Set return value */
ret_value = dblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block, if it was protected */
if (dblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
- (unsigned long long)dblock->addr)
- } /* end if */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
+ }
-END_FUNC(PKG) /* end H5EA__dblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_unprotect
@@ -333,22 +352,26 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags))
+herr_t
+H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
/* Unprotect the data block */
if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
- CATCH
+done:
-END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_delete
@@ -362,11 +385,13 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts))
+herr_t
+H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -376,8 +401,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
/* Check if this is a paged data block */
if (dblk_nelmts > hdr->dblk_page_nelmts) {
@@ -395,20 +421,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Evict the data block page from the metadata cache */
/* (OK to call if it doesn't exist in the cache) */
if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTEXPUNGE, FAIL,
+ "unable to remove array data block page from metadata cache")
/* Advance to next page address */
dblk_page_addr += dblk_page_size;
} /* end for */
} /* end if */
- CATCH
+done:
/* Finished deleting data block in metadata cache */
if (dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block")
-END_FUNC(PKG) /* end H5EA__dblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_dest
@@ -422,7 +450,12 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dblock))
+herr_t
+H5EA__dblock_dest(H5EA_dblock_t *dblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
@@ -435,14 +468,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl
/* Free buffer for data block elements */
HDassert(dblock->nelmts > 0);
if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to free extensible array data block element buffer")
dblock->elmts = NULL;
dblock->nelmts = 0;
} /* end if */
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(dblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblock->hdr = NULL;
} /* end if */
@@ -452,6 +487,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl
/* Free the data block itself */
dblock = H5FL_FREE(H5EA_dblock_t, dblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__dblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_dest() */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 7f142af..2c68949 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -102,17 +102,21 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f))
+H5EA_hdr_t *
+H5EA__hdr_alloc(H5F_t *f)
+{
+ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ H5EA_hdr_t *ret_value = NULL;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
/* Allocate space for the shared information */
if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array shared header")
/* Set non-zero internal fields */
hdr->addr = HADDR_UNDEF;
@@ -126,12 +130,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f))
/* Set the return value */
ret_value = hdr;
- CATCH
+done:
if (!ret_value)
if (hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_init
@@ -168,12 +173,15 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
-
- /* Local variables */
+herr_t
+H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)
+{
hsize_t start_idx; /* First element index for each super block */
hsize_t start_dblk; /* First data block index for each super block */
size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -188,7 +196,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Allocate information for each super block */
if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, "memory allocation failed for super block info array")
/* Compute information about each super block */
start_idx = 0;
@@ -202,7 +210,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Advance starting indices for next super block */
start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts;
start_dblk += (hsize_t)hdr->sblk_info[u].ndblks;
- } /* end for */
+ }
/* Set size of header on disk (locally and in statistics) */
hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr);
@@ -210,12 +218,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Create the callback context, if there's one */
if (hdr->cparam.cls->crt_context) {
if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array client callback context")
+ }
-END_FUNC(PKG) /* end H5EA__hdr_init() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_init() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_alloc_elmts
@@ -229,11 +238,14 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts))
-
- /* Local variables */
+void *
+H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)
+{
void * elmts = NULL; /* Element buffer allocated */
unsigned idx; /* Index of element buffer factory in header */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -251,8 +263,8 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr,
/* Re-allocate array of element factories */
if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc)))
- H5E_THROW(H5E_CANTALLOC,
- "memory allocation failed for data block data element buffer factory array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block data element buffer factory array")
/* Zero out new elements allocated */
HDmemset(new_fac + hdr->elmt_fac.nalloc, 0,
@@ -266,22 +278,24 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr,
/* Check for un-initialized factory at index */
if (NULL == hdr->elmt_fac.fac[idx]) {
if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create data block data element buffer factory")
} /* end if */
/* Allocate buffer for elements in index block */
if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx])))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block data element buffer")
/* Set the return value */
ret_value = elmts;
- CATCH
+done:
if (!ret_value)
if (elmts)
elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_alloc_elmts() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_free_elmts
@@ -295,11 +309,13 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts))
-
- /* Local variables */
+herr_t
+H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)
+{
unsigned idx; /* Index of element buffer factory in header */
+ FUNC_ENTER_PACKAGE_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(nelmts > 0);
@@ -314,26 +330,30 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr,
HDassert(hdr->elmt_fac.fac[idx]);
elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__hdr_free_elmts() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_create
*
* Purpose: Creates a new extensible array header in the file
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Address of new header in the file
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Jun 17 2008
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
+haddr_t
+H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)
+{
+ H5EA_hdr_t *hdr = NULL; /* Extensible array header */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Extensible array header */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -347,39 +367,45 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Check for valid parameters */
if (cparam->raw_elmt_size == 0)
- H5E_THROW(H5E_BADVALUE, "element size must be greater than zero")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero")
if (cparam->max_nelmts_bits == 0)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements bits must be greater than zero")
if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u",
- (unsigned)H5EA_MAX_NELMTS_IDX_MAX)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "max. # of elements bits must be <= %u",
+ (unsigned)H5EA_MAX_NELMTS_IDX_MAX)
if (cparam->sup_blk_min_data_ptrs < 2)
- H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of data block pointers in super block must be >= two")
if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs))
- H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of data block pointers in super block must be power of two")
if (!POWER_OF_TWO(cparam->data_blk_min_elmts))
- H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of elements per data block must be power of two")
dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits;
if (dblk_page_nelmts < cparam->idx_blk_elmts)
- H5E_THROW(H5E_BADVALUE,
- "# of elements per data block page must be greater than # of elements in index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "# of elements per data block page must be greater than # of elements in index block")
/* Compute the number of elements in data blocks for first actual super block */
sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs);
dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts);
if (dblk_page_nelmts < dblk_nelmts)
- H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in "
- "first data block from super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements per data block page bits must be > # of elements in "
+ "first data block from super block")
if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits)
- H5E_THROW(H5E_BADVALUE,
- "max. # of elements per data block page bits must be <= max. # of elements bits")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements per data block page bits must be <= max. # of elements bits")
}
#endif /* NDEBUG */
/* Allocate space for the shared information */
if (NULL == (hdr = H5EA__hdr_alloc(f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array shared header")
/* Set the internal parameters for the array */
hdr->idx_blk_addr = HADDR_UNDEF;
@@ -389,49 +415,55 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Finish initializing extensible array header */
if (H5EA__hdr_init(hdr, ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, HADDR_UNDEF,
+ "initialization failed for extensible array header")
/* Allocate space for the header on disk */
if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array header")
/* Create 'top' proxy for extensible array entries */
if (hdr->swmr_write)
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create extensible array entry proxy")
/* Cache the new extensible array header */
if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array header to cache")
inserted = TRUE;
/* Add header as child of 'top' proxy */
if (hdr->top_proxy)
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
/* Set address of array header to return */
ret_value = hdr->addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (hdr) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(hdr) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array header from cache")
/* Release header's disk space */
if (H5F_addr_defined(hdr->addr) &&
H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free extensible array header")
/* Destroy header */
if (H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array header")
} /* end if */
-END_FUNC(PKG) /* end H5EA__hdr_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_incr
@@ -445,7 +477,12 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_incr(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -453,14 +490,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if (hdr->rc == 0)
if (H5AC_pin_protected_entry(hdr) < 0)
- H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPIN, FAIL, "unable to pin extensible array header")
/* Increment reference count on shared header */
hdr->rc++;
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_incr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_incr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_decr
@@ -474,7 +511,12 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_decr(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -487,12 +529,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr))
if (hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
if (H5AC_unpin_entry(hdr) < 0)
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin extensible array header")
+ }
-END_FUNC(PKG) /* end H5EA__hdr_decr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_decr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_incr
@@ -506,7 +548,10 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -514,21 +559,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
/* Increment file reference count on shared header */
hdr->file_rc++;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__hdr_fuse_incr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_decr
*
* Purpose: Decrement file reference count on shared array header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: The reference count of the header
+ * Failure: Can't fail
*
* Programmer: Quincey Koziol
* Aug 26 2008
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
+size_t
+H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)
+{
+ size_t ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -540,7 +592,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
/* Set return value */
ret_value = hdr->file_rc;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_fuse_decr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_modified
@@ -554,7 +607,12 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_modified(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -562,11 +620,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr))
/* Mark header as dirty in cache */
if (H5AC_mark_entry_dirty(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark extensible array header as dirty")
-END_FUNC(PKG) /* end H5EA__hdr_modified() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_modified() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_protect
@@ -580,12 +638,14 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL,
- H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags))
-
- /* Local variables */
+H5EA_hdr_t *
+H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags)
+{
H5EA_hdr_t * hdr; /* Extensible array header */
H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */
+ H5EA_hdr_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -601,27 +661,28 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL,
/* Protect the header */
if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
- (unsigned long long)ea_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
/* Create top proxy, if it doesn't exist */
if (hdr->swmr_write && NULL == hdr->top_proxy) {
/* Create 'top' proxy for extensible array entries */
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, NULL, "can't create extensible array entry proxy")
/* Add header as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
} /* end if */
/* Set return value */
ret_value = hdr;
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_protect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_unprotect
@@ -635,21 +696,24 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags))
+herr_t
+H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Unprotect the header */
if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu",
- (unsigned long long)hdr->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr)
-END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_delete
@@ -663,46 +727,48 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr))
-
- /* Local variables */
+herr_t
+H5EA__hdr_delete(H5EA_hdr_t *hdr)
+{
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
#ifndef NDEBUG
- {
- unsigned hdr_status = 0; /* Array header's status in the metadata cache */
+ unsigned hdr_status = 0; /* Array header's status in the metadata cache */
- /* Check the array header's status in the metadata cache */
- if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header")
+ /* Check the array header's status in the metadata cache */
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header")
- /* Sanity checks on array header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- } /* end block */
+ /* Sanity checks on array header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
#endif /* NDEBUG */
/* Check for index block */
if (H5F_addr_defined(hdr->idx_blk_addr)) {
/* Delete index block */
if (H5EA__iblock_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array index block")
} /* end if */
/* Set flags to finish deleting header on unprotect */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
+done:
/* Unprotect the header, deleting it if an error hasn't occurred */
if (H5EA__hdr_unprotect(hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_dest
@@ -716,7 +782,12 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_dest(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -725,7 +796,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Destroy the callback context */
if (hdr->cb_ctx) {
if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy extensible array client callback context")
} /* end if */
hdr->cb_ctx = NULL;
@@ -741,7 +813,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Check if this factory has been initialized */
if (hdr->elmt_fac.fac[u]) {
if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy extensible array header factory")
hdr->elmt_fac.fac[u] = NULL;
} /* end if */
} /* end for */
@@ -757,13 +830,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Destroy the 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy extensible array 'top' proxy")
hdr->top_proxy = NULL;
} /* end if */
/* Free the shared info itself */
hdr = H5FL_FREE(H5EA_hdr_t, hdr);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_dest() */
diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c
index 1ef7980..5afb28a 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -91,21 +91,25 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t *hdr))
+H5EA_iblock_t *
+H5EA__iblock_alloc(H5EA_hdr_t *hdr)
+{
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ H5EA_iblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the index block */
if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array index block")
/* Share common array information */
if (H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
iblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -121,27 +125,30 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t
if (NULL ==
(iblock->elmts = H5FL_BLK_MALLOC(
idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size))))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block data element buffer")
/* Allocate buffer for data block addresses in index block */
if (iblock->ndblk_addrs > 0)
if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block data block addresses")
/* Allocate buffer for super block addresses in index block */
if (iblock->nsblk_addrs > 0)
if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block super block addresses")
/* Set the return value */
ret_value = iblock;
- CATCH
+done:
if (!ret_value)
if (iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
-
-END_FUNC(PKG) /* end H5EA__iblock_alloc() */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_create
@@ -155,13 +162,15 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed))
+haddr_t
+H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)
+{
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ haddr_t iblock_addr; /* Extensible array index block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- haddr_t iblock_addr; /* Extensible array index block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -169,21 +178,24 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the index block */
if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array index block")
/* Set size of index block on disk */
iblock->size = H5EA_IBLOCK_SIZE(iblock);
/* 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)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array index block")
iblock->addr = iblock_addr;
/* Clear any elements in index block to fill value */
if (hdr->cparam.idx_blk_elmts > 0) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set extensible array index block elements to class's fill value")
} /* end if */
/* Reset any data block addresses in the index block */
@@ -204,13 +216,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Cache the new extensible array index block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF,
+ "can't add extensible array index block to cache")
inserted = TRUE;
/* Add index block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
iblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -229,25 +243,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of index block to return */
ret_value = iblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (iblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(iblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array index block from cache")
/* Release index block's disk space */
if (H5F_addr_defined(iblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release file space for extensible array index block")
/* Destroy index block */
if (H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array index block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_protect
@@ -261,10 +279,13 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags))
+H5EA_iblock_t *
+H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)
+{
+ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ H5EA_iblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -275,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_
/* Protect the index block */
if (NULL ==
(iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
- (unsigned long long)hdr->idx_blk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == iblock->top_proxy) {
/* Add index block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
iblock->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = iblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the index block, if it was protected */
if (iblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
- (unsigned long long)iblock->addr)
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
} /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_unprotect
@@ -313,22 +338,25 @@ 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))
+herr_t
+H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(iblock);
/* Unprotect the index block */
if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
- (unsigned long long)iblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
-END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_delete
@@ -342,10 +370,13 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr))
+herr_t
+H5EA__iblock_delete(H5EA_hdr_t *hdr)
+{
+ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -353,8 +384,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
- (unsigned long long)hdr->idx_blk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Check for index block having data block pointers */
if (iblock->ndblk_addrs > 0) {
@@ -370,7 +402,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Delete data block */
if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u],
hdr->sblk_info[sblk_idx].dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL,
+ "unable to delete extensible array data block")
iblock->dblk_addrs[u] = HADDR_UNDEF;
} /* end if */
@@ -396,19 +429,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Delete super block */
if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) <
0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL,
+ "unable to delete extensible array super block")
iblock->sblk_addrs[u] = HADDR_UNDEF;
- } /* end if */
- } /* end for */
- } /* end if */
+ }
+ }
+ }
- CATCH
+done:
/* Finished deleting index block in metadata cache */
if (iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block")
-END_FUNC(PKG) /* end H5EA__iblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_dest
@@ -422,7 +457,12 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *iblock))
+herr_t
+H5EA__iblock_dest(H5EA_iblock_t *iblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(iblock);
@@ -454,7 +494,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(iblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
iblock->hdr = NULL;
} /* end if */
@@ -464,6 +505,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl
/* Free the index block itself */
iblock = H5FL_FREE(H5EA_iblock_t, iblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__iblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_dest() */
diff --git a/src/H5EAint.c b/src/H5EAint.c
index 472cfb4..af7ff4c 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -79,8 +79,12 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Create a flush dependency between parent and child entry */
if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
-END_FUNC(PKG) /* end H5EA__create_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__create_flush_depend() */
/*-------------------------------------------------------------------------
* Function: H5EA__destroy_flush_depend
@@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Destroy a flush dependency between parent and child entry */
if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
-END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__destroy_flush_depend() */
diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c
index 8639217..30cb220 100644
--- a/src/H5EAsblock.c
+++ b/src/H5EAsblock.c
@@ -91,22 +91,25 @@ H5FL_BLK_DEFINE(page_init);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
- H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx))
+H5EA_sblock_t *
+H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)
+{
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ H5EA_sblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the index block */
if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array super block")
/* Share common array information */
if (H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
sblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -121,7 +124,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Allocate buffer for data block addresses in super block */
if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for super block data block addresses")
/* Check if # of elements in data blocks requires paging */
if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) {
@@ -141,7 +145,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Allocate buffer for all 'page init' bitmasks in super block */
if (NULL ==
(sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for super block page init bitmask")
/* Compute data block page size */
sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM;
@@ -150,12 +155,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Set the return value */
ret_value = sblock;
- CATCH
+done:
if (!ret_value)
if (sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block")
-END_FUNC(PKG) /* end H5EA__sblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_create
@@ -169,15 +175,16 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed,
- unsigned sblk_idx))
+haddr_t
+H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed, unsigned sblk_idx)
+{
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ haddr_t sblock_addr; /* Extensible array super block address */
+ haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- haddr_t sblock_addr; /* Extensible array super block address */
- haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -185,7 +192,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the super block */
if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array super block")
/* Set size of super block on disk */
sblock->size = H5EA_SBLOCK_SIZE(sblock);
@@ -195,7 +203,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate space for the super block on disk */
if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array super block")
sblock->addr = sblock_addr;
/* Reset data block addresses to "undefined" address value */
@@ -203,13 +212,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Cache the new extensible array super block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF,
+ "can't add extensible array super block to cache")
inserted = TRUE;
/* Add super block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
sblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -223,25 +234,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of super block to return */
ret_value = sblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (sblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(sblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array super block from cache")
/* Release super block's disk space */
if (H5F_addr_defined(sblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release extensible array super block")
/* Destroy super block */
if (H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array super block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__sblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_protect
@@ -255,13 +270,15 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
- H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx,
- unsigned flags))
-
- /* Local variables */
+H5EA_sblock_t *
+H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx,
+ unsigned flags)
+{
H5EA_sblock_t * sblock = NULL; /* Pointer to super block */
H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */
+ H5EA_sblock_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -279,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Protect the super block */
if (NULL ==
(sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)sblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == sblock->top_proxy) {
/* Add super block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
sblock->top_proxy = hdr->top_proxy;
- } /* end if */
+ }
/* Set return value */
ret_value = sblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the super block, if it was protected */
if (sblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
- (unsigned long long)sblock->addr)
- } /* end if */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
+ }
-END_FUNC(PKG) /* end H5EA__sblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_unprotect
@@ -317,22 +338,25 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags))
+herr_t
+H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(sblock);
/* Unprotect the super block */
if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
- (unsigned long long)sblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
-END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_delete
@@ -346,12 +370,14 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx))
-
- /* Local variables */
+herr_t
+H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx)
+{
H5EA_sblock_t *sblock = NULL; /* Pointer to super block */
size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -359,8 +385,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Protect super block */
if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)sblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
/* Iterate over data blocks */
for (u = 0; u < sblock->ndblks; u++) {
@@ -368,18 +395,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (H5F_addr_defined(sblock->dblk_addrs[u])) {
/* Delete data block */
if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array data block")
sblock->dblk_addrs[u] = HADDR_UNDEF;
} /* end if */
} /* end for */
- CATCH
+done:
/* Finished deleting super block in metadata cache */
if (sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block")
-END_FUNC(PKG) /* end H5EA__sblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_dest
@@ -393,7 +421,12 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sblock))
+herr_t
+H5EA__sblock_dest(H5EA_sblock_t *sblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(sblock);
@@ -413,7 +446,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(sblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
sblock->hdr = NULL;
} /* end if */
@@ -423,6 +457,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl
/* Free the super block itself */
sblock = H5FL_FREE(H5EA_sblock_t, sblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__sblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_dest() */
diff --git a/src/H5EAstat.c b/src/H5EAstat.c
index 47b9a86..5705cb8 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -80,17 +80,17 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats))
+herr_t
+H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /* Local variables */
-
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(stats);
/* Copy extensible array statistics */
H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
-END_FUNC(PRIV) /* end H5EA_get_stats() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_stats() */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index dd669fc..7924eaa 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -119,17 +119,19 @@ H5FL_DEFINE_STATIC(H5EA__ctx_cb_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata))
+static void *
+H5EA__test_crt_context(void *_udata)
+{
+ H5EA__test_ctx_t *ctx; /* Context for callbacks */
+ H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */
+ void * ret_value = NULL;
- /* Local variables */
- H5EA__test_ctx_t *ctx; /* Context for callbacks */
- H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */
-
- /* Sanity checks */
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Initialize the context */
ctx->bogus = H5EA__TEST_BOGUS_VAL;
@@ -138,9 +140,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata)
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_crt_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_crt_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_dst_context
@@ -155,18 +157,21 @@ END_FUNC(STATIC) /* end H5EA__test_crt_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5EA__test_dst_context(void *_ctx)
+{
H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus);
/* Release context structure */
ctx = H5FL_FREE(H5EA__test_ctx_t, ctx);
-END_FUNC(STATIC) /* end H5EA__test_dst_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_fill
@@ -181,18 +186,21 @@ END_FUNC(STATIC) /* end H5EA__test_dst_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_fill(void *nat_blk, size_t nelmts))
-
- /* Local variables */
+static herr_t
+H5EA__test_fill(void *nat_blk, size_t nelmts)
+{
uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(nat_blk);
HDassert(nelmts);
H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts);
-END_FUNC(STATIC) /* end H5EA__test_fill() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_fill() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_encode
@@ -207,12 +215,14 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx))
+static herr_t
+H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
- const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(raw);
@@ -223,13 +233,12 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check for callback action */
if (ctx->cb) {
if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0)
- H5E_THROW(H5E_BADVALUE, "extensible array testing callback action failed")
- } /* end if */
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "extensible array testing callback action failed")
+ }
/* Encode native elements into raw elements */
while (nelmts) {
- /* Encode element */
- /* (advances 'raw' pointer) */
+ /* Encode element - advances 'raw' pointer */
UINT64ENCODE(raw, *elmt);
/* Advance native element pointer */
@@ -237,11 +246,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Decrement # of elements to encode */
nelmts--;
- } /* end while */
+ }
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_encode() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_encode() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_decode
@@ -256,16 +265,17 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
#endif /* NDEBUG */
uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(raw);
HDassert(elmt);
@@ -274,8 +284,7 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Decode raw elements into native elements */
while (nelmts) {
- /* Decode element */
- /* (advances 'raw' pointer) */
+ /* Decode element - advances 'raw' pointer */
UINT64DECODE(raw, *elmt);
/* Advance native element pointer */
@@ -283,9 +292,10 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Decrement # of elements to decode */
nelmts--;
- } /* end while */
+ }
-END_FUNC(STATIC) /* end H5EA__test_decode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_decode() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_debug
@@ -300,12 +310,13 @@ END_FUNC(STATIC) /* end H5EA__test_decode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt))
-
- /* Local variables */
+static herr_t
+H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
+{
char temp_str[128]; /* Temporary string, for formatting */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(stream);
HDassert(elmt);
@@ -315,7 +326,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
-END_FUNC(STATIC) /* end H5EA__test_debug() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_crt_dbg_context
@@ -329,22 +341,25 @@ END_FUNC(STATIC) /* end H5EA__test_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr))
-
- /* Local variables */
+static void *
+H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)
+{
H5EA__ctx_cb_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_dst_dbg_context
@@ -358,17 +373,20 @@ END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_dbg_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5EA__test_dst_dbg_context(void *_ctx)
+{
H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
HDassert(_ctx);
/* Release context structure */
ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx);
-END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_dst_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__get_cparam_test
@@ -383,7 +401,10 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
+herr_t
+H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(ea);
@@ -397,7 +418,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *e
cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts;
cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits;
-END_FUNC(PKG) /* end H5EA__get_cparam_test() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__get_cparam_test() */
/*-------------------------------------------------------------------------
* Function: H5EA__cmp_cparam_test
@@ -412,39 +434,48 @@ END_FUNC(PKG) /* end H5EA__get_cparam_test() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
- H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2))
+int
+H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)
+{
+ int ret_value = 0;
- /* Check arguments. */
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Check arguments */
HDassert(cparam1);
HDassert(cparam2);
/* Compare creation parameters for array */
if (cparam1->raw_elmt_size < cparam2->raw_elmt_size)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits)
- H5_LEAVE(1)
-
- CATCH
+ HGOTO_DONE(1)
-END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cmp_cparam_test() */
diff --git a/src/H5ES.c b/src/H5ES.c
index 2ba8a72..ccc0dd8 100644
--- a/src/H5ES.c
+++ b/src/H5ES.c
@@ -34,11 +34,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
#include "H5ESpkg.h" /* Event Sets */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -103,10 +104,61 @@ done:
} /* end H5EScreate() */
/*-------------------------------------------------------------------------
+ * Function: H5ESinsert_request
+ *
+ * Purpose: Insert a request from a VOL connector into an event set.
+ *
+ * Note: This function is primarily targeted at VOL connector
+ * authors and is _not_ designed for general-purpose application use.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request)
+{
+ H5ES_t *es; /* Event set */
+ H5VL_t *connector = NULL; /* VOL connector */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ii*x", es_id, connector_id, request);
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == request)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL request pointer")
+
+ /* Create new VOL connector object, using the connector ID */
+ if (NULL == (connector = H5VL_new_connector(connector_id)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create VOL connector object")
+
+ /* Insert request into event set */
+ if (H5ES__insert_request(es, connector, request) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "can't insert request into event set")
+
+done:
+ /* Clean up on error */
+ if (ret_value < 0)
+ /* Release newly created connector */
+ if (connector && H5VL_conn_dec_rc(connector) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESinsert_request() */
+
+/*-------------------------------------------------------------------------
* Function: H5ESget_count
*
* Purpose: Retrieve the # of events in an event set
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -117,19 +169,23 @@ done:
herr_t
H5ESget_count(hid_t es_id, size_t *count /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, count);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
- /* Retrieve the count, if non-NULL */
- if (count)
- *count = H5ES__list_count(&es->active);
+ /* Retrieve the count, if non-NULL */
+ if (count)
+ *count = H5ES__list_count(&es->active);
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -145,6 +201,8 @@ done:
* mechanism for matching operations inserted into the event
* set with [possible] errors that occur.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -155,19 +213,23 @@ done:
herr_t
H5ESget_op_counter(hid_t es_id, uint64_t *op_counter /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, op_counter);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the operation counter, if non-NULL */
- if (op_counter)
- *op_counter = es->op_counter;
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the operation counter, if non-NULL */
+ if (op_counter)
+ *op_counter = es->op_counter;
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -192,6 +254,8 @@ done:
* value returned for the # of operations in progress may be
* inaccurate.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -202,33 +266,82 @@ done:
herr_t
H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress /*out*/, hbool_t *op_failed /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iULxx", es_id, timeout, num_in_progress, op_failed);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
- if (NULL == num_in_progress)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer")
- if (NULL == op_failed)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
-
- /* Wait for operations */
- if (H5ES__wait(es, timeout, num_in_progress, op_failed) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == num_in_progress)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer")
+ if (NULL == op_failed)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
+
+ /* Wait for operations */
+ if (H5ES__wait(es, timeout, num_in_progress, op_failed) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations")
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5ESwait() */
/*-------------------------------------------------------------------------
+ * Function: H5EScancel
+ *
+ * Purpose: Attempt to cancel operations in an event set
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5EScancel(hid_t es_id, size_t *num_not_canceled /*out*/, hbool_t *op_failed /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ixx", es_id, num_not_canceled, op_failed);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == num_not_canceled)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_not_canceled pointer")
+ if (NULL == op_failed)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
+
+ /* Cancel operations */
+ if (H5ES__cancel(es, num_not_canceled, op_failed) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, FAIL, "can't cancel operations")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5EScancel() */
+
+/*-------------------------------------------------------------------------
* Function: H5ESget_err_status
*
* Purpose: Check if event set has failed operations
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -239,19 +352,23 @@ done:
herr_t
H5ESget_err_status(hid_t es_id, hbool_t *err_status /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, err_status);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the error flag, if non-NULL */
- if (err_status)
- *err_status = es->err_occurred;
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the error flag, if non-NULL */
+ if (err_status)
+ *err_status = es->err_occurred;
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -265,6 +382,8 @@ done:
* Note: Does not wait for active operations to complete, so count may
* not include all failures.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -275,23 +394,27 @@ done:
herr_t
H5ESget_err_count(hid_t es_id, size_t *num_errs /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, num_errs);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the error flag, if non-NULL */
- if (num_errs) {
- if (es->err_occurred)
- *num_errs = H5ES__list_count(&es->failed);
- else
- *num_errs = 0;
- } /* end if */
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the error flag, if non-NULL */
+ if (num_errs) {
+ if (es->err_occurred)
+ *num_errs = H5ES__list_count(&es->failed);
+ else
+ *num_errs = 0;
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -305,6 +428,8 @@ done:
* Note: The strings retrieved for each error info must be released
* by calling H5free_memory().
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -316,29 +441,164 @@ herr_t
H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[] /*out*/,
size_t *num_cleared /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "izxx", es_id, num_err_info, err_info, num_cleared);
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (0 == num_err_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0")
+ if (NULL == err_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer")
+ if (NULL == num_cleared)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer")
+
+ /* Retrieve the error information */
+ if (H5ES__get_err_info(es, num_err_info, err_info, num_cleared) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESget_err_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESfree_err_info
+ *
+ * Purpose: Convenience routine to free 1+ H5ES_err_info_t structs.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 5, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[])
+{
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "z*#", num_err_info, err_info);
+
/* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
if (0 == num_err_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0")
if (NULL == err_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer")
- if (NULL == num_cleared)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer")
- /* Retrieve the error information */
- if (H5ES__get_err_info(es, num_err_info, err_info, num_cleared) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)")
+ /* Iterate over array, releasing error information */
+ for (u = 0; u < num_err_info; u++) {
+ H5MM_xfree(err_info[u].api_name);
+ H5MM_xfree(err_info[u].api_args);
+ H5MM_xfree(err_info[u].app_file_name);
+ H5MM_xfree(err_info[u].app_func_name);
+ if (H5I_dec_app_ref(err_info[u].err_stack_id) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "can't close error stack for err_info #%zu", u)
+ } /* end for */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5ESget_err_info() */
+} /* end H5ESfree_err_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESregister_insert_func
+ *
+ * Purpose: Registers a callback to invoke when a new operation is inserted
+ * into an event set.
+ *
+ * Note: Only one insert callback can be registered for each event set.
+ * Registering a new callback will replace the existing one.
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iEI*x", es_id, func, ctx);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == func)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer")
+
+ /* Set the event set's insert callback */
+ es->ins_func = func;
+ es->ins_ctx = ctx;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESregister_insert_func() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESregister_complete_func
+ *
+ * Purpose: Registers a callback to invoke when an operation completes
+ * within an event set.
+ *
+ * Note: Only one complete callback can be registered for each event set.
+ * Registering a new callback will replace the existing one.
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iEC*x", es_id, func, ctx);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == func)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer")
+
+ /* Set the event set's completion callback */
+ es->comp_func = func;
+ es->comp_ctx = ctx;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESregister_complete_func() */
/*-------------------------------------------------------------------------
* Function: H5ESclose
@@ -347,6 +607,8 @@ done:
*
* Note: Fails if active operations are present.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -362,16 +624,19 @@ H5ESclose(hid_t es_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", es_id);
- /* Check arguments */
- if (H5I_EVENTSET != H5I_get_type(es_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set")
-
- /*
- * Decrement the counter on the object. It will be freed if the count
- * reaches zero.
- */
- if (H5I_dec_app_ref(es_id) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ /* Check arguments */
+ if (H5I_EVENTSET != H5I_get_type(es_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set")
+
+ /*
+ * Decrement the counter on the object. It will be freed if the count
+ * reaches zero.
+ */
+ if (H5I_dec_app_ref(es_id) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set")
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5ESdevelop.h b/src/H5ESdevelop.h
new file mode 100644
index 0000000..5a0f2b4
--- /dev/null
+++ b/src/H5ESdevelop.h
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5ES (event set) developer
+ * support routines.
+ */
+
+#ifndef _H5ESdevelop_H
+#define _H5ESdevelop_H
+
+/* Include package's public header */
+#include "H5ESpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL herr_t H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5ESdevelop_H */
diff --git a/src/H5ESevent.c b/src/H5ESevent.c
index b0c3578..aafc785 100644
--- a/src/H5ESevent.c
+++ b/src/H5ESevent.c
@@ -139,14 +139,14 @@ H5ES__event_free(H5ES_event_t *ev)
/* Sanity check */
HDassert(ev);
- if (ev->api_name)
- H5MM_xfree_const(ev->api_name);
- if (ev->api_args)
- H5MM_xfree_const(ev->api_args);
- if (ev->app_file)
- H5MM_xfree_const(ev->app_file);
- if (ev->app_func)
- H5MM_xfree_const(ev->app_func);
+ /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ ev->op_info.api_name = NULL;
+ if (ev->op_info.api_args)
+ H5MM_xfree_const(ev->op_info.api_args);
+ ev->op_info.app_file_name = NULL;
+ ev->op_info.app_func_name = NULL;
if (ev->request) {
/* Free the request */
if (H5VL_request_free(ev->request) < 0)
diff --git a/src/H5ESint.c b/src/H5ESint.c
index da3f779..6f9efe9 100644
--- a/src/H5ESint.c
+++ b/src/H5ESint.c
@@ -53,11 +53,18 @@
/* Callback context for wait operations */
typedef struct H5ES_wait_ctx_t {
H5ES_t * es; /* Event set being operated on */
- uint64_t timeout; /* Timeout for wait operation */
+ uint64_t timeout; /* Timeout for wait operation (in ns) */
size_t * num_in_progress; /* Count of # of operations that have not completed */
hbool_t *op_failed; /* Flag to indicate an operation failed */
} H5ES_wait_ctx_t;
+/* Callback context for cancel operations */
+typedef struct H5ES_cancel_ctx_t {
+ H5ES_t * es; /* Event set being operated on */
+ size_t * num_not_canceled; /* Count of # of operations were not canceled */
+ hbool_t *op_failed; /* Flag to indicate an operation failed */
+} H5ES_cancel_ctx_t;
+
/* Callback context for get error info (gei) operations */
typedef struct H5ES_gei_ctx_t {
H5ES_t * es; /* Event set being operated on */
@@ -73,9 +80,14 @@ typedef struct H5ES_gei_ctx_t {
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5ES__close(H5ES_t *es);
static herr_t H5ES__close_cb(void *es, void **request_token);
+static herr_t H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app_file,
+ const char *app_func, unsigned app_line, const char *caller, const char *api_args);
static herr_t H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev);
+static herr_t H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status);
static int H5ES__wait_cb(H5ES_event_t *ev, void *_ctx);
+static int H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx);
static int H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx);
static int H5ES__close_failed_cb(H5ES_event_t *ev, void *_ctx);
@@ -233,6 +245,81 @@ done:
} /* end H5ES__create() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__insert
+ *
+ * Purpose: Insert a request token into an event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app_file, const char *app_func,
+ unsigned app_line, const char *caller, const char *api_args)
+{
+ H5ES_event_t *ev = NULL; /* Event for request */
+ hbool_t ev_inserted = FALSE; /* Flag to indicate that event is in active list */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(es);
+
+ /* Create new event */
+ if (NULL == (ev = H5ES__event_new(connector, request_token)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object")
+
+ /* Copy the app source information */
+ /* The 'app_func' & 'app_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ev->op_info.app_file_name = app_file;
+ ev->op_info.app_func_name = app_func;
+ ev->op_info.app_line_num = app_line;
+
+ /* Set the event's operation counter */
+ ev->op_info.op_ins_count = es->op_counter++;
+
+ /* Set the event's timestamp & execution time */
+ ev->op_info.op_ins_ts = H5_now_usec();
+ ev->op_info.op_exec_ts = UINT64_MAX;
+ ev->op_info.op_exec_time = UINT64_MAX;
+
+ /* Copy the API routine's name & arguments */
+ /* The 'caller' string is also statically allocated (by the compiler)
+ * there's no need to duplicate it.
+ */
+ ev->op_info.api_name = caller;
+ if (NULL == (ev->op_info.api_args = H5MM_xstrdup(api_args)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments")
+
+ /* Append fully initialized event onto the event set's 'active' list */
+ H5ES__list_append(&es->active, ev);
+ ev_inserted = TRUE;
+
+ /* Invoke the event set's 'insert' callback, if present */
+ if (es->ins_func)
+ if ((es->ins_func)(&ev->op_info, es->ins_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'insert' callback for event set failed")
+
+done:
+ /* Release resources on error */
+ if (ret_value < 0)
+ if (ev) {
+ if (ev_inserted)
+ H5ES__list_remove(&es->active, ev);
+ if (H5ES__event_free(ev) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__insert() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES_insert
*
* Purpose: Insert a request token into an event set
@@ -247,15 +334,15 @@ done:
herr_t
H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, const char *caller_args, ...)
{
- H5ES_t * es = NULL; /* Event set for the operation */
- H5ES_event_t *ev = NULL; /* Event for request */
- H5RS_str_t * rs = NULL; /* Ref-counted string to compose formatted argument string in */
- const char * app_file; /* Application source file name */
- const char * app_func; /* Application source function name */
- const char * s; /* Pointer to internal string from ref-counted string */
- va_list ap; /* Varargs for caller */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5ES_t * es = NULL; /* Event set for the operation */
+ const char *app_file; /* Application source file name */
+ const char *app_func; /* Application source function name */
+ unsigned app_line; /* Application source line number */
+ H5RS_str_t *rs = NULL; /* Ref-counted string to compose formatted argument string in */
+ const char *api_args; /* Pointer to api_args string from ref-counted string */
+ va_list ap; /* Varargs for caller */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -273,10 +360,6 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
if (es->err_occurred)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
- /* Create new event */
- if (NULL == (ev = H5ES__event_new(connector, token)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object")
-
/* Start working on the API routines arguments */
HDva_start(ap, caller_args);
arg_started = TRUE;
@@ -284,24 +367,10 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
/* Copy the app source information */
(void)HDva_arg(ap, char *); /* Toss the 'app_file' parameter name */
app_file = HDva_arg(ap, char *);
- if (NULL == (ev->app_file = H5MM_strdup(app_file)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy app source file name")
(void)HDva_arg(ap, char *); /* Toss the 'app_func' parameter name */
app_func = HDva_arg(ap, char *);
- if (NULL == (ev->app_func = H5MM_strdup(app_func)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy app source function name")
(void)HDva_arg(ap, char *); /* Toss the 'app_line' parameter name */
- ev->app_line = HDva_arg(ap, unsigned);
-
- /* Set the event's operation counter */
- ev->ev_count = es->op_counter++;
-
- /* Set the event's timestamp */
- ev->ev_time = H5_now_usec();
-
- /* Copy the API routine's name */
- if (NULL == (ev->api_name = H5MM_strdup(caller)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine name")
+ app_line = HDva_arg(ap, unsigned);
/* Create the string for the API routine's arguments */
if (NULL == (rs = H5RS_create(NULL)))
@@ -312,13 +381,12 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
HDassert(0 == HDstrncmp(caller_args, "*s*sIu", 6));
if (H5_trace_args(rs, caller_args + 6, ap) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments")
- if (NULL == (s = H5RS_get_str(rs)))
+ if (NULL == (api_args = H5RS_get_str(rs)))
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get pointer to formatted API arguments")
- if (NULL == (ev->api_args = H5MM_strdup(s)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments")
- /* Append fully initialized event onto the event set's 'active' list */
- H5ES__list_append(&es->active, ev);
+ /* Insert the operation into the event set */
+ if (H5ES__insert(es, connector, token, app_file, app_func, app_line, caller, api_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
done:
/* Clean up */
@@ -327,15 +395,42 @@ done:
if (rs)
H5RS_decr(rs);
- /* Release resources on error */
- if (ret_value < 0)
- if (ev && H5ES__event_free(ev) < 0)
- HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ES_insert() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__insert_request
+ *
+ * Purpose: Directly insert a request token into an event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(connector);
+ HDassert(token);
+
+ /* Insert an 'anonymous' operation into the event set */
+ if (H5ES__insert(es, connector, token, NULL, NULL, 0, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__insert_request() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__handle_fail
*
* Purpose: Handle a failed event
@@ -370,6 +465,101 @@ H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev)
} /* end H5ES__handle_fail() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__op_complete
+ *
+ * Purpose: Handle an operation completing
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status)
+{
+ H5VL_request_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t err_stack_id = H5I_INVALID_HID; /* Error stack for failed operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(ev);
+ HDassert(H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_FAIL == ev_status ||
+ H5VL_REQUEST_STATUS_CANCELED == ev_status);
+
+ /* Handle each form of event completion */
+ if (H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_CANCELED == ev_status) {
+ /* Invoke the event set's 'complete' callback, if present */
+ if (es->comp_func) {
+ H5ES_status_t op_status; /* Status for complete callback */
+
+ /* Set appropriate info for callback */
+ if (H5VL_REQUEST_STATUS_SUCCEED == ev_status) {
+ /* Translate status */
+ op_status = H5ES_STATUS_SUCCEED;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_EXEC_TIME;
+ vol_cb_args.args.get_exec_time.exec_ts = &ev->op_info.op_exec_ts;
+ vol_cb_args.args.get_exec_time.exec_time = &ev->op_info.op_exec_time;
+
+ /* Retrieve the execution time info */
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL,
+ "unable to retrieve execution time info for operation")
+ }
+ else
+ /* Translate status */
+ op_status = H5ES_STATUS_CANCELED;
+
+ if ((es->comp_func)(&ev->op_info, op_status, H5I_INVALID_HID, es->comp_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed")
+ } /* end if */
+
+ /* Event success or cancellation */
+ if (H5ES__event_completed(ev, &es->active) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release completed event")
+ } /* end if */
+ else if (H5VL_REQUEST_STATUS_FAIL == ev_status) {
+ /* Invoke the event set's 'complete' callback, if present */
+ if (es->comp_func) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_ERR_STACK;
+ vol_cb_args.args.get_err_stack.err_stack_id = H5I_INVALID_HID;
+
+ /* Retrieve the error stack for the operation */
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "unable to retrieve error stack for operation")
+
+ /* Set values */
+ err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id;
+
+ if ((es->comp_func)(&ev->op_info, H5ES_STATUS_FAIL, err_stack_id, es->comp_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed")
+ } /* end if */
+
+ /* Handle failure */
+ if (H5ES__handle_fail(es, ev) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "unable to handle failed event")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, FAIL, "unknown event status?!?")
+
+done:
+ /* Clean up */
+ if (H5I_INVALID_HID != err_stack_id)
+ if (H5I_dec_ref(err_stack_id) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL,
+ "unable to decrement ref count on error stack for failed operation")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__op_complete() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__wait_cb
*
* Purpose: Common routine for testing / waiting on an operation
@@ -405,9 +595,9 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx)
/* Check for status values that indicate we should break out of the loop */
if (ev_status == H5VL_REQUEST_STATUS_FAIL) {
- /* Handle failure */
- if (H5ES__handle_fail(ctx->es, ev) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event")
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
/* Record the error */
*ctx->op_failed = TRUE;
@@ -415,13 +605,15 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx)
/* Exit from the iteration */
ret_value = H5_ITER_STOP;
} /* end if */
- else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED) {
- if (H5ES__event_completed(ev, &ctx->es->active) < 0)
+ else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED || ev_status == H5VL_REQUEST_STATUS_CANCELED) {
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
} /* end else-if */
- else if (ev_status == H5VL_REQUEST_STATUS_CANCELED)
- /* Should never get a status of 'cancel' back from test / wait operation */
- HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, H5_ITER_ERROR, "received 'cancel' status for operation")
+ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL)
+ /* Should never get a status of 'can't cancel' back from test / wait operation */
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, H5_ITER_ERROR,
+ "received \"can't cancel\" status for operation")
else {
/* Sanity check */
HDassert(ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS);
@@ -489,6 +681,114 @@ done:
} /* end H5ES__wait() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__cancel_cb
+ *
+ * Purpose: Callback for canceling operations
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx)
+{
+ H5ES_cancel_ctx_t * ctx = (H5ES_cancel_ctx_t *)_ctx; /* Callback context */
+ H5VL_request_status_t ev_status = H5VL_REQUEST_STATUS_SUCCEED; /* Status from event's operation */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(ev);
+ HDassert(ctx);
+
+ /* Attempt to cancel the request */
+ if (H5VL_request_cancel(ev->request, &ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, H5_ITER_ERROR, "unable to cancel operation")
+
+ /* Check for status values that indicate we should break out of the loop */
+ if (ev_status == H5VL_REQUEST_STATUS_FAIL) {
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event")
+
+ /* Record the error */
+ *ctx->op_failed = TRUE;
+
+ /* Exit from the iteration */
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED) {
+ /* Increment "not canceled" counter */
+ (*ctx->num_not_canceled)++;
+
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
+ } /* end else-if */
+ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL || ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS) {
+ /* Increment "not canceled" counter */
+ (*ctx->num_not_canceled)++;
+ } /* end else-if */
+ else {
+ /* Sanity check */
+ HDassert(ev_status == H5VL_REQUEST_STATUS_CANCELED);
+
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__cancel_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ES__cancel
+ *
+ * Purpose: Cancel operations in event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed)
+{
+ H5ES_cancel_ctx_t ctx; /* Iterator callback context info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(num_not_canceled);
+ HDassert(op_failed);
+
+ /* Set user's parameters to known values */
+ *num_not_canceled = 0;
+ *op_failed = FALSE;
+
+ /* Set up context for iterator callbacks */
+ ctx.es = es;
+ ctx.num_not_canceled = num_not_canceled;
+ ctx.op_failed = op_failed;
+
+ /* Iterate over the events in the set, attempting to cancel them */
+ if (H5ES__list_iterate(&es->active, H5ES__cancel_cb, &ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__cancel() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__get_err_info_cb
*
* Purpose: Retrieve information about a failed operation
@@ -503,8 +803,9 @@ done:
static int
H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx)
{
- H5ES_gei_ctx_t *ctx = (H5ES_gei_ctx_t *)_ctx; /* Callback context */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5VL_request_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5ES_gei_ctx_t * ctx = (H5ES_gei_ctx_t *)_ctx; /* Callback context */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -513,22 +814,35 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx)
HDassert(ctx);
/* Copy operation info for event */
- if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->api_name)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API name")
- if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->api_args)))
+ /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler)
+ * so there's no need to duplicate them internally, but they are duplicated
+ * here, when they are given back to the user.
+ */
+ if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name")
+ if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args)))
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments")
- if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->app_file)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy app source file name")
- if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->app_func)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy app function name")
- ctx->curr_err_info->app_line_num = ev->app_line;
- ctx->curr_err_info->op_ins_count = ev->ev_count;
- ctx->curr_err_info->op_ins_ts = ev->ev_time;
+ if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name")
+ if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name")
+ ctx->curr_err_info->app_line_num = ev->op_info.app_line_num;
+ ctx->curr_err_info->op_ins_count = ev->op_info.op_ins_count;
+ ctx->curr_err_info->op_ins_ts = ev->op_info.op_ins_ts;
+ ctx->curr_err_info->op_exec_ts = ev->op_info.op_exec_ts;
+ ctx->curr_err_info->op_exec_time = ev->op_info.op_exec_time;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_ERR_STACK;
+ vol_cb_args.args.get_err_stack.err_stack_id = H5I_INVALID_HID;
/* Get error stack for event */
- if (H5VL_request_specific(ev->request, H5VL_REQUEST_GET_ERR_STACK, &ctx->curr_err_info->err_stack_id) < 0)
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, H5_ITER_ERROR, "unable to retrieve error stack for operation")
+ /* Set value */
+ ctx->curr_err_info->err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id;
+
/* Remove event from event set's failed list */
H5ES__list_remove(&ctx->es->failed, ev);
diff --git a/src/H5ESmodule.h b/src/H5ESmodule.h
index ea9fd7a..5169b52 100644
--- a/src/H5ESmodule.h
+++ b/src/H5ESmodule.h
@@ -29,4 +29,39 @@
#define H5_MY_PKG_ERR H5E_EVENTSET
#define H5_MY_PKG_INIT YES
+/**\defgroup H5ES H5ES
+ *
+ * \todo Add the event set life cycle.
+ *
+ * \brief Event Set Interface
+ *
+ * \details \Bold{This interface can be only used with the HDF5 VOL connectors that
+ * enable the asynchronous feature in HDF5.} The native HDF5 library has
+ * only synchronous operations.
+ *
+ * HDF5 VOL connectors with support for asynchronous operations:
+ * - ASYNC
+ * - DAOS
+ *
+ * \par Example:
+ * \code
+ * fid = H5Fopen(..);
+ * gid = H5Gopen(fid, ..); //Starts when H5Fopen completes
+ * did = H5Dopen(gid, ..); //Starts when H5Gopen completes
+ *
+ * es_id = H5EScreate(); // Create event set for tracking async operations
+ * status = H5Dwrite_async(did, .., es_id); //Asynchronous, starts when H5Dopen completes,
+ * // may run concurrently with other H5Dwrite_async
+ * // in event set.
+ * status = H5Dwrite_async(did, .., es_id); //Asynchronous, starts when H5Dopen completes,
+ * // may run concurrently with other H5Dwrite_async
+ * // in event set....
+ * <other user code>
+ * ...
+ * H5ESwait(es_id); // Wait for operations in event set to complete, buffers
+ * // used for H5Dwrite_async must only be changed after wait
+ * // returns.
+ * \endcode
+ */
+
#endif /* H5ESmodule_H */
diff --git a/src/H5ESpkg.h b/src/H5ESpkg.h
index 339ce1d..a7a8e20 100644
--- a/src/H5ESpkg.h
+++ b/src/H5ESpkg.h
@@ -43,14 +43,7 @@ typedef struct H5ES_event_t {
H5VL_object_t * request; /* Request token for event */
struct H5ES_event_t *prev, *next; /* Previous and next event nodes */
- /* Useful info for debugging and error reporting */
- const char *api_name; /* Name of API routine for event */
- const char *api_args; /* Arguments to API routine */
- const char *app_file; /* Name of source file from application */
- const char *app_func; /* Name of source function from application */
- unsigned app_line; /* Line # of source file from application */
- uint64_t ev_count; /* This event is the n'th operation in the event set */
- uint64_t ev_time; /* Timestamp for this event (in ms from UNIX epoch) */
+ H5ES_op_info_t op_info; /* Useful info about operation */
} H5ES_event_t;
/* Typedef for lists of event set operations */
@@ -61,7 +54,11 @@ typedef struct H5ES_event_list_t {
/* Typedef for event set objects */
struct H5ES_t {
- uint64_t op_counter; /* Count of operations inserted into this set */
+ uint64_t op_counter; /* Count of operations inserted into this set */
+ H5ES_event_insert_func_t ins_func; /* Callback to invoke for operation inserts */
+ void * ins_ctx; /* Context for callback to invoke for operation inserts */
+ H5ES_event_complete_func_t comp_func; /* Callback to invoke for operation completions */
+ void * comp_ctx; /* Context for callback to invoke for operation inserts */
/* Active events */
H5ES_event_list_t active; /* List of active events in set */
@@ -82,10 +79,11 @@ typedef int (*H5ES_list_iter_func_t)(H5ES_event_t *ev, void *ctx);
/* Package Private Prototypes */
/******************************/
H5_DLL H5ES_t *H5ES__create(void);
+H5_DLL herr_t H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token);
H5_DLL herr_t H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_failed);
+H5_DLL herr_t H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed);
H5_DLL herr_t H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[],
size_t *num_cleared);
-H5_DLL herr_t H5ES__close(H5ES_t *es);
/* Event list operations */
H5_DLL void H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev);
diff --git a/src/H5ESprivate.h b/src/H5ESprivate.h
index 4f843ba..3d9ce9f 100644
--- a/src/H5ESprivate.h
+++ b/src/H5ESprivate.h
@@ -24,8 +24,9 @@
#ifndef H5ESprivate_H
#define H5ESprivate_H
-/* Include package's public header */
-#include "H5ESpublic.h" /* Event Sets */
+/* Include package's public headers */
+#include "H5ESpublic.h"
+#include "H5ESdevelop.h"
/* Private headers needed by this file */
#include "H5VLprivate.h" /* Virtual Object Layer */
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index 752218b..4cf71c5 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -25,7 +25,7 @@
/*****************/
/* Default value for "no event set" / synchronous execution */
-#define H5ES_NONE (hid_t)0
+#define H5ES_NONE 0 /* (hid_t) */
/* Special "wait" timeout values */
#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */
@@ -42,46 +42,61 @@
/* Asynchronous operation status */
typedef enum H5ES_status_t {
- 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_IN_PROGRESS, /* Operation(s) have not yet completed */
+ H5ES_STATUS_SUCCEED, /* Operation(s) have completed, successfully */
+ H5ES_STATUS_CANCELED, /* Operation(s) has been canceled */
+ H5ES_STATUS_FAIL /* An operation has completed, but failed */
} H5ES_status_t;
-/* 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 */
+/* Information about operations in an event set */
+typedef struct H5ES_op_info_t {
+ /* API call info */
+ char *api_name; /* Name of HDF5 API routine called */
+ char *api_args; /* "Argument string" for arguments to HDF5 API routine called */
+
+ /* Application info */
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 */
+
+ /* Operation info */
+ 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 */
+ uint64_t op_exec_ts; /* Timestamp for when the operation began execution */
+ uint64_t op_exec_time; /* Execution time for operation (in ns) */
+} H5ES_op_info_t;
+
+//! <!-- [H5ES_err_info_t_snip] -->
+/**
+ * Information about failed operations in event set
+ */
+typedef struct H5ES_err_info_t {
+ /* API call info */
+ char *api_name; /**< Name of HDF5 API routine called */
+ char *api_args; /**< "Argument string" for arguments to HDF5 API routine called */
+
+ /* Application info */
+ 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 */
+
+ /* Operation info */
+ 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 */
+ uint64_t op_exec_ts; /**< Timestamp for when the operation began execution */
+ uint64_t op_exec_time; /**< Execution time for operation (in ns) */
/* Error info */
- hid_t err_stack_id; /* ID for error stack from failed operation */
+ 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);
@@ -98,15 +113,12 @@ Possible debugging routines: (Should also be configured from Env Var)
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);
*/
+typedef int (*H5ES_event_insert_func_t)(const H5ES_op_info_t *op_info, void *ctx);
+typedef int (*H5ES_event_complete_func_t)(const H5ES_op_info_t *op_info, H5ES_status_t status,
+ hid_t err_stack, void *ctx);
+
/********************/
/* Public Variables */
/********************/
@@ -119,14 +131,161 @@ How to Trace Async Operations?
extern "C" {
#endif
-H5_DLL hid_t H5EScreate(void);
+/**
+ * \ingroup H5ES
+ *
+ * \brief Creates an event set
+ *
+ * \returns \hid_ti{event set}
+ *
+ * \details H5EScreate() creates a new event set and returns a corresponding
+ * event set identifier.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL hid_t H5EScreate(void);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Waits for operations in event set to complete
+ *
+ * \es_id
+ * \param[in] timeout Total time in nanoseconds to wait for all operations in
+ * the event set to complete
+ * \param[out] num_in_progress The number of operations still in progress
+ * \param[out] err_occurred Flag if an operation in the event set failed
+ * \returns \herr_t
+ *
+ * \details H5ESwait() waits for operations in an event set \p es_id to wait
+ * with \p timeout.
+ *
+ * Timeout value is in nanoseconds, and is for the H5ESwait() call and
+ * not for each individual operation in the event set. For example, if
+ * "10" is passed as a timeout value and the event set waited 4
+ * nanoseconds for the first operation to complete, the remaining
+ * operations would be allowed to wait for at most 6 nanoseconds more,
+ * i.e., the timeout value used across all operations in the event set
+ * until it reaches 0, then any remaining operations are only checked
+ * for completion, not waited on.
+ *
+ * This call will stop waiting on operations and will return
+ * immediately if an operation fails. If a failure occurs, the value
+ * returned for the number of operations in progress may be inaccurate.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress, hbool_t *err_occurred);
+H5_DLL herr_t H5EScancel(hid_t es_id, size_t *num_not_canceled, hbool_t *err_occurred);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Retrieves number of events in an event set
+ *
+ * \es_id
+ * \param[out] count The number of events in the event set
+ * \returns \herr_t
+ *
+ * \details H5ESget_count() retrieves number of events in an event set specified
+ * by \p es_id.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESget_count(hid_t es_id, size_t *count);
+
+/**
+ * \ingroup H5ES
+ *
+ * \todo Fill in the blanks!
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESget_op_counter(hid_t es_id, uint64_t *counter);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Checks for failed operations
+ *
+ * \es_id
+ * \param[out] err_occurred Status indicating if error is present in the event
+ * set
+ * \returns \herr_t
+ *
+ * \details H5ESget_err_status() checks if event set specified by es_id has
+ * failed operations.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESget_err_status(hid_t es_id, hbool_t *err_occurred);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Retrieves the number of failed operations
+ *
+ * \es_id
+ * \param[out] num_errs Number of errors
+ * \returns \herr_t
+ *
+ * \details H5ESget_err_count() retrieves the number of failed operations in an
+ * event set specified by \p es_id.
+ *
+ * The function does not wait for active operations to complete, so
+ * count may not include all failures.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESget_err_count(hid_t es_id, size_t *num_errs);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Retrieves information about failed operations
+ *
+ * \es_id
+ * \param[in] num_err_info The number of elements in \p err_info array
+ * \param[out] err_info Array of structures
+ * \param[out] err_cleared Number of cleared errors
+ * \returns \herr_t
+ *
+ * \details H5ESget_err_info() retrieves information about failed operations in
+ * an event set specified by \p es_id. The strings retrieved for each
+ * error info must be released by calling H5free_memory().
+ *
+ * Below is the description of the \ref H5ES_err_info_t structure:
+ * \snippet this H5ES_err_info_t_snip
+ * \click4more
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[],
size_t *err_cleared);
+H5_DLL herr_t H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]);
+H5_DLL herr_t H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx);
+H5_DLL herr_t H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *ctx);
+
+/**
+ * \ingroup H5ES
+ *
+ * \brief Terminates access to an event set
+ *
+ * \es_id
+ * \returns \herr_t
+ *
+ * \details H5ESclose() terminates access to an event set specified by \p es_id.
+ *
+ * \since 1.13.0
+ *
+ */
H5_DLL herr_t H5ESclose(hid_t es_id);
#ifdef __cplusplus
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 7e46beb..6438cd9 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -129,7 +129,7 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
/* Copy the message into the user's buffer, if given */
if (msg_str) {
- HDstrncpy(msg_str, msg->msg, MIN((size_t)(len + 1), size));
+ HDstrncpy(msg_str, msg->msg, size);
if ((size_t)len >= size)
msg_str[size - 1] = '\0';
} /* end if */
@@ -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;
@@ -772,11 +772,12 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
if (H5I_inc_ref(min_id, FALSE) < 0)
HGOTO_DONE(FAIL)
estack->slot[estack->nused].min_num = min_id;
- if (NULL == (estack->slot[estack->nused].func_name = H5MM_xstrdup(func)))
- HGOTO_DONE(FAIL)
- if (NULL == (estack->slot[estack->nused].file_name = H5MM_xstrdup(file)))
- HGOTO_DONE(FAIL)
- estack->slot[estack->nused].line = line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ estack->slot[estack->nused].func_name = func;
+ estack->slot[estack->nused].file_name = file;
+ estack->slot[estack->nused].line = line;
if (NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc)))
HGOTO_DONE(FAIL)
estack->nused++;
@@ -826,10 +827,11 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
/* Release strings */
- if (error->func_name)
- error->func_name = (const char *)H5MM_xfree_const(error->func_name);
- if (error->file_name)
- error->file_name = (const char *)H5MM_xfree_const(error->file_name);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ error->func_name = NULL;
+ error->file_name = NULL;
if (error->desc)
error->desc = (const char *)H5MM_xfree_const(error->desc);
}
diff --git a/src/H5Emodule.h b/src/H5Emodule.h
index 1670c03..58a3517 100644
--- a/src/H5Emodule.h
+++ b/src/H5Emodule.h
@@ -29,4 +29,54 @@
#define H5_MY_PKG_ERR H5E_ERROR
#define H5_MY_PKG_INIT YES
+/**\defgroup H5E H5E
+ *
+ * Use the functions in this module to manage HDF5 error stacks and error
+ * messages.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5E_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5E_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5E_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5E_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \internal The \c 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.
+ *
+ * \internal Certain API functions in the \ref H5E package, such as H5Eprint(),
+ * 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.
+ *
+ * \internal 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.
+ *
+ * \internal 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 \ref H5E package.
+ *
+ */
+
#endif /* H5Emodule_H */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 58010a3..a30cb6a 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -31,7 +31,7 @@ typedef struct H5E_t H5E_t;
* error number, the minor error number, and a description of the error.
*/
#define HERROR(maj_id, min_id, ...) \
- H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__)
+ H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__)
/*
* HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR
@@ -111,6 +111,7 @@ typedef struct H5E_t H5E_t;
/* Retrieve the error code description string and push it onto the error
* stack.
*/
+#ifndef H5_HAVE_WIN32_API
#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
{ \
int myerrno = errno; \
@@ -129,6 +130,35 @@ typedef struct H5E_t H5E_t;
HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
HDstrerror(myerrno)); \
}
+#else /* H5_HAVE_WIN32_API */
+/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a
+ * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will
+ * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero,
+ * though I wouldn't count on that.
+ */
+#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HDONE_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HGOTO_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#endif /* H5_HAVE_WIN32_API */
#ifdef H5_HAVE_PARALLEL
/*
@@ -138,70 +168,18 @@ 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 */
-/******************************************************************************/
-/* Revisions to Error Macros, to go with Revisions to FUNC_ENTER/LEAVE Macros */
-/******************************************************************************/
-
-/*
- * H5E_PRINTF macro, used to facilitate error reporting between a BEGIN_FUNC()
- * and an END_FUNC() within a function body. The arguments are the minor
- * error number, a description of the error (as a printf-like format string),
- * and an optional set of arguments for the printf format arguments.
- */
-#define H5E_PRINTF(...) \
- H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__)
-
-/*
- * H5_LEAVE macro, used to facilitate control flow between a
- * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is
- * the return value.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
- */
-#define H5_LEAVE(v) \
- { \
- ret_value = v; \
- if (!past_catch) \
- goto catch_except; \
- }
-
-/*
- * H5E_THROW macro, used to facilitate error reporting between a
- * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are
- * the minor error number, and an error string.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
- */
-#define H5E_THROW(...) \
- { \
- H5E_PRINTF(__VA_ARGS__); \
- H5_LEAVE(fail_value) \
- }
-
-/* Macro for "catching" flow of control when an error occurs. Note that the
- * H5_LEAVE macro won't jump back here once it's past this point.
- */
-#define CATCH \
-catch_except:; \
- past_catch = TRUE;
-
/* Library-private functions defined in H5E package */
H5_DLL herr_t H5E_init(void);
H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id,
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 1deef04..9dfd1fc 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -24,20 +24,31 @@
#include "H5Ipublic.h"
/* Value for the default error stack */
-#define H5E_DEFAULT (hid_t)0
+#define H5E_DEFAULT 0 /* (hid_t) */
-/* 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,30 +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 H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack);
-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.
@@ -189,30 +670,267 @@ 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
+ *
+ * \deprecated 1.8.0 Function H5Eclear() renamed to H5Eclear1() and deprecated
+ * in this release.
+ *
+ * \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()).
+ *
+ */
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
+ *
+ * \deprecated 1.8.0 Function H5Eget_auto() renamed to H5Eget_auto1() and
+ * deprecated in this release.
+ *
+ * \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.
+ *
+ */
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
+ *
+ * \deprecated 1.8.0 Function H5Epush() renamed to H5Epush1() and
+ * deprecated in this release.
+ *
+ * \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
+ */
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
+ *
+ * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and
+ * deprecated in this release.
+ *
+ * \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.
+ *
+ */
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
+ *
+ * \deprecated 1.8.0 Function H5Eset_auto() renamed to H5Eset_auto1() and
+ * deprecated in this release.
+ *
+ * \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.
+ *
+ */
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
+ *
+ * \deprecated 1.8.0 Function H5Ewalk() renamed to H5Ewalk1() and
+ * deprecated in this release.
+ *
+ * \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
+ *
+ */
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
+ *
+ * \deprecated 1.8.0 Function deprecated in this release.
+ *
+ * \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.
+ *
+ */
+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
+ *
+ * \deprecated 1.8.0 Function deprecated and return type changed in this release.
+ *
+ * \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.
+ *
+ */
+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 8618851..8a28b00 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -112,8 +112,9 @@ H5FL_EXTERN(H5VL_object_t);
hid_t
H5Fget_create_plist(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
@@ -122,10 +123,17 @@ H5Fget_create_plist(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FCPL;
+ vol_cb_args.args.get_fcpl.fcpl_id = H5I_INVALID_HID;
+
/* Retrieve the file creation property list */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_fcpl.fcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_create_plist() */
@@ -151,8 +159,9 @@ done:
hid_t
H5Fget_access_plist(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", file_id);
@@ -161,10 +170,17 @@ H5Fget_access_plist(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FAPL;
+ vol_cb_args.args.get_fapl.fapl_id = H5I_INVALID_HID;
+
/* Retrieve the file's access property list */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_fapl.fapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_access_plist() */
@@ -222,16 +238,25 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
* count the IDs in the file.
*/
if (file_id != (hid_t)H5F_OBJ_ALL) {
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj; /* File for file_id */
+ size_t count = 0; /* Object count */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_COUNT;
+ vol_cb_args.args.get_obj_count.types = types;
+ vol_cb_args.args.get_obj_count.count = &count;
+
/* Get the count */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types,
- &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
+
+ /* Set return value */
+ ret_value = (ssize_t)count;
}
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
@@ -333,16 +358,27 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list /
* get the IDs from the file.
*/
if (file_id != (hid_t)H5F_OBJ_ALL) {
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj; /* File for file_id */
+ size_t count = 0; /* Object count */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_IDS;
+ vol_cb_args.args.get_obj_ids.types = types;
+ vol_cb_args.args.get_obj_ids.max_objs = max_objs;
+ vol_cb_args.args.get_obj_ids.oid_list = oid_list;
+ vol_cb_args.args.get_obj_ids.count = &count;
+
/* Get the IDs */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types,
- max_objs, oid_list, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
+
+ /* Set return value */
+ ret_value = (ssize_t)count;
} /* end if */
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
@@ -396,8 +432,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iix", file_id, fapl_id, file_handle);
@@ -410,9 +448,14 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_vfd_handle.fapl_id = fapl_id;
+ file_opt_args.get_vfd_handle.file_handle = file_handle;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_VFD_HANDLE;
+ vol_cb_args.args = &file_opt_args;
+
/* Retrieve the VFD handle for the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_VFD_HANDLE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, file_handle, fapl_id) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
@@ -432,7 +475,9 @@ done:
htri_t
H5Fis_accessible(const char *filename, hid_t fapl_id)
{
- htri_t ret_value; /* Return value */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "*si", filename, fapl_id);
@@ -447,11 +492,19 @@ H5Fis_accessible(const char *filename, hid_t fapl_id)
else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* Check if file is accessible */
- if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
- filename, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
+ /* Set return value */
+ ret_value = (htri_t)is_accessible;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_accessible() */
@@ -477,10 +530,17 @@ H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr)
supported = 0;
if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation")
- if (supported & H5VL_OPT_QUERY_SUPPORTED)
+ if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN;
+ vol_cb_args.args = NULL;
+
/* Make the 'post open' callback */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -651,7 +711,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) {
+ H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID")
@@ -670,7 +730,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0)
+ H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set")
@@ -828,7 +888,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID")
@@ -847,7 +907,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set")
@@ -870,8 +930,9 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5I_type_t obj_type; /* Type of object to use */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_t obj_type; /* Type of object to use */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -885,9 +946,13 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL
if (NULL == (*vol_obj_ptr = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_FLUSH;
+ vol_cb_args.args.flush.obj_type = obj_type;
+ vol_cb_args.args.flush.scope = scope;
+
/* Flush the object */
- if (H5VL_file_specific(*vol_obj_ptr, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, token_ptr, (int)obj_type,
- (int)scope) < 0)
+ if (H5VL_file_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
@@ -955,7 +1020,7 @@ H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE6(FUNC, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0)
+ H5ARG_TRACE6(__func__, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1049,7 +1114,7 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1072,10 +1137,11 @@ done:
herr_t
H5Fdelete(const char *filename, hid_t fapl_id)
{
- H5P_genplist_t * plist; /* Property list pointer */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- htri_t is_hdf5 = FAIL;
- herr_t ret_value = SUCCEED;
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "*si", filename, fapl_id);
@@ -1100,16 +1166,25 @@ H5Fdelete(const char *filename, hid_t fapl_id)
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* 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,
- filename, &is_hdf5) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
- if (!is_hdf5)
+ if (!is_accessible)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_DELETE;
+ vol_cb_args.args.del.filename = filename;
+ vol_cb_args.args.del.fapl_id = fapl_id;
+
/* Delete the file */
- if (H5VL_file_specific(NULL, H5VL_FILE_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
- filename, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file")
done:
@@ -1129,11 +1204,13 @@ done:
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 */
+ H5VL_object_t * loc_vol_obj = NULL; /* Parent object */
+ H5VL_object_t * child_vol_obj = NULL; /* Child object */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * grp = NULL; /* Root group opened */
+ H5I_type_t loc_type; /* ID type of location */
+ int same_connector = 0; /* Whether parent and child files use the same connector */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
@@ -1146,8 +1223,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
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)
+ if (H5I_FILE != H5I_get_type(child_id))
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;
@@ -1159,23 +1235,71 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
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")
+ /* Need to open the root group of a file, if a file ID was given as the
+ * 'loc_id', because the 'mount' operation is a group specific operation.
+ */
+ if (H5I_FILE == loc_type) {
+ H5VL_object_t * vol_obj; /* Object for loc_id (file) */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+
+ /* 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 = loc_type;
+
+ /* Open the root group object */
+ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+
+ /* Create a VOL object for the root group */
+ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group")
+ } /* end if */
+ else {
+ HDassert(H5I_GROUP == loc_type);
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ } /* end else */
/* 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")
+ if (H5VL_cmp_connector_cls(&same_connector, loc_vol_obj->connector->cls, child_vol_obj->connector->cls) <
+ 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't mount file onto object from different VOL connector")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_MOUNT;
+ vol_cb_args.args.mount.name = name;
+ vol_cb_args.args.mount.child_file =
+ child_vol_obj->data; /* Don't unwrap fully, so each connector can see its object */
+ vol_cb_args.args.mount.fmpl_id = plist_id;
/* 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)
+ /* (This is on a group, so that the VOL framework always sees groups for
+ * the 'mount' operation, instead of mixing files and groups)
+ */
+ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
+ /* Clean up if we temporarily opened the root group for a file */
+ if (grp) {
+ HDassert(loc_vol_obj);
+ if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if (H5VL_free_object(loc_vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Fmount() */
@@ -1198,9 +1322,11 @@ done:
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 */
+ H5VL_object_t * loc_vol_obj = NULL; /* Parent object */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * grp = NULL; /* Root group opened */
+ 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);
@@ -1219,15 +1345,57 @@ H5Funmount(hid_t loc_id, const char *name)
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")
+ /* Need to open the root group of a file, if a file ID was given as the
+ * 'loc_id', because the 'mount' operation is a group specific operation.
+ */
+ if (H5I_FILE == loc_type) {
+ H5VL_object_t * vol_obj; /* Object for loc_id (file) */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+
+ /* 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 = loc_type;
+
+ /* Open the root group object */
+ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+
+ /* Create a VOL object for the root group */
+ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group")
+ } /* end if */
+ else {
+ HDassert(H5I_GROUP == loc_type);
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ } /* end else */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_UNMOUNT;
+ vol_cb_args.args.unmount.name = name;
/* 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)
+ /* (This is on a group, so that the VOL framework always sees groups for
+ * the 'unmount' operation, instead of mixing files and groups)
+ */
+ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
+ /* Clean up if we temporarily opened the root group for a file */
+ if (grp) {
+ HDassert(loc_vol_obj);
+ if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if (H5VL_free_object(loc_vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Funmount() */
@@ -1245,9 +1413,10 @@ done:
static hid_t
H5F__reopen_api_common(hid_t file_id, void **token_ptr)
{
- void * file = NULL; /* File struct for new file */
- H5VL_object_t *vol_obj = NULL; /* Object for loc_id */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * reopen_file = NULL; /* Pointer to the re-opened file object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -1255,16 +1424,20 @@ H5F__reopen_api_common(hid_t file_id, void **token_ptr)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_REOPEN;
+ vol_cb_args.args.reopen.file = &reopen_file;
+
/* Reopen the file */
- if (H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, token_ptr, &file) < 0)
+ if (H5VL_file_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector")
/* Make sure that worked */
- if (NULL == file)
+ if (NULL == reopen_file)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
/* Get an ID for the file */
- if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_FILE, reopen_file, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle")
done:
@@ -1351,7 +1524,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) {
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref(ret_value) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID")
@@ -1370,7 +1543,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set")
@@ -1398,15 +1571,19 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/)
/* If no intent flags were passed in, exit quietly */
if (intent_flags) {
- H5VL_object_t *vol_obj; /* File info */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the internal file structure */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_INTENT;
+ vol_cb_args.args.get_intent.flags = intent_flags;
+
/* Get the flags */
- if ((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, intent_flags)) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags")
} /* end if */
@@ -1434,15 +1611,19 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/)
/* If no fnumber pointer was passed in, exit quietly */
if (fnumber) {
- H5VL_object_t *vol_obj; /* File info */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the internal file structure */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- /* Get the flags */
- if ((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fnumber)) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FILENO;
+ vol_cb_args.args.get_fileno.fileno = fnumber;
+
+ /* Get the 'file number' */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'")
} /* end if */
@@ -1462,8 +1643,11 @@ done:
hssize_t
H5Fget_freespace(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL;
- hssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ hsize_t file_freespace = 0; /* Size of freespace in the file */
+ hssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Hs", "i", file_id);
@@ -1472,11 +1656,18 @@ H5Fget_freespace(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_freespace.size = &file_freespace;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FREE_SPACE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the amount of free space in the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SPACE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
+ /* Set return value */
+ ret_value = (hssize_t)file_freespace;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_freespace() */
@@ -1495,8 +1686,10 @@ done:
herr_t
H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, size);
@@ -1507,9 +1700,13 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
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")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_size.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_SIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file size */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- size) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -1556,8 +1753,11 @@ done:
ssize_t
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 */
+ H5VL_object_t * vol_obj; /* File object for file ID */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ size_t image_len = 0; /* Size of image buffer */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", file_id, buf, buf_len);
@@ -1566,11 +1766,20 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_file_image.buf_size = buf_len;
+ file_opt_args.get_file_image.buf = buf;
+ file_opt_args.get_file_image.image_len = &image_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FILE_IMAGE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file image */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, buf, &ret_value, buf_len) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
+ /* Set return value */
+ ret_value = (ssize_t)image_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_file_image() */
@@ -1592,8 +1801,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, config);
@@ -1606,9 +1817,13 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_config.config = config;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_CONF;
+ vol_cb_args.args = &file_opt_args;
+
/* 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) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1627,10 +1842,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
+H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Cc", file_id, config_ptr);
@@ -1639,9 +1856,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.set_mdc_config.config = config_ptr;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MDC_CONFIG;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the metadata cache configuration */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MDC_CONFIG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, config_ptr) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
@@ -1663,8 +1884,10 @@ done:
herr_t
H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/)
{
- H5VL_object_t *vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, hit_rate);
@@ -1675,9 +1898,13 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/)
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")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_hit_rate.hit_rate = hit_rate;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_HR;
+ vol_cb_args.args = &file_opt_args;
+
/* 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) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1701,8 +1928,11 @@ herr_t
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 */
+ H5VL_object_t * vol_obj;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ uint32_t index_len = 0; /* Size of cache index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ixxxx", file_id, max_size, min_clean_size, cur_size, cur_num_entries);
@@ -1711,11 +1941,22 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size
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")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_size.max_size = max_size;
+ file_opt_args.get_mdc_size.min_clean_size = min_clean_size;
+ file_opt_args.get_mdc_size.cur_size = cur_size;
+ file_opt_args.get_mdc_size.cur_num_entries = &index_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_SIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* 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, min_clean_size, cur_size, cur_num_entries) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
+ /* Set mis-matched return value */
+ if (cur_num_entries)
+ *cur_num_entries = (int)index_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_mdc_size() */
@@ -1739,8 +1980,9 @@ done:
herr_t
H5Freset_mdc_hit_rate_stats(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1749,9 +1991,12 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE;
+ vol_cb_args.args = NULL;
+
/* Reset the hit rate statistic */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
@@ -1780,9 +2025,11 @@ done:
ssize_t
H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size)
{
- H5VL_object_t *vol_obj = NULL;
- H5I_type_t type;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t type;
+ size_t file_name_len = 0; /* Length of file name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
@@ -1797,11 +2044,20 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = type;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
/* Get the filename via the VOL */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, size,
- name, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name")
+ /* Set the return value */
+ ret_value = (ssize_t)file_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_name() */
@@ -1822,9 +2078,11 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5I_type_t type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", obj_id, finfo);
@@ -1843,9 +2101,14 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_info.type = type;
+ file_opt_args.get_info.finfo = finfo;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file information */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)type, finfo) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@@ -1865,8 +2128,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj = NULL; /* File object for file ID */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, info);
@@ -1879,10 +2144,14 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/)
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")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_metadata_read_retry_info.info = info;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the retry info */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1903,8 +2172,11 @@ done:
ssize_t
H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ size_t sect_count = 0; /* Number of sections */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
@@ -1915,11 +2187,21 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info
if (sect_info && nsects == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_free_sections.type = type;
+ file_opt_args.get_free_sections.sect_info = sect_info;
+ file_opt_args.get_free_sections.nsects = nsects;
+ file_opt_args.get_free_sections.sect_count = &sect_count;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FREE_SECTIONS;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the free-space section information in the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, sect_info, &ret_value, (int)type, nsects) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
+ /* Set return value */
+ ret_value = (ssize_t)sect_count;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_free_sections() */
@@ -1938,8 +2220,9 @@ done:
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1948,9 +2231,12 @@ H5Fclear_elink_file_cache(hid_t file_id)
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")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE;
+ vol_cb_args.args = NULL;
+
/* Release the EFC */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
@@ -1994,8 +2280,9 @@ done:
herr_t
H5Fstart_swmr_write(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -2008,9 +2295,12 @@ H5Fstart_swmr_write(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_SWMR_WRITE;
+ vol_cb_args.args = NULL;
+
/* Start SWMR writing */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_SWMR_WRITE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
@@ -2030,8 +2320,9 @@ done:
herr_t
H5Fstart_mdc_logging(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -2040,9 +2331,12 @@ H5Fstart_mdc_logging(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_MDC_LOGGING;
+ vol_cb_args.args = NULL;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging")
done:
@@ -2063,8 +2357,9 @@ done:
herr_t
H5Fstop_mdc_logging(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -2073,9 +2368,12 @@ H5Fstop_mdc_logging(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_STOP_MDC_LOGGING;
+ vol_cb_args.args = NULL;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_STOP_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging")
done:
@@ -2096,8 +2394,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", file_id, is_enabled, is_currently_logging);
@@ -2106,9 +2406,14 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_logging_status.is_enabled = is_enabled;
+ file_opt_args.get_mdc_logging_status.is_currently_logging = is_currently_logging;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS;
+ vol_cb_args.args = &file_opt_args;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, is_enabled, is_currently_logging) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
done:
@@ -2130,8 +2435,10 @@ done:
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
- H5VL_object_t *vol_obj; /* File as VOL object */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File as VOL object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", file_id, low, high);
@@ -2144,9 +2451,14 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ file_opt_args.set_libver_bounds.low = low;
+ file_opt_args.set_libver_bounds.high = high;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the library's version bounds */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, low, high) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
@@ -2167,8 +2479,9 @@ done:
herr_t
H5Fformat_convert(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -2181,9 +2494,12 @@ H5Fformat_convert(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_FORMAT_CONVERT;
+ vol_cb_args.args = NULL;
+
/* Convert the format */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
@@ -2202,8 +2518,9 @@ done:
herr_t
H5Freset_page_buffering_stats(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File to reset stats on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File to reset stats on */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -2212,9 +2529,12 @@ H5Freset_page_buffering_stats(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS;
+ vol_cb_args.args = NULL;
+
/* Reset the statistics */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
@@ -2235,8 +2555,10 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne
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 */
+ H5VL_object_t * vol_obj; /* File object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "ixxxxx", file_id, accesses, hits, misses, evictions, bypasses);
@@ -2247,9 +2569,17 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne
if (NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_page_buffering_stats.accesses = accesses;
+ file_opt_args.get_page_buffering_stats.hits = hits;
+ file_opt_args.get_page_buffering_stats.misses = misses;
+ file_opt_args.get_page_buffering_stats.evictions = evictions;
+ file_opt_args.get_page_buffering_stats.bypasses = bypasses;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the statistics */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@@ -2272,8 +2602,10 @@ done:
herr_t
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 */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", file_id, image_addr, image_len);
@@ -2282,9 +2614,14 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_image_info.addr = image_addr;
+ file_opt_args.get_mdc_image_info.len = image_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Go get the address and size of the cache image */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, image_addr, image_len) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
@@ -2317,9 +2654,16 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/)
/* Only do work if valid pointer to fill in */
if (eoa) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+
+ /* Set up VOL callback arguments */
+ file_opt_args.get_eoa.eoa = eoa;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_EOA;
+ vol_cb_args.args = &file_opt_args;
+
/* Retrieve the EOA for the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_EOA, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- eoa) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
} /* end if */
@@ -2339,8 +2683,10 @@ done:
herr_t
H5Fincrement_filesize(hid_t file_id, hsize_t increment)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", file_id, increment);
@@ -2349,9 +2695,13 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.increment_filesize.increment = increment;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_INCR_FILESIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* Increment the file size */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_INCR_FILESIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- increment) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
@@ -2371,21 +2721,27 @@ done:
herr_t
H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, minimize);
+ /* Check args */
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")
-
- vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == vol_obj)
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, minimize) < 0)
+ /* Set up VOL callback arguments */
+ file_opt_args.get_min_dset_ohdr_flag.minimize = minimize;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG;
+ vol_cb_args.args = &file_opt_args;
+
+ /* Get the dataset object header minimum size flag */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
@@ -2405,57 +2761,27 @@ done:
herr_t
H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, minimize);
- vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == vol_obj)
+ /* Check args */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, minimize) < 0)
+ /* Set up VOL callback arguments */
+ file_opt_args.set_min_dset_ohdr_flag.minimize = minimize;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG;
+ vol_cb_args.args = &file_opt_args;
+
+ /* Set the 'minimize dataset object headers flag' */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fset_dset_no_attrs_hint */
-
-/*-------------------------------------------------------------------------
- * Function: H5Fwait
- *
- * Purpose: Wait for all operations on a dataset.
- * Tang: added for async
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Fwait(hid_t file_id)
-{
- H5VL_object_t *vol_obj; /* File for this operation */
- H5I_type_t obj_type; /* Type of object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", file_id);
-
- /* Get the type of object we're flushing + sanity check */
- obj_type = H5I_get_type(file_id);
- if (H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type &&
- H5I_DATASET != obj_type && H5I_ATTR != obj_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier")
-
- if ((ret_value = H5VL_file_specific(vol_obj, H5VL_FILE_WAIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- file_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPERATE, FAIL, "unable to wait file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Fwait() */
diff --git a/src/H5FA.c b/src/H5FA.c
index 05b0bd8..ad69ee2 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -105,39 +105,40 @@ H5FL_BLK_DEFINE(fa_native_elmt);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL,
- H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata))
+static H5FA_t *
+H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata)
+{
+ H5FA_t * fa = NULL; /* Pointer to new fixed array */
+ H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ H5FA_t * ret_value = NULL;
- /* Local variables */
- H5FA_t * fa = NULL; /* Pointer to new fixed array */
- H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Allocate fixed array wrapper */
if (NULL == (fa = H5FL_CALLOC(H5FA_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array info")
/* Lock the array header into memory */
if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to load fixed array header")
/* Check for pending array deletion */
if (from_open && hdr->pending_delete)
- H5E_THROW(H5E_CANTOPENOBJ, "can't open fixed array pending deletion")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTOPENOBJ, NULL, "can't open fixed array pending deletion")
/* Point fixed array wrapper at header and bump it's ref count */
fa->hdr = hdr;
if (H5FA__hdr_incr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
/* Increment # of files using this array header */
if (H5FA__hdr_fuse_incr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared array header")
/* Set file pointer for this array open context */
fa->f = f;
@@ -145,15 +146,15 @@ BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL,
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to release fixed array header")
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(STATIC) /* end H5FA__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__new() */
/*-------------------------------------------------------------------------
* Function: H5FA_create
@@ -168,16 +169,16 @@ END_FUNC(STATIC) /* end H5FA__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL,
- H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
-
- /* Local variables */
+H5FA_t *
+H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)
+{
H5FA_t *fa = NULL; /* Pointer to new fixed array */
haddr_t fa_addr; /* Fixed array header address */
+ H5FA_t *ret_value = NULL;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(cparam);
@@ -186,22 +187,23 @@ BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL,
/* Create fixed array header */
if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "can't create fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "can't create fixed array header")
/* Allocate and initialize new fixed array wrapper */
if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for fixed array wrapper")
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(PRIV) /* end H5FA_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_create() */
/*-------------------------------------------------------------------------
* Function: H5FA_open
@@ -216,31 +218,33 @@ END_FUNC(PRIV) /* end H5FA_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata))
+H5FA_t *
+H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata)
+{
+ H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */
+ H5FA_t *ret_value = NULL;
- /* Local variables */
- H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */
+ FUNC_ENTER_NOAPI(NULL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Allocate and initialize new fixed array wrapper */
if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for fixed array wrapper")
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(PRIV) /* end H5FA_open() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_open() */
/*-------------------------------------------------------------------------
* Function: H5FA_get_nelmts
@@ -254,20 +258,20 @@ END_FUNC(PRIV) /* end H5FA_open() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts))
-
- /* Local variables */
+herr_t
+H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(nelmts);
/* Retrieve the current number of elements in the fixed array */
*nelmts = fa->hdr->stats.nelmts;
-END_FUNC(PRIV) /* end H5FA_get_nelmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_nelmts() */
/*-------------------------------------------------------------------------
* Function: H5FA_get_addr
@@ -281,13 +285,12 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, haddr_t *addr))
-
- /* Local variables */
+herr_t
+H5FA_get_addr(const H5FA_t *fa, haddr_t *addr)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
HDassert(addr);
@@ -295,7 +298,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, hadd
/* Retrieve the address of the fixed array's header */
*addr = fa->hdr->addr;
-END_FUNC(PRIV) /* end H5FA_get_addr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_addr() */
/*-------------------------------------------------------------------------
* Function: H5FA_set
@@ -309,9 +313,9 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
-
- /* Local variables */
+herr_t
+H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)
+{
H5FA_hdr_t * hdr = fa->hdr; /* Header for fixed array */
H5FA_dblock_t * dblock = NULL; /* Pointer to fixed array Data block */
H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to fixed array Data block page */
@@ -319,10 +323,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
unsigned dblk_page_cache_flags =
H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */
hbool_t hdr_dirty = FALSE; /* Whether header information changed */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
@@ -334,15 +339,16 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
/* Create the data block */
hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty);
if (!H5F_addr_defined(hdr->dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create fixed array data block")
+ }
HDassert(idx < hdr->cparam.nelmts);
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)hdr->dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu",
+ (unsigned long long)hdr->dblk_addr)
/* Check for paging data block */
if (!dblock->npages) {
@@ -375,7 +381,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) {
/* Create the data block page */
if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0)
- H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page")
/* Mark data block page as initialized in data block */
H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE);
@@ -385,8 +391,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
/* Protect the data block page */
if (NULL ==
(dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Set the element in the data block page */
H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt,
@@ -394,19 +401,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
dblk_page_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end else */
- CATCH
+done:
/* Check for header modified */
if (hdr_dirty)
if (H5FA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as modified")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as modified")
/* Release resources */
if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page")
-END_FUNC(PRIV) /* end H5FA_set() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_set() */
/*-------------------------------------------------------------------------
* Function: H5FA_get
@@ -420,16 +428,17 @@ END_FUNC(PRIV) /* end H5FA_set() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
-
- /* Local variables */
+herr_t
+H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)
+{
H5FA_hdr_t * hdr = fa->hdr; /* Header for FA */
H5FA_dblock_t * dblock = NULL; /* Pointer to data block for FA */
H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
@@ -440,14 +449,15 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
if (!H5F_addr_defined(hdr->dblk_addr)) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else {
/* Get the data block */
HDassert(H5F_addr_defined(hdr->dblk_addr));
if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)hdr->dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu",
+ (unsigned long long)hdr->dblk_addr)
/* Check for paged data block */
if (!dblock->npages)
@@ -464,10 +474,10 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
/* We've retrieved the value, leave now */
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
else { /* get the page */
size_t dblk_page_nelmts; /* # of elements in a data block page */
@@ -490,9 +500,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
/* Protect the data block page */
if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts,
H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Retrieve element from data block */
H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx),
@@ -501,13 +511,14 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
} /* end else */
} /* end else */
- CATCH
+done:
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page")
-END_FUNC(PRIV) /* end H5FA_get() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_get() */
/*-------------------------------------------------------------------------
* Function: H5FA_close
@@ -521,18 +532,19 @@ END_FUNC(PRIV) /* end H5FA_get() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
-
- /* Local variables */
+herr_t
+H5FA_close(H5FA_t *fa)
+{
hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
- /* Close the header, if it was set */
+ /* Close the header if it was set */
if (fa->hdr) {
/* Decrement file reference & check if this is the last open fixed array using the shared array header
*/
@@ -562,7 +574,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
/* Check the header's status in the metadata cache */
if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for fixed array header")
/* Sanity checks on header */
HDassert(hdr_status & H5AC_ES__IN_CACHE);
@@ -574,7 +587,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
/* Lock the array header into memory */
/* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
if (NULL == (hdr = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTLOAD, FAIL, "unable to load fixed array header")
/* Set the shared array header's file context for this operation */
hdr->f = fa->f;
@@ -584,11 +597,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
* immediately -QAK)
*/
if (H5FA__hdr_decr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
/* Delete array, starting with header (unprotects header) */
if (H5FA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array")
} /* end if */
else {
/* Decrement the reference count on the array header */
@@ -596,16 +610,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
* immediately -QAK)
*/
if (H5FA__hdr_decr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
} /* end else */
} /* end if */
/* Release the fixed array wrapper */
fa = H5FL_FREE(H5FA_t, fa);
- CATCH
-
-END_FUNC(PRIV) /* end H5FA_close() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_close() */
/*-------------------------------------------------------------------------
* Function: H5FA_delete
@@ -619,21 +634,22 @@ END_FUNC(PRIV) /* end H5FA_close() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata))
+herr_t
+H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata)
+{
+ H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Lock the array header into memory */
if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu",
- (unsigned long long)fa_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array header, address = %llu",
+ (unsigned long long)fa_addr)
/* Check for files using shared array header */
if (hdr->file_rc)
@@ -644,17 +660,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_ad
/* Delete array now, starting with header (unprotects header) */
if (H5FA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array")
hdr = NULL;
- } /* end if */
-
- CATCH
+ }
- /* Unprotect the header, if an error occurred */
+done:
+ /* Unprotect the header if an error occurred */
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PRIV) /* end H5FA_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA_iterate
@@ -671,44 +687,44 @@ END_FUNC(PRIV) /* end H5FA_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
- H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
-
- /* Local variables */
+int
+H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata)
+{
uint8_t *elmt = NULL;
hsize_t u;
- int cb_ret = H5_ITER_CONT; /* Return value from callback */
+ int ret_value = H5_ITER_CONT;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(H5_ITER_ERROR)
+
+ /* Check arguments */
HDassert(fa);
HDassert(op);
HDassert(udata);
/* Allocate space for a native array element */
if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, H5_ITER_ERROR,
+ "memory allocation failed for fixed array element")
/* Iterate over all elements in array */
- for (u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) {
+ for (u = 0; u < fa->hdr->stats.nelmts && ret_value == H5_ITER_CONT; u++) {
/* Get array element */
if (H5FA_get(fa, u, elmt) < 0)
- H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array")
- /* Make callback */
- if ((cb_ret = (*op)(u, elmt, udata)) < 0) {
- H5E_PRINTF(H5E_BADITER, "iterator function failed");
- H5_LEAVE(cb_ret)
- } /* end if */
- } /* end for */
-
- CATCH
+ /* Invoke callback */
+ if ((ret_value = (*op)(u, elmt, udata)) < 0) {
+ HERROR(H5E_FARRAY, H5E_BADITER, "iteration callback error");
+ break;
+ }
+ }
+done:
if (elmt)
elmt = H5FL_BLK_FREE(fa_native_elmt, elmt);
-END_FUNC(PRIV) /* end H5FA_iterate() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_iterate() */
/*-------------------------------------------------------------------------
* Function: H5FA_depend
@@ -723,14 +739,15 @@ END_FUNC(PRIV) /* end H5FA_iterate() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent))
+herr_t
+H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent)
+{
+ H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(hdr);
HDassert(parent);
@@ -749,13 +766,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_
/* Add the fixed array as a child of the parent (proxy) */
if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array as child of proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "unable to add fixed array as child of proxy")
hdr->parent = parent;
- } /* end if */
-
- CATCH
+ }
-END_FUNC(PRIV) /* end H5FA_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_depend() */
/*-------------------------------------------------------------------------
* Function: H5FA_patch_file
@@ -769,17 +786,17 @@ END_FUNC(PRIV) /* end H5FA_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_patch_file(H5FA_t *fa, H5F_t *f))
+herr_t
+H5FA_patch_file(H5FA_t *fa, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /* Local variables */
-
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(f);
if (fa->f != f || fa->hdr->f != f)
fa->f = fa->hdr->f = f;
-END_FUNC(PRIV) /* end H5FA_patch_file() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_patch_file() */
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 4e6c57d..367b4b0 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -167,12 +167,13 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; /* User data for callback */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->f);
@@ -181,7 +182,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f);
-END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_verify_chksum
@@ -196,13 +198,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -213,7 +217,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_deserialize
@@ -228,16 +233,18 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_cls_id_t id; /* ID of fixed array class, as found in file */
H5FA_hdr_t * hdr = NULL; /* Fixed array info */
H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata;
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(udata);
@@ -246,24 +253,24 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate space for the fixed array data structure */
if (NULL == (hdr = H5FA__hdr_alloc(udata->f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array shared header")
/* Set the fixed array header's address */
hdr->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature")
+ if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5FA_HDR_VERSION)
- H5E_THROW(H5E_VERSION, "wrong fixed array header version")
+ HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array header version")
/* Fixed array class */
id = (H5FA_cls_id_t)*image++;
if (id >= H5FA_NUM_CLS_ID)
- H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class")
hdr->cparam.cls = H5FA_client_class_g[id];
/* General array creation/configuration information */
@@ -311,20 +318,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Finish initializing fixed array header */
if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "initialization failed for fixed array header")
HDassert(hdr->size == len);
/* Set return value */
ret_value = hdr;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (hdr && H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header")
-END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_image_len
@@ -338,12 +345,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -351,7 +359,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = hdr->size;
-END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_serialize
@@ -365,15 +374,16 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the fixed array header */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* check arguments */
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check arguments */
HDassert(f);
HDassert(image);
HDassert(hdr);
@@ -410,7 +420,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_notify
@@ -424,11 +435,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(hdr);
@@ -460,16 +473,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on object header proxy */
if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent,
(void *)hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between fixed array and proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between fixed array and proxy")
hdr->parent = NULL;
} /* end if */
/* Detach from 'top' proxy for fixed array */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between header and fixed array 'top' proxy")
/* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
} /* end if */
@@ -477,7 +490,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
@@ -486,9 +499,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
else
HDassert(NULL == hdr->parent);
- CATCH
+done:
-END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_free_icr
@@ -503,18 +517,23 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_hdr_free_icr(void *thing))
+static herr_t
+H5FA__cache_hdr_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array header */
if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array header")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header")
-END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_get_initial_load_size
@@ -528,14 +547,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data */
H5FA_dblock_t dblock; /* Fake data block for computing size */
size_t dblk_page_nelmts; /* # of elements per data block page */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -564,7 +584,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = (size_t)H5FA_DBLOCK_PREFIX_SIZE(&dblock);
-END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_verify_chksum
@@ -579,13 +600,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -596,7 +619,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_deserialize
@@ -611,16 +635,18 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_dblock_t * dblock = NULL; /* Data block info */
H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data for loading data block */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -628,7 +654,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the fixed array data block */
if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block")
HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) ||
(len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock)));
@@ -637,28 +663,28 @@ 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))
- H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature")
+ if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array data block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5FA_DBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong fixed array data block version")
+ HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array data block version")
/* Fixed array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong fixed array header address")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header address")
/* Page initialization flags */
if (dblock->npages > 0) {
H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
- } /* end if */
+ }
/* Only decode elements if the data block is not paged */
if (!dblock->npages) {
@@ -666,9 +692,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts,
udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements")
image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size);
- } /* end if */
+ }
/* Sanity check */
/* (allow for checksum not decoded yet) */
@@ -688,14 +714,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (dblock && H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block")
-END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_image_len
@@ -709,12 +735,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(image_len);
@@ -725,7 +752,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = H5FA_DBLOCK_PREFIX_SIZE(dblock);
-END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_serialize
@@ -739,14 +767,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(f);
@@ -773,7 +802,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Store the 'page init' bitmasks */
H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
- } /* end if */
+ }
/* Only encode elements if the data block is not paged */
if (!dblock->npages) {
@@ -783,9 +812,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t);
if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts,
dblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements")
image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size);
- } /* end if */
+ }
/* Compute metadata checksum */
metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
@@ -796,9 +825,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_notify
@@ -812,11 +841,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing;
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing;
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblock);
@@ -829,8 +860,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5FA__create_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_FARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block and header, address = %llu",
(unsigned long long)dblock->addr)
break;
@@ -842,35 +873,35 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
/* Detach from 'top' proxy for fixed array */
if (dblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block "
- "and fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block "
+ "and fixed array 'top' proxy")
dblock->top_proxy = NULL;
- } /* end if */
+ }
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
+#else
HDassert(0 && "Unknown action?!?");
-#endif /* NDEBUG */
+#endif
} /* end switch */
} /* end if */
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_free_icr
@@ -885,20 +916,24 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_free_icr(void *_thing))
+static herr_t
+H5FA__cache_dblock_free_icr(void *_thing)
+{
+ H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(dblock);
/* Release the fixed array data block */
if (H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array data block")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block")
-END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_fsf_size
@@ -929,11 +964,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
-
+static herr_t
+H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)
+{
const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -942,7 +979,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
*fsf_size = dblock->size;
-END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_fsf_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_get_initial_load_size
@@ -956,12 +994,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -971,7 +1010,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts);
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblk_page_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_verify_chksum
@@ -986,13 +1026,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1003,7 +1045,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_deserialize
@@ -1018,18 +1061,19 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_dblk_page_t * dblk_page = NULL; /* Data block page info */
H5FA_dblk_page_cache_ud_t *udata =
(H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
/* Sanity check */
+ FUNC_ENTER_STATIC
+
HDassert(udata);
HDassert(udata->hdr);
HDassert(udata->nelmts > 0);
@@ -1037,7 +1081,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the fixed array data block page */
if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for fixed array data block page")
/* Set the fixed array data block's information */
dblk_page->addr = udata->dblk_page_addr;
@@ -1047,7 +1092,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Decode elements in data block page */
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements")
image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
/* Sanity check */
@@ -1068,14 +1113,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Release resources */
if (!ret_value)
if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page")
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_image_len
@@ -1089,12 +1135,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblk_page);
HDassert(image_len);
@@ -1102,7 +1149,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = dblk_page->size;
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblk_page_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_serialize
@@ -1116,14 +1164,16 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image,
- size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing)
+{
H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -1138,7 +1188,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts,
dblk_page->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements")
image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size);
/* Compute metadata checksum */
@@ -1150,9 +1200,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_notify
@@ -1166,11 +1216,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)
+{
H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblk_page);
@@ -1187,8 +1239,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for fixed 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 fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page "
+ "and fixed array 'top' proxy")
dblk_page->top_proxy = NULL;
} /* end if */
break;
@@ -1204,15 +1257,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_free_icr
@@ -1227,15 +1280,20 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_free_icr(void *thing))
+static herr_t
+H5FA__cache_dblk_page_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the fixed array data block page */
if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array data block page")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block page")
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_free_icr() */
diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c
index 8c2c9a8..a69c078 100644
--- a/src/H5FAdbg.c
+++ b/src/H5FAdbg.c
@@ -79,13 +79,16 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5FA_class_t *cls, haddr_t obj_addr))
-
+herr_t
+H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls,
+ haddr_t obj_addr)
+{
/* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */
- void * dbg_ctx = NULL; /* Fixed array debugging context */
+ H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */
+ void * dbg_ctx = NULL; /* Fixed array debugging context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the fixed array header */
if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header")
/* Print opening message */
HDfprintf(stream, "%*sFixed Array Header...\n", indent, "");
@@ -126,13 +129,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Fixed Array Data Block Address:", hdr->dblk_addr);
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context")
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__hdr_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_debug() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_debug
@@ -146,15 +150,18 @@ END_FUNC(PKG) /* end H5FA__hdr_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
-
+herr_t
+H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls,
+ haddr_t hdr_addr, haddr_t obj_addr)
+{
/* Local variables */
- H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */
- H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
- void * dbg_ctx = NULL; /* Fixed array context */
- size_t u; /* Local index variable */
+ H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */
+ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
+ void * dbg_ctx = NULL; /* Fixed array context */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -170,16 +177,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the fixed array header */
if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header")
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)addr)
/* Print opening message */
HDfprintf(stream, "%*sFixed Array data Block...\n", indent, "");
@@ -222,9 +229,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts,
H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, 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);
for (u = 0; u < dblk_page_nelmts; u++) {
@@ -232,10 +239,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblk_page->elmts) +
(hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to release fixed array data block page")
/* Advance to next page address */
dblk_page_addr += dblock->dblk_page_size;
@@ -250,16 +258,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) <
0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
} /* end else */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context")
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__dblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_debug() */
diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c
index 0f5ee29..713bd67 100644
--- a/src/H5FAdblkpage.c
+++ b/src/H5FAdblkpage.c
@@ -84,21 +84,25 @@ H5FL_BLK_DEFINE(page_elmts);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts))
-
- /* Local variables */
+H5FA_dblk_page_t *
+H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)
+{
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
+ H5FA_dblk_page_t *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the data block */
if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for fixed array data block page")
/* Share common array information */
if (H5FA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblk_page->hdr = hdr;
/* Set non-zero internal fields */
@@ -106,40 +110,44 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_
/* Allocate buffer for elements in data block page */
if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block page element buffer")
/* Set the return value */
ret_value = dblk_page;
- CATCH
+done:
if (!ret_value)
if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page")
-END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_create
*
* Purpose: Creates a new fixed array data block page in the file
*
- * Return: Valid file address on success/HADDR_UNDEF on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts))
-
- /* Local variables */
+herr_t
+H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts)
+{
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
- HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr);
+ HDfprintf(stderr, "%s: Called, addr = %a\n", __func__, addr);
#endif /* H5FA_DEBUG */
/* Sanity check */
@@ -147,45 +155,50 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Allocate the data block page */
if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for fixed array data block page")
/* Set info about data block page on disk */
dblk_page->addr = addr;
dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts);
#ifdef H5FA_DEBUG
- HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size);
+ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", __func__, dblk_page->size);
#endif /* H5FA_DEBUG */
/* Clear any elements in data block page to fill value */
if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL,
+ "can't set fixed array data block page elements to class's fill value")
/* Cache the new fixed array data block page */
if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, FAIL, "can't add fixed array data block page to cache")
inserted = TRUE;
/* Add data block page as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL,
+ "unable to add fixed array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
- CATCH
+done:
if (ret_value < 0)
if (dblk_page) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblk_page) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block page from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, FAIL,
+ "unable to remove fixed array data block page from cache")
/* Destroy data block page */
if (H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "unable to destroy fixed array data block page")
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblk_page_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_protect
@@ -200,16 +213,17 @@ END_FUNC(PKG) /* end H5FA__dblk_page_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL,
- H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts,
- unsigned flags))
-
- /* Local variables */
+H5FA_dblk_page_t *
+H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags)
+{
H5FA_dblk_page_t * dblk_page = NULL; /* Fixed array data block page */
H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
+ H5FA_dblk_page_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
- HDfprintf(stderr, "%s: Called\n", FUNC);
+ HDfprintf(stderr, "%s: Called\n", __func__);
#endif /* H5FA_DEBUG */
/* Sanity check */
@@ -227,32 +241,36 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL,
/* Protect the data block page */
if (NULL == (dblk_page = (H5FA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr,
&udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblk_page->top_proxy) {
/* Add data block page as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block page, if it was protected */
if (dblk_page &&
H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblk_page_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_unprotect
@@ -267,13 +285,15 @@ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags))
+herr_t
+H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
-/* Local variables */
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
- HDfprintf(stderr, "%s: Called\n", FUNC);
+ HDfprintf(stderr, "%s: Called\n", __func__);
#endif /* H5FA_DEBUG */
/* Sanity check */
@@ -281,12 +301,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Unprotect the data block page */
if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
-END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_dest
@@ -300,7 +321,12 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page))
+herr_t
+H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
@@ -315,7 +341,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_
/* Decrement reference count on shared info */
if (H5FA__hdr_decr(dblk_page->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblk_page->hdr = NULL;
} /* end if */
@@ -325,6 +352,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_
/* Free the data block page itself */
dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__dblk_page_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_dest() */
diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c
index 21e2e03..1ccc97d 100644
--- a/src/H5FAdblock.c
+++ b/src/H5FAdblock.c
@@ -88,10 +88,13 @@ H5FL_BLK_DEFINE(fa_page_init);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t *hdr))
+H5FA_dblock_t *
+H5FA__dblock_alloc(H5FA_hdr_t *hdr)
+{
+ H5FA_dblock_t *dblock = NULL; /* fixed array data block */
+ H5FA_dblock_t *ret_value = NULL;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* fixed array data block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -99,11 +102,11 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate memory for the data block */
if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block")
/* Share common array information */
if (H5FA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -126,7 +129,7 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate space for 'page init' flags */
if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for page init bitmask")
/* Compute data block page size */
dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM;
@@ -143,19 +146,20 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate buffer for elements in data block */
H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t);
if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block element buffer")
} /* end else */
/* Set the return value */
ret_value = dblock;
- CATCH
-
+done:
if (!ret_value)
if (dblock && H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block")
-END_FUNC(PKG) /* end H5FA__dblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_create
@@ -169,13 +173,15 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty))
+haddr_t
+H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty)
+{
+ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
+ haddr_t dblock_addr; /* Fixed array data block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
- haddr_t dblock_addr; /* Fixed array data block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -183,31 +189,35 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the data block */
if (NULL == (dblock = H5FA__dblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for fixed array data block")
/* Set size of data block on disk */
hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock);
/* Allocate space for the data block on disk */
if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for fixed array data block")
dblock->addr = dblock_addr;
/* Don't initialize elements if paged */
if (!dblock->npages)
/* Clear any elements in data block to fill value */
if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set fixed array data block elements to class's fill value")
/* Cache the new fixed array data block */
if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array data block to cache")
inserted = TRUE;
/* Add data block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add fixed array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -217,26 +227,28 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of data block to return */
ret_value = dblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (dblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove fixed array data block from cache")
/* Release data block's disk space */
if (H5F_addr_defined(dblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to release fixed array data block")
/* Destroy data block */
if (H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy fixed array data block")
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_protect
@@ -250,12 +262,14 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL,
- H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags))
+H5FA_dblock_t *
+H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags)
+{
+ H5FA_dblock_t * dblock = NULL; /* Fixed array data block */
+ H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ H5FA_dblock_t * ret_value = NULL;
- /* Local variables */
- H5FA_dblock_t * dblock; /* Fixed array data block */
- H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -271,31 +285,33 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL,
/* Protect the data block */
if (NULL ==
(dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblock->top_proxy) {
/* Add data block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblock;
- CATCH
-
+done:
/* Clean up on error */
if (!ret_value)
/* Release the data block, if it was protected */
if (dblock &&
H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu",
- (unsigned long long)dblock->addr)
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect fixed array data block, address = %llu",
+ (unsigned long long)dblock->addr)
-END_FUNC(PKG) /* end H5FA__dblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_unprotect
@@ -309,22 +325,25 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags))
+herr_t
+H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
/* Unprotect the data block */
if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu",
- (unsigned long long)dblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array data block, address = %llu",
+ (unsigned long long)dblock->addr)
-END_FUNC(PKG) /* end H5FA__dblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_delete
@@ -338,10 +357,13 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr))
+herr_t
+H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr)
+{
+ H5FA_dblock_t *dblock = NULL; /* Pointer to data block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* Pointer to data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -349,8 +371,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr,
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr)
/* Check if data block is paged */
if (dblock->npages) {
@@ -365,21 +387,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr,
/* Evict the data block page from the metadata cache */
/* (OK to call if it doesn't exist in the cache) */
if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTEXPUNGE, FAIL,
+ "unable to remove array data block page from metadata cache")
/* Advance to next page address */
dblk_page_addr += dblock->dblk_page_size;
} /* end for */
} /* end if */
- CATCH
-
+done:
/* Finished deleting data block in metadata cache */
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
-END_FUNC(PKG) /* end H5FA__dblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_dest
@@ -393,7 +416,12 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dblock))
+herr_t
+H5FA__dblock_dest(H5FA_dblock_t *dblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
@@ -417,7 +445,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl
/* Decrement reference count on shared info */
if (H5FA__hdr_decr(dblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblock->hdr = NULL;
} /* end if */
@@ -427,6 +456,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl
/* Free the data block itself */
dblock = H5FL_FREE(H5FA_dblock_t, dblock);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__dblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_dest() */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 867160f..aeb3fb1 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -82,17 +82,20 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f))
+H5FA_hdr_t *
+H5FA__hdr_alloc(H5F_t *f)
+{
+ H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */
+ H5FA_hdr_t *ret_value = NULL;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
/* Allocate space for the shared information */
if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for Fixed Array shared header")
/* Set non-zero internal fields */
hdr->addr = HADDR_UNDEF;
@@ -106,13 +109,12 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f))
/* Set the return value */
ret_value = hdr;
- CATCH
-
+done:
if (!ret_value)
if (hdr && H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header")
-
-END_FUNC(PKG) /* end H5FA__hdr_alloc() */
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_init
@@ -126,9 +128,12 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata))
+herr_t
+H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -140,33 +145,36 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void
hdr->stats.nelmts = hdr->cparam.nelmts;
/* Create the callback context, if there's one */
- if (hdr->cparam.cls->crt_context) {
+ if (hdr->cparam.cls->crt_context)
if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create fixed array client callback context")
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_init() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_init() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_create
*
* Purpose: Creates a new Fixed Array header in the file
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Address of new header in the file
+ * Failure: HADDR_UNDEF
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
+haddr_t
+H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)
+{
+ H5FA_hdr_t *hdr = NULL; /* Fixed array header */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Fixed array header */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -176,17 +184,19 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
{
/* Check for valid parameters */
if (cparam->raw_elmt_size == 0)
- H5E_THROW(H5E_BADVALUE, "element size must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero")
if (cparam->max_dblk_page_nelmts_bits == 0)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements bits must be greater than zero")
if (cparam->nelmts == 0)
- H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# of elements must be greater than zero")
}
#endif /* NDEBUG */
/* Allocate space for the shared information */
if (NULL == (hdr = H5FA__hdr_alloc(f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for Fixed Array shared header")
hdr->dblk_addr = HADDR_UNDEF;
@@ -195,50 +205,52 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Finish initializing fixed array header */
if (H5FA__hdr_init(hdr, ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "initialization failed for fixed array header")
/* Allocate space for the header on disk */
if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header")
/* Create 'top' proxy for extensible array entries */
if (hdr->swmr_write)
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy")
/* Cache the new Fixed Array header */
if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array header to cache")
inserted = TRUE;
/* Add header as child of 'top' proxy */
if (hdr->top_proxy)
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add fixed array entry as child of array proxy")
/* Set address of array header to return */
ret_value = hdr->addr;
- CATCH
-
+done:
if (!H5F_addr_defined(ret_value))
if (hdr) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(hdr) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array header from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove fixed array header from cache")
/* Release header's disk space */
if (H5F_addr_defined(hdr->addr) &&
H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free Fixed Array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free Fixed Array header")
/* Destroy header */
if (H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy Fixed Array header")
- } /* end if */
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy Fixed Array header")
+ }
-END_FUNC(PKG) /* end H5FA__hdr_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_incr
@@ -252,7 +264,12 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_incr(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -260,14 +277,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if (hdr->rc == 0)
if (H5AC_pin_protected_entry(hdr) < 0)
- H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "unable to pin fixed array header")
/* Increment reference count on shared header */
hdr->rc++;
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_incr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_incr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_decr
@@ -281,7 +298,12 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_decr(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -294,12 +316,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr))
if (hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
if (H5AC_unpin_entry(hdr) < 0)
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header")
+ }
-END_FUNC(PKG) /* end H5FA__hdr_decr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_decr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_fuse_incr
@@ -313,7 +335,10 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -321,21 +346,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr))
/* Increment file reference count on shared header */
hdr->file_rc++;
-END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__hdr_fuse_incr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_fuse_decr
*
* Purpose: Decrement file reference count on shared array header
*
- * Return: SUCCEED/FAIL
+ * Return: Success: The reference count of the header
+ * Failure: Can't fail
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr))
+size_t
+H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr)
+{
+ size_t ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -347,7 +379,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr))
/* Set return value */
ret_value = hdr->file_rc;
-END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_fuse_decr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_modified
@@ -361,18 +394,23 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_modified(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_modified(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Mark header as dirty in cache */
if (H5AC_mark_entry_dirty(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty")
-END_FUNC(PKG) /* end H5FA__hdr_modified() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_modified() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_protect
@@ -386,12 +424,14 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL,
- H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags))
-
- /* Local variables */
+H5FA_hdr_t *
+H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags)
+{
H5FA_hdr_t * hdr; /* Fixed array header */
H5FA_hdr_cache_ud_t udata; /* User data for cache callbacks */
+ H5FA_hdr_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -407,27 +447,28 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL,
/* Protect the header */
if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu",
- (unsigned long long)fa_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array header, address = %llu",
+ (unsigned long long)fa_addr)
hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
/* Create top proxy, if it doesn't exist */
if (hdr->swmr_write && NULL == hdr->top_proxy) {
/* Create 'top' proxy for fixed array entries */
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "can't create fixed array entry proxy")
/* Add header as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
+ }
/* Set return value */
ret_value = hdr;
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_protect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_unprotect
@@ -441,21 +482,24 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags))
+herr_t
+H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Unprotect the header */
if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu",
- (unsigned long long)hdr->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr)
-END_FUNC(PKG) /* end H5FA__hdr_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_delete
@@ -469,46 +513,49 @@ END_FUNC(PKG) /* end H5FA__hdr_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_delete(H5FA_hdr_t *hdr))
-
- /* Local variables */
+herr_t
+H5FA__hdr_delete(H5FA_hdr_t *hdr)
+{
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
#ifndef NDEBUG
- {
- unsigned hdr_status = 0; /* Array header's status in the metadata cache */
- /* Check the array header's status in the metadata cache */
- if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header")
+ unsigned hdr_status = 0; /* Array header's status in the metadata cache */
+
+ /* Check the array header's status in the metadata cache */
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header")
+
+ /* Sanity checks on array header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- /* Sanity checks on array header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- } /* end block */
#endif /* NDEBUG */
/* Check for Fixed Array Data block */
if (H5F_addr_defined(hdr->dblk_addr)) {
/* Delete Fixed Array Data block */
if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block")
+ }
/* Set flags to finish deleting header on unprotect */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
-
+done:
/* Unprotect the header, deleting it if an error hasn't occurred */
if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__hdr_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_dest
@@ -522,7 +569,12 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_dest(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -531,20 +583,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr))
/* Destroy the callback context */
if (hdr->cb_ctx) {
if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy fixed array client callback context")
+ }
hdr->cb_ctx = NULL;
/* Destroy the 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy fixed array 'top' proxy")
hdr->top_proxy = NULL;
- } /* end if */
+ }
/* Free the shared info itself */
hdr = H5FL_FREE(H5FA_hdr_t, hdr);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_dest() */
diff --git a/src/H5FAint.c b/src/H5FAint.c
index 864c7ee..2206901 100644
--- a/src/H5FAint.c
+++ b/src/H5FAint.c
@@ -79,8 +79,12 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Create a flush dependency between parent and child entry */
if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
-END_FUNC(PKG) /* end H5FA__create_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__create_flush_depend() */
/*-------------------------------------------------------------------------
* Function: H5FA__destroy_flush_depend
@@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5FA__create_flush_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Destroy a flush dependency between parent and child entry */
if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
-END_FUNC(PKG) /* end H5FA__destroy_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__destroy_flush_depend() */
diff --git a/src/H5FAstat.c b/src/H5FAstat.c
index 1fdf47f..f7d1b90 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -78,21 +78,21 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats))
-
-/* Local variables */
+herr_t
+H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
#ifdef H5FA_DEBUG
- HDfprintf(stderr, "%s: Called\n", FUNC);
+ HDfprintf(stderr, "%s: Called\n", __func__);
#endif /* H5FA_DEBUG */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(stats);
/* Copy fixed array statistics */
H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
-END_FUNC(PRIV) /* end H5FA_get_stats() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_stats() */
diff --git a/src/H5FAtest.c b/src/H5FAtest.c
index 6dd6e00..384a657 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -112,14 +112,17 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_UNUSED *udata))
-
- /* Local variables */
+static void *
+H5FA__test_crt_context(void H5_ATTR_UNUSED *udata)
+{
H5FA__test_ctx_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
/* Initialize the context */
ctx->bogus = H5FA__TEST_BOGUS_VAL;
@@ -127,9 +130,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__test_crt_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__test_crt_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_dst_context
@@ -143,18 +146,21 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_dst_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5FA__test_dst_context(void *_ctx)
+{
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus);
/* Release context structure */
ctx = H5FL_FREE(H5FA__test_ctx_t, ctx);
-END_FUNC(STATIC) /* end H5FA__test_dst_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_fill
@@ -168,18 +174,21 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_fill(void *nat_blk, size_t nelmts))
-
- /* Local variables */
+static herr_t
+H5FA__test_fill(void *nat_blk, size_t nelmts)
+{
uint64_t fill_val = H5FA_TEST_FILL; /* Value to fill elements with */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(nat_blk);
HDassert(nelmts);
H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts);
-END_FUNC(STATIC) /* end H5FA__test_fill() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_fill() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_encode
@@ -193,14 +202,15 @@ END_FUNC(STATIC) /* end H5FA__test_fill() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
-#endif /* NDEBUG */
- const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+#endif
+ const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(raw);
@@ -221,7 +231,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
nelmts--;
} /* end while */
-END_FUNC(STATIC) /* end H5FA__test_encode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_encode() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_decode
@@ -235,15 +246,16 @@ END_FUNC(STATIC) /* end H5FA__test_encode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
-#endif /* NDEBUG */
- uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
- const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+#endif
+ uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(raw);
@@ -264,7 +276,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
nelmts--;
} /* end while */
-END_FUNC(STATIC) /* end H5FA__test_decode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_decode() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_debug
@@ -278,12 +291,13 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt))
-
- /* Local variables */
+static herr_t
+H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
+{
char temp_str[128]; /* Temporary string, for formatting */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(stream);
HDassert(elmt);
@@ -293,7 +307,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
-END_FUNC(STATIC) /* end H5FA__test_debug() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_debug() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_crt_dbg_context
@@ -308,15 +323,17 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr))
-
- /* Local variables */
+static void *
+H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)
+{
H5FA__test_ctx_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
/* Initialize the context */
ctx->bogus = H5FA__TEST_BOGUS_VAL;
@@ -324,9 +341,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FA__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__get_cparam_test
@@ -340,7 +357,10 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam))
+herr_t
+H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(fa);
@@ -350,22 +370,27 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *f
cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size;
cparam->nelmts = fa->hdr->cparam.nelmts;
-END_FUNC(PKG) /* end H5FA__get_cparam_test() */
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* end H5FA__get_cparam_test() */
/*-------------------------------------------------------------------------
* Function: H5FA__cmp_cparam_test
*
* Purpose: Compare the parameters used to create the fixed array
*
- * Return: SUCCEED/FAIL
+ * Return: An integer value like strcmp
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
- H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2))
+int
+H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)
+{
+ int ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(cparam1);
@@ -373,10 +398,10 @@ BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
/* Compare creation parameters for array */
if (cparam1->raw_elmt_size < cparam2->raw_elmt_size)
- H5_LEAVE(-1)
+ ret_value = -1;
else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size)
- H5_LEAVE(1)
+ ret_value = 1;
- CATCH
+ FUNC_LEAVE_NOAPI(ret_value)
-END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */
+} /* end H5FA__cmp_cparam_test() */
diff --git a/src/H5FD.c b/src/H5FD.c
index 3cc5e82..fad212e 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -301,6 +301,62 @@ done:
} /* end H5FD_register() */
/*-------------------------------------------------------------------------
+ * Function: H5FDis_driver_registered_by_name
+ *
+ * Purpose: Tests whether a VFD class has been registered or not
+ * according to a supplied driver name.
+ *
+ * Return: >0 if a VFD with that name has been registered
+ * 0 if a VFD with that name has NOT been registered
+ * <0 on errors
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FDis_driver_registered_by_name(const char *driver_name)
+{
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "*s", driver_name);
+
+ /* Check if driver with this name is registered */
+ if ((ret_value = H5FD_is_driver_registered_by_name(driver_name, NULL)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5FDis_driver_registered_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FDis_driver_registered_by_value
+ *
+ * Purpose: Tests whether a VFD class has been registered or not
+ * according to a supplied driver value (ID).
+ *
+ * Return: >0 if a VFD with that value has been registered
+ * 0 if a VFD with that value hasn't been registered
+ * <0 on errors
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value)
+{
+ htri_t ret_value = FALSE;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "DV", driver_value);
+
+ /* Check if driver with this value is registered */
+ if ((ret_value = H5FD_is_driver_registered_by_value(driver_value, NULL)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5FDis_driver_registered_by_value() */
+
+/*-------------------------------------------------------------------------
* Function: H5FDunregister
*
* Purpose: Removes a driver ID from the library. This in no way affects
@@ -496,9 +552,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 */
@@ -2147,7 +2203,8 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void
}
else if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) {
- HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (no ctl and fail if unknown)")
+ HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL,
+ "VFD ctl request failed (no ctl and fail if unknown flag is set)")
}
done:
@@ -2355,3 +2412,37 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/)
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 5fe845c..7ae89c6 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -148,8 +148,11 @@ 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 inline const H5FD_core_fapl_t *H5FD__core_get_default_config(void);
static const H5FD_class_t H5FD_core_g = {
+ H5FD_CORE_VALUE, /* value */
"core", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -185,10 +188,16 @@ 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, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
+/* Default configurations, if none provided */
+static const H5FD_core_fapl_t H5FD_core_default_config_g = {H5_MB, TRUE, H5FD_CORE_WRITE_TRACKING_FLAG,
+ H5FD_CORE_WRITE_TRACKING_PAGE_SIZE};
+static const H5FD_core_fapl_t H5FD_core_default_paged_config_g = {H5_MB, TRUE, TRUE, (size_t)4096};
+
/* Define a free list to manage the region type */
H5FL_DEFINE(H5FD_core_region_t);
@@ -411,6 +420,32 @@ done:
} /* end H5FD__core_write_to_bstore() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__core_get_default_config
+ *
+ * Purpose: Retrieves a default configuration for this VFD when no
+ * configuration information has been provided.
+ *
+ * Return: Valid Core VFD configuration information pointer (can't
+ * fail)
+ *
+ *-------------------------------------------------------------------------
+ */
+static inline const H5FD_core_fapl_t *
+H5FD__core_get_default_config(void)
+{
+ char *driver = HDgetenv(HDF5_DRIVER);
+
+ if (driver) {
+ if (!HDstrcmp(driver, "core"))
+ return &H5FD_core_default_config_g;
+ else if (!HDstrcmp(driver, "core_paged"))
+ return &H5FD_core_default_paged_config_g;
+ }
+
+ return &H5FD_core_default_config_g;
+} /* end H5FD__core_get_default_config() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD__init_package
*
* Purpose: Initializes any interface-specific data or routines.
@@ -428,7 +463,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
/* Check the use disabled file locks environment variable */
- lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
@@ -531,7 +566,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
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)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
+ old_fa = H5FD__core_get_default_config();
/* Set VFD info values */
HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t));
@@ -541,7 +576,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size)
fa.page_size = page_size;
/* Set the property values & the driver for the FAPL */
- if (H5P_set_driver(plist, H5FD_CORE, &fa) < 0)
+ if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver")
done:
@@ -625,7 +660,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
fa.page_size = H5FD_CORE_WRITE_TRACKING_PAGE_SIZE;
/* Set the property values & the driver for the FAPL */
- if (H5P_set_driver(plist, H5FD_CORE, &fa) < 0)
+ if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver")
done:
@@ -750,7 +785,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "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, NULL, "bad VFL driver info")
+ fa = H5FD__core_get_default_config();
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
@@ -1713,3 +1748,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)))
+ fa = H5FD__core_get_default_config();
+
+ 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/H5FDcore.h b/src/H5FDcore.h
index f8a516a..590478e 100644
--- a/src/H5FDcore.h
+++ b/src/H5FDcore.h
@@ -20,13 +20,76 @@
#ifndef H5FDcore_H
#define H5FDcore_H
-#define H5FD_CORE (H5FD_core_init())
+#define H5FD_CORE (H5FD_core_init())
+#define H5FD_CORE_VALUE H5_VFD_CORE
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_core_init(void);
+H5_DLL hid_t H5FD_core_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Modifies the file access property list to use the #H5FD_CORE driver
+ *
+ * \fapl_id
+ * \param[in] increment Size, in bytes, of memory increments
+ * \param[in] backing_store Boolean flag indicating whether to write the file
+ * contents to disk when the file is closed
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_core() modifies the file access property list to use the
+ * #H5FD_CORE driver.
+ *
+ * The #H5FD_CORE driver enables an application to work with a file in
+ * memory, speeding reads and writes as no disk access is made. File
+ * contents are stored only in memory until the file is closed. The \p
+ * backing_store parameter determines whether file contents are ever
+ * written to disk.
+ *
+ * \p increment specifies the increment by which allocated memory is to
+ * be increased each time more memory is required.
+ *
+ * While using H5Fcreate() to create a core file, if the \p
+ * backing_store is set to 1 (TRUE), the file contents are flushed to a
+ * file with the same name as this core file when the file is closed or
+ * access to the file is terminated in memory.
+ *
+ * The application is allowed to open an existing file with #H5FD_CORE
+ * driver. While using H5Fopen() to open an existing file, if the \p
+ * backing_store is set to 1 (TRUE) and the \c flags for H5Fopen() is set to
+ * #H5F_ACC_RDWR, any change to the file contents are saved to the file
+ * when the file is closed. If \p backing_store is set to 0 (FALSE) and the \c
+ * flags for H5Fopen() is set to #H5F_ACC_RDWR, any change to the file
+ * contents will be lost when the file is closed. If the flags for
+ * H5Fopen() is set to #H5F_ACC_RDONLY, no change to the file is
+ * allowed either in memory or on file.
+ *
+ * \note Currently this driver cannot create or open family or multi files.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Queries core file driver properties
+ *
+ * \fapl_id
+ * \param[out] increment Size, in bytes, of memory increments
+ * \param[out] backing_store Boolean flag indicating whether to write the file
+ * contents to disk when the file is closed
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_core() queries the #H5FD_CORE driver properties as set
+ * by H5Pset_fapl_core().
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/);
#ifdef __cplusplus
}
diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h
new file mode 100644
index 0000000..9b31fae
--- /dev/null
+++ b/src/H5FDdevelop.h
@@ -0,0 +1,287 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5FD (file drivers) developer
+ * support routines.
+ */
+
+#ifndef _H5FDdevelop_H
+#define _H5FDdevelop_H
+
+/* Include package's public header */
+#include "H5FDpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/* Map "fractal heap" header blocks to 'ohdr' type file memory, since its
+ * a fair amount of work to add a new kind of file memory and they are similar
+ * enough to object headers and probably too minor to deserve their own type.
+ *
+ * Map "fractal heap" indirect blocks to 'ohdr' type file memory, since they
+ * are similar to fractal heap header blocks.
+ *
+ * Map "fractal heap" direct blocks to 'lheap' type file memory, since they
+ * will be replacing local heaps.
+ *
+ * Map "fractal heap" 'huge' objects to 'draw' type file memory, since they
+ * represent large objects that are directly stored in the file.
+ *
+ * -QAK
+ */
+#define H5FD_MEM_FHEAP_HDR H5FD_MEM_OHDR
+#define H5FD_MEM_FHEAP_IBLOCK H5FD_MEM_OHDR
+#define H5FD_MEM_FHEAP_DBLOCK H5FD_MEM_LHEAP
+#define H5FD_MEM_FHEAP_HUGE_OBJ H5FD_MEM_DRAW
+
+/* Map "free space" header blocks to 'ohdr' type file memory, since its
+ * a fair amount of work to add a new kind of file memory and they are similar
+ * enough to object headers and probably too minor to deserve their own type.
+ *
+ * Map "free space" serialized sections to 'lheap' type file memory, since they
+ * are similar enough to local heap info.
+ *
+ * -QAK
+ */
+#define H5FD_MEM_FSPACE_HDR H5FD_MEM_OHDR
+#define H5FD_MEM_FSPACE_SINFO H5FD_MEM_LHEAP
+
+/* Map "shared object header message" master table to 'ohdr' type file memory,
+ * since its a fair amount of work to add a new kind of file memory and they are
+ * similar enough to object headers and probably too minor to deserve their own
+ * type.
+ *
+ * Map "shared object header message" indices to 'btree' type file memory,
+ * since they are similar enough to B-tree nodes.
+ *
+ * -QAK
+ */
+#define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR
+#define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE
+
+/* Map "extensible array" header blocks to 'ohdr' type file memory, since its
+ * a fair amount of work to add a new kind of file memory and they are similar
+ * enough to object headers and probably too minor to deserve their own type.
+ *
+ * Map "extensible array" index blocks to 'ohdr' type file memory, since they
+ * are similar to extensible array header blocks.
+ *
+ * Map "extensible array" super blocks to 'btree' type file memory, since they
+ * are similar enough to B-tree nodes.
+ *
+ * Map "extensible array" data blocks & pages to 'lheap' type file memory, since
+ * they are similar enough to local heap info.
+ *
+ * -QAK
+ */
+#define H5FD_MEM_EARRAY_HDR H5FD_MEM_OHDR
+#define H5FD_MEM_EARRAY_IBLOCK H5FD_MEM_OHDR
+#define H5FD_MEM_EARRAY_SBLOCK H5FD_MEM_BTREE
+#define H5FD_MEM_EARRAY_DBLOCK H5FD_MEM_LHEAP
+#define H5FD_MEM_EARRAY_DBLK_PAGE H5FD_MEM_LHEAP
+
+/* Map "fixed array" header blocks to 'ohdr' type file memory, since its
+ * a fair amount of work to add a new kind of file memory and they are similar
+ * enough to object headers and probably too minor to deserve their own type.
+ *
+ * Map "fixed array" data blocks & pages to 'lheap' type file memory, since
+ * they are similar enough to local heap info.
+ *
+ */
+#define H5FD_MEM_FARRAY_HDR H5FD_MEM_OHDR
+#define H5FD_MEM_FARRAY_DBLOCK H5FD_MEM_LHEAP
+#define H5FD_MEM_FARRAY_DBLK_PAGE H5FD_MEM_LHEAP
+
+/*
+ * A free-list map which maps all types of allocation requests to a single
+ * free list. This is useful for drivers that don't really care about
+ * keeping different requests segregated in the underlying file and which
+ * want to make most efficient reuse of freed memory. The use of the
+ * H5FD_MEM_SUPER free list is arbitrary.
+ */
+#define H5FD_FLMAP_SINGLE \
+ { \
+ H5FD_MEM_SUPER, /*default*/ \
+ H5FD_MEM_SUPER, /*super*/ \
+ H5FD_MEM_SUPER, /*btree*/ \
+ H5FD_MEM_SUPER, /*draw*/ \
+ H5FD_MEM_SUPER, /*gheap*/ \
+ H5FD_MEM_SUPER, /*lheap*/ \
+ H5FD_MEM_SUPER /*ohdr*/ \
+ }
+
+/*
+ * A free-list map which segregates requests into `raw' or `meta' data
+ * pools.
+ */
+#define H5FD_FLMAP_DICHOTOMY \
+ { \
+ H5FD_MEM_SUPER, /*default*/ \
+ H5FD_MEM_SUPER, /*super*/ \
+ H5FD_MEM_SUPER, /*btree*/ \
+ H5FD_MEM_DRAW, /*draw*/ \
+ H5FD_MEM_DRAW, /*gheap*/ \
+ H5FD_MEM_SUPER, /*lheap*/ \
+ H5FD_MEM_SUPER /*ohdr*/ \
+ }
+
+/*
+ * The default free list map which causes each request type to use it's own
+ * free-list.
+ */
+#define H5FD_FLMAP_DEFAULT \
+ { \
+ H5FD_MEM_DEFAULT, /*default*/ \
+ H5FD_MEM_DEFAULT, /*super*/ \
+ H5FD_MEM_DEFAULT, /*btree*/ \
+ H5FD_MEM_DEFAULT, /*draw*/ \
+ H5FD_MEM_DEFAULT, /*gheap*/ \
+ H5FD_MEM_DEFAULT, /*lheap*/ \
+ H5FD_MEM_DEFAULT /*ohdr*/ \
+ }
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* Forward declaration */
+typedef struct H5FD_t H5FD_t;
+
+/* Class information for each file driver */
+typedef struct H5FD_class_t {
+ H5FD_class_value_t value;
+ const char * name;
+ haddr_t maxaddr;
+ H5F_close_degree_t fc_degree;
+ herr_t (*terminate)(void);
+ hsize_t (*sb_size)(H5FD_t *file);
+ herr_t (*sb_encode)(H5FD_t *file, char *name /*out*/, unsigned char *p /*out*/);
+ herr_t (*sb_decode)(H5FD_t *f, const char *name, const unsigned char *p);
+ size_t fapl_size;
+ void *(*fapl_get)(H5FD_t *file);
+ void *(*fapl_copy)(const void *fapl);
+ herr_t (*fapl_free)(void *fapl);
+ size_t dxpl_size;
+ void *(*dxpl_copy)(const void *dxpl);
+ herr_t (*dxpl_free)(void *dxpl);
+ H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr);
+ herr_t (*close)(H5FD_t *file);
+ int (*cmp)(const H5FD_t *f1, const H5FD_t *f2);
+ herr_t (*query)(const H5FD_t *f1, unsigned long *flags);
+ herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map);
+ haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
+ herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
+ haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type);
+ herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr);
+ haddr_t (*get_eof)(const H5FD_t *file, H5FD_mem_t type);
+ herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void **file_handle);
+ herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer);
+ herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer);
+ herr_t (*read_vector)(H5FD_t *file, hid_t dxpl, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
+ size_t sizes[], void *bufs[]);
+ herr_t (*write_vector)(H5FD_t *file, hid_t dxpl, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
+ size_t sizes[], const void *bufs[]);
+ herr_t (*read_selection)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, size_t count, hid_t mem_spaces[],
+ hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[],
+ void *bufs[] /*out*/);
+ herr_t (*write_selection)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, size_t count, hid_t mem_spaces[],
+ hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[],
+ const void *bufs[] /*in*/);
+ herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
+ 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);
+ herr_t (*ctl)(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output);
+ H5FD_mem_t fl_map[H5FD_MEM_NTYPES];
+} H5FD_class_t;
+
+/* A free list is a singly-linked list of address/size pairs. */
+typedef struct H5FD_free_t {
+ haddr_t addr;
+ hsize_t size;
+ struct H5FD_free_t *next;
+} H5FD_free_t;
+
+/*
+ * The main datatype for each driver. Public fields common to all drivers
+ * are declared here and the driver appends private fields in memory.
+ */
+struct H5FD_t {
+ hid_t driver_id; /*driver ID for this file */
+ const H5FD_class_t *cls; /*constant class info */
+ unsigned long fileno; /* File 'serial' number */
+ unsigned access_flags; /* File access flags (from create or open) */
+ unsigned long feature_flags; /* VFL Driver feature Flags */
+ haddr_t maxaddr; /* For this file, overrides class */
+ haddr_t base_addr; /* Base address for HDF5 data w/in file */
+
+ /* Space allocation management fields */
+ hsize_t threshold; /* Threshold for alignment */
+ hsize_t alignment; /* Allocation alignment */
+ hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
+};
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
+H5_DLL htri_t H5FDis_driver_registered_by_name(const char *driver_name);
+H5_DLL htri_t H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value);
+H5_DLL herr_t H5FDunregister(hid_t driver_id);
+H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+H5_DLL herr_t H5FDclose(H5FD_t *file);
+H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
+H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags);
+H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
+H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
+H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
+H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
+H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
+H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle);
+H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
+ void *buf /*out*/);
+H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
+ const void *buf);
+H5_DLL herr_t H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[],
+ haddr_t addrs[], size_t sizes[], void *bufs[] /* out */);
+H5_DLL herr_t H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[],
+ haddr_t addrs[], size_t sizes[], const void *bufs[] /* in */);
+H5_DLL herr_t H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count,
+ hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[],
+ size_t element_sizes[], void *bufs[] /* out */);
+H5_DLL herr_t H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count,
+ hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[],
+ size_t element_sizes[], const void *bufs[]);
+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);
+H5_DLL herr_t H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5FDdevelop_H */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 21a46da..81d311f 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -120,6 +120,8 @@ typedef struct H5FD_direct_t {
/* Prototypes */
static herr_t H5FD__direct_term(void);
+static herr_t H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_size,
+ H5FD_direct_fapl_t *fa_out);
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);
@@ -137,8 +139,10 @@ static herr_t H5FD__direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id,
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 = {
+ H5FD_DIRECT_VALUE, /* value */
"direct", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -174,6 +178,7 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD__direct_truncate, /* truncate */
H5FD__direct_lock, /* lock */
H5FD__direct_unlock, /* unlock */
+ H5FD__direct_delete, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -202,7 +207,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
/* Check the use disabled file locks environment variable */
- lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
@@ -298,28 +303,10 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu
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_direct_fapl_t));
- if (boundary != 0)
- fa.mboundary = boundary;
- else
- fa.mboundary = MBOUNDARY_DEF;
- if (block_size != 0)
- fa.fbsize = block_size;
- else
- fa.fbsize = FBSIZE_DEF;
- if (cbuf_size != 0)
- fa.cbsize = cbuf_size;
- else
- fa.cbsize = CBSIZE_DEF;
+ if (H5FD__direct_populate_config(boundary, block_size, cbuf_size, &fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info")
- /* Set the default to be true for data alignment */
- fa.must_align = TRUE;
-
- /* Copy buffer size must be a multiple of file block size */
- if (fa.cbsize % fa.fbsize != 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size")
-
- ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa);
+ ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -369,6 +356,53 @@ done:
} /* end H5Pget_fapl_direct() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__direct_populate_config
+ *
+ * Purpose: Populates a H5FD_direct_fapl_t structure with the provided
+ * values, supplying defaults where values are not provided.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_size, H5FD_direct_fapl_t *fa_out)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(fa_out);
+
+ HDmemset(fa_out, 0, sizeof(H5FD_direct_fapl_t));
+
+ if (boundary != 0)
+ fa_out->mboundary = boundary;
+ else
+ fa_out->mboundary = MBOUNDARY_DEF;
+
+ if (block_size != 0)
+ fa_out->fbsize = block_size;
+ else
+ fa_out->fbsize = FBSIZE_DEF;
+
+ if (cbuf_size != 0)
+ fa_out->cbsize = cbuf_size;
+ else
+ fa_out->cbsize = CBSIZE_DEF;
+
+ /* Set the default to be true for data alignment */
+ fa_out->must_align = TRUE;
+
+ /* Copy buffer size must be a multiple of file block size */
+ if (fa_out->cbsize % fa_out->fbsize != 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__direct_populate_config() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD__direct_fapl_get
*
* Purpose: Returns a file access property list which indicates how the
@@ -452,6 +486,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
int fd = (-1);
H5FD_direct_t * file = NULL;
const H5FD_direct_fapl_t *fa;
+ H5FD_direct_fapl_t default_fa;
#ifdef H5_HAVE_WIN32_API
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
@@ -500,8 +535,11 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
/* Get the driver specific information */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
+ if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) {
+ if (H5FD__direct_populate_config(0, 0, 0, &default_fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info")
+ fa = &default_fa;
+ }
file->fd = fd;
H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t);
@@ -1385,4 +1423,29 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* 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/H5FDdirect.h b/src/H5FDdirect.h
index eec10de..a439e55 100644
--- a/src/H5FDdirect.h
+++ b/src/H5FDdirect.h
@@ -21,9 +21,11 @@
#define H5FDdirect_H
#ifdef H5_HAVE_DIRECT
-#define H5FD_DIRECT (H5FD_direct_init())
+#define H5FD_DIRECT (H5FD_direct_init())
+#define H5FD_DIRECT_VALUE H5_VFD_DIRECT
#else
-#define H5FD_DIRECT (H5I_INVALID_HID)
+#define H5FD_DIRECT (H5I_INVALID_HID)
+#define H5FD_DIRECT_VALUE H5_VFD_INVALID
#endif /* H5_HAVE_DIRECT */
#ifdef H5_HAVE_DIRECT
@@ -37,8 +39,69 @@ extern "C" {
#define FBSIZE_DEF 4096
#define CBSIZE_DEF 16 * 1024 * 1024
-H5_DLL hid_t H5FD_direct_init(void);
+H5_DLL hid_t H5FD_direct_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets up use of the direct I/O driver
+ *
+ * \fapl_id
+ * \param[in] alignment Required memory alignment boundary
+ * \param[in] block_size File system block size
+ * \param[in] cbuf_size Copy buffer size
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_direct() sets the file access property list, \p fapl_id,
+ * to use the direct I/O driver, #H5FD_DIRECT. With this driver, data
+ * is written to or read from the file synchronously without being
+ * cached by the system.
+ *
+ * File systems usually require the data address in memory, the file
+ * address, and the size of the data to be aligned. The HDF5 library’s
+ * direct I/O driver is able to handle unaligned data, though that will
+ * consume some additional memory resources and may slow
+ * performance. To get better performance, use the system function \p
+ * posix_memalign to align the data buffer in memory and the HDF5
+ * function H5Pset_alignment() to align the data in the file. Be aware,
+ * however, that aligned data I/O may cause the HDF5 file to be bigger
+ * than the actual data size would otherwise require because the
+ * alignment may leave some holes in the file.
+ *
+ * \p alignment specifies the required alignment boundary in memory.
+ *
+ * \p block_size specifies the file system block size. A value of 0
+ * (zero) means to use HDF5 library’s default value of 4KB.
+ *
+ * \p cbuf_size specifies the copy buffer size.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves direct I/O driver settings
+ *
+ * \fapl_id
+ * \param[out] boundary Required memory alignment boundary
+ * \param[out] block_size File system block size
+ * \param[out] cbuf_size Copy buffer size
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_direct() retrieves the required memory alignment (\p
+ * alignment), file system block size (\p block_size), and copy buffer
+ * size (\p cbuf_size) settings for the direct I/O driver, #H5FD_DIRECT,
+ * from the file access property list \p fapl_id.
+ *
+ * See H5Pset_fapl_direct() for discussion of these values,
+ * requirements, and important considerations.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size /*out*/,
size_t *cbuf_size /*out*/);
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index ac3f54d..a1a90d8 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -47,6 +47,9 @@
/* The size of the member name buffers */
#define H5FD_FAM_MEMB_NAME_BUF_SIZE 4096
+/* Default member size - 100 MiB */
+#define H5FD_FAM_DEF_MEM_SIZE ((hsize_t)(100 * H5_MB))
+
/* The driver identification number, initialized at runtime */
static hid_t H5FD_FAMILY_g = 0;
@@ -77,6 +80,10 @@ typedef struct H5FD_family_fapl_t {
hid_t memb_fapl_id; /*file access property list of each memb*/
} H5FD_family_fapl_t;
+/* Private routines */
+static herr_t H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out);
+static char * H5FD__family_get_default_printf_filename(const char *old_filename);
+
/* Callback prototypes */
static herr_t H5FD__family_term(void);
static void * H5FD__family_fapl_get(H5FD_t *_file);
@@ -101,48 +108,167 @@ 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_VALUE, /* value */
+ "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_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_read, /* read */
+ H5FD__family_write, /* write */
NULL, /* read_vector */
NULL, /* write_vector */
NULL, /* read_selection */
NULL, /* write_selection */
- H5FD__family_flush, /* flush */
- H5FD__family_truncate, /* truncate */
+ H5FD__family_flush, /* flush */
+ H5FD__family_truncate, /* truncate */
H5FD__family_lock, /* lock */
H5FD__family_unlock, /* unlock */
+ H5FD__family_delete, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
+/*-------------------------------------------------------------------------
+ * Function: H5FD__family_get_default_config
+ *
+ * Purpose: Populates a H5FD_family_fapl_t structure with default
+ * values.
+ *
+ * Return: Non-negative on Success/Negative on Failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out)
+{
+ H5P_genplist_t *def_plist;
+ H5P_genplist_t *plist;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(fa_out);
+
+ fa_out->memb_size = H5FD_FAM_DEF_MEM_SIZE;
+
+ /* Use copy of default file access property list for member FAPL ID.
+ * The Sec2 driver is explicitly set on the member FAPL ID, as the
+ * default driver might have been replaced with the Family VFD, which
+ * would cause recursion badness in the child members.
+ */
+ if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if ((fa_out->memb_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list")
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fa_out->memb_fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on member FAPL")
+
+done:
+ if (ret_value < 0 && fa_out->memb_fapl_id >= 0) {
+ if (H5I_dec_ref(fa_out->memb_fapl_id) < 0)
+ HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__family_get_default_config() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__family_get_default_printf_filename
+ *
+ * Purpose: Given a filename, allocates and returns a new filename
+ * buffer that contains the given filename modified into this
+ * VFD's printf-style format. For example, the filename
+ * "file1.h5" would be modified to "file1-%06d.h5". This would
+ * allow for member filenames such as "file1-000000.h5",
+ * "file1-000001.h5", etc. The caller is responsible for
+ * freeing the returned buffer.
+ *
+ * Return: Non-negative on Success/Negative on Failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
+H5FD__family_get_default_printf_filename(const char *old_filename)
+{
+ const char *suffix = "-%06d";
+ size_t old_filename_len = 0;
+ size_t new_filename_len = 0;
+ char * file_extension = NULL;
+ char * tmp_buffer = NULL;
+ char * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(old_filename);
+
+ old_filename_len = HDstrlen(old_filename);
+ if (0 == old_filename_len)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename")
+
+ new_filename_len = old_filename_len + HDstrlen(suffix) + 1;
+ if (NULL == (tmp_buffer = H5MM_malloc(new_filename_len)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer")
+
+ /* Determine if filename contains a ".h5" extension. */
+ if ((file_extension = strstr(old_filename, ".h5"))) {
+ /* Insert the printf format between the filename and ".h5" extension. */
+ HDstrcpy(tmp_buffer, old_filename);
+ file_extension = strstr(tmp_buffer, ".h5");
+ HDsprintf(file_extension, "%s%s", suffix, ".h5");
+ }
+ else if ((file_extension = strrchr(old_filename, '.'))) {
+ char *new_extension_loc = NULL;
+
+ /* If the filename doesn't contain a ".h5" extension, but contains
+ * AN extension, just insert the printf format before that extension.
+ */
+ HDstrcpy(tmp_buffer, old_filename);
+ new_extension_loc = strrchr(tmp_buffer, '.');
+ HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
+ }
+ else {
+ /* If the filename doesn't contain an extension at all, just insert
+ * the printf format at the end of the filename.
+ */
+ HDsnprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix);
+ }
+
+ ret_value = tmp_buffer;
+
+done:
+ if (!ret_value)
+ H5MM_xfree(tmp_buffer);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__family_get_default_printf_filename() */
+
/*--------------------------------------------------------------------------
NAME
H5FD__init_package -- Initialize interface-specific information
@@ -245,7 +371,7 @@ herr_t
H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id)
{
herr_t ret_value;
- H5FD_family_fapl_t fa = {0, -1};
+ H5FD_family_fapl_t fa = {0, H5I_INVALID_HID};
H5P_genplist_t * plist; /* Property list pointer */
FUNC_ENTER_API(FAIL)
@@ -254,18 +380,22 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id)
/* Check arguments */
if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5P_DEFAULT == memb_fapl_id)
- memb_fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ if (H5P_DEFAULT == memb_fapl_id) {
+ /* Get default configuration for member FAPL */
+ if (H5FD__family_get_default_config(&fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default driver configuration info")
+ }
else if (TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
/* Initialize driver specific information. */
- fa.memb_size = msize;
- fa.memb_fapl_id = memb_fapl_id;
+ fa.memb_size = msize;
+ if (H5P_DEFAULT != memb_fapl_id)
+ fa.memb_fapl_id = memb_fapl_id;
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa);
+ ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -585,15 +715,16 @@ done:
* memb_name & temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
static H5FD_t *
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;
- hsize_t eof = HADDR_UNDEF;
- unsigned t_flags = flags & ~H5F_ACC_CREAT;
- H5FD_t * ret_value = NULL;
+ hsize_t eof = HADDR_UNDEF;
+ hbool_t default_config = FALSE;
+ unsigned t_flags = flags & ~H5F_ACC_CREAT;
+ H5FD_t * ret_value = NULL;
FUNC_ENTER_STATIC
@@ -607,21 +738,32 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
if (NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
if (H5P_FILE_ACCESS_DEFAULT == fapl_id) {
- file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT;
- if (H5I_inc_ref(file->memb_fapl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
- file->memb_size = 1024 * 1024 * 1024; /*1GB. Actual member size to be updated later */
- file->pmem_size = 1024 * 1024 * 1024; /*1GB. Member size passed in through property */
- file->mem_newsize = 0; /*New member size used by h5repart only */
- } /* end if */
+ H5FD_family_fapl_t default_fa;
+
+ /* Get default configuration */
+ if (H5FD__family_get_default_config(&default_fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default driver configuration info")
+
+ file->memb_fapl_id = default_fa.memb_fapl_id;
+ file->memb_size = H5FD_FAM_DEF_MEM_SIZE; /* Actual member size to be updated later */
+ file->pmem_size = H5FD_FAM_DEF_MEM_SIZE; /* Member size passed in through property */
+ file->mem_newsize = 0; /*New member size used by h5repart only */
+
+ default_config = TRUE;
+ } /* end if */
else {
H5P_genplist_t * plist; /* Property list pointer */
const H5FD_family_fapl_t *fa;
+ H5FD_family_fapl_t default_fa;
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
+ if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) {
+ if (H5FD__family_get_default_config(&default_fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default family VFD configuration")
+ fa = &default_fa;
+ default_config = TRUE;
+ }
/* Check for new family file size. It's used by h5repart only. */
if (H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) {
@@ -645,7 +787,10 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
} /* end else */
file->memb_size = fa->memb_size; /* Actual member size to be updated later */
file->pmem_size = fa->memb_size; /* Member size passed in through property */
- } /* end else */
+
+ if (default_config && H5I_dec_ref(fa->memb_fapl_id) < 0)
+ HGOTO_ERROR(H5E_ID, H5E_CANTDEC, NULL, "can't decrement ref. count on member FAPL")
+ } /* end else */
file->name = H5MM_strdup(name);
file->flags = flags;
@@ -658,8 +803,16 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
/* Check that names are unique */
HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0);
HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1);
- if (!HDstrcmp(memb_name, temp))
- HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
+ if (!HDstrcmp(memb_name, temp)) {
+ if (default_config) {
+ temp = H5MM_xfree(temp);
+ if (NULL == (temp = H5FD__family_get_default_printf_filename(name)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default printf-style filename")
+ name = temp;
+ }
+ else
+ HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
+ }
/* Open all the family members */
while (1) {
@@ -738,7 +891,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__family_open() */
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD__family_close
@@ -908,7 +1061,7 @@ H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* memb_name in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
static herr_t
H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
@@ -977,7 +1130,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD__family_get_eof
@@ -1348,3 +1501,113 @@ H5FD__family_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* 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;
+ H5FD_family_fapl_t default_fa = {0, H5I_INVALID_HID};
+ hbool_t default_config = FALSE;
+ 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) {
+ if (H5FD__family_get_default_config(&default_fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration")
+ memb_fapl_id = default_fa.memb_fapl_id;
+ default_config = TRUE;
+ }
+ 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))) {
+ if (H5FD__family_get_default_config(&default_fa) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration")
+ fa = &default_fa;
+ default_config = TRUE;
+ }
+ 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)) {
+ if (default_config) {
+ temp = H5MM_xfree(temp);
+ if (NULL == (temp = H5FD__family_get_default_printf_filename(filename)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default printf-style filename")
+ filename = temp;
+ }
+ else
+ 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);
+
+ /* Only close memb_fapl_id if we created one from the default configuration */
+ if (default_fa.memb_fapl_id >= 0 && H5I_dec_ref(default_fa.memb_fapl_id) < 0)
+ HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__family_delete() */
diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h
index f00836f..7b76a16 100644
--- a/src/H5FDfamily.h
+++ b/src/H5FDfamily.h
@@ -20,14 +20,65 @@
#ifndef H5FDfamily_H
#define H5FDfamily_H
-#define H5FD_FAMILY (H5FD_family_init())
+#define H5FD_FAMILY (H5FD_family_init())
+#define H5FD_FAMILY_VALUE H5_VFD_FAMILY
#ifdef __cplusplus
extern "C" {
#endif
-H5_DLL hid_t H5FD_family_init(void);
+H5_DLL hid_t H5FD_family_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the file access property list to use the family driver
+ *
+ * \fapl_id
+ * \param[in] memb_size Size in bytes of each file member
+ * \param[in] memb_fapl_id Identifier of file access property list for
+ * each family member
+ * \returns \herr_t
+ *
+ * \details H5Pset_fapl_family() sets the file access property list identifier,
+ * \p fapl_id, to use the family driver.
+ *
+ * \p memb_size is the size in bytes of each file member. This size
+ * will be saved in file when the property list \p fapl_id is used to
+ * create a new file. If \p fapl_id is used to open an existing file,
+ * \p memb_size has to be equal to the original size saved in file. A
+ * failure with an error message indicating the correct member size
+ * will be returned if \p memb_size does not match the size saved. If
+ * any user does not know the original size, #H5F_FAMILY_DEFAULT can be
+ * passed in. The library will retrieve the saved size.
+ *
+ * \p memb_fapl_id is the identifier of the file access property list
+ * to be used for each family member.
+ *
+ * \version 1.8.0 Behavior of the \p memb_size parameter was changed.
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id);
+
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns file access property list information
+ *
+ * \fapl_id
+ * \param[out] memb_size Size in bytes of each file member
+ * \param[out] memb_fapl_id Identifier of file access property list for
+ * each family member
+ * \returns \herr_t
+ *
+ * \details H5Pget_fapl_family() returns file access property list for use with
+ * the family driver. This information is returned through the output
+ * parameters.
+ *
+ * \since 1.4.0
+ *
+ */
H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size /*out*/, hid_t *memb_fapl_id /*out*/);
#ifdef __cplusplus
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index e48d62e..82985cc 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -1,15 +1,13 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Read-Only HDFS Virtual File Driver (VFD) *
- * Copyright (c) 2018, The HDF Group. *
- * *
+ * Copyright by The HDF Group. *
* All rights reserved. *
* *
- * NOTICE: *
- * All information contained herein is, and remains, the property of The HDF *
- * Group. The intellectual and technical concepts contained herein are *
- * proprietary to The HDF Group. Dissemination of this information or *
- * reproduction of this material is strictly forbidden unless prior written *
- * permission is obtained from The HDF Group. *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -20,8 +18,10 @@
* File System (HDFS).
*/
+#ifdef H5_HAVE_LIBHDFS
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
@@ -278,6 +278,7 @@ static herr_t H5FD__hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing
static herr_t H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t *fa);
static const H5FD_class_t H5FD_hdfs_g = {
+ H5FD_HDFS_VALUE, /* value */
"hdfs", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -313,6 +314,7 @@ static const H5FD_class_t H5FD_hdfs_g = {
H5FD__hdfs_truncate, /* truncate */
NULL, /* lock */
NULL, /* unlock */
+ NULL, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -367,7 +369,7 @@ H5FD_hdfs_init(void)
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (H5I_VFL != H5I_get_type(H5FD_HDFS_g))
@@ -408,7 +410,7 @@ H5FD__hdfs_term(void)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
/* Reset VFL ID */
@@ -442,7 +444,7 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (path == NULL || path[0] == '\0')
@@ -527,7 +529,7 @@ H5FD__hdfs_handle_close(hdfs_t *handle)
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (handle == NULL)
@@ -618,7 +620,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa)
HDassert(fa != NULL);
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
@@ -627,7 +629,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa)
if (FAIL == H5FD__hdfs_validate_config(fa))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config")
- ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa);
+ ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -659,7 +661,7 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/)
H5TRACE2("e", "ix", fapl_id, fa_dst);
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (fa_dst == NULL)
@@ -816,7 +818,7 @@ hdfs__reset_stats(H5FD_hdfs_t *file)
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (file == NULL)
@@ -874,7 +876,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif /* HDFS_DEBUG */
/* Sanity check on file offsets */
@@ -1212,7 +1214,7 @@ H5FD__hdfs_close(H5FD_t *_file)
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
/* Sanity checks */
@@ -1268,7 +1270,7 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif /* HDFS_DEBUG */
HDassert(f1->hdfs_handle != NULL);
@@ -1341,7 +1343,7 @@ H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
if (flags) {
@@ -1379,7 +1381,7 @@ H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
FUNC_LEAVE_NOAPI(file->eoa)
@@ -1410,7 +1412,7 @@ H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
file->eoa = addr;
@@ -1444,7 +1446,7 @@ H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC_NOERR
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
HDassert(file->hdfs_handle != NULL);
@@ -1479,7 +1481,7 @@ H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif /* HDFS_DEBUG */
if (!file_handle)
@@ -1529,7 +1531,7 @@ H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif /* HDFS_DEBUG */
HDassert(file != NULL);
@@ -1601,7 +1603,7 @@ H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file")
@@ -1639,7 +1641,7 @@ H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id,
FUNC_ENTER_STATIC
#if HDFS_DEBUG
- HDfprintf(stdout, "called %s.\n", FUNC);
+ HDfprintf(stdout, "called %s.\n", __func__);
#endif
HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file")
diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h
index abe7682..a9f34a0 100644
--- a/src/H5FDhdfs.h
+++ b/src/H5FDhdfs.h
@@ -1,15 +1,14 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Read-Only HDFS Virtual File Driver (VFD) *
- * Copyright (c) 2018, The HDF Group. *
+ * Copyright by The HDF Group. *
* *
* All rights reserved. *
* *
- * NOTICE: *
- * All information contained herein is, and remains, the property of The HDF *
- * Group. The intellectual and technical concepts contained herein are *
- * proprietary to The HDF Group. Dissemination of this information or *
- * reproduction of this material is strictly forbidden unless prior written *
- * permission is obtained from The HDF Group. *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -23,9 +22,11 @@
#define H5FDhdfs_H
#ifdef H5_HAVE_LIBHDFS
-#define H5FD_HDFS (H5FD_hdfs_init())
+#define H5FD_HDFS (H5FD_hdfs_init())
+#define H5FD_HDFS_VALUE H5_VFD_HDFS
#else /* H5_HAVE_LIBHDFS */
-#define H5FD_HDFS (H5I_INVALID_HID)
+#define H5FD_HDFS (H5I_INVALID_HID)
+#define H5FD_HDFS_VALUE H5_VFD_INVALID
#endif /* H5_HAVE_LIBHDFS */
#ifdef H5_HAVE_LIBHDFS
@@ -112,8 +113,20 @@ typedef struct H5FD_hdfs_fapl_t {
int32_t stream_buffer_size;
} H5FD_hdfs_fapl_t;
-H5_DLL hid_t H5FD_hdfs_init(void);
+H5_DLL hid_t H5FD_hdfs_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa);
#ifdef __cplusplus
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 64386b8..af3562b 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -35,6 +35,7 @@
#include "H5Fprivate.h" /* File access */
#include "H5FDpkg.h" /* File Drivers */
#include "H5Iprivate.h" /* IDs */
+#include "H5PLprivate.h" /* Plugins */
/****************/
/* Local Macros */
@@ -74,6 +75,20 @@ typedef struct H5FD_vsrt_tmp_t {
int index;
} H5FD_vsrt_tmp_t;
+/* Information needed for iterating over the registered VFD hid_t IDs.
+ * The name or value of the new VFD that is being registered is stored
+ * in the name (or value) field and the found_id field is initialized to
+ * H5I_INVALID_HID (-1). If we find a VFD with the same name / value,
+ * we set the found_id field to the existing ID for return to the function.
+ */
+typedef struct H5FD_get_driver_ud_t {
+ /* IN */
+ H5PL_vfd_key_t key;
+
+ /* OUT */
+ hid_t found_id; /* The driver ID, if we found a match */
+} H5FD_get_driver_ud_t;
+
/********************/
/* Package Typedefs */
/********************/
@@ -81,6 +96,7 @@ typedef struct H5FD_vsrt_tmp_t {
/********************/
/* Local Prototypes */
/********************/
+static int H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data);
/*********************/
/* Package Variables */
@@ -751,7 +767,6 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin
/* Sanity checks */
HDassert(file);
HDassert(file->cls);
- HDassert(count > 0);
HDassert(vec_arr_nalloc == sizeof(sizes_static) / sizeof(sizes_static[0]));
HDassert(vec_arr_nalloc == sizeof(vec_bufs_static) / sizeof(vec_bufs_static[0]));
HDassert(mem_spaces);
@@ -1372,7 +1387,6 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui
/* Sanity checks */
HDassert(file);
HDassert(file->cls);
- HDassert(count > 0);
HDassert(vec_arr_nalloc == sizeof(sizes_static) / sizeof(sizes_static[0]));
HDassert(vec_arr_nalloc == sizeof(vec_bufs_static) / sizeof(vec_bufs_static[0]));
HDassert(mem_spaces);
@@ -2124,6 +2138,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t count, H5FD_mem_t t
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
+
HDassert(vector_was_sorted);
HDassert((types) || (count == 0));
@@ -2309,3 +2324,403 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_sort_vector_io_req() */
+
+/*-------------------------------------------------------------------------
+ * 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_check_plugin_load
+ *
+ * Purpose: Check if a VFD plugin matches the search criteria, and can
+ * be loaded.
+ *
+ * Note: Matching the driver's name / value, but the driver having
+ * an incompatible version is not an error, but means that the
+ * driver isn't a "match". Setting the SUCCEED value to FALSE
+ * and not failing for that case allows the plugin framework
+ * to keep looking for other DLLs that match and have a
+ * compatible version.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, hbool_t *success)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cls);
+ HDassert(key);
+ HDassert(success);
+
+ /* Which kind of key are we looking for? */
+ if (key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) {
+ /* Check if plugin name matches VFD class name */
+ if (cls->name && !HDstrcmp(cls->name, key->vfd.u.name))
+ *success = TRUE;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE);
+
+ /* Check if plugin value matches VFD class value */
+ if (cls->value == key->vfd.u.value)
+ *success = TRUE;
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_check_plugin_load() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__get_driver_cb
+ *
+ * Purpose: Callback routine to search through registered VFDs
+ *
+ * Return: Success: H5_ITER_STOP if the class and op_data name
+ * members match. H5_ITER_CONT otherwise.
+ * Failure: Can't fail
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data)
+{
+ H5FD_get_driver_ud_t *op_data = (H5FD_get_driver_ud_t *)_op_data; /* User data for callback */
+ H5FD_class_t * cls = (H5FD_class_t *)obj;
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ if (H5FD_GET_DRIVER_BY_NAME == op_data->key.kind) {
+ if (0 == HDstrcmp(cls->name, op_data->key.u.name)) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(H5FD_GET_DRIVER_BY_VALUE == op_data->key.kind);
+ if (cls->value == op_data->key.u.value) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__get_driver_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_register_driver_by_name
+ *
+ * Purpose: Registers a new VFD as a member of the virtual file driver
+ * class.
+ *
+ * Return: Success: A VFD ID which is good until the library is
+ * closed.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5FD_register_driver_by_name(const char *name, hbool_t app_ref)
+{
+ htri_t driver_is_registered = FALSE;
+ hid_t driver_id = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Check if driver is already registered */
+ if ((driver_is_registered = H5FD_is_driver_registered_by_name(name, &driver_id)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered")
+
+ /* If driver is already registered, increment ref count on ID and return ID */
+ if (driver_is_registered) {
+ HDassert(driver_id >= 0);
+
+ if (H5I_inc_ref(driver_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD")
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5FD_class_t *cls;
+
+ /* Try loading the driver */
+ key.vfd.kind = H5FD_GET_DRIVER_BY_NAME;
+ key.vfd.u.name = name;
+ if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD")
+
+ /* Register the driver we loaded */
+ if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID")
+ } /* end else */
+
+ ret_value = driver_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_register_driver_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_register_driver_by_value
+ *
+ * Purpose: Registers a new VFD as a member of the virtual file driver
+ * class.
+ *
+ * Return: Success: A VFD ID which is good until the library is
+ * closed.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref)
+{
+ htri_t driver_is_registered = FALSE;
+ hid_t driver_id = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Check if driver is already registered */
+ if ((driver_is_registered = H5FD_is_driver_registered_by_value(value, &driver_id)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered")
+
+ /* If driver is already registered, increment ref count on ID and return ID */
+ if (driver_is_registered) {
+ HDassert(driver_id >= 0);
+
+ if (H5I_inc_ref(driver_id, app_ref) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD")
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5FD_class_t *cls;
+
+ /* Try loading the driver */
+ key.vfd.kind = H5FD_GET_DRIVER_BY_VALUE;
+ key.vfd.u.value = value;
+ if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD")
+
+ /* Register the driver we loaded */
+ if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID")
+ } /* end else */
+
+ ret_value = driver_id;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_register_driver_by_value() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_is_driver_registered_by_name
+ *
+ * Purpose: Checks if a driver with a particular name is registered.
+ * If `registered_id` is non-NULL and a driver with the
+ * specified name has been registered, the driver's ID will be
+ * returned in `registered_id`.
+ *
+ * Return: >0 if a VFD with that name has been registered
+ * 0 if a VFD with that name has NOT been registered
+ * <0 on errors
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FD_is_driver_registered_by_name(const char *driver_name, hid_t *registered_id)
+{
+ H5FD_get_driver_ud_t op_data; /* Callback info for driver search */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set up op data for iteration */
+ op_data.key.kind = H5FD_GET_DRIVER_BY_NAME;
+ op_data.key.u.name = driver_name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find driver with name */
+ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs")
+
+ /* Found a driver with that name */
+ if (op_data.found_id != H5I_INVALID_HID) {
+ if (registered_id)
+ *registered_id = op_data.found_id;
+ ret_value = TRUE;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_is_driver_registered_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_is_driver_registered_by_value
+ *
+ * Purpose: Checks if a driver with a particular value (ID) is
+ * registered. If `registered_id` is non-NULL and a driver
+ * with the specified value has been registered, the driver's
+ * ID will be returned in `registered_id`.
+ *
+ * Return: >0 if a VFD with that value has been registered
+ * 0 if a VFD with that value has NOT been registered
+ * <0 on errors
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id)
+{
+ H5FD_get_driver_ud_t op_data; /* Callback info for driver search */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set up op data for iteration */
+ op_data.key.kind = H5FD_GET_DRIVER_BY_VALUE;
+ op_data.key.u.value = driver_value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find driver with value */
+ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs")
+
+ /* Found a driver with that value */
+ if (op_data.found_id != H5I_INVALID_HID) {
+ if (registered_id)
+ *registered_id = op_data.found_id;
+ ret_value = TRUE;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_is_driver_registered_by_value() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_get_driver_id_by_name
+ *
+ * Purpose: Retrieves the ID for a registered VFL driver.
+ *
+ * Return: Positive if the VFL driver has been registered
+ * Negative on error (if the driver is not a valid driver or
+ * is not registered)
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5FD_get_driver_id_by_name(const char *name, hbool_t is_api)
+{
+ H5FD_get_driver_ud_t op_data;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Set up op data for iteration */
+ op_data.key.kind = H5FD_GET_DRIVER_BY_NAME;
+ op_data.key.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find driver with specified name */
+ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers")
+
+ /* Found a driver with that name */
+ if (op_data.found_id != H5I_INVALID_HID) {
+ ret_value = op_data.found_id;
+ if (H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_get_driver_id_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_get_driver_id_by_value
+ *
+ * Purpose: Retrieves the ID for a registered VFL driver.
+ *
+ * Return: Positive if the VFL driver has been registered
+ * Negative on error (if the driver is not a valid driver or
+ * is not registered)
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5FD_get_driver_id_by_value(H5FD_class_value_t value, hbool_t is_api)
+{
+ H5FD_get_driver_ud_t op_data;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Set up op data for iteration */
+ op_data.key.kind = H5FD_GET_DRIVER_BY_VALUE;
+ op_data.key.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Find driver with specified value */
+ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers")
+
+ /* Found a driver with that value */
+ if (op_data.found_id != H5I_INVALID_HID) {
+ ret_value = op_data.found_id;
+ if (H5I_inc_ref(ret_value, is_api) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_get_driver_id_by_value() */
diff --git a/src/H5FDioc.c b/src/H5FDioc.c
index 273ca0f..fdbe41e 100644
--- a/src/H5FDioc.c
+++ b/src/H5FDioc.c
@@ -21,8 +21,8 @@
#include "H5FDpublic.h" /* Basic H5FD definitions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5FDioc.h" /* IOC file driver */
#include "H5FDprivate.h" /* File drivers */
+#include "H5FDioc.h" /* IOC file driver */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Fprivate.h" /* File access */
#include "H5Iprivate.h" /* IDs */
@@ -127,6 +127,7 @@ static herr_t H5FD__ioc_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags,
*/
static const H5FD_class_t H5FD_ioc_g = {
+ H5FD_IOC_VALUE, /* value */
"ioc", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -162,6 +163,7 @@ static const H5FD_class_t H5FD_ioc_g = {
H5FD__ioc_truncate, /* truncate */
H5FD__ioc_lock, /* lock */
H5FD__ioc_unlock, /* unlock */
+ NULL, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -359,7 +361,7 @@ H5Pset_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *vfd_config)
memcpy(info, vfd_config, sizeof(H5FD_ioc_config_t));
info->common.ioc_fapl_id = fapl_id;
- ret_value = H5P_set_driver(plist_ptr, H5FD_IOC, info);
+ ret_value = H5P_set_driver(plist_ptr, H5FD_IOC, info, NULL);
done:
if (info)
diff --git a/src/H5FDioc.h b/src/H5FDioc.h
index 3e04c80..d0fa6cd 100644
--- a/src/H5FDioc.h
+++ b/src/H5FDioc.h
@@ -20,7 +20,8 @@
#ifndef H5FDioc_H
#define H5FDioc_H
-#define H5FD_IOC (H5FD_ioc_init())
+#define H5FD_IOC (H5FD_ioc_init())
+#define H5FD_IOC_VALUE H5_VFD_IOC
#ifndef H5FD_IOC_FAPL_T_MAGIC
#define H5FD_CURR_IOC_FAPL_T_VERSION 1
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index ea18b02..253c35b 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -177,47 +177,53 @@ static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha
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, /* read vector */
- NULL, /* write vector */
- NULL, /* read_selection */
- NULL, /* write_selection */
- NULL, /* flush */
- H5FD__log_truncate, /* truncate */
- H5FD__log_lock, /* lock */
- H5FD__log_unlock, /* unlock */
- NULL, /* ctl */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ H5FD_LOG_VALUE, /* value */
+ "log", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ H5FD__log_term, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ sizeof(H5FD_log_fapl_t), /* fapl_size */
+ H5FD__log_fapl_get, /* fapl_get */
+ H5FD__log_fapl_copy, /* fapl_copy */
+ H5FD__log_fapl_free, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD__log_open, /* open */
+ H5FD__log_close, /* close */
+ H5FD__log_cmp, /* cmp */
+ H5FD__log_query, /* query */
+ NULL, /* get_type_map */
+ H5FD__log_alloc, /* alloc */
+ H5FD__log_free, /* free */
+ H5FD__log_get_eoa, /* get_eoa */
+ H5FD__log_set_eoa, /* set_eoa */
+ H5FD__log_get_eof, /* get_eof */
+ H5FD__log_get_handle, /* get_handle */
+ H5FD__log_read, /* read */
+ H5FD__log_write, /* write */
+ NULL, /* read vector */
+ NULL, /* write vector */
+ NULL, /* read_selection */
+ NULL, /* write_selection */
+ NULL, /* flush */
+ H5FD__log_truncate, /* truncate */
+ H5FD__log_lock, /* lock */
+ H5FD__log_unlock, /* unlock */
+ H5FD__log_delete, /* del */
+ NULL, /* ctl */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
+/* Default configuration, if none provided */
+static const H5FD_log_fapl_t H5FD_log_default_config_g = {NULL, H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC, 4096};
+
/* Declare a free list to manage the H5FD_log_t struct */
H5FL_DEFINE_STATIC(H5FD_log_t);
@@ -239,7 +245,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
/* Check the use disabled file locks environment variable */
- lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
@@ -331,12 +337,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
@@ -347,7 +356,7 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
fa.flags = flags;
fa.buf_size = buf_size;
- ret_value = H5P_set_driver(plist, H5FD_LOG, &fa);
+ ret_value = H5P_set_driver(plist, H5FD_LOG, &fa, NULL);
done:
if (fa.logfile)
@@ -431,7 +440,7 @@ 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() */
@@ -482,15 +491,16 @@ static H5FD_t *
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 */
- const H5FD_log_fapl_t *fa; /* File access property list information */
- int fd = -1; /* File descriptor */
- int o_flags; /* Flags for open() call */
+ H5P_genplist_t * plist; /* Property list */
+ const H5FD_log_fapl_t *fa; /* File access property list information */
+ H5FD_log_fapl_t default_fa = H5FD_log_default_config_g;
+ int fd = -1; /* File descriptor */
+ int o_flags; /* Flags for open() call */
#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 */
@@ -507,6 +517,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,14 +533,14 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get the driver specific information */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
+ if (NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) {
+ /* Use default driver configuration*/
+ fa = &default_fa;
+ }
/* 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) {
@@ -536,17 +550,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)
@@ -599,15 +611,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)
@@ -621,14 +633,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)
@@ -650,7 +662,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;
@@ -661,7 +673,7 @@ done:
HDclose(fd);
if (file)
file = H5FL_FREE(H5FD_log_t, file);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_open() */
@@ -682,20 +694,21 @@ done:
static herr_t
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_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)
@@ -716,7 +729,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)
@@ -751,13 +764,13 @@ H5FD__log_close(H5FD_t *_file)
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 %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
/* Dump the read I/O information */
if (file->fa.flags & H5FD_LOG_FILE_READ) {
@@ -772,13 +785,13 @@ H5FD__log_close(H5FD_t *_file)
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 %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
- } /* end if */
+ }
/* Dump the I/O flavor information */
if (file->fa.flags & H5FD_LOG_FLAVOR) {
@@ -793,12 +806,12 @@ H5FD__log_close(H5FD_t *_file)
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 %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n",
last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
- } /* end if */
+ }
/* Free the logging information */
if (file->fa.flags & H5FD_LOG_FILE_WRITE)
@@ -925,7 +938,7 @@ 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() */
@@ -964,13 +977,13 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs
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,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr,
(haddr_t)((addr + size) - 1), size, flavors[type]);
- } /* end if */
+ }
/* Set return value */
ret_value = addr;
@@ -1003,13 +1016,13 @@ 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, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
addr, (haddr_t)((addr + size) - 1), size, flavors[type]);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__log_free() */
@@ -1070,14 +1083,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,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n",
file->eoa, addr, size, flavors[type]);
- } /* end if */
+ }
/* Check for decreasing file size */
if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) {
@@ -1088,15 +1101,15 @@ 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,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
file->eoa, addr, size, flavors[type]);
- } /* end if */
- } /* end if */
+ }
+ }
file->eoa = addr;
@@ -1179,23 +1192,22 @@ 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_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 = {{0}, {0}, {0}, FALSE}; /* 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 */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t read_timer; /* Timer for read operation */
+ H5_timevals_t read_times; /* Elapsed time for read operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_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)
@@ -1212,17 +1224,21 @@ H5FD__log_read(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->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")
@@ -1239,7 +1255,7 @@ H5FD__log_read(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) {
@@ -1253,15 +1269,13 @@ H5FD__log_read(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 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,
@@ -1306,13 +1320,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
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);
@@ -1320,8 +1334,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
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)
@@ -1335,7 +1348,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
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) {
@@ -1349,7 +1362,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
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
@@ -1359,7 +1372,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
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;
@@ -1370,7 +1383,7 @@ 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() */
@@ -1393,17 +1406,13 @@ 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_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 = {{0}, {0}, {0}, FALSE}; /* 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 */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t write_timer; /* Timer for write operation */
+ H5_timevals_t write_times; /* Elapsed time for write operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1411,13 +1420,16 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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))
@@ -1435,16 +1447,20 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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")
@@ -1461,7 +1477,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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) {
@@ -1475,15 +1491,13 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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
@@ -1550,7 +1564,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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) {
@@ -1563,8 +1577,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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
@@ -1574,7 +1588,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
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;
@@ -1587,7 +1601,7 @@ 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() */
@@ -1617,14 +1631,15 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
/* Extend the file to make sure it's large enough */
if (!H5F_addr_eq(file->eoa, file->eof)) {
- H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */
- H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+ 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
{
@@ -1648,7 +1663,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
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")
@@ -1671,7 +1686,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
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) {
@@ -1685,7 +1700,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
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;
@@ -1777,3 +1792,28 @@ H5FD__log_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* 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..bc96c52 100644
--- a/src/H5FDlog.h
+++ b/src/H5FDlog.h
@@ -20,7 +20,8 @@
#ifndef H5FDlog_H
#define H5FDlog_H
-#define H5FD_LOG (H5FD_log_init())
+#define H5FD_LOG (H5FD_log_init())
+#define H5FD_LOG_VALUE H5_VFD_LOG
/* Flags for H5Pset_fapl_log() */
/* Flags for tracking 'meta' operations (truncate) */
@@ -65,7 +66,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 4b7cb38..f1fbc46 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -15,12 +15,12 @@
* a remote host.
*/
-#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
-
#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_MIRROR_VFD
+#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
+
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
@@ -160,6 +160,7 @@ 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 = {
+ H5FD_MIRROR_VALUE, /* value */
"mirror", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -195,6 +196,7 @@ static const H5FD_class_t H5FD_mirror_g = {
H5FD__mirror_truncate, /* truncate */
H5FD__mirror_lock, /* lock */
H5FD__mirror_unlock, /* unlock */
+ NULL, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -223,7 +225,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
if (H5FD_mirror_init() < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD");
@@ -249,7 +251,7 @@ H5FD_mirror_init(void)
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g))
H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE);
@@ -276,7 +278,7 @@ H5FD__mirror_term(void)
/* Reset VFL ID */
H5FD_MIRROR_g = 0;
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__mirror_term() */
@@ -1132,7 +1134,7 @@ H5FD__mirror_verify_reply(H5FD_mirror_t *file)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
HDassert(file && file->sock_fd);
@@ -1187,7 +1189,7 @@ H5FD__mirror_fapl_get(H5FD_t *_file)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t));
if (NULL == fa)
@@ -1223,7 +1225,7 @@ H5FD__mirror_fapl_copy(const void *_old_fa)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t));
if (new_fa == NULL)
@@ -1255,7 +1257,7 @@ H5FD__mirror_fapl_free(void *_fa)
FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
/* sanity check */
HDassert(fa != NULL);
@@ -1286,7 +1288,7 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", fapl_id, fa_dst);
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
if (NULL == fa_dst)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL");
@@ -1327,7 +1329,7 @@ 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(FUNC);
+ LOG_OP_CALL(__func__);
plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS);
if (NULL == plist)
@@ -1339,7 +1341,7 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa)
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);
+ ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -1373,7 +1375,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
/* --------------- */
/* Check arguments */
@@ -1498,7 +1500,7 @@ H5FD__mirror_close(H5FD_t *_file)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -1570,7 +1572,7 @@ H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags)
{
FUNC_ENTER_STATIC_NOERR;
- LOG_OP_CALL(FUNC);
+ 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
@@ -1607,7 +1609,7 @@ H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
HDassert(file);
@@ -1634,7 +1636,7 @@ H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
HDassert(file);
@@ -1689,7 +1691,7 @@ H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
HDassert(file);
@@ -1710,7 +1712,7 @@ H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type,
{
FUNC_ENTER_STATIC_NOERR
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5FD__mirror_read() */
@@ -1743,7 +1745,7 @@ H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id,
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
HDassert(file);
HDassert(buf);
@@ -1806,7 +1808,7 @@ H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_TRUNCATE;
@@ -1854,7 +1856,7 @@ H5FD__mirror_lock(H5FD_t *_file, hbool_t rw)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_LOCK;
@@ -1901,7 +1903,7 @@ H5FD__mirror_unlock(H5FD_t *_file)
FUNC_ENTER_STATIC
- LOG_OP_CALL(FUNC);
+ LOG_OP_CALL(__func__);
file->xmit.xmit_count = (file->xmit_i)++;
file->xmit.op = H5FD_MIRROR_OP_UNLOCK;
diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h
index 8aef934..66954b1 100644
--- a/src/H5FDmirror.h
+++ b/src/H5FDmirror.h
@@ -19,7 +19,8 @@
#ifdef H5_HAVE_MIRROR_VFD
-#define H5FD_MIRROR (H5FD_mirror_init())
+#define H5FD_MIRROR (H5FD_mirror_init())
+#define H5FD_MIRROR_VALUE H5_VFD_MIRROR
#ifdef __cplusplus
extern "C" {
@@ -61,8 +62,20 @@ 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 hid_t H5FD_mirror_init(void);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out);
+
+/**
+ * \ingroup FAPL
+ *
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa);
#ifdef __cplusplus
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 1e7bb95..ad0812d 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -42,9 +42,12 @@
static hid_t H5FD_MPIO_g = 0;
/* Whether to allow collective I/O operations */
-/* (Value can be set from environment variable also) */
+/* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */
hbool_t H5FD_mpi_opt_types_g = TRUE;
+/* Whether the driver initialized MPI on its own */
+hbool_t H5FD_mpi_self_initialized = FALSE;
+
/*
* The view is set to this value
*/
@@ -91,68 +94,74 @@ static herr_t H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_
const void *bufs[]);
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_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags,
- const void H5_ATTR_UNUSED *input, void **output);
+static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id);
+static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input,
+ void **output);
/* The MPIO file driver information */
static const H5FD_class_t H5FD_mpio_g = {
- "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 */
+ H5_VFD_MPIO, /* value */
+ "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_read_vector, /*read_vector */
H5FD__mpio_write_vector, /*write_vector */
NULL, /*read_selection */
NULL, /*write_selection */
- H5FD__mpio_flush, /*flush */
- H5FD__mpio_truncate, /*truncate */
- NULL, /*lock */
- NULL, /*unlock */
- H5FD__mpio_ctl, /*ctl */
- H5FD_FLMAP_DICHOTOMY /*fl_map */
+ H5FD__mpio_flush, /* flush */
+ H5FD__mpio_truncate, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD__mpio_delete, /* del */
+ H5FD__mpio_ctl, /* ctl */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
#ifdef H5FDmpio_DEBUG
-/* Flags to control debug actions in H5Fmpio.
- * Meant to be indexed by characters.
- *
- * 'c' show result of MPI_Get_count after read
- * 'r' show read offset and size
- * 't' trace function entry and exit
- * 'w' show write offset and size
+/* Flags to control debug actions in the MPI-IO VFD.
+ * (Meant to be indexed by characters)
+ *
+ * These flags can be set with either (or both) the environment variable
+ * "H5FD_mpio_Debug" set to a string containing one or more characters
+ * (flags) or by setting them as a string value for the
+ * "H5F_mpio_debug_key" MPI Info key.
+ *
+ * Supported characters in 'H5FD_mpio_Debug' string:
+ * 't' trace function entry and exit
+ * 'r' show read offset and size
+ * 'w' show write offset and size
+ * '0'-'9' only show output from a single MPI rank (ranks 0-9 supported)
*/
-static int H5FD_mpio_Debug[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static int H5FD_mpio_debug_flags_s[256];
+static int H5FD_mpio_debug_rank_s = -1;
+
+/* Indicate if this rank should output tracing info */
+#define H5FD_MPIO_TRACE_THIS_RANK(file) \
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == (file)->mpi_rank)
#endif
/*--------------------------------------------------------------------------
@@ -184,6 +193,41 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD__init_package() */
+#ifdef H5FDmpio_DEBUG
+
+/*---------------------------------------------------------------------------
+ * Function: H5FD__mpio_parse_debug_str
+ *
+ * Purpose: Parse a string for debugging flags
+ *
+ * Returns: N/A
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, Aug 12, 2020
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+H5FD__mpio_parse_debug_str(const char *s)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(s);
+
+ /* Set debug mask */
+ while (*s) {
+ if ((int)(*s) >= (int)'0' && (int)(*s) <= (int)'9')
+ H5FD_mpio_debug_rank_s = ((int)*s) - (int)'0';
+ else
+ H5FD_mpio_debug_flags_s[(int)*s]++;
+ s++;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5FD__mpio_parse_debug_str() */
+#endif /* H5FDmpio_DEBUG */
+
/*-------------------------------------------------------------------------
* Function: H5FD_mpio_init
*
@@ -201,11 +245,9 @@ done:
hid_t
H5FD_mpio_init(void)
{
-#ifdef H5FDmpio_DEBUG
static int H5FD_mpio_Debug_inited = 0;
-#endif /* H5FDmpio_DEBUG */
- const char *s; /* String for environment variables */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ char * env = NULL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -213,28 +255,42 @@ H5FD_mpio_init(void)
if (H5I_VFL != H5I_get_type(H5FD_MPIO_g))
H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_t), FALSE);
- /* Allow MPI buf-and-file-type optimizations? */
- s = HDgetenv("HDF5_MPI_OPT_TYPES");
- if (s && HDisdigit(*s)) {
- long env_val = HDstrtol(s, NULL, 0);
- H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE;
+ /* Check if MPI driver has been loaded dynamically */
+ env = HDgetenv(HDF5_DRIVER);
+ if (env && !HDstrcmp(env, "mpio")) {
+ int mpi_initialized = 0;
+
+ /* Initialize MPI if not already initialized */
+ if (MPI_SUCCESS != MPI_Initialized(&mpi_initialized))
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, H5I_INVALID_HID, "can't check if MPI is initialized")
+ if (!mpi_initialized) {
+ if (MPI_SUCCESS != MPI_Init(NULL, NULL))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "can't initialize MPI")
+ H5FD_mpi_self_initialized = TRUE;
+ }
}
-#ifdef H5FDmpio_DEBUG
if (!H5FD_mpio_Debug_inited) {
+ const char *s; /* String for environment variables */
+
+ /* Allow MPI buf-and-file-type optimizations? */
+ s = HDgetenv("HDF5_MPI_OPT_TYPES");
+ if (s && HDisdigit(*s))
+ H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE;
+
+#ifdef H5FDmpio_DEBUG
+ /* Clear the flag buffer */
+ HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s));
+
/* Retrieve MPI-IO debugging environment variable */
s = HDgetenv("H5FD_mpio_Debug");
- if (s) {
- /* Set debug mask */
- while (*s) {
- H5FD_mpio_Debug[(int)*s]++;
- s++;
- } /* end while */
- } /* end if */
- H5FD_mpio_Debug_inited++;
- } /* end if */
+ if (s)
+ H5FD__mpio_parse_debug_str(s);
#endif /* H5FDmpio_DEBUG */
+ H5FD_mpio_Debug_inited++;
+ } /* end if */
+
/* Set return value */
ret_value = H5FD_MPIO_g;
@@ -259,6 +315,17 @@ H5FD__mpio_term(void)
{
FUNC_ENTER_STATIC_NOERR
+ /* Terminate MPI if the driver initialized it */
+ if (H5FD_mpi_self_initialized) {
+ int mpi_finalized = 0;
+
+ MPI_Finalized(&mpi_finalized);
+ if (!mpi_finalized)
+ MPI_Finalize();
+
+ H5FD_mpi_self_initialized = FALSE;
+ }
+
/* Reset VFL ID */
H5FD_MPIO_g = 0;
@@ -320,7 +387,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object")
/* duplication is done during driver setting. */
- ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL);
+ ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -658,30 +725,27 @@ herr_t
H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
- if (FALSE == flag)
- temp_flag = 0;
- else
- temp_flag = 1;
-
/* set atomicity value */
- if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag)))
+ if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, (int)(flag != FALSE))))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -703,15 +767,18 @@ herr_t
H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Get atomicity value */
@@ -725,8 +792,8 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -753,36 +820,52 @@ done:
static H5FD_t *
H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr)
{
- H5FD_mpio_t * file = NULL;
- MPI_File fh;
- hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */
- int mpi_amode;
- int mpi_rank; /* MPI rank of this process */
- int mpi_size; /* Total number of MPI processes */
- int mpi_code; /* MPI return code */
- MPI_Offset size;
- H5P_genplist_t *plist; /* Property list pointer */
- MPI_Comm comm = MPI_COMM_NULL;
- MPI_Info info = MPI_INFO_NULL;
- H5FD_t * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
+ H5FD_mpio_t * file = NULL; /* VFD File struct for new file */
+ H5P_genplist_t *plist; /* Property list pointer */
+ MPI_Comm comm = MPI_COMM_NULL; /* MPI Communicator, from plist */
+ MPI_Info info = MPI_INFO_NULL; /* MPI Info, from plist */
+ MPI_File fh; /* MPI file handle */
+ hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */
+ int mpi_amode; /* MPI file access flags */
+ int mpi_rank = INT_MAX; /* MPI rank of this process */
+ int mpi_size; /* Total number of MPI processes */
+ MPI_Offset file_size; /* File size (of existing files) */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC,
- name, flags, (int)fapl_id, (unsigned long)maxaddr);
+ hbool_t H5FD_mpio_debug_t_flag = FALSE;
#endif
+ int mpi_code; /* MPI return code */
+ H5FD_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Get a pointer to the fapl */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- /* Get the MPI communicator and info object from the property list */
- if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator")
- if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object")
+ if (H5FD_mpi_self_initialized) {
+ comm = MPI_COMM_WORLD;
+ }
+ else {
+ /* Get the MPI communicator and info object from the property list */
+ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator")
+ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object")
+ }
+
+ /* Get the MPI rank of this process and the total number of processes */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
+
+#ifdef H5FDmpio_DEBUG
+ H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] &&
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank));
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n",
+ __func__, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr);
+#endif
/* Convert HDF5 flags to MPI-IO flags */
/* Some combinations are illegal; let MPI-IO figure it out */
@@ -799,26 +882,15 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
int flag;
MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag);
- if (flag) {
- int i;
-
- HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str);
- for (i = 0; debug_str[i] /*end of string*/ && i < 128 /*just in case*/; ++i)
- H5FD_mpio_Debug[(int)debug_str[i]] = 1;
- } /* end if */
- } /* end if */
+ if (flag)
+ H5FD__mpio_parse_debug_str(debug_str);
+ } /* end if */
#endif
if (MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh)))
HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code)
file_opened = TRUE;
- /* Get the MPI rank of this process and the total number of processes */
- if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
- if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
-
/* Build the return value and initialize it */
if (NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -829,17 +901,17 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
file->mpi_size = mpi_size;
/* Only processor p0 will get the filesize and broadcast it. */
- if (mpi_rank == 0) {
- if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &size)))
+ if (mpi_rank == 0)
+ if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &file_size)))
HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code)
- } /* end if */
/* Broadcast file size */
- if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&file_size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm)))
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
/* Determine if the file should be truncated */
- if (size && (flags & H5F_ACC_TRUNC)) {
+ if (file_size && (flags & H5F_ACC_TRUNC)) {
+ /* Truncate the file */
if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0)))
HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code)
@@ -848,11 +920,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code)
/* File is zero size now */
- size = 0;
+ file_size = 0;
} /* end if */
/* Set the size of the file (from library's perspective) */
- file->eof = H5FD_mpi_MPIOff_to_haddr(size);
+ file->eof = H5FD_mpi_MPIOff_to_haddr(file_size);
file->local_eof = file->eof;
/* Set return value */
@@ -871,8 +943,8 @@ done:
} /* end if */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -894,14 +966,18 @@ static herr_t
H5FD__mpio_close(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED; /* Return value */
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ int mpi_rank = file->mpi_rank;
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -909,7 +985,7 @@ H5FD__mpio_close(H5FD_t *_file)
HDassert(H5FD_MPIO == file->pub.driver_id);
/* MPI_File_close sets argument to MPI_FILE_NULL */
- if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f) /*in,out*/)))
+ if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f))))
HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code)
/* Clean up other stuff */
@@ -919,8 +995,8 @@ H5FD__mpio_close(H5FD_t *_file)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -952,7 +1028,7 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
*flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
*flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default
- VFD */
+ VFD */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1114,7 +1190,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
- int mpi_code; /* mpi return code */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
int size_i; /* Integer copy of 'size' to read */
#if MPI_VERSION >= 3
@@ -1130,13 +1205,18 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
#endif
hbool_t use_view_this_time = FALSE;
hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1154,11 +1234,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if ((hsize_t)size_i != size)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
-#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
-#endif
-
/* Only look for MPI views for raw data transfers */
if (type == H5FD_MEM_DRAW) {
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
@@ -1202,8 +1277,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1211,14 +1286,14 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank);
#endif
/* Check whether we should read from rank 0 and broadcast to other ranks */
if (H5CX_get_mpio_rank0_bcast()) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank);
#endif
/* Indicate path we've taken */
rank0_bcast = TRUE;
@@ -1231,16 +1306,19 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS !=
- (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ else
+ /* Perform collective read operation */
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
} /* end if */
else {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank);
#endif
+ /* Perform independent read operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
@@ -1253,8 +1331,16 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank);
+#endif
+
+ /* Perform independent read operation */
+ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ } /* end else */
/* Only retrieve bytes read if this rank _actually_ participated in I/O */
if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) {
@@ -1296,6 +1382,12 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (bytes_read < 0 || bytes_read > io_size)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", __func__, file->mpi_rank,
+ (long)mpi_off, bytes_read);
+#endif
+
/*
* This gives us zeroes beyond end of physical MPI file.
*/
@@ -1304,8 +1396,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1340,7 +1432,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int mpi_code; /* MPI return code */
#if MPI_VERSION >= 3
MPI_Count bytes_written;
MPI_Count type_size; /* MPI datatype used for I/O's size */
@@ -1354,13 +1445,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
hbool_t use_view_this_time = FALSE;
hbool_t derived_type = FALSE;
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1379,11 +1475,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off")
size_i = (int)size;
-#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
-#endif
-
/* Get the transfer mode from the API context */
if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
@@ -1436,8 +1527,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
@@ -1446,9 +1537,10 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank);
#endif
+ /* Perform collective write operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code)
@@ -1457,10 +1549,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (type != H5FD_MEM_DRAW)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL,
"Metadata Coll opt property should be collective at this point")
+
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank);
#endif
+ /* Perform independent write operation */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
@@ -1471,11 +1565,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else if (MPI_SUCCESS !=
- (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank);
+#endif
- /* How many bytes were actually written? */
+ /* Perform independent write operation */
+ if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ } /* end else */
+
+ /* How many bytes were actually written? */
#if MPI_VERSION >= 3
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written)))
#else
@@ -1498,6 +1599,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (bytes_written != io_size || bytes_written < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", __func__, file->mpi_rank,
+ (long)mpi_off, bytes_written);
+#endif
+
/* Each process will keep track of its perceived EOF value locally, and
* ultimately we will reduce this value to the maximum amongst all
* processes, but until then keep the actual eof at HADDR_UNDEF just in
@@ -1510,12 +1617,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
file->local_eof = addr + (haddr_t)bytes_written;
done:
- if (derived_type) {
+ if (derived_type)
MPI_Type_free(&buf_type);
- }
+
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1603,13 +1710,18 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
int io_size; /* Actual number of bytes requested */
int n;
#endif
+ hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1639,7 +1751,23 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
if (xfer_mode == H5FD_MPIO_COLLECTIVE) {
- if (count > 0) { /* create MPI derived types describing the vector write */
+ if (count == 1) {
+ /* Single block. Just use a series of MPI_BYTEs for the file view.
+ */
+ size_i = (int)sizes[0];
+ buf_type = MPI_BYTE;
+ file_type = MPI_BYTE;
+ mpi_bufs_base = bufs[0];
+
+ /* Setup s_sizes (needed for incomplete read filling code) */
+ vector_was_sorted = TRUE;
+ s_sizes = sizes;
+
+ /* some numeric conversions */
+ if (H5FD_mpi_haddr_to_MPIOff(addrs[0], &mpi_off) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI offset")
+ }
+ else if (count > 0) { /* create MPI derived types describing the vector write */
/* sort the vector I/O request into increasing address order if required
*
@@ -1750,6 +1878,10 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit for file_type failed", mpi_code)
+
+ /* some numeric conversions */
+ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0")
}
else {
@@ -1763,18 +1895,18 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
/* MPI count to read */
size_i = 0;
+
+ /* some numeric conversions */
+ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0")
}
/* Portably initialize MPI status variable */
- HDmemset(&mpi_stat, 0, sizeof(MPI_Status));
-
- /* some numeric conversions */
- if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0")
+ HDmemset(&mpi_stat, 0, sizeof(mpi_stat));
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i);
#endif
/* Setup the file view. */
@@ -1782,6 +1914,10 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* Reset mpi_off to 0 since the view now starts at the data offset */
+ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0")
+
/* Get the collective_opt property to check whether the application wants to do IO individually.
*/
if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1790,24 +1926,39 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
/* Read the data. */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: using MPIO collective mode\n", __func__);
#endif
-
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: doing MPI collective IO\n", __func__);
+#endif
+ /* Check whether we should read from rank 0 and broadcast to other ranks */
+ if (H5CX_get_mpio_rank0_bcast()) {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", __func__);
#endif
+ /* Indicate path we've taken */
+ rank0_bcast = TRUE;
- if (MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, mpi_bufs_base, size_i,
- buf_type, &mpi_stat)))
+ /* Read on rank 0 Bcast to other ranks */
+ if (file->mpi_rank == 0)
+ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, mpi_bufs_base, size_i,
+ buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(mpi_bufs_base, size_i, buf_type, 0, file->comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+ else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, mpi_bufs_base, size_i,
+ buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
} /* end if */
else if (size_i > 0) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__);
#endif
if (MPI_SUCCESS !=
@@ -1822,15 +1973,35 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
+ /* Only retrieve bytes read if this rank _actually_ participated in I/O */
+ if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) {
+
/* How many bytes were actually read? */
#if MPI_VERSION >= 3
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
#else
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
#endif
- HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ } /* end if */
- /* Get the type's size */
+ /* If the rank0-bcast feature was used, broadcast the # of bytes read to
+ * other ranks, which didn't perform any I/O.
+ */
+ /* NOTE: This could be optimized further to be combined with the broadcast
+ * of the data. (QAK - 2019/1/2)
+ * Or have rank 0 clear the unread parts of the buffer prior to
+ * the bcast. (NAF - 2021/9/15)
+ */
+ if (rank0_bcast)
+#if MPI_VERSION >= 3
+ if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_COUNT, 0, file->comm))
+#else
+ if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_INT, 0, file->comm))
+#endif
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0)
+
+ /* Get the type's size */
#if MPI_VERSION >= 3
if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
#else
@@ -1888,8 +2059,8 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
fixed_size = FALSE;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__);
#endif
for (i = 0; i < (int)count; i++) {
@@ -1915,6 +2086,9 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou
/* Check if we acutally need to do I/O */
if (addrs[i] < max_addr) {
+ /* Portably initialize MPI status variable */
+ HDmemset(&mpi_stat, 0, sizeof(mpi_stat));
+
/* Issue read */
if (MPI_SUCCESS !=
(mpi_code = MPI_File_read_at(file->f, mpi_off, bufs[i], size_i, MPI_BYTE, &mpi_stat)))
@@ -2006,8 +2180,8 @@ done:
}
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -2085,13 +2259,17 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
H5FD_mpio_collective_opt_t coll_opt_mode; /* whether we are doing collective or independent I/O */
int size_i;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -2259,8 +2437,8 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0")
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i);
#endif
/* Setup the file view. */
@@ -2276,14 +2454,14 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co
/* Write the data. */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stdout, "%s: using MPIO collective mode\n", __func__);
#endif
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stdout, "%s: doing MPI collective IO\n", __func__);
#endif
if (MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, mpi_bufs_base, size_i,
@@ -2292,8 +2470,8 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co
} /* end if */
else if (size_i > 0) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__);
#endif
if (MPI_SUCCESS !=
@@ -2321,8 +2499,8 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co
fixed_size = FALSE;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__);
#endif
for (i = 0; i < (int)count; i++) {
@@ -2427,8 +2605,8 @@ done:
}
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -2450,14 +2628,17 @@ static herr_t
H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* mpi return code */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -2471,8 +2652,8 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -2485,13 +2666,14 @@ done:
*
* This is a little sticky in the mpio case, as it is not
* easy for us to track the current EOF by extracting it from
- * write calls.
+ * write calls, since other ranks could have written to the
+ * file beyond the local EOF.
*
- * Instead, we first check to see if the eoa has changed since
+ * Instead, we first check to see if the EOA has changed since
* the last call to this function. If it has, we call
* MPI_File_get_size() to determine the current EOF, and
* only call MPI_File_set_size() if this value disagrees
- * with the current eoa.
+ * with the current EOA.
*
* Return: SUCCEED/FAIL
*
@@ -2503,14 +2685,17 @@ done:
static herr_t
H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank);
#endif
/* Sanity checks */
@@ -2553,7 +2738,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
if (H5FD_mpi_haddr_to_MPIOff(file->eoa, &needed_eof) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset")
- /* eoa != eof. Set eof to eoa */
+ /* EOA != EOF. Set EOF to EOA */
if (size != needed_eof) {
/* Extend the file's size */
if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(file->f, needed_eof)))
@@ -2578,14 +2763,73 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* 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));
+
+ if (H5FD_mpi_self_initialized) {
+ comm = MPI_COMM_WORLD;
+ }
+ else {
+ /* 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_ctl
*
* Purpose: MPIO version of the ctl callback.
@@ -2660,5 +2904,4 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__mpio_ctl() */
-
#endif /* H5_HAVE_PARALLEL */
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 8527c60..bbc34e7 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -35,6 +35,38 @@
#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
+
+/* Macros for enabling/disabling particular GCC / clang warnings
+ *
+ * These are (renamed) duplicates of macros in H5private.h. If you make changes
+ * here, be sure to update those as well.
+ *
+ * (see the following web-sites for more info:
+ * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
+ * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+ */
+/* These pragmas are only implemented usefully in gcc 4.6+ */
+#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+#define H5_MULTI_GCC_DIAG_JOINSTR(x, y) x y
+#define H5_MULTI_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
+#define H5_MULTI_GCC_DIAG_PRAGMA(x) H5_MULTI_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+#define H5_MULTI_GCC_DIAG_OFF(x) \
+ H5_MULTI_GCC_DIAG_PRAGMA(push) H5_MULTI_GCC_DIAG_PRAGMA(ignored H5_MULTI_GCC_DIAG_JOINSTR("-W", x))
+#define H5_MULTI_GCC_DIAG_ON(x) H5_MULTI_GCC_DIAG_PRAGMA(pop)
+#else
+#define H5_MULTI_GCC_DIAG_OFF(x)
+#define H5_MULTI_GCC_DIAG_ON(x)
+#endif
+
/* Loop through all mapped files */
#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \
{ \
@@ -103,9 +135,13 @@ 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 herr_t H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext,
+ hid_t raw_plist_id, hbool_t relax, H5FD_multi_fapl_t *fa_out);
+static herr_t H5FD_multi_populate_config(const H5FD_mem_t *memb_map, const hid_t *memb_fapl,
+ const char *const *memb_name, const haddr_t *memb_addr,
+ hbool_t relax, H5FD_multi_fapl_t *fa_out);
+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,79 +170,54 @@ 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);
+static herr_t H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input,
+ void **output);
/* 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 */
- NULL, /*read_vector */
- NULL, /*write_vector */
- NULL, /* read_selection */
- NULL, /* write_selection */
- H5FD_multi_flush, /*flush */
- H5FD_multi_truncate, /*truncate */
- H5FD_multi_lock, /*lock */
- H5FD_multi_unlock, /*unlock */
- NULL, /*ctl */
- H5FD_FLMAP_DEFAULT /*fl_map */
+ H5_VFD_MULTI, /* value */
+ "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 */
+ NULL, /*read_vector */
+ NULL, /*write_vector */
+ NULL, /* read_selection */
+ NULL, /* write_selection */
+ H5FD_multi_flush, /* flush */
+ H5FD_multi_truncate, /* truncate */
+ H5FD_multi_lock, /* lock */
+ H5FD_multi_unlock, /* unlock */
+ H5FD_multi_delete, /* del */
+ H5FD_multi_ctl, /* ctl */
+ 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
@@ -273,75 +284,19 @@ 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)
{
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN];
- char raw_name[H5FD_MULT_MAX_FILE_NAME_LEN];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_multi_fapl_t fa;
+ static const char *func = "H5Pset_fapl_split"; /* Function Name for error reporting */
/*NO TRACE*/
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- /* Initialize */
- ALL_MEMBERS(mt)
- {
- /* Treat global heap as raw data, not metadata */
- memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER);
- memb_fapl[mt] = -1;
- memb_name[mt] = NULL;
- memb_addr[mt] = HADDR_UNDEF;
- }
- END_MEMBERS;
-
- /* The file access properties */
- memb_fapl[H5FD_MEM_SUPER] = meta_plist_id;
- memb_fapl[H5FD_MEM_DRAW] = raw_plist_id;
-
- /* The names */
- /* process meta filename */
- if (meta_ext) {
- if (strstr(meta_ext, "%s")) {
- /* Note: this doesn't accommodate for when the '%s' in the user's
- * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17
- */
- strncpy(meta_name, meta_ext, sizeof(meta_name));
- meta_name[sizeof(meta_name) - 1] = '\0';
- }
- else
- sprintf(meta_name, "%%s%s", meta_ext);
- }
- else {
- strncpy(meta_name, "%s.meta", sizeof(meta_name));
- meta_name[sizeof(meta_name) - 1] = '\0';
- }
- memb_name[H5FD_MEM_SUPER] = meta_name;
+ if (H5FD_split_populate_config(meta_ext, meta_plist_id, raw_ext, raw_plist_id, TRUE, &fa) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup split driver configuration",
+ -1);
- /* process raw filename */
- if (raw_ext) {
- if (strstr(raw_ext, "%s")) {
- /* Note: this doesn't accommodate for when the '%s' in the user's
- * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17
- */
- strncpy(raw_name, raw_ext, sizeof(raw_name));
- raw_name[sizeof(raw_name) - 1] = '\0';
- }
- else
- sprintf(raw_name, "%%s%s", raw_ext);
- }
- else {
- strncpy(raw_name, "%s.raw", sizeof(raw_name));
- raw_name[sizeof(raw_name) - 1] = '\0';
- }
- memb_name[H5FD_MEM_DRAW] = raw_name;
-
- /* The sizes */
- memb_addr[H5FD_MEM_SUPER] = 0;
- memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
-
- return H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE);
+ return H5Pset_driver(fapl, H5FD_MULTI, &fa);
}
/*-------------------------------------------------------------------------
@@ -425,14 +380,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f
const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax)
{
H5FD_multi_fapl_t fa;
- H5FD_mem_t mt, mmt;
- H5FD_mem_t _memb_map[H5FD_MEM_NTYPES];
- hid_t _memb_fapl[H5FD_MEM_NTYPES];
- char _memb_name[H5FD_MEM_NTYPES][16];
- const char * _memb_name_ptrs[H5FD_MEM_NTYPES];
- haddr_t _memb_addr[H5FD_MEM_NTYPES];
- static const char *letters = "Xsbrglo";
- static const char *func = "H5FDset_fapl_multi"; /* Function Name for error reporting */
+ static const char *func = "H5FDset_fapl_multi"; /* Function Name for error reporting */
/*NO TRACE*/
@@ -441,66 +389,10 @@ 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;
- }
- 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);
- memb_fapl = _memb_fapl;
- }
- if (!memb_name) {
- assert(strlen(letters) == H5FD_MEM_NTYPES);
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- sprintf(_memb_name[mt], "%%s-%c.h5", letters[mt]);
- _memb_name_ptrs[mt] = _memb_name[mt];
- }
- memb_name = _memb_name_ptrs;
- }
- if (!memb_addr) {
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1))
- _memb_addr[mt] = (hsize_t)(mt ? (mt - 1) : 0) * (HADDR_MAX / (H5FD_MEM_NTYPES - 1));
- memb_addr = _memb_addr;
- }
-
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- /* 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_PLIST, H5E_BADVALUE, "not an access list", -1);
+ if (H5FD_multi_populate_config(memb_map, memb_fapl, memb_name, memb_addr, relax, &fa) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "can't setup driver configuration", -1);
- /*
- * 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)
-
- /* 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)
- }
-
- /*
- * Initialize driver specific information. No need to copy it into the FA
- * struct since all members will be copied by H5Pset_driver().
- */
- memset(&fa, 0, sizeof(H5FD_multi_fapl_t));
- memcpy(fa.memb_map, memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
- memcpy(fa.memb_fapl, memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t));
- memcpy(fa.memb_name, memb_name, H5FD_MEM_NTYPES * sizeof(char *));
- memcpy(fa.memb_addr, memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t));
- fa.relax = relax;
-
- /* Patch up H5P_DEFAULT property lists for members */
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- if (fa.memb_fapl[mt] == H5P_DEFAULT)
- fa.memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS);
- }
return H5Pset_driver(fapl_id, H5FD_MULTI, &fa);
}
@@ -525,6 +417,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax)
{
const H5FD_multi_fapl_t *fa;
+ H5FD_multi_fapl_t default_fa;
H5FD_mem_t mt;
static const char * func = "H5FDget_fapl_multi"; /* Function Name for error reporting */
@@ -534,13 +427,23 @@ 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)
+ 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);
+ H5E_BEGIN_TRY
+ {
+ fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
+ }
+ H5E_END_TRY;
+ if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id)) {
+ if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup default driver configuration",
+ -1);
+ fa = &default_fa;
+ }
- if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
+ 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)
@@ -566,6 +469,231 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl
}
/*-------------------------------------------------------------------------
+ * Function: H5FD_split_populate_config
+ *
+ * Purpose: Populates a H5FD_multi_fapl_t structure with the provided
+ * split driver values, supplying defaults where values are not
+ * provided.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id,
+ hbool_t relax, H5FD_multi_fapl_t *fa_out)
+{
+ static const char *func = "H5FD_split_populate_config"; /* Function Name for error reporting */
+ static char
+ meta_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store metadata member name */
+ static char
+ raw_name_g[H5FD_MULT_MAX_FILE_NAME_LEN]; /* Static scratch buffer to store raw data member name */
+ const char *_memb_name[H5FD_MEM_NTYPES];
+ H5FD_mem_t _memb_map[H5FD_MEM_NTYPES];
+ hid_t _memb_fapl[H5FD_MEM_NTYPES];
+ haddr_t _memb_addr[H5FD_MEM_NTYPES];
+ herr_t ret_value = 0;
+
+ assert(fa_out);
+
+ /* Initialize */
+ ALL_MEMBERS (mt) {
+ /* Treat global heap as raw data, not metadata */
+ _memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER);
+ _memb_fapl[mt] = H5P_DEFAULT;
+ _memb_name[mt] = NULL;
+ _memb_addr[mt] = HADDR_UNDEF;
+ }
+ END_MEMBERS;
+
+ /* The file access properties */
+ _memb_fapl[H5FD_MEM_SUPER] = meta_plist_id;
+ _memb_fapl[H5FD_MEM_DRAW] = raw_plist_id;
+
+ /* The names */
+ /* process meta filename */
+ if (meta_ext) {
+ if (strstr(meta_ext, "%s")) {
+ /* Note: this doesn't accommodate for when the '%s' in the user's
+ * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17
+ */
+ strncpy(meta_name_g, meta_ext, sizeof(meta_name_g));
+ meta_name_g[sizeof(meta_name_g) - 1] = '\0';
+ }
+ else
+ sprintf(meta_name_g, "%%s%s", meta_ext);
+ }
+ else {
+ strncpy(meta_name_g, "%s.meta", sizeof(meta_name_g));
+ meta_name_g[sizeof(meta_name_g) - 1] = '\0';
+ }
+ _memb_name[H5FD_MEM_SUPER] = meta_name_g;
+
+ /* process raw filename */
+ if (raw_ext) {
+ if (strstr(raw_ext, "%s")) {
+ /* Note: this doesn't accommodate for when the '%s' in the user's
+ * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17
+ */
+ strncpy(raw_name_g, raw_ext, sizeof(raw_name_g));
+ raw_name_g[sizeof(raw_name_g) - 1] = '\0';
+ }
+ else
+ sprintf(raw_name_g, "%%s%s", raw_ext);
+ }
+ else {
+ strncpy(raw_name_g, "%s.raw", sizeof(raw_name_g));
+ raw_name_g[sizeof(raw_name_g) - 1] = '\0';
+ }
+ _memb_name[H5FD_MEM_DRAW] = raw_name_g;
+
+ /* The sizes */
+ _memb_addr[H5FD_MEM_SUPER] = 0;
+ _memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
+
+ ALL_MEMBERS (mt) {
+ /* Map usage type */
+ H5FD_mem_t 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);
+
+ /*
+ * 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);
+
+ /* 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);
+ }
+ END_MEMBERS;
+
+ /*
+ * Initialize driver specific information. No need to copy it into the FA
+ * struct since all members will be copied by H5Pset_driver().
+ */
+ memset(fa_out, 0, sizeof(H5FD_multi_fapl_t));
+ memcpy(fa_out->memb_map, _memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
+ memcpy(fa_out->memb_fapl, _memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t));
+ memcpy(fa_out->memb_name, _memb_name, H5FD_MEM_NTYPES * sizeof(char *));
+ memcpy(fa_out->memb_addr, _memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t));
+ fa_out->relax = relax;
+
+ /* Patch up H5P_DEFAULT property lists for members */
+ ALL_MEMBERS (mt) {
+ if (fa_out->memb_fapl[mt] == H5P_DEFAULT) {
+ fa_out->memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_sec2(fa_out->memb_fapl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET,
+ "can't set sec2 driver on member FAPL", -1);
+ }
+ }
+ END_MEMBERS;
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_populate_config
+ *
+ * Purpose: Populates a H5FD_multi_fapl_t structure with the provided
+ * values, supplying defaults where values are not provided.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_populate_config(const H5FD_mem_t *memb_map, const hid_t *memb_fapl, const char *const *memb_name,
+ const haddr_t *memb_addr, hbool_t relax, H5FD_multi_fapl_t *fa_out)
+{
+ static const char *func = "H5FD_multi_populate_config"; /* Function Name for error reporting */
+ static const char *letters = "Xsbrglo";
+ static char _memb_name_g[H5FD_MEM_NTYPES][16]; /* Static scratch buffer to store member names */
+ H5FD_mem_t mt, mmt;
+ H5FD_mem_t _memb_map[H5FD_MEM_NTYPES];
+ hid_t _memb_fapl[H5FD_MEM_NTYPES];
+ const char * _memb_name_ptrs[H5FD_MEM_NTYPES];
+ haddr_t _memb_addr[H5FD_MEM_NTYPES];
+ herr_t ret_value = 0;
+
+ assert(fa_out);
+
+ 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);
+ if (H5Pset_fapl_sec2(_memb_fapl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET,
+ "can't set sec2 driver on member FAPL", -1);
+ }
+ memb_fapl = _memb_fapl;
+ }
+ if (!memb_name) {
+ assert(strlen(letters) == H5FD_MEM_NTYPES);
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ sprintf(_memb_name_g[mt], "%%s-%c.h5", letters[mt]);
+ _memb_name_ptrs[mt] = _memb_name_g[mt];
+ }
+ memb_name = _memb_name_ptrs;
+ }
+ if (!memb_addr) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1))
+ _memb_addr[mt] = (hsize_t)(mt ? (mt - 1) : 0) * (HADDR_MAX / (H5FD_MEM_NTYPES - 1));
+ memb_addr = _memb_addr;
+ }
+
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ /* 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;
+
+ /*
+ * 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);
+
+ /* 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);
+ }
+
+ /*
+ * Initialize driver specific information. No need to copy it into the FA
+ * struct since all members will be copied by H5Pset_driver().
+ */
+ memset(fa_out, 0, sizeof(H5FD_multi_fapl_t));
+ memcpy(fa_out->memb_map, memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t));
+ memcpy(fa_out->memb_fapl, memb_fapl, H5FD_MEM_NTYPES * sizeof(hid_t));
+ memcpy(fa_out->memb_name, memb_name, H5FD_MEM_NTYPES * sizeof(char *));
+ memcpy(fa_out->memb_addr, memb_addr, H5FD_MEM_NTYPES * sizeof(haddr_t));
+ fa_out->relax = relax;
+
+ /* Patch up H5P_DEFAULT property lists for members */
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if (fa_out->memb_fapl[mt] == H5P_DEFAULT) {
+ fa_out->memb_fapl[mt] = H5Pcreate(H5P_FILE_ACCESS);
+ if (H5Pset_fapl_sec2(fa_out->memb_fapl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET,
+ "can't set sec2 driver on member FAPL", -1);
+ }
+ }
+
+ return ret_value;
+} /* end H5FD_multi_populate_config() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD_multi_sb_size
*
* Purpose: Returns the size of the private information to be stored in
@@ -591,15 +719,16 @@ H5FD_multi_sb_size(H5FD_t *_file)
H5Eclear2(H5E_DEFAULT);
/* How many unique files? */
- UNIQUE_MEMBERS(file->fa.memb_map, mt) { nseen++; }
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
+ nseen++;
+ }
END_MEMBERS;
/* Addresses and EOA markers */
nbytes += nseen * 2 * 8;
/* Name templates */
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
nbytes += (n + 7) & ~((size_t)0x0007);
}
@@ -646,7 +775,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
H5Eclear2(H5E_DEFAULT);
/* Name and version number */
- strncpy(name, "NCSAmulti", (size_t)8);
+ strncpy(name, "NCSAmult", (size_t)9);
name[8] = '\0';
assert(7 == H5FD_MEM_NTYPES);
@@ -666,8 +795,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
nseen = 0;
p = buf + 8;
assert(sizeof(haddr_t) <= 8);
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t));
p += sizeof(haddr_t);
memb_eoa = H5FDget_eoa(file->memb[mt], mt);
@@ -677,14 +805,13 @@ 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;
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ /* 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);
+ strcpy((char *)p, file->fa.memb_name[mt]);
p += n;
for (i = n; i % 8; i++)
*p++ = '\0';
@@ -734,16 +861,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;
/*
@@ -757,7 +883,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
map_changed = TRUE;
}
- UNIQUE_MEMBERS(map, mt) { nseen++; }
+ UNIQUE_MEMBERS (map, mt) {
+ nseen++;
+ }
END_MEMBERS;
buf += 8;
@@ -766,19 +894,17 @@ 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 */
- UNIQUE_MEMBERS(map, mt)
- {
+ 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++;
}
END_MEMBERS;
/* Decode name templates */
- UNIQUE_MEMBERS(map, mt)
- {
+ UNIQUE_MEMBERS (map, mt) {
size_t n = strlen((const char *)buf) + 1;
memb_name[_unmapped] = (const char *)buf;
buf += (n + 7) & ~((unsigned)0x0007);
@@ -793,15 +919,18 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
*/
if (map_changed) {
/* Commit map */
- ALL_MEMBERS(mt) { file->fa.memb_map[mt] = map[mt]; }
+ ALL_MEMBERS (mt) {
+ file->fa.memb_map[mt] = map[mt];
+ }
END_MEMBERS;
/* Close files which are unused now */
memset(in_use, 0, sizeof in_use);
- UNIQUE_MEMBERS(map, mt) { in_use[mt] = TRUE; }
+ UNIQUE_MEMBERS (map, mt) {
+ in_use[mt] = TRUE;
+ }
END_MEMBERS;
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (!in_use[mt] && file->memb[mt]) {
(void)H5FDclose(file->memb[mt]);
file->memb[mt] = NULL;
@@ -812,8 +941,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
}
/* Commit member starting addresses and name templates */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
file->fa.memb_addr[mt] = memb_addr[mt];
if (memb_name[mt]) {
if (file->fa.memb_name[mt])
@@ -823,23 +951,22 @@ 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;
@@ -901,8 +1028,7 @@ H5FD_multi_fapl_copy(const void *_old_fa)
H5Eclear2(H5E_DEFAULT);
memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t));
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (old_fa->memb_fapl[mt] >= 0) {
if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) {
nerrors++;
@@ -921,8 +1047,7 @@ H5FD_multi_fapl_copy(const void *_old_fa)
END_MEMBERS;
if (nerrors) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (new_fa->memb_fapl[mt] >= 0)
(void)H5Idec_ref(new_fa->memb_fapl[mt]);
if (new_fa->memb_name[mt])
@@ -930,7 +1055,7 @@ 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;
}
@@ -958,12 +1083,12 @@ H5FD_multi_fapl_free(void *_fa)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ 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);
@@ -1001,28 +1126,40 @@ 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);
+ /*
+ * 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);
+ H5E_BEGIN_TRY
+ {
+ fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
+ }
+ H5E_END_TRY;
+ if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id) || (H5FD_MULTI != H5Pget_driver(fapl_id))) {
+ char *env = getenv(HDF5_DRIVER);
+
+ close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if (env && !strcmp(env, "split")) {
+ if (H5Pset_fapl_split(fapl_id, NULL, H5P_DEFAULT, NULL, H5P_DEFAULT) < 0)
+ H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error)
+ }
+ else {
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);
+
+ fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
+ }
assert(fa);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
file->fa.memb_map[mt] = fa->memb_map[mt];
file->fa.memb_addr[mt] = fa->memb_addr[mt];
if (fa->memb_fapl[mt] >= 0)
@@ -1058,8 +1195,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
error:
/* Cleanup and fail */
if (file) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
(void)H5FDclose(file->memb[mt]);
if (file->fa.memb_fapl[mt] >= 0)
@@ -1102,8 +1238,7 @@ H5FD_multi_close(H5FD_t *_file)
H5Eclear2(H5E_DEFAULT);
/* Close as many members as possible */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt]) {
if (H5FDclose(file->memb[mt]) < 0) {
nerrors++;
@@ -1115,16 +1250,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)
-
- /* 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]);
- }
+ 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]);
+ }
END_MEMBERS;
free(file->name);
@@ -1161,8 +1295,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
out_mt = mt;
if (f1->memb[mt] && f2->memb[mt])
break;
@@ -1271,18 +1404,22 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
* the query is for TYPE == H5FD_MEM_DEFAULT.
*/
if (H5FD_MEM_DEFAULT == type) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
haddr_t memb_eoa;
if (file->memb[mt]) {
/* Retrieve EOA */
- H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); }
+ H5E_BEGIN_TRY
+ {
+ memb_eoa = H5FDget_eoa(file->memb[mt], mt);
+ }
H5E_END_TRY;
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) {
/*
@@ -1293,7 +1430,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,12 +1445,17 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
mmt = type;
if (file->memb[mmt]) {
- H5E_BEGIN_TRY { eoa = H5FDget_eoa(file->memb[mmt], mmt); }
+ H5E_BEGIN_TRY
+ {
+ eoa = H5FDget_eoa(file->memb[mmt], mmt);
+ }
H5E_END_TRY;
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) {
/*
@@ -1324,7 +1466,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);
}
}
@@ -1384,12 +1526,15 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
assert(eoa >= file->fa.memb_addr[mmt]);
assert(eoa < file->memb_next[mmt]);
- H5E_BEGIN_TRY { status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); }
+ H5E_BEGIN_TRY
+ {
+ status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt]));
+ }
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() */
/*-------------------------------------------------------------------------
@@ -1420,18 +1565,22 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
H5Eclear2(H5E_DEFAULT);
if (H5FD_MEM_DEFAULT == type) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
haddr_t tmp_eof;
if (file->memb[mt]) {
/* Retrieve EOF */
- H5E_BEGIN_TRY { tmp_eof = H5FDget_eof(file->memb[mt], type); }
+ H5E_BEGIN_TRY
+ {
+ tmp_eof = H5FDget_eof(file->memb[mt], type);
+ }
H5E_END_TRY;
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 +1591,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;
@@ -1457,12 +1606,17 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
if (file->memb[mmt]) {
/* Retrieve EOF */
- H5E_BEGIN_TRY { eof = H5FDget_eof(file->memb[mmt], mmt); }
+ H5E_BEGIN_TRY
+ {
+ eof = H5FDget_eof(file->memb[mmt], mmt);
+ }
H5E_END_TRY;
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) {
/*
@@ -1473,7 +1627,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;
@@ -1501,9 +1655,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;
@@ -1538,8 +1693,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* XXX: NEED to work on this again */
if (file->pub.paged_aggr) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
file->memb[mt]->paged_aggr = file->pub.paged_aggr;
}
@@ -1547,8 +1701,8 @@ 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 ) {
@@ -1556,7 +1710,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
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
@@ -1761,9 +1915,9 @@ 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;
}
/*-------------------------------------------------------------------------
@@ -1802,9 +1956,9 @@ 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() */
/*-------------------------------------------------------------------------
@@ -1834,8 +1988,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
H5Eclear2(H5E_DEFAULT);
/* Lock all member files */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
out_mt = mt;
if (file->memb[mt]) {
H5E_BEGIN_TRY
@@ -1865,7 +2018,8 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
} /* end if */
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1) return 0;
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1);
+ return 0;
} /* H5FD_multi_lock() */
@@ -1893,8 +2047,7 @@ H5FD_multi_unlock(H5FD_t *_file)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
if (H5FDunlock(file->memb[mt]) < 0)
nerrors++;
@@ -1902,9 +2055,9 @@ H5FD_multi_unlock(H5FD_t *_file)
END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1);
- return 0;
+ return 0;
} /* H5FD_multi_unlock() */
/*-------------------------------------------------------------------------
@@ -1928,11 +2081,12 @@ compute_next(H5FD_multi_t *file)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt) { file->memb_next[mt] = HADDR_UNDEF; }
+ ALL_MEMBERS (mt) {
+ file->memb_next[mt] = HADDR_UNDEF;
+ }
END_MEMBERS;
- UNIQUE_MEMBERS(file->fa.memb_map, mt1)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt1) {
UNIQUE_MEMBERS2(file->fa.memb_map, mt2)
{
if (file->fa.memb_addr[mt1] < file->fa.memb_addr[mt2] &&
@@ -1964,35 +2118,38 @@ compute_next(H5FD_multi_t *file)
*
*-------------------------------------------------------------------------
*/
-/* 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.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_MULTI_GCC_DIAG_OFF("format-nonliteral")
static int
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);
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
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';
- H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); }
+ 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
+ {
+ file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF);
+ }
H5E_END_TRY;
if (!file->memb[mt]) {
if (!file->fa.relax || (file->flags & H5F_ACC_RDWR))
@@ -2001,13 +2158,126 @@ open_members(H5FD_multi_t *file)
}
END_MEMBERS;
if (nerrors)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1);
- return 0;
+ return 0;
}
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_MULTI_GCC_DIAG_ON("format-nonliteral")
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_MULTI_GCC_DIAG_OFF("format-nonliteral")
+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;
+ H5FD_multi_fapl_t default_fa;
+ static const char * func = "H5FD_multi_delete"; /* Function Name for error reporting */
+
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ assert(filename);
+
+ /* Get the driver info */
+ H5E_BEGIN_TRY
+ {
+ fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
+ }
+ H5E_END_TRY;
+ if (!fa) {
+ char *env = getenv(HDF5_DRIVER);
+
+ if (env && !strcmp(env, "split")) {
+ if (H5FD_split_populate_config(NULL, H5P_DEFAULT, NULL, H5P_DEFAULT, TRUE, &default_fa) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup driver configuration", -1);
+ }
+ else {
+ if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup driver configuration", -1);
+ }
+
+ fa = &default_fa;
+ }
+ 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_MULTI_GCC_DIAG_ON("format-nonliteral")
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_ctl
+ *
+ * Purpose: Multi VFD version of the ctl callback.
+ *
+ * The desired operation is specified by the op_code
+ * parameter.
+ *
+ * The flags parameter controls management of op_codes that
+ * are unknown to the callback
+ *
+ * The input and output parameters allow op_code specific
+ * input and output
+ *
+ * At present, this VFD supports no op codes of its own.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output)
+{
+ H5FD_multi_t * file = (H5FD_multi_t *)_file;
+ static const char *func = "H5FD_multi_ctl"; /* Function Name for error reporting */
+ herr_t ret_value = 0;
+
+ /* Silence compiler */
+ (void)file;
+ (void)input;
+ (void)output;
+
+ /* Clear the error stack */
+ H5Eclear2(H5E_DEFAULT);
+
+ switch (op_code) {
+ /* Unknown op code */
+ default:
+ if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_FCNTL,
+ "VFD ctl request failed (unknown op code and fail if unknown flag is set)", -1);
+
+ break;
+ }
+
+ return ret_value;
+} /* end H5FD_multi_ctl() */
-#ifdef _H5private_H
+#ifdef H5private_H
/*
* This is not related to the functionality of the driver code.
* It is added here to trigger warning if HDF5 private definitions are included
diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h
index 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 60784f4..c48d0fc 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -18,8 +18,9 @@
#ifndef H5FDprivate_H
#define H5FDprivate_H
-/* Include package's public header */
+/* Include package's public headers */
#include "H5FDpublic.h"
+#include "H5FDdevelop.h"
/* Private headers needed by this file */
#include "H5Pprivate.h" /* Property lists */
@@ -81,12 +82,22 @@ typedef struct {
} \
}
-/* Define structure to hold driver ID & info for FAPLs */
+/* Define structure to hold driver ID, info & configuration string for FAPLs */
typedef struct {
- hid_t driver_id; /* Driver's ID */
- const void *driver_info; /* Driver info, for open callbacks */
+ hid_t driver_id; /* Driver's ID */
+ const void *driver_info; /* Driver info, for open callbacks */
+ const char *driver_config_str; /* Driver configuration string */
} H5FD_driver_prop_t;
+/* Which kind of VFD field to use for searching */
+typedef enum H5FD_get_driver_kind_t {
+ H5FD_GET_DRIVER_BY_NAME, /* Name field is set */
+ H5FD_GET_DRIVER_BY_VALUE /* Value field is set */
+} H5FD_get_driver_kind_t;
+
+/* Forward declarations for prototype arguments */
+struct H5S_t;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -97,6 +108,7 @@ typedef struct {
/* Forward declarations for prototype arguments */
struct H5F_t;
+union H5PL_key_t;
H5_DLL int H5FD_term_interface(void);
H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr);
@@ -107,10 +119,17 @@ H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t
H5_DLL void * H5FD_fapl_get(H5FD_t *file);
H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
+H5_DLL hid_t H5FD_register_driver_by_name(const char *name, hbool_t app_ref);
+H5_DLL hid_t H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref);
+H5_DLL htri_t H5FD_is_driver_registered_by_name(const char *driver_name, hid_t *registered_id);
+H5_DLL htri_t H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id);
+H5_DLL hid_t H5FD_get_driver_id_by_name(const char *name, hbool_t is_api);
+H5_DLL hid_t H5FD_get_driver_id_by_value(H5FD_class_value_t value, hbool_t is_api);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
H5_DLL herr_t H5FD_close(H5FD_t *file);
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);
H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/);
+H5_DLL herr_t H5FD_check_plugin_load(const H5FD_class_t *cls, const union H5PL_key_t *key, hbool_t *success);
H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr,
hsize_t *frag_size);
H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size);
@@ -130,11 +149,13 @@ H5_DLL herr_t H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[]
H5_DLL herr_t H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
size_t sizes[], const void *bufs[] /* out */);
H5_DLL herr_t H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count,
- const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces,
- haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */);
+ const struct H5S_t *const *mem_spaces,
+ const struct H5S_t *const *file_spaces, haddr_t offsets[],
+ size_t element_sizes[], void *bufs[] /* out */);
H5_DLL herr_t H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count,
- const H5S_t *const *mem_spaces, const H5S_t *const *file_spaces,
- haddr_t offsets[], size_t element_sizes[], const void *bufs[]);
+ const struct H5S_t *const *mem_spaces,
+ const struct H5S_t *const *file_spaces, haddr_t offsets[],
+ size_t element_sizes[], const void *bufs[]);
H5_DLL herr_t H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[],
hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[],
void *bufs[] /* out */);
@@ -145,6 +166,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_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output);
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);
@@ -175,4 +197,4 @@ H5_DLL int H5FD_mpi_get_size(H5FD_t *file);
H5_DLL MPI_Comm H5FD_mpi_get_comm(H5FD_t *file);
#endif /* H5_HAVE_PARALLEL */
-#endif /* !_H5FDprivate_H */
+#endif /* H5FDprivate_H */
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index eed41c2..ac3c838 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -18,140 +18,50 @@
#ifndef H5FDpublic_H
#define H5FDpublic_H
-#include "H5public.h"
-#include "H5Fpublic.h" /*for H5F_close_degree_t */
+/* Public headers needed by this file */
+#include "H5public.h" /* Generic Functions */
+#include "H5Fpublic.h" /* Files */
-#define H5_HAVE_VFL 1 /*define a convenient app feature test*/
-#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */
-
-/* Types of allocation requests: see H5Fpublic.h */
-typedef enum H5F_mem_t H5FD_mem_t;
-
-/* Map "fractal heap" header blocks to 'ohdr' type file memory, since its
- * a fair amount of work to add a new kind of file memory and they are similar
- * enough to object headers and probably too minor to deserve their own type.
- *
- * Map "fractal heap" indirect blocks to 'ohdr' type file memory, since they
- * are similar to fractal heap header blocks.
- *
- * Map "fractal heap" direct blocks to 'lheap' type file memory, since they
- * will be replacing local heaps.
- *
- * Map "fractal heap" 'huge' objects to 'draw' type file memory, since they
- * represent large objects that are directly stored in the file.
- *
- * -QAK
- */
-#define H5FD_MEM_FHEAP_HDR H5FD_MEM_OHDR
-#define H5FD_MEM_FHEAP_IBLOCK H5FD_MEM_OHDR
-#define H5FD_MEM_FHEAP_DBLOCK H5FD_MEM_LHEAP
-#define H5FD_MEM_FHEAP_HUGE_OBJ H5FD_MEM_DRAW
-
-/* Map "free space" header blocks to 'ohdr' type file memory, since its
- * a fair amount of work to add a new kind of file memory and they are similar
- * enough to object headers and probably too minor to deserve their own type.
- *
- * Map "free space" serialized sections to 'lheap' type file memory, since they
- * are similar enough to local heap info.
- *
- * -QAK
- */
-#define H5FD_MEM_FSPACE_HDR H5FD_MEM_OHDR
-#define H5FD_MEM_FSPACE_SINFO H5FD_MEM_LHEAP
+/*****************/
+/* Public Macros */
+/*****************/
-/* Map "shared object header message" master table to 'ohdr' type file memory,
- * since its a fair amount of work to add a new kind of file memory and they are
- * similar enough to object headers and probably too minor to deserve their own
- * type.
- *
- * Map "shared object header message" indices to 'btree' type file memory,
- * since they are similar enough to B-tree nodes.
- *
- * -QAK
- */
-#define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR
-#define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE
-
-/* Map "extensible array" header blocks to 'ohdr' type file memory, since its
- * a fair amount of work to add a new kind of file memory and they are similar
- * enough to object headers and probably too minor to deserve their own type.
- *
- * Map "extensible array" index blocks to 'ohdr' type file memory, since they
- * are similar to extensible array header blocks.
- *
- * Map "extensible array" super blocks to 'btree' type file memory, since they
- * are similar enough to B-tree nodes.
- *
- * Map "extensible array" data blocks & pages to 'lheap' type file memory, since
- * they are similar enough to local heap info.
- *
- * -QAK
- */
-#define H5FD_MEM_EARRAY_HDR H5FD_MEM_OHDR
-#define H5FD_MEM_EARRAY_IBLOCK H5FD_MEM_OHDR
-#define H5FD_MEM_EARRAY_SBLOCK H5FD_MEM_BTREE
-#define H5FD_MEM_EARRAY_DBLOCK H5FD_MEM_LHEAP
-#define H5FD_MEM_EARRAY_DBLK_PAGE H5FD_MEM_LHEAP
-
-/* Map "fixed array" header blocks to 'ohdr' type file memory, since its
- * a fair amount of work to add a new kind of file memory and they are similar
- * enough to object headers and probably too minor to deserve their own type.
- *
- * Map "fixed array" data blocks & pages to 'lheap' type file memory, since
- * they are similar enough to local heap info.
- *
- */
-#define H5FD_MEM_FARRAY_HDR H5FD_MEM_OHDR
-#define H5FD_MEM_FARRAY_DBLOCK H5FD_MEM_LHEAP
-#define H5FD_MEM_FARRAY_DBLK_PAGE H5FD_MEM_LHEAP
+#define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */
-/*
- * A free-list map which maps all types of allocation requests to a single
- * free list. This is useful for drivers that don't really care about
- * keeping different requests segregated in the underlying file and which
- * want to make most efficient reuse of freed memory. The use of the
- * H5FD_MEM_SUPER free list is arbitrary.
+/* VFD identifier values
+ * These are H5FD_class_value_t values, NOT hid_t values!
*/
-#define H5FD_FLMAP_SINGLE \
- { \
- H5FD_MEM_SUPER, /*default*/ \
- H5FD_MEM_SUPER, /*super*/ \
- H5FD_MEM_SUPER, /*btree*/ \
- H5FD_MEM_SUPER, /*draw*/ \
- H5FD_MEM_SUPER, /*gheap*/ \
- H5FD_MEM_SUPER, /*lheap*/ \
- H5FD_MEM_SUPER /*ohdr*/ \
- }
+#define H5_VFD_INVALID ((H5FD_class_value_t)(-1))
+#define H5_VFD_SEC2 ((H5FD_class_value_t)(0))
+#define H5_VFD_CORE ((H5FD_class_value_t)(1))
+#define H5_VFD_LOG ((H5FD_class_value_t)(2))
+#define H5_VFD_FAMILY ((H5FD_class_value_t)(3))
+#define H5_VFD_MULTI ((H5FD_class_value_t)(4))
+#define H5_VFD_STDIO ((H5FD_class_value_t)(5))
+#define H5_VFD_SPLITTER ((H5FD_class_value_t)(6))
+#ifdef H5_HAVE_PARALLEL
+#define H5_VFD_MPIO ((H5FD_class_value_t)(7))
+#endif
+#ifdef H5_HAVE_DIRECT
+#define H5_VFD_DIRECT ((H5FD_class_value_t)(8))
+#endif
+#ifdef H5_HAVE_MIRROR_VFD
+#define H5_VFD_MIRROR ((H5FD_class_value_t)(9))
+#endif
+#ifdef H5_HAVE_LIBHDFS
+#define H5_VFD_HDFS ((H5FD_class_value_t)(10))
+#endif
+#ifdef H5_HAVE_ROS3_VFD
+#define H5_VFD_ROS3 ((H5FD_class_value_t)(11))
+#endif
+#define H5_VFD_SUBFILING ((H5FD_class_value_t)(12))
+#define H5_VFD_IOC ((H5FD_class_value_t)(13))
-/*
- * A free-list map which segregates requests into `raw' or `meta' data
- * pools.
- */
-#define H5FD_FLMAP_DICHOTOMY \
- { \
- H5FD_MEM_SUPER, /*default*/ \
- H5FD_MEM_SUPER, /*super*/ \
- H5FD_MEM_SUPER, /*btree*/ \
- H5FD_MEM_DRAW, /*draw*/ \
- H5FD_MEM_DRAW, /*gheap*/ \
- H5FD_MEM_SUPER, /*lheap*/ \
- H5FD_MEM_SUPER /*ohdr*/ \
- }
+/* VFD IDs below this value are reserved for library use. */
+#define H5_VFD_RESERVED 256
-/*
- * The default free list map which causes each request type to use it's own
- * free-list.
- */
-#define H5FD_FLMAP_DEFAULT \
- { \
- H5FD_MEM_DEFAULT, /*default*/ \
- H5FD_MEM_DEFAULT, /*super*/ \
- H5FD_MEM_DEFAULT, /*btree*/ \
- H5FD_MEM_DEFAULT, /*draw*/ \
- H5FD_MEM_DEFAULT, /*gheap*/ \
- H5FD_MEM_DEFAULT, /*lheap*/ \
- H5FD_MEM_DEFAULT /*ohdr*/ \
- }
+/* Maximum VFD ID */
+#define H5_VFD_MAX 65535
/* Define VFL driver features that can be enabled on a per-driver basis */
/* These are returned with the 'query' function pointer in H5FD_class_t */
@@ -262,13 +172,32 @@ typedef enum H5F_mem_t H5FD_mem_t;
* enabled may be used as the Write-Only (W/O) channel driver.
*/
#define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000
+/*
+ * Defining H5FD_FEAT_MEMMANAGE for a VFL driver means that
+ * the driver uses special memory management routines or wishes
+ * to do memory management in a specific manner. Therefore, HDF5
+ * should request that the driver handle any memory management
+ * operations when appropriate.
+ */
+#define H5FD_FEAT_MEMMANAGE 0x00010000
+
+/* ctl function definitions: */
+#define H5FD_CTL_OPC_RESERVED 512 /* Opcodes below this value are reserved for library use */
+#define H5FD_CTL_OPC_EXPER_MIN \
+ H5FD_CTL_OPC_RESERVED /* Minimum opcode value available for experimental use \
+ */
+#define H5FD_CTL_OPC_EXPER_MAX \
+ (H5FD_CTL_OPC_RESERVED + 511) /* Maximum opcode value available for experimental use */
/* ctl function op codes: */
#define H5FD_CTL__INVALID_OPCODE 0
-#define H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE 1
-#define H5FD_CTL__GET_MPI_RANK_OPCODE 2
-#define H5FD_CTL__GET_MPI_SIZE_OPCODE 3
-#define H5FD_CTL__NUM_OPCODES 4 /* must be last */
+#define H5FD_CTL__TEST_OPCODE 1
+#define H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE 2
+#define H5FD_CTL__GET_MPI_RANK_OPCODE 3
+#define H5FD_CTL__GET_MPI_SIZE_OPCODE 4
+#define H5FD_CTL__MEM_ALLOC 5
+#define H5FD_CTL__MEM_FREE 6
+#define H5FD_CTL__MEM_COPY 7
/* ctl function flags: */
@@ -326,143 +255,157 @@ typedef enum H5F_mem_t H5FD_mem_t;
*/
#define H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG 0x0002
-/* Forward declaration */
-typedef struct H5FD_t H5FD_t;
-
-/* Class information for each file driver */
-typedef struct H5FD_class_t {
- const char * name;
- haddr_t maxaddr;
- H5F_close_degree_t fc_degree;
- herr_t (*terminate)(void);
- hsize_t (*sb_size)(H5FD_t *file);
- herr_t (*sb_encode)(H5FD_t *file, char *name /*out*/, unsigned char *p /*out*/);
- herr_t (*sb_decode)(H5FD_t *f, const char *name, const unsigned char *p);
- size_t fapl_size;
- void *(*fapl_get)(H5FD_t *file);
- void *(*fapl_copy)(const void *fapl);
- herr_t (*fapl_free)(void *fapl);
- size_t dxpl_size;
- void *(*dxpl_copy)(const void *dxpl);
- herr_t (*dxpl_free)(void *dxpl);
- H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr);
- herr_t (*close)(H5FD_t *file);
- int (*cmp)(const H5FD_t *f1, const H5FD_t *f2);
- herr_t (*query)(const H5FD_t *f1, unsigned long *flags);
- herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map);
- haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
- herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
- haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type);
- herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr);
- haddr_t (*get_eof)(const H5FD_t *file, H5FD_mem_t type);
- herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void **file_handle);
- herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer);
- herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, const void *buffer);
- herr_t (*read_vector)(H5FD_t *file, hid_t dxpl, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
- size_t sizes[], void *bufs[]);
- herr_t (*write_vector)(H5FD_t *file, hid_t dxpl, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
- size_t sizes[], const void *bufs[]);
- herr_t (*read_selection)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, size_t count, hid_t mem_spaces[],
- hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[],
- void *bufs[] /*out*/);
- herr_t (*write_selection)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, size_t count, hid_t mem_spaces[],
- hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[],
- const void *bufs[] /*in*/);
- herr_t (*flush)(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
- 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 (*ctl)(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output);
- H5FD_mem_t fl_map[H5FD_MEM_NTYPES];
-} H5FD_class_t;
-
-/* A free list is a singly-linked list of address/size pairs. */
-typedef struct H5FD_free_t {
- haddr_t addr;
- hsize_t size;
- struct H5FD_free_t *next;
-} H5FD_free_t;
+/*******************/
+/* Public Typedefs */
+/*******************/
/*
- * The main datatype for each driver. Public fields common to all drivers
- * are declared here and the driver appends private fields in memory.
+ * File driver identifiers.
+ *
+ * Values 0 through 255 are for drivers defined by the HDF5 library.
+ * Values 256 through 511 are available for testing new drivers.
+ * Subsequent values should be obtained from the HDF5 development
+ * team at mailto:help@hdfgroup.org.
*/
-struct H5FD_t {
- hid_t driver_id; /*driver ID for this file */
- const H5FD_class_t *cls; /*constant class info */
- unsigned long fileno; /* File 'serial' number */
- unsigned access_flags; /* File access flags (from create or open) */
- unsigned long feature_flags; /* VFL Driver feature Flags */
- haddr_t maxaddr; /* For this file, overrides class */
- haddr_t base_addr; /* Base address for HDF5 data w/in file */
+typedef int H5FD_class_value_t;
- /* Space allocation management fields */
- hsize_t threshold; /* Threshold for alignment */
- hsize_t alignment; /* Allocation alignment */
- hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */
-};
+/* Types of allocation requests: see H5Fpublic.h */
+typedef enum H5F_mem_t H5FD_mem_t;
-/* 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] -->
+
+/**
+ * Define structure to hold "ctl memory copy" parameters
+ */
+//! <!-- [H5FD_ctl_memcpy_args_t_snip] -->
+typedef struct H5FD_ctl_memcpy_args_t {
+ void * dstbuf; /**< Destination buffer */
+ hsize_t dst_off; /**< Offset within destination buffer */
+ const void *srcbuf; /**< Source buffer */
+ hsize_t src_off; /**< Offset within source buffer */
+ size_t len; /**< Length of data to copy from source buffer */
+} H5FD_ctl_memcpy_args_t;
+//! <!-- [H5FD_ctl_memcpy_args_t_snip] -->
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
#endif
/* Function prototypes */
-H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
-H5_DLL herr_t H5FDunregister(hid_t driver_id);
-H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
-H5_DLL herr_t H5FDclose(H5FD_t *file);
-H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
-H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags);
-H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
-H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
-H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
-H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
-H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
-H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle);
-H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- void *buf /*out*/);
-H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- const void *buf);
-H5_DLL herr_t H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[],
- haddr_t addrs[], size_t sizes[], void *bufs[] /* out */);
-H5_DLL herr_t H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[],
- haddr_t addrs[], size_t sizes[], const void *bufs[] /* in */);
-H5_DLL herr_t H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count,
- hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[],
- size_t element_sizes[], void *bufs[] /* out */);
-H5_DLL herr_t H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count,
- hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[],
- size_t element_sizes[], const void *bufs[]);
-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 H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void **output);
-
/* 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 165667c..6c855a1 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -22,8 +22,10 @@
* Relies on "s3comms" utility layer to implement the AWS REST API.
*/
+#ifdef H5_HAVE_ROS3_VFD
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
@@ -235,6 +237,7 @@ 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 = {
+ H5FD_ROS3_VALUE, /* value */
"ros3", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -270,6 +273,7 @@ static const H5FD_class_t H5FD_ros3_g = {
H5FD__ros3_truncate, /* truncate */
NULL, /* lock */
NULL, /* unlock */
+ NULL, /* del */
NULL, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -412,7 +416,7 @@ H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *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);
+ ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FDros3.h b/src/H5FDros3.h
index 3ef6b8a..d69ebe4 100644
--- a/src/H5FDros3.h
+++ b/src/H5FDros3.h
@@ -22,9 +22,11 @@
#define H5FDros3_H
#ifdef H5_HAVE_ROS3_VFD
-#define H5FD_ROS3 (H5FD_ros3_init())
+#define H5FD_ROS3 (H5FD_ros3_init())
+#define H5FD_ROS3_VALUE H5_VFD_ROS3
#else
-#define H5FD_ROS3 (H5I_INVALID_HID)
+#define H5FD_ROS3 (H5I_INVALID_HID)
+#define H5FD_ROS3_VALUE H5_VFD_INVALID
#endif /* H5_HAVE_ROS3_VFD */
#ifdef H5_HAVE_ROS3_VFD
@@ -89,8 +91,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/H5FDsec2.c b/src/H5FDsec2.c
index 95a5414..90844c1 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -138,8 +138,12 @@ static herr_t H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, h
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 herr_t H5FD__sec2_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input,
+ void **output);
static const H5FD_class_t H5FD_sec2_g = {
+ H5FD_SEC2_VALUE, /* value */
"sec2", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -175,7 +179,8 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD__sec2_truncate, /* truncate */
H5FD__sec2_lock, /* lock */
H5FD__sec2_unlock, /* unlock */
- NULL, /* ctl */
+ H5FD__sec2_delete, /* del */
+ H5FD__sec2_ctl, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -200,7 +205,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
/* Check the use disabled file locks environment variable */
- lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
@@ -295,7 +300,7 @@ H5Pset_fapl_sec2(hid_t fapl_id)
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL);
+ ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -1046,3 +1051,73 @@ H5FD__sec2_unlock(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* 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() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__sec2_ctl
+ *
+ * Purpose: Sec2 VFD version of the ctl callback.
+ *
+ * The desired operation is specified by the op_code
+ * parameter.
+ *
+ * The flags parameter controls management of op_codes that
+ * are unknown to the callback
+ *
+ * The input and output parameters allow op_code specific
+ * input and output
+ *
+ * At present, no op codes are supported by this VFD.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__sec2_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATTR_UNUSED *input,
+ void H5_ATTR_UNUSED **output)
+{
+ H5FD_sec2_t *file = (H5FD_sec2_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(H5FD_SEC2 == file->pub.driver_id);
+
+ switch (op_code) {
+ /* Unknown op code */
+ default:
+ if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG)
+ HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set")
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__sec2_ctl() */
diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h
index 541ac71..5c35677 100644
--- a/src/H5FDsec2.h
+++ b/src/H5FDsec2.h
@@ -20,7 +20,8 @@
#ifndef H5FDsec2_H
#define H5FDsec2_H
-#define H5FD_SEC2 (H5FD_sec2_init())
+#define H5FD_SEC2 (H5FD_sec2_init())
+#define H5FD_SEC2_VALUE H5_VFD_SEC2
#ifdef __cplusplus
extern "C" {
diff --git a/src/H5FDspace.c b/src/H5FDspace.c
index 339c413..de52dc3 100644
--- a/src/H5FDspace.c
+++ b/src/H5FDspace.c
@@ -148,7 +148,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr
FUNC_ENTER_PACKAGE
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size);
#endif /* H5FD_ALLOC_DEBUG */
/* check args */
@@ -211,7 +211,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr
done:
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value);
#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__alloc_real() */
@@ -287,7 +287,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
HDassert(size > 0);
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size);
+ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type, addr, size);
#endif /* H5FD_ALLOC_DEBUG */
/* Sanity checking */
@@ -304,7 +304,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
/* Check for file driver 'free' callback and call it if available */
if (file->cls->free) {
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Letting VFD free space\n", FUNC);
+ HDfprintf(stderr, "%s: Letting VFD free space\n", __func__);
#endif /* H5FD_ALLOC_DEBUG */
if ((file->cls->free)(file, type, H5CX_get_dxpl(), addr, size) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
@@ -317,11 +317,11 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
eoa = file->cls->get_eoa(file, type);
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa);
+ HDfprintf(stderr, "%s: eoa = %a\n", __func__, eoa);
#endif /* H5FD_ALLOC_DEBUG */
if (eoa == (addr + size)) {
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, addr);
+ HDfprintf(stderr, "%s: Reducing file size to = %a\n", __func__, addr);
#endif /* H5FD_ALLOC_DEBUG */
if (file->cls->set_eoa(file, type, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed")
@@ -330,7 +330,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
else {
/* leak memory */
#ifdef H5FD_ALLOC_DEBUG
- HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type,
+ HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type,
addr, size);
#endif /* H5FD_ALLOC_DEBUG */
} /* end else */
diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c
index 045277e..3e03c9f 100644
--- a/src/H5FDsplitter.c
+++ b/src/H5FDsplitter.c
@@ -104,6 +104,10 @@ static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr);
/* Prototypes */
static herr_t H5FD__splitter_term(void);
+static herr_t H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config,
+ H5FD_splitter_fapl_t * fapl_out);
+static herr_t H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len,
+ const char *base_filename);
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);
@@ -129,8 +133,12 @@ static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closin
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_delete(const char *filename, hid_t fapl_id);
+static herr_t H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input,
+ void **output);
static const H5FD_class_t H5FD_splitter_g = {
+ H5FD_SPLITTER_VALUE, /* value */
"splitter", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -138,7 +146,7 @@ static const H5FD_class_t H5FD_splitter_g = {
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 */
+ 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 */
@@ -149,7 +157,7 @@ static const H5FD_class_t H5FD_splitter_g = {
H5FD__splitter_close, /* close */
H5FD__splitter_cmp, /* cmp */
H5FD__splitter_query, /* query */
- H5FD__splitter_get_type_map, /* get_type_map */
+ H5FD__splitter_get_type_map, /* get_type_map */
H5FD__splitter_alloc, /* alloc */
H5FD__splitter_free, /* free */
H5FD__splitter_get_eoa, /* get_eoa */
@@ -166,7 +174,8 @@ static const H5FD_class_t H5FD_splitter_g = {
H5FD__splitter_truncate, /* truncate */
H5FD__splitter_lock, /* lock */
H5FD__splitter_unlock, /* unlock */
- NULL, /* ctl */
+ H5FD__splitter_delete, /* del */
+ H5FD__splitter_ctl, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -191,7 +200,7 @@ H5FD__init_package(void)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
if (H5FD_splitter_init() < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD")
@@ -217,7 +226,7 @@ H5FD_splitter_init(void)
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g))
H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g);
@@ -241,7 +250,7 @@ H5FD__splitter_term(void)
{
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Reset VFL ID */
H5FD_SPLITTER_g = 0;
@@ -266,7 +275,7 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(id_out_ptr != NULL);
@@ -304,7 +313,7 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*#", fapl_id, vfd_config);
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
if (H5FD_SPLITTER_MAGIC != vfd_config->magic)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)")
@@ -313,55 +322,14 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list")
- /* Make sure that the W/O channel supports write-only capability.
- * Some drivers (e.g. family or multi) do revision of the superblock
- * in-memory, causing problems in that channel.
- * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the
- * determining attribute.
- */
- if (H5P_DEFAULT != vfd_config->wo_fapl_id) {
- H5FD_class_t * wo_driver = NULL;
- H5FD_driver_prop_t wo_driver_prop;
- H5P_genplist_t * wo_plist_ptr = NULL;
- unsigned long wo_driver_flags = 0;
-
- wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id);
- if (NULL == wo_plist_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info")
- wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id);
- if (NULL == wo_driver)
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list")
- if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags")
- if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags))
- HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver")
- } /* end if W/O VFD is non-default */
-
info = H5FL_CALLOC(H5FD_splitter_fapl_t);
if (NULL == info)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
- info->ignore_wo_errs = vfd_config->ignore_wo_errs;
- HDstrncpy(info->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(info->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX);
- info->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
- info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+ if (H5FD__splitter_populate_config(vfd_config, info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't setup driver configuration")
- /* Set non-default channel FAPL IDs in splitter configuration info */
- if (H5P_DEFAULT != vfd_config->rw_fapl_id) {
- if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
- info->rw_fapl_id = vfd_config->rw_fapl_id;
- }
- if (H5P_DEFAULT != vfd_config->wo_fapl_id) {
- if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
- info->wo_fapl_id = vfd_config->wo_fapl_id;
- }
-
- ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info);
+ ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info, NULL);
done:
if (info)
@@ -385,14 +353,15 @@ done:
herr_t
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;
+ const H5FD_splitter_fapl_t *fapl_ptr = NULL;
+ H5FD_splitter_fapl_t * default_fapl = NULL;
+ H5P_genplist_t * plist_ptr = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", fapl_id, config);
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
@@ -413,11 +382,17 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
- if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info")
+ fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr);
+ if (NULL == fapl_ptr) {
+ if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
+ if (H5FD__splitter_populate_config(NULL, default_fapl) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info")
+ fapl_ptr = default_fapl;
+ }
- 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);
+ HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
config->ignore_wo_errs = fapl_ptr->ignore_wo_errs;
/* Copy R/W and W/O FAPLs */
@@ -427,10 +402,188 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL");
done:
+ if (default_fapl)
+ H5FL_FREE(H5FD_splitter_fapl_t, default_fapl);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fapl_splitter() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_populate_config
+ *
+ * Purpose: Populates a H5FD_splitter_fapl_t structure with the provided
+ * values, supplying defaults where values are not provided.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_splitter_fapl_t *fapl_out)
+{
+ H5P_genplist_t *def_plist;
+ H5P_genplist_t *plist;
+ hbool_t free_config = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(fapl_out);
+
+ HDmemset(fapl_out, 0, sizeof(H5FD_splitter_fapl_t));
+
+ if (!vfd_config) {
+ vfd_config = H5MM_calloc(sizeof(H5FD_splitter_vfd_config_t));
+ if (NULL == vfd_config)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
+
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->rw_fapl_id = H5P_DEFAULT;
+ vfd_config->wo_fapl_id = H5P_DEFAULT;
+
+ free_config = TRUE;
+ }
+
+ /* Make sure that the W/O channel supports write-only capability.
+ * Some drivers (e.g. family or multi) do revision of the superblock
+ * in-memory, causing problems in that channel.
+ * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the
+ * determining attribute.
+ */
+ if (H5P_DEFAULT != vfd_config->wo_fapl_id) {
+ H5FD_class_t * wo_driver = NULL;
+ H5FD_driver_prop_t wo_driver_prop;
+ H5P_genplist_t * wo_plist_ptr = NULL;
+ unsigned long wo_driver_flags = 0;
+
+ wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id);
+ if (NULL == wo_plist_ptr)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info")
+ wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id);
+ if (NULL == wo_driver)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list")
+ if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags")
+ if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver")
+ } /* end if W/O VFD is non-default */
+
+ fapl_out->ignore_wo_errs = vfd_config->ignore_wo_errs;
+ HDstrncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ fapl_out->wo_path[H5FD_SPLITTER_PATH_MAX] = '\0';
+ HDstrncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
+ fapl_out->log_file_path[H5FD_SPLITTER_PATH_MAX] = '\0';
+ fapl_out->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+ fapl_out->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+
+ if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+
+ /* Set non-default channel FAPL IDs in splitter configuration info */
+ if (H5P_DEFAULT != vfd_config->rw_fapl_id) {
+ if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
+ fapl_out->rw_fapl_id = vfd_config->rw_fapl_id;
+ }
+ else {
+ /* Use copy of default file access property list for R/W channel FAPL ID.
+ * The Sec2 driver is explicitly set on the FAPL ID, as the default
+ * driver might have been replaced with the Splitter VFD, which
+ * would cause recursion badness.
+ */
+ if ((fapl_out->rw_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list")
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->rw_fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL")
+ }
+ if (H5P_DEFAULT != vfd_config->wo_fapl_id) {
+ if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
+ fapl_out->wo_fapl_id = vfd_config->wo_fapl_id;
+ }
+ else {
+ /* Use copy of default file access property list for W/O channel FAPL ID.
+ * The Sec2 driver is explicitly set on the FAPL ID, as the default
+ * driver might have been replaced with the Splitter VFD, which
+ * would cause recursion badness.
+ */
+ if ((fapl_out->wo_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list")
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->wo_fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL")
+ }
+
+done:
+ if (free_config && vfd_config)
+ H5MM_free(vfd_config);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_populate_config() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_get_default_wo_path
+ *
+ * Purpose: Given a base filename, returns a default filename for the
+ * W/O channel file by appending '_wo' to the base file name.
+ *
+ * Return: Non-negative on Success/Negative on Failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const char *base_filename)
+{
+ const char *suffix = "_wo";
+ size_t old_filename_len = 0;
+ char * file_extension = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(new_path);
+ HDassert(base_filename);
+
+ /* Check that output buffer can hold base filename + `_wo` suffix */
+ old_filename_len = HDstrlen(base_filename);
+ if (old_filename_len > H5FD_SPLITTER_PATH_MAX - HDstrlen(suffix) - 1)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length")
+
+ /* Determine if filename contains a ".h5" extension. */
+ if ((file_extension = strstr(base_filename, ".h5"))) {
+ /* Insert the suffix between the filename and ".h5" extension. */
+ HDstrcpy(new_path, base_filename);
+ file_extension = strstr(new_path, ".h5");
+ HDsprintf(file_extension, "%s%s", suffix, ".h5");
+ }
+ else if ((file_extension = strrchr(base_filename, '.'))) {
+ char *new_extension_loc = NULL;
+
+ /* If the filename doesn't contain a ".h5" extension, but contains
+ * AN extension, just insert the suffix before that extension.
+ */
+ HDstrcpy(new_path, base_filename);
+ new_extension_loc = strrchr(new_path, '.');
+ HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
+ }
+ else {
+ /* If the filename doesn't contain an extension at all, just insert
+ * the suffix at the end of the filename.
+ */
+ HDsnprintf(new_path, new_path_len, "%s%s", base_filename, suffix);
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_get_default_wo_path() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD__splitter_flush
*
* Purpose: Flushes all data to disk for both channels.
@@ -446,13 +599,13 @@ H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Public API for dxpl "context" */
if (H5FDflush(file->rw_file, dxpl_id, closing) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file")
if (H5FDflush(file->wo_file, dxpl_id, closing) < 0)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -481,7 +634,7 @@ H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(file && file->pub.cls);
HDassert(buf);
@@ -521,7 +674,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -531,7 +684,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr
if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed")
if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -557,7 +710,7 @@ H5FD__splitter_fapl_get(H5FD_t *_file)
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
ret_value = H5FD__splitter_fapl_copy(&(file->fa));
@@ -582,7 +735,7 @@ H5FD__splitter_fapl_copy(const void *_old_fa)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(old_fa_ptr);
@@ -591,8 +744,8 @@ H5FD__splitter_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t));
- HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
/* Copy R/W and W/O FAPLs */
if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0)
@@ -626,7 +779,7 @@ H5FD__splitter_fapl_free(void *_fapl)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(fapl);
@@ -657,14 +810,15 @@ done:
static H5FD_t *
H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr)
{
- H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */
- const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */
- H5P_genplist_t * plist_ptr = NULL;
- H5FD_t * ret_value = NULL;
+ H5FD_splitter_t * file_ptr = NULL; /* Splitter VFD info */
+ const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */
+ H5FD_splitter_fapl_t * default_fapl = NULL;
+ H5P_genplist_t * plist_ptr = NULL;
+ H5FD_t * ret_value = NULL;
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
if (!name || !*name)
@@ -673,8 +827,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
- if ((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)))
- /* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */
+ if (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter")
file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t);
@@ -688,12 +841,24 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
if (NULL == plist_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr);
- if (NULL == fapl_ptr)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info")
+ if (NULL == fapl_ptr) {
+ if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file access property list struct")
+ if (H5FD__splitter_populate_config(NULL, default_fapl) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info")
+
+ /* If W/O path is not set, use base filename with '_wo' suffix */
+ if (*default_fapl->wo_path == '\0')
+ if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, name) <
+ 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't generate default filename for W/O channel")
+
+ fapl_ptr = default_fapl;
+ }
/* Copy simpler info */
- HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs;
/* Copy R/W and W/O channel FAPLs. */
@@ -720,11 +885,14 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF);
if (!file_ptr->wo_file)
- H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file")
+ 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 (default_fapl)
+ H5FL_FREE(H5FD_splitter_fapl_t, default_fapl);
+
if (NULL == ret_value) {
if (file_ptr) {
if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id)
@@ -761,7 +929,7 @@ H5FD__splitter_close(H5FD_t *_file)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -776,7 +944,8 @@ H5FD__splitter_close(H5FD_t *_file)
HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file")
if (file->wo_file)
if (H5FD_close(file->wo_file) == FAIL)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTCLOSEFILE, FAIL,
+ "unable to close W/O file")
if (file->logfp) {
HDfclose(file->logfp);
@@ -811,7 +980,7 @@ H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -842,7 +1011,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC)
+ H5FD_SPLITTER_LOG_CALL(__func__)
/* Sanity check */
HDassert(file);
@@ -853,7 +1022,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file")
if (H5FD_set_eoa(file->wo_file, type, addr) < 0)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file")
+ 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)
@@ -879,7 +1048,7 @@ H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -908,7 +1077,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(file);
HDassert(file->rw_file);
@@ -918,7 +1087,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file")
if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -946,7 +1115,7 @@ H5FD__splitter_sb_size(H5FD_t *_file)
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -974,7 +1143,7 @@ H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -1005,7 +1174,7 @@ H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *b
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Sanity check */
HDassert(file);
@@ -1036,7 +1205,7 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(f1);
HDassert(f2);
@@ -1063,7 +1232,7 @@ H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
@@ -1094,7 +1263,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
HDassert(file);
HDassert(file->rw_file);
@@ -1105,7 +1274,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw)
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")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1127,7 +1296,7 @@ H5FD__splitter_unlock(H5FD_t *_file)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
@@ -1146,6 +1315,63 @@ done:
} /* end H5FD__splitter_unlock */
/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_ctl
+ *
+ * Purpose: Splitter VFD version of the ctl callback.
+ *
+ * The desired operation is specified by the op_code
+ * parameter.
+ *
+ * The flags parameter controls management of op_codes that
+ * are unknown to the callback
+ *
+ * The input and output parameters allow op_code specific
+ * input and output
+ *
+ * At present, this VFD supports no op codes of its own and
+ * simply passes ctl calls on to the R/W channel VFD.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output)
+{
+ H5FD_splitter_t *file = (H5FD_splitter_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(file);
+ HDassert(H5FD_SPLITTER == file->pub.driver_id);
+
+ switch (op_code) {
+ /* Unknown op code */
+ default:
+ if (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG) {
+ /* Pass ctl call down to R/W channel VFD */
+ if (H5FDctl(file->rw_file, op_code, flags, input, output) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed")
+ }
+ else {
+ /* If no valid VFD routing flag is specified, fail for unknown op code
+ * if H5FD_CTL__FAIL_IF_UNKNOWN_FLAG flag is set.
+ */
+ if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG)
+ HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL,
+ "VFD ctl request failed (unknown op code and fail if unknown flag is set)")
+ }
+
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__splitter_ctl() */
+
+/*-------------------------------------------------------------------------
* Function: H5FD__splitter_query
*
* Purpose: Set the flags that this VFL driver is capable of supporting.
@@ -1162,7 +1388,7 @@ H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
if (file) {
HDassert(file);
@@ -1199,7 +1425,7 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
@@ -1210,7 +1436,8 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file")
if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file")
+ 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)
@@ -1232,7 +1459,7 @@ H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
@@ -1262,7 +1489,7 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
FUNC_ENTER_STATIC
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
@@ -1272,13 +1499,81 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file")
if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0)
- H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file")
+ H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__splitter_free() */
/*-------------------------------------------------------------------------
+ * Function: H5FD__splitter_delete
+ *
+ * Purpose: Delete a file
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__splitter_delete(const char *filename, hid_t fapl_id)
+{
+ const H5FD_splitter_fapl_t *fapl_ptr = NULL;
+ H5FD_splitter_fapl_t * default_fapl = NULL;
+ H5P_genplist_t * plist;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(filename);
+
+ /* Get the driver info */
+ if (H5P_FILE_ACCESS_DEFAULT == fapl_id) {
+ if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
+ if (H5FD__splitter_populate_config(NULL, default_fapl) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info")
+
+ /* If W/O path is not set, use base filename with '_wo' suffix */
+ if (*default_fapl->wo_path == '\0')
+ if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1,
+ filename) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel")
+
+ fapl_ptr = default_fapl;
+ }
+ 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 == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist))) {
+ if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL,
+ "unable to allocate file access property list struct")
+ if (H5FD__splitter_populate_config(NULL, default_fapl) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info")
+
+ /* If W/O path is not set, use base filename with '_wo' suffix */
+ if (*default_fapl->wo_path == '\0')
+ if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1,
+ filename) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel")
+
+ fapl_ptr = default_fapl;
+ }
+ }
+
+ if (H5FDdelete(filename, fapl_ptr->rw_fapl_id) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
+ if (H5FDdelete(fapl_ptr->wo_path, fapl_ptr->wo_fapl_id) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete W/O channel file")
+
+done:
+ if (default_fapl)
+ H5FL_FREE(H5FD_splitter_fapl_t, default_fapl);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+/*-------------------------------------------------------------------------
* Function: H5FD__splitter_log_error
*
* Purpose: Log an error from the W/O channel appropriately.
@@ -1293,7 +1588,7 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const
FUNC_ENTER_STATIC_NOERR
- H5FD_SPLITTER_LOG_CALL(FUNC);
+ H5FD_SPLITTER_LOG_CALL(__func__);
/* Check arguments */
HDassert(file);
diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h
index a201116..3a743e4 100644
--- a/src/H5FDsplitter.h
+++ b/src/H5FDsplitter.h
@@ -17,7 +17,8 @@
#ifndef H5FDsplitter_H
#define H5FDsplitter_H
-#define H5FD_SPLITTER (H5FD_splitter_init())
+#define H5FD_SPLITTER (H5FD_splitter_init())
+#define H5FD_SPLITTER_VALUE H5_VFD_SPLITTER
/* The version of the H5FD_splitter_vfd_config_t structure used */
#define H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION 1
@@ -87,8 +88,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 bb287b5..22d6323 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -180,8 +180,10 @@ 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 = {
+ H5_VFD_STDIO, /* value */
"stdio", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -217,6 +219,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, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -245,7 +248,7 @@ H5FD_stdio_init(void)
H5Eclear2(H5E_DEFAULT);
/* Check the use disabled file locks environment variable */
- lock_env_var = getenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = getenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT"))
ignore_disabled_file_locks_s = 1; /* Override: Ignore disabled locks */
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1")))
@@ -305,9 +308,9 @@ H5Pset_fapl_stdio(hid_t fapl_id)
H5Eclear2(H5E_DEFAULT);
if (0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
- return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
+ return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
} /* end H5Pset_fapl_stdio() */
/*-------------------------------------------------------------------------
@@ -358,14 +361,15 @@ H5FD_stdio_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) 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");
@@ -378,14 +382,14 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
}
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)
@@ -396,14 +400,13 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
* 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;
@@ -467,7 +470,7 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
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;
@@ -501,9 +504,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() */
@@ -774,9 +777,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() */
/*-------------------------------------------------------------------------
@@ -813,12 +816,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;
@@ -829,7 +833,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;
}
@@ -861,7 +865,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)) {
@@ -915,20 +919,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
@@ -950,7 +953,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);
@@ -1004,11 +1007,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 */
@@ -1073,13 +1076,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);
@@ -1087,11 +1090,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;
@@ -1101,7 +1104,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;
@@ -1146,16 +1149,16 @@ H5FD_stdio_lock(H5FD_t *_file, hbool_t rw)
*/
errno = 0;
else
- H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "file lock failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "file lock failed", -1);
} /* end if */
/* Flush the stream */
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
#endif /* H5_HAVE_FLOCK */
- return 0;
+ return 0;
} /* end H5FD_stdio_lock() */
/*-------------------------------------------------------------------------
@@ -1187,26 +1190,53 @@ H5FD_stdio_unlock(H5FD_t *_file)
/* Flush the stream */
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
-
- /* Place a non-blocking lock on the file */
- if (flock(file->fd, LOCK_UN) < 0)
- {
- if (file->ignore_disabled_file_locks && ENOSYS == errno)
- /* When errno is set to ENOSYS, the file system does not support
- * locking, so ignore it.
- */
- errno = 0;
- else
- H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1)
- } /* end if */
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+
+ /* Place a non-blocking lock on the file */
+ if (flock(file->fd, LOCK_UN) < 0) {
+ if (file->ignore_disabled_file_locks && ENOSYS == errno)
+ /* When errno is set to ENOSYS, the file system does not support
+ * locking, so ignore it.
+ */
+ errno = 0;
+ else
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1);
+ } /* end if */
#endif /* H5_HAVE_FLOCK */
return 0;
} /* end H5FD_stdio_unlock() */
-#ifdef _H5private_H
+/*-------------------------------------------------------------------------
+ * 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.
* It is added here to trigger warning if HDF5 private definitions are included
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/H5FDsubfiling.c b/src/H5FDsubfiling.c
index cd7739d..a5077a9 100644
--- a/src/H5FDsubfiling.c
+++ b/src/H5FDsubfiling.c
@@ -240,6 +240,7 @@ static herr_t H5FD__subfiling_get_info(H5FD_t *_file, void **mpi_info);
#endif /* JRM */
static const H5FD_class_t H5FD_subfiling_g = {
+ H5FD_SUBFILING_VALUE, /* value */
"subfiling", /* name */
MAXADDR, /* maxaddr */
H5F_CLOSE_WEAK, /* fc_degree */
@@ -247,7 +248,7 @@ static const H5FD_class_t H5FD_subfiling_g = {
NULL, /* sb_size */
NULL, /* sb_encode */
NULL, /* sb_decode */
- sizeof(H5FD_subfiling_config_t), /* fapl_size */
+ sizeof(H5FD_subfiling_config_t), /* fapl_size */
H5FD__subfiling_fapl_get, /* fapl_get */
H5FD__subfiling_fapl_copy, /* fapl_copy */
H5FD__subfiling_fapl_free, /* fapl_free */
@@ -275,6 +276,7 @@ static const H5FD_class_t H5FD_subfiling_g = {
H5FD__subfiling_truncate, /* truncate */
H5FD__subfiling_lock, /* lock */
H5FD__subfiling_unlock, /* unlock */
+ NULL, /* del */
H5FD__subfiling_ctl, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -509,7 +511,7 @@ H5Pset_fapl_subfiling(hid_t fapl_id, H5FD_subfiling_config_t *fa)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid subfiling config")
}
- ret_value = H5P_set_driver(plist, H5FD_SUBFILING, (void *)fa);
+ ret_value = H5P_set_driver(plist, H5FD_SUBFILING, (void *)fa, NULL);
done:
FUNC_LEAVE_API(ret_value)
@@ -1079,7 +1081,7 @@ H5FD__subfiling_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /
*flags = 0;
*flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
*flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- // *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
+ //*flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
*flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default
VFD */
diff --git a/src/H5FDsubfiling.h b/src/H5FDsubfiling.h
index c7ab265..59a78ce 100644
--- a/src/H5FDsubfiling.h
+++ b/src/H5FDsubfiling.h
@@ -20,6 +20,9 @@
#ifndef H5FDsubfiling_H
#define H5FDsubfiling_H
+#define H5FD_SUBFILING (H5FD_subfiling_init())
+#define H5FD_SUBFILING_VALUE H5_VFD_SUBFILING
+
#if 1 /* JRM */ /* For now, H5FDsubfiling_priv.h needs mercury. Since the code that needs it will \
* move to its own header, just hack it for now. \
*/
@@ -30,8 +33,6 @@
#include "H5FDsubfiling_priv.h"
-#define H5FD_SUBFILING (H5FD_subfiling_init())
-
#ifndef H5FD_SUBFILING_FAPL_T_MAGIC
#define H5FD_CURR_SUBFILING_FAPL_T_VERSION 1
#define H5FD_SUBFILING_FAPL_T_MAGIC 0xFED01331
diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c
index 6ce33a7..fa3c05f 100644
--- a/src/H5FDwindows.c
+++ b/src/H5FDwindows.c
@@ -56,7 +56,7 @@ H5Pset_fapl_windows(hid_t fapl_id)
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL);
+ ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL, NULL);
done:
FUNC_LEAVE_API(ret_value)
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 95188d5..cb58868 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -207,7 +207,7 @@ H5FL_term_package(void)
/* Dump information about all the outstanding allocations */
while (trk != NULL) {
/* Print information about the outstanding block */
- HDfprintf(stderr, "%s: Outstanding allocation:\n", FUNC);
+ HDfprintf(stderr, "%s: Outstanding allocation:\n", __func__);
HDfprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n",
(((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line);
H5CS_print_stack(trk->stack, stderr);
@@ -337,8 +337,11 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -443,8 +446,11 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -625,7 +631,7 @@ H5FL__reg_term(void)
tmp = H5FL_reg_gc_head.first->next;
#ifdef H5FL_DEBUG
- HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name,
+ HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->list->name,
(int)H5FL_reg_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
@@ -908,8 +914,11 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -1004,8 +1013,11 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -1120,14 +1132,20 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
/* Release previous tracking information */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Store new tracking information */
trk->stack = H5CS_copy_stack();
HDassert(trk->stack);
- trk->file = H5MM_strdup(call_file);
- trk->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ trk->file = call_file;
+ trk->func = call_func;
trk->line = call_line;
}
#endif /* H5FL_TRACK */
@@ -1303,7 +1321,7 @@ H5FL__blk_term(void)
tmp = H5FL_blk_gc_head.first->next;
#ifdef H5FL_DEBUG
- HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name,
+ HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name,
(int)H5FL_blk_gc_head.first->pq->allocated);
#endif /* H5FL_DEBUG */
@@ -1763,7 +1781,7 @@ H5FL__arr_term(void)
/* Check if the list has allocations outstanding */
#ifdef H5FL_DEBUG
- HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name,
+ HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->list->name,
(int)H5FL_arr_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
if (H5FL_arr_gc_head.first->list->allocated > 0) {
@@ -2017,8 +2035,11 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -2120,8 +2141,11 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -2348,8 +2372,8 @@ H5FL__fac_term_all(void)
tmp = H5FL_fac_gc_head.first->next;
#ifdef H5FL_DEBUG
- HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size,
- (int)H5FL_fac_gc_head.first->list->allocated);
+ HDprintf("%s: head->size = %d, head->allocated = %d\n", __func__,
+ (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
/* The list cannot have any allocations outstanding */
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 42581ac..381f977 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -51,7 +51,7 @@
/* #define H5FL_TRACK */
#ifdef H5FL_TRACK
/* Macro for inclusion in the free list allocation calls */
-#define H5FL_TRACK_INFO , __FILE__, FUNC, __LINE__
+#define H5FL_TRACK_INFO , __FILE__, __func__, __LINE__
/* Macro for inclusion in internal free list allocation calls */
#define H5FL_TRACK_INFO_INT , call_file, call_func, call_line
diff --git a/src/H5FS.c b/src/H5FS.c
index c85790c..cb18ab3 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -100,7 +100,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t
FUNC_ENTER_NOAPI(NULL)
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, nclasses);
+ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", __func__, nclasses);
#endif /* H5FS_DEBUG */
/* Check arguments. */
@@ -146,7 +146,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t
/* Set the return value */
ret_value = fspace;
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", FUNC, fspace, fspace->addr);
+ HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", __func__, fspace, fspace->addr);
#endif /* H5FS_DEBUG */
done:
@@ -155,7 +155,7 @@ done:
HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header")
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value);
#endif /* H5FS_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_create() */
@@ -183,7 +183,7 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class
FUNC_ENTER_NOAPI(NULL)
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", FUNC, fs_addr,
+ HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", __func__, fs_addr,
nclasses);
#endif /* H5FS_DEBUG */
@@ -204,11 +204,11 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class
(fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header")
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
- HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
- HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sect_size);
- HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo);
- HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc);
+ HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr);
+ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", __func__, fspace->sect_size);
+ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", __func__, fspace->alloc_sect_size);
+ HDfprintf(stderr, "%s: fspace->sinfo = %p\n", __func__, fspace->sinfo);
+ HDfprintf(stderr, "%s: fspace->rc = %u\n", __func__, fspace->rc);
#endif /* H5FS_DEBUG */
/* Increment the reference count on the free space manager header */
@@ -251,7 +251,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_addr);
+ HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", __func__, fs_addr);
#endif /* H5FS_DEBUG */
/* Check arguments. */
@@ -278,7 +278,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL,
"unable to check metadata cache status for free space section info")
- HDfprintf(stderr, "%s: fspace_status = %0x: ", FUNC, fspace_status);
+ HDfprintf(stderr, "%s: fspace_status = %0x: ", __func__, fspace_status);
if (fspace_status) {
hbool_t printed = FALSE;
@@ -321,7 +321,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)
/* Delete serialized section storage, if there are any */
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
+ HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr);
#endif /* H5FS_DEBUG */
if (fspace->serial_sect_count > 0) {
unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */
@@ -342,7 +342,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)
HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED));
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC);
+ HDfprintf(stderr, "%s: Expunging free space section info from cache\n", __func__);
#endif /* H5FS_DEBUG */
/* Evict the free space section info from the metadata cache */
/* (Free file space) */
@@ -361,12 +361,12 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)
} /* end block */
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC);
+ HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", __func__);
#endif /* H5FS_DEBUG */
} /* end if */
else {
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Deleting free space section info from file\n", FUNC);
+ HDfprintf(stderr, "%s: Deleting free space section info from file\n", __func__);
#endif /* H5FS_DEBUG */
/* Release the space in the file */
if (!H5F_IS_TMP_ADDR(f, fspace->sect_addr))
@@ -407,7 +407,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
HDassert(f);
HDassert(fspace);
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", FUNC, fspace,
+ HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", __func__, fspace,
fspace->addr, fspace->sinfo);
#endif /* H5FS_DEBUG */
@@ -418,15 +418,15 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
HDfprintf(stderr,
"%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = %Hu, fspace->sect_addr = "
"%a, fspace->rc = %u\n",
- FUNC, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc);
- HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
+ __func__, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc);
+ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__,
fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_DEBUG */
/* If there are sections to serialize, update them */
/* (if the free space manager is persistent) */
if (fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) {
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
+ HDfprintf(stderr, "%s: Real sections to store in file\n", __func__);
#endif /* H5FS_DEBUG */
if (fspace->sinfo->dirty) {
/* Check if the section info is "floating" */
@@ -465,7 +465,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
} /* end if */
else {
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: NOT storing section info in file\n", FUNC);
+ HDfprintf(stderr, "%s: NOT storing section info in file\n", __func__);
#endif /* H5FS_DEBUG */
/* Check if space for the section info is allocated */
if (H5F_addr_defined(fspace->sect_addr)) {
@@ -474,7 +474,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
HDassert(H5F_addr_defined(fspace->addr));
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info allocated though\n", FUNC);
+ HDfprintf(stderr, "%s: Section info allocated though\n", __func__);
#endif /* H5FS_DEBUG */
/* Check if the section info is for the free space in the file */
/* (NOTE: This is the "bootstrapping" special case for the
@@ -486,12 +486,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
htri_t status; /* "can absorb" status for section into */
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info is for file free space\n", FUNC);
+ HDfprintf(stderr, "%s: Section info is for file free space\n", __func__);
#endif /* H5FS_DEBUG */
/* Try to shrink the file or absorb the section info into a block aggregator */
if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", FUNC);
+ HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n",
+ __func__);
#endif /* H5FS_DEBUG */
/* Reset section info in header */
fspace->sect_addr = HADDR_UNDEF;
@@ -512,12 +513,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
* header to record it
*/
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC);
+ HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n",
+ __func__);
#endif /* H5FS_DEBUG */
} /* end if */
else {
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
+ HDfprintf(stderr, "%s: Section info went 'go away'\n", __func__);
#endif /* H5FS_DEBUG */
/* Reset section info in header */
fspace->sect_addr = HADDR_UNDEF;
@@ -536,7 +538,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
fspace->alloc_sect_size; /* Previous size of section info in file */
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
+ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", __func__);
#endif /* H5FS_DEBUG */
/* Reset section info in header */
fspace->sect_addr = HADDR_UNDEF;
@@ -576,7 +578,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
done:
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_value, fspace->rc);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", __func__, ret_value, fspace->rc);
#endif /* H5FS_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_close() */
@@ -709,7 +711,8 @@ H5FS__incr(H5FS_t *fspace)
FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
+ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr,
+ fspace->rc);
#endif /* H5FS_DEBUG */
/*
@@ -748,7 +751,8 @@ H5FS__decr(H5FS_t *fspace)
FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
- HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
+ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr,
+ fspace->rc);
#endif /* H5FS_DEBUG */
/*
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 4212794..39f0333 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -248,7 +248,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len
fspace->addr = udata->addr;
/* Magic number */
- if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature")
image += H5_SIZEOF_MAGIC;
@@ -988,7 +988,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l
H5_CHECKED_ASSIGN(old_sect_size, size_t, fspace->sect_size, hsize_t);
/* Magic number */
- if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 6ba1bc3..c764932 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -123,7 +123,7 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace)
HDassert(f);
HDassert(fspace);
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr);
+ HDfprintf(stderr, "%s: fspace->addr = %a\n", __func__, fspace->addr);
#endif /* H5FS_SINFO_DEBUG */
/* Allocate the free space header */
@@ -136,10 +136,10 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace)
sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8;
sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size);
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size);
- HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr);
- HDfprintf(stderr, "%s: sinfo->nbins = %u\n", FUNC, sinfo->nbins);
- HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", FUNC,
+ HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", __func__, fspace->max_sect_size);
+ HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", __func__, fspace->max_sect_addr);
+ HDfprintf(stderr, "%s: sinfo->nbins = %u\n", __func__, sinfo->nbins);
+ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", __func__,
sinfo->sect_off_size, sinfo->sect_len_size);
#endif /* H5FS_SINFO_DEBUG */
@@ -200,9 +200,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
FUNC_ENTER_STATIC
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC,
+ HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", __func__,
fspace->addr, fspace->sinfo, fspace->sect_addr);
- HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
+ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__,
fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */
@@ -251,7 +251,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
HDassert(H5F_addr_defined(fspace->addr));
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC,
+ HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", __func__,
fspace->sect_addr);
#endif /* H5FS_SINFO_DEBUG */
/* Protect the free space sections */
@@ -267,7 +267,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
} /* end if */
else {
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Creating new section info\n", FUNC);
+ HDfprintf(stderr, "%s: Creating new section info\n", __func__);
#endif /* H5FS_SINFO_DEBUG */
/* Sanity check */
HDassert(fspace->tot_sect_count == 0);
@@ -289,9 +289,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
done:
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC,
- fspace->addr, fspace->sinfo, fspace->sect_addr);
- HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
+ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n",
+ __func__, fspace->addr, fspace->sinfo, fspace->sect_addr);
+ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__,
fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
@@ -331,13 +331,13 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
FUNC_ENTER_STATIC
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC,
+ HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", __func__,
modified, fspace->addr, fspace->sect_addr);
HDfprintf(
stderr,
"%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n",
- FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected);
- HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
+ __func__, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected);
+ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__,
fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */
@@ -413,7 +413,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
/* (Possibly dirty) */
/* (Possibly taking ownership from the cache) */
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", FUNC, cache_flags);
+ HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", __func__, cache_flags);
#endif /* H5FS_SINFO_DEBUG */
if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info")
@@ -424,14 +424,14 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
/* Check if header is taking ownership of section info */
if ((cache_flags & H5AC__TAKE_OWNERSHIP_FLAG)) {
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Taking ownership of section info\n", FUNC);
+ HDfprintf(stderr, "%s: Taking ownership of section info\n", __func__);
#endif /* H5FS_SINFO_DEBUG */
/* Set flag to release section info space in file */
release_sinfo_space = TRUE;
} /* end if */
else {
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
+ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", __func__);
#endif /* H5FS_SINFO_DEBUG */
/* Free space header relinquished ownership of section info */
fspace->sinfo = NULL;
@@ -491,7 +491,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr,
"%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n",
- FUNC, old_sect_addr, old_alloc_sect_size);
+ __func__, old_sect_addr, old_alloc_sect_size);
#endif /* H5FS_SINFO_DEBUG */
/* Release space for section info in file */
if (!H5F_IS_TMP_ADDR(f, old_sect_addr))
@@ -502,7 +502,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)
done:
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value);
#endif /* H5FS_SINFO_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS__sinfo_unlock() */
@@ -1343,7 +1343,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->size, sect->type,
+ 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"));
#endif /* H5FS_SINFO_DEBUG */
@@ -1367,7 +1367,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag
/* Check for merging returned space with existing section node */
if (flags & H5FS_ADD_RETURNED_SPACE) {
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Returning space\n", FUNC);
+ HDfprintf(stderr, "%s: Returning space\n", __func__);
#endif /* H5FS_SINFO_DEBUG */
/* Attempt to merge returned section with existing sections */
@@ -1384,7 +1384,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
+ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", __func__, fspace->tot_space);
#endif /* H5FS_SINFO_DEBUG */
/* Mark free space sections as changed */
/* (if adding sections while deserializing sections, don't set the flag) */
@@ -1401,7 +1401,7 @@ done:
H5FS__assert(fspace);
#endif /* H5FS_DEBUG_ASSERT */
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value);
#endif /* H5FS_SINFO_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_sect_add() */
@@ -1429,7 +1429,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", FUNC, addr, size,
+ HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", __func__, addr, size,
extra_requested);
#endif /* H5FS_SINFO_DEBUG */
@@ -1442,9 +1442,9 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize
/* Check for any sections on free space list */
#ifdef H5FS_SINFO_DEBUG
- HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count);
- HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count);
- HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count);
+ HDfprintf(stderr, "%s: fspace->tot_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 /* H5FS_SINFO_DEBUG */
if (fspace->tot_sect_count > 0) {
H5FS_section_info_t *sect; /* Temporary free space section */
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index aed5812..4821272 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -36,7 +36,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
+#include "H5FDprivate.h" /* File drivers */
#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index b482961..ff6b4a0 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -89,10 +89,12 @@
herr_t
H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- H5I_type_t type;
- H5F_info2_t finfo2; /* Current file info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5I_type_t type;
+ H5F_info2_t finfo2; /* Current file info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", obj_id, finfo);
@@ -111,9 +113,14 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_info.type = type;
+ file_opt_args.get_info.finfo = &finfo2;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file information */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- type, &finfo2) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@@ -141,7 +148,9 @@ done:
htri_t
H5Fis_hdf5(const char *name)
{
- htri_t ret_value; /* Return value */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("t", "*s", name);
@@ -150,11 +159,19 @@ H5Fis_hdf5(const char *name)
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = name;
+ vol_cb_args.args.is_accessible.fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* Check if file is accessible */
- if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5")
+ /* Set return value */
+ ret_value = (htri_t)is_accessible;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_hdf5() */
@@ -196,10 +213,11 @@ done:
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
- H5VL_object_t *vol_obj; /* File as VOL object */
- H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
- H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File as VOL object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
@@ -218,9 +236,14 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
if (!latest_format)
low = H5F_LIBVER_EARLIEST;
+ /* Set up VOL callback arguments */
+ file_opt_args.set_libver_bounds.low = low;
+ file_opt_args.set_libver_bounds.high = H5F_LIBVER_LATEST;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the library's version bounds */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)low, (int)high) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 3f9a22f..2d4eff2 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -36,10 +36,10 @@
#include "H5Pprivate.h" /* Property lists */
/* Special values for the "tag" field below */
-#define H5F_EFC_TAG_DEFAULT -1
-#define H5F_EFC_TAG_LOCK -2
-#define H5F_EFC_TAG_CLOSE -3
-#define H5F_EFC_TAG_DONTCLOSE -4
+#define H5F_EFC_TAG_DEFAULT (-1)
+#define H5F_EFC_TAG_LOCK (-2)
+#define H5F_EFC_TAG_CLOSE (-3)
+#define H5F_EFC_TAG_DONTCLOSE (-4)
/* Structure for each entry in a file's external file cache */
typedef struct H5F_efc_ent_t {
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 920bf51..d772088 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -81,6 +81,7 @@ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **
static char * H5F__getenv_prefix_name(char **env_prefix /*in,out*/);
static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, hbool_t *use_file_locking);
+static herr_t H5F__dest(H5F_t *f, hbool_t flush);
static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
@@ -276,7 +277,7 @@ H5F__parse_file_lock_env_var(htri_t *use_locks)
FUNC_ENTER_PACKAGE_NOERR
/* Check the file locking environment variable */
- lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
+ lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
if (lock_env_var && (!HDstrcmp(lock_env_var, "FALSE") || !HDstrcmp(lock_env_var, "0")))
*use_locks = FALSE; /* Override: Never use locks */
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "BEST_EFFORT") ||
@@ -453,9 +454,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.")
/* Prepare the driver property */
- driver_prop.driver_id = f->shared->lf->driver_id;
- driver_prop.driver_info = H5FD_fapl_get(f->shared->lf);
- driver_prop_copied = TRUE;
+ driver_prop.driver_id = f->shared->lf->driver_id;
+ driver_prop.driver_info = H5FD_fapl_get(f->shared->lf);
+ driver_prop.driver_config_str = H5P_peek_driver_config_str(old_plist);
+ driver_prop_copied = TRUE;
/* Set the driver property */
if (H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
@@ -1056,9 +1058,10 @@ done:
htri_t
H5F__is_hdf5(const char *name, hid_t fapl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
- htri_t ret_value = FAIL; /* Return value */
+ H5FD_t * file = NULL; /* Low-level file struct */
+ H5F_shared_t *shared = NULL; /* Shared part of file */
+ haddr_t sig_addr = HADDR_UNDEF; /* Addess of hdf5 file signature */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1069,10 +1072,20 @@ H5F__is_hdf5(const char *name, hid_t fapl_id)
if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file")
- /* The file is an hdf5 file if the hdf5 file signature can be found */
- if (H5FD_locate_signature(file, &sig_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature")
- ret_value = (HADDR_UNDEF != sig_addr);
+ /* If the file is already open, it's an HDF5 file
+ *
+ * If the file is open with an exclusive lock on an operating system that enforces
+ * mandatory file locks (like Windows), creating a new file handle and attempting
+ * to read through it will fail so we have to try this first.
+ */
+ if ((shared = H5F__sfile_search(file)) != NULL)
+ ret_value = TRUE;
+ else {
+ /* The file is an HDF5 file if the HDF5 file signature can be found */
+ if (H5FD_locate_signature(file, &sig_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature")
+ ret_value = (HADDR_UNDEF != sig_addr);
+ }
done:
/* Close the file */
@@ -1368,12 +1381,12 @@ done:
* Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5F__dest(H5F_t *f, hbool_t flush)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -1782,7 +1795,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
FUNC_ENTER_NOAPI(NULL)
/*
- * If the driver has a `cmp' method then the driver is capable of
+ * If the driver has a 'cmp' method then the driver is capable of
* determining when two file handles refer to the same file and the
* library can insure that when the application opens a file twice
* that the two handles coordinate their operations appropriately.
@@ -1816,7 +1829,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
else
tent_flags = flags;
- if (NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
+ H5E_BEGIN_TRY
+ {
+ lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF);
+ }
+ H5E_END_TRY;
+
+ if (NULL == lf) {
if (tent_flags == flags)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x",
name, tent_flags)
@@ -2340,6 +2359,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_PACKAGE
+
+ 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:
@@ -2501,11 +2545,6 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
if (H5F__efc_try_close(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC")
- /* Delay flush until the shared file struct is closed, in H5F__dest. If the
- * application called H5Fclose, it would have been flushed in that function
- * (unless it will have been flushed in H5F__dest anyways).
- */
-
/* Destroy the H5F_t struct and decrement the reference count for the
* shared H5F_shared_t struct. If the reference count for the H5F_shared_t
* struct reaches zero then destroy it also.
@@ -3077,27 +3116,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F__get_file_image
*
- * Purpose: Private version of H5Fget_file_image
+ * Purpose: Private version of H5Fget_file_image, returns bytes copied/
+ * number of bytes needed in *image_len.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Bytes copied / number of bytes needed.
- * Failure: -1
*-------------------------------------------------------------------------
*/
-ssize_t
-H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
+herr_t
+H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_len)
{
- H5FD_t *fd_ptr; /* file driver */
- haddr_t eoa; /* End of file address */
- ssize_t ret_value = -1; /* Return value */
+ H5FD_t *fd_ptr; /* file driver */
+ haddr_t eoa; /* End of file address */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
if (!file || !file->shared || !file->shared->lf)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
fd_ptr = file->shared->lf;
if (!fd_ptr->cls)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "fd_ptr yields invalid class pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
/* the address space used by the split and multi file drivers is not
* a good fit for this call. Since the plan is to depreciate these
@@ -3118,7 +3158,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 11/11/22
*/
if (HDstrcmp(fd_ptr->cls->name, "multi") == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "Not supported for multi file driver.")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
/* While the family file driver is conceptually fully compatible
* with the get file image operation, it sets a file driver message
@@ -3126,7 +3166,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* driver other than the family file driver. Needless to say, this
* rather defeats the purpose of the get file image operation.
*
- * While this problem is quire solvable, the required time and
+ * While this problem is quite solvable, the required time and
* resources are lacking at present. Hence, for now, we don't
* allow the get file image operation to be perfomed on files
* opened with the family file driver.
@@ -3140,30 +3180,24 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 12/21/11
*/
if (HDstrcmp(fd_ptr->cls->name, "family") == 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "Not supported for family file driver.")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.")
/* Go get the actual file size */
if (HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file size")
-
- /* set ret_value = to eoa -- will overwrite this if appropriate */
- ret_value = (ssize_t)eoa;
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
- /* test to see if a buffer was provided -- if not, we are done */
+ /* Test to see if a buffer was provided */
if (buf_ptr != NULL) {
- size_t space_needed; /* size of file image */
unsigned tmp, tmp_size;
/* Check for buffer too small */
if ((haddr_t)buf_len < eoa)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
- space_needed = (size_t)eoa;
-
- /* read in the file image */
+ /* Read in the file image */
/* (Note compensation for base address addition in internal routine) */
- if (H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed")
+ if (H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, (size_t)eoa, buf_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
/* Offset to "status_flags" in the superblock */
tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers);
@@ -3175,6 +3209,9 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
HDmemset((uint8_t *)buf_ptr + tmp, 0, tmp_size);
} /* end if */
+ /* Set *image_len = to EOA */
+ *image_len = (size_t)eoa;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_file_image() */
@@ -3718,10 +3755,17 @@ H5F__start_swmr_write(H5F_t *f)
setup = TRUE;
/* Place an advisory lock on the file */
- if (H5F_USE_FILE_LOCKING(f))
+ if (H5F_USE_FILE_LOCKING(f)) {
+ /* Have to unlock on Windows as Win32 doesn't support changing the lock
+ * type (exclusive vs shared) with a second call.
+ */
+ if (H5FD_unlock(f->shared->lf) < 0) {
+ HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file")
+ }
if (H5FD_lock(f->shared->lf, TRUE) < 0) {
HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file")
}
+ }
/* Mark superblock as dirty */
if (H5F_super_dirty(f) < 0)
@@ -3863,11 +3907,12 @@ done:
hid_t
H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
{
- void * vol_obj_file = NULL; /* File object pointer */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t file_id = H5I_INVALID_HID; /* File ID for object */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * vol_obj_file = NULL; /* File object pointer */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -3875,9 +3920,12 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_FILE;
+ vol_cb_args.args.get_file.file = &vol_obj_file;
+
/* Retrieve VOL file from object */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &vol_obj_file) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object")
/* Check if the file's ID already exists */
diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h
index 33c302a..81c1ede 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -29,10 +29,43 @@
#define H5_MY_PKG_ERR H5E_FILE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5F H5F
- * \brief File Interface
- * \todo Describe concisely what the functions in this module are about.
+/**\defgroup H5F H5F
+ *
+ * Use the functions in this module to manage HDF5 files.
+ *
+ * In the code snippets below, we show the skeletal life cycle of an HDF5 file,
+ * when creating a new file (left) or when opening an existing file (right).
+ * File creation is essentially controlled through \ref FCPL, and file access to
+ * new and existing files is controlled through \ref FAPL. The file \c name and
+ * creation or access \c mode control the interaction with the underlying
+ * storage such as file systems.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5F_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5F_examples.c read
+ * </td>
+ * </tr>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5F_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5F_examples.c delete
+ * </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 f107c98..4b90ea3 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -83,7 +83,7 @@ done:
} /* end H5F__close_mounts() */
/*-------------------------------------------------------------------------
- * Function: H5F__mount
+ * Function: H5F_mount
*
* Purpose: Mount file CHILD onto the group specified by LOC and NAME,
* using mount properties in PLIST. CHILD must not already be
@@ -97,7 +97,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id)
+H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id)
{
H5G_t * mount_point = NULL; /*mount point group */
H5F_t * ancestor = NULL; /*ancestor files */
@@ -110,7 +110,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
H5G_loc_t root_loc; /* Group location of root of file to mount */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(loc);
HDassert(name && *name);
@@ -157,10 +157,9 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
HDassert(mp_loc.oloc);
mp_loc.path = H5G_nameof(mount_point);
HDassert(mp_loc.path);
- for (ancestor = parent; ancestor; ancestor = ancestor->parent) {
+ for (ancestor = parent; ancestor; ancestor = ancestor->parent)
if (ancestor->shared == child->shared)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle")
- }
/* Make certain that the parent & child files have the same "file close degree" */
if (parent->shared->fc_degree != child->shared->fc_degree)
@@ -240,10 +239,10 @@ done:
}
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__mount() */
+} /* end H5F_mount() */
/*-------------------------------------------------------------------------
- * Function: H5F__unmount
+ * Function: H5F_unmount
*
* Purpose: Unmount the child which is mounted at the group specified by
* LOC and NAME or fail if nothing is mounted there. Neither
@@ -261,7 +260,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__unmount(H5G_loc_t *loc, const char *name)
+H5F_unmount(const H5G_loc_t *loc, const char *name)
{
H5G_t * child_group = NULL; /* Child's group in parent mtab */
H5F_t * child = NULL; /*mounted file */
@@ -275,7 +274,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
int child_idx; /* Index of child in parent's mtab */
herr_t ret_value = SUCCEED; /*return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(loc);
HDassert(name && *name);
@@ -291,7 +290,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
* then we must have found the mount point.
*/
if (H5G_loc_find(loc, name, &mp_loc /*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
+ HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "group not found")
mp_loc_setup = TRUE;
child = mp_loc.oloc->file;
mnt_oloc = H5G_oloc(child->shared->root_grp);
@@ -364,7 +363,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
/* Search the open IDs replace names to reflect unmount operation */
if (H5G_name_replace(NULL, H5G_NAME_UNMOUNT, mp_loc.oloc->file, mp_loc.path->full_path_r,
root_loc.oloc->file, root_loc.path->full_path_r) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to replace name")
/* Eliminate the mount point from the table */
HDmemmove(parent->shared->mtab.child + (unsigned)child_idx,
@@ -376,7 +375,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
/* Unmount the child file from the parent file */
if (H5G_unmount(child_group) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to reset group mounted flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to reset group mounted flag")
if (H5G_close(child_group) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
@@ -391,7 +390,7 @@ done:
H5G_loc_free(&mp_loc);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__unmount() */
+} /* end H5F_unmount() */
/*-------------------------------------------------------------------------
* Function: H5F_is_mount
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 3336d4f..53d2d78 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -68,35 +68,6 @@
/*******************/
#ifdef H5_HAVE_PARALLEL
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_mpi_handle
- *
- * Purpose: Retrieves MPI File handle.
- *
- * Return: Success: The size (positive)
- * Failure: Negative
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle)
-{
- herr_t ret_value = SUCCEED;
- hid_t fapl_id = H5I_INVALID_HID;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(f && f->shared);
-
- /* Dispatch to driver */
- if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_mpi_handle() */
-
/*-------------------------------------------------------------------------
* Function: H5F_mpi_get_rank
*
@@ -222,7 +193,7 @@ done:
} /* end H5F_mpi_get_size() */
/*-------------------------------------------------------------------------
- * Function: H5F_set_mpi_atomicity
+ * Function: H5F__set_mpi_atomicity
*
* Purpose: Private call to set the atomicity mode
*
@@ -231,11 +202,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag)
+H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(file);
@@ -251,7 +222,7 @@ H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5F_set_mpi_atomicity() */
+} /* end H5F__set_mpi_atomicity() */
/*-------------------------------------------------------------------------
* Function: H5Fset_mpi_atomicity
@@ -269,9 +240,10 @@ done:
herr_t
H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
{
- H5VL_object_t *vol_obj = NULL;
- int va_flag = (int)flag; /* C is grumpy about passing hbool_t via va_arg */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "ib", file_id, flag);
@@ -280,9 +252,13 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
+ /* Set up VOL callback arguments */
+ file_opt_args.set_mpi_atomicity.flag = flag;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MPI_ATOMICITY;
+ vol_cb_args.args = &file_opt_args;
+
/* Set atomicity value */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, va_flag) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity");
done:
@@ -290,7 +266,7 @@ done:
} /* end H5Fset_mpi_atomicity() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_mpi_atomicity
+ * Function: H5F__get_mpi_atomicity
*
* Purpose: Private call to get the atomicity mode
*
@@ -299,11 +275,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag)
+H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(file);
@@ -320,7 +296,7 @@ H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5F_get_mpi_atomicity() */
+} /* end H5F__get_mpi_atomicity() */
/*-------------------------------------------------------------------------
* Function: H5Fget_mpi_atomicity
@@ -338,8 +314,10 @@ done:
herr_t
H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "ix", file_id, flag);
@@ -348,9 +326,13 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mpi_atomicity.flag = flag;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MPI_ATOMICITY;
+ vol_cb_args.args = &file_opt_args;
+
/* Get atomicity value */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, flag) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity");
done:
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 371260d..b016696 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -33,6 +33,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Bprivate.h" /* B-trees */
+#include "H5FDprivate.h" /* File drivers */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5FSprivate.h" /* File free space */
@@ -404,22 +405,20 @@ H5_DLLVAR htri_t use_locks_env_g;
/* General routines */
H5_DLL herr_t H5F__post_open(H5F_t *f);
-H5_DLL H5F_t * H5F__reopen(H5F_t *f);
-H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
-H5_DLL herr_t H5F__flush(H5F_t *f);
-H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
-H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
-H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
-H5_DLL herr_t H5F__format_convert(H5F_t *f);
-H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
-H5_DLL herr_t H5F__close(H5F_t *f);
-H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
-H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
-H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks);
+H5_DLL H5F_t *H5F__reopen(H5F_t *f);
+H5_DLL herr_t H5F__flush(H5F_t *f);
+H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
+H5_DLL herr_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, size_t *image_len);
+H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
+H5_DLL herr_t H5F__format_convert(H5F_t *f);
+H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
+H5_DLL herr_t H5F__close(H5F_t *f);
+H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
+H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
+H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks);
+H5_DLL herr_t H5F__delete(const char *filename, hid_t fapl_id);
/* File mount related routines */
-H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
-H5_DLL herr_t H5F__unmount(H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5F__close_mounts(H5F_t *f);
H5_DLL herr_t H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
@@ -449,6 +448,12 @@ H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared);
H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf);
H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared);
+/* Parallel I/O (i.e. MPI) related routines */
+#ifdef H5_HAVE_PARALLEL
+H5_DLL herr_t H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag);
+H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag);
+#endif /* H5_HAVE_PARALLEL */
+
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 2779a2b..354226b 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -24,11 +24,9 @@ typedef struct H5F_t H5F_t;
/* Include package's public header */
#include "H5Fpublic.h"
-/* Public headers needed by this file */
-#include "H5FDpublic.h" /* File drivers */
-
/* Private headers needed by this file */
#include "H5MMprivate.h" /* Memory management */
+#include "H5FDprivate.h" /* File drivers */
#ifdef H5_HAVE_PARALLEL
#include "H5Pprivate.h" /* Property lists */
#endif /* H5_HAVE_PARALLEL */
@@ -755,6 +753,7 @@ typedef struct H5F_t H5F_t;
/* Forward declarations (for prototypes & type definitions) */
struct H5B_class_t;
struct H5UC_t;
+struct H5G_loc_t;
struct H5O_loc_t;
struct H5HG_heap_t;
struct H5VL_class_t;
@@ -906,9 +905,12 @@ H5_DLL hbool_t H5F_shared_has_feature(const H5F_shared_t *f, unsigned feature);
H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type);
H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type);
+H5_DLL herr_t H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle);
H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle);
-/* Functions that check file mounting information */
+/* File mounting routines */
+H5_DLL herr_t H5F_mount(const struct H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
+H5_DLL herr_t H5F_unmount(const struct H5G_loc_t *loc, const char *name);
H5_DLL hbool_t H5F_is_mount(const H5F_t *file);
H5_DLL hbool_t H5F_has_mount(const H5F_t *file);
H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc /*in,out*/);
@@ -966,14 +968,11 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f);
/* Parallel I/O (i.e. MPI) related routines */
#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle);
H5_DLL int H5F_mpi_get_rank(const H5F_t *f);
H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f);
H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh);
H5_DLL int H5F_mpi_get_size(const H5F_t *f);
H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm);
-H5_DLL herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag);
-H5_DLL herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag);
#endif /* H5_HAVE_PARALLEL */
/* External file cache routines */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 24fe350..c3230e1 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -47,27 +47,23 @@
* We're assuming that these constants are used rather early in the hdf5
* session.
*/
-#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< absence of rdwr => rd-only */
-#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< open for read and write */
-#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< overwrite existing files */
-#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< fail if file already exists*/
+#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< Absence of RDWR: read-only */
+#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< Open for read and write */
+#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< Overwrite existing files */
+#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< Fail if file already exists*/
/* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */
-#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< create non-existing files */
+#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< Create non-existing files */
#define H5F_ACC_SWMR_WRITE \
- (H5CHECK 0x0020u) /**< indicate that this file is open for writing in a \
- single-writer/multi-reader (SWMR) scenario. \
- Note that the process(es) opening the file for reading must \
- open the file with RDONLY access, and use the special "SWMR_READ" \
- access flag. */
+ (H5CHECK 0x0020u) /**< Indicate that this file is open for writing in a \
+ * single-writer/multi-reader (SWMR) scenario. \
+ * Note that the process(es) opening the file for reading \
+ * must open the file with #H5F_ACC_RDONLY and use the \
+ * #H5F_ACC_SWMR_READ access flag. */
#define H5F_ACC_SWMR_READ \
- (H5CHECK 0x0040u) /**< indicate that this file is \
- * open for reading in a \
- * single-writer/multi-reader (SWMR) \
- * scenario. Note that the \
- * process(es) opening the file \
- * for SWMR reading must also \
- * open the file with the RDONLY \
- * flag. */
+ (H5CHECK 0x0040u) /**< Indicate that this file is open for reading in a \
+ * single-writer/multi-reader (SWMR) scenario. Note that \
+ * the process(es) opening the file for SWMR reading must \
+ * also open the file with the #H5F_ACC_RDONLY flag. */
/**
* Default property list identifier
@@ -88,10 +84,10 @@
(0x0020u) /**< Restrict search to objects opened through current file ID \
(as opposed to objects opened through any file ID accessing this file) */
-#define H5F_FAMILY_DEFAULT (hsize_t)0
+#define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */
#ifdef H5_HAVE_PARALLEL
-/*
+/**
* Use this constant string as the MPI_Info key to set H5Fmpio debug flags.
* To turn on H5Fmpio debug flags, set the MPI_Info value with this key to
* have the value of a string consisting of the characters that turn on the
@@ -101,32 +97,33 @@
#endif /* H5_HAVE_PARALLEL */
/**
- * The difference between a single file and a set of mounted files
+ * The scope of an operation such as H5Fflush(), e.g.,
+ * a single file vs. a set of mounted files
*/
typedef enum H5F_scope_t {
- H5F_SCOPE_LOCAL = 0, /**< specified file handle only */
- H5F_SCOPE_GLOBAL = 1 /**< entire virtual file */
+ H5F_SCOPE_LOCAL = 0, /**< The specified file handle only */
+ H5F_SCOPE_GLOBAL = 1 /**< The entire virtual file */
} H5F_scope_t;
/**
* Unlimited file size for H5Pset_external()
*/
-#define H5F_UNLIMITED ((hsize_t)(-1L))
+#define H5F_UNLIMITED HSIZE_UNDEF
/**
* How does file close behave?
*/
typedef enum H5F_close_degree_t {
- H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlining VFL */
+ H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlying VFD */
H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */
- H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is close; otherwise, file close fails */
+ H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is closed; otherwise, file close fails */
H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */
} H5F_close_degree_t;
/**
* Current "global" information about file
*/
-//! [H5F_info2_t_snip]
+//! <!-- [H5F_info2_t_snip] -->
typedef struct H5F_info2_t {
struct {
unsigned version; /**< Superblock version # */
@@ -144,7 +141,7 @@ typedef struct H5F_info2_t {
H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */
} sohm;
} H5F_info2_t;
-//! [H5F_info2_t_snip]
+//! <!-- [H5F_info2_t_snip] -->
/**
* Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT
@@ -176,12 +173,12 @@ typedef enum H5F_mem_t {
/**
* Free space section information
*/
-//! [H5F_sect_info_t_snip]
+//! <!-- [H5F_sect_info_t_snip] -->
typedef struct H5F_sect_info_t {
haddr_t addr; /**< Address of free space section */
hsize_t size; /**< Size of free space section */
} H5F_sect_info_t;
-//! [H5F_sect_info_t_snip]
+//! <!-- [H5F_sect_info_t_snip] -->
/**
* Library's format versions
@@ -193,7 +190,7 @@ typedef enum H5F_libver_t {
H5F_LIBVER_V110 = 2, /**< Use the latest v110 format for storing objects */
H5F_LIBVER_V112 = 3, /**< Use the latest v112 format for storing objects */
H5F_LIBVER_V114 = 4, /**< Use the latest v114 format for storing objects */
- H5F_LIBVER_NBOUNDS
+ H5F_LIBVER_NBOUNDS /**< Sentinel */
} H5F_libver_t;
#define H5F_LIBVER_LATEST H5F_LIBVER_V114
@@ -201,7 +198,7 @@ typedef enum H5F_libver_t {
/**
* File space handling strategy
*/
-//! [H5F_fspace_strategy_t_snip]
+//! <!-- [H5F_fspace_strategy_t_snip] -->
typedef enum H5F_fspace_strategy_t {
H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file
drivers This is the library default when not set */
@@ -211,7 +208,7 @@ typedef enum H5F_fspace_strategy_t {
H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */
H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */
} H5F_fspace_strategy_t;
-//! [H5F_fspace_strategy_t_snip]
+//! <!-- [H5F_fspace_strategy_t_snip] -->
/**
* File space handling strategy for release 1.10.0
@@ -228,7 +225,7 @@ typedef enum H5F_file_space_type_t {
H5F_FILE_SPACE_NTYPES /**< Sentinel */
} H5F_file_space_type_t;
-//! [H5F_retry_info_t_snip]
+//! <!-- [H5F_retry_info_t_snip] -->
#define H5F_NUM_METADATA_READ_RETRY_TYPES 21
/**
@@ -239,7 +236,7 @@ typedef struct H5F_retry_info_t {
unsigned nbins;
uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES];
} H5F_retry_info_t;
-//! [H5F_retry_info_t_snip]
+//! <!-- [H5F_retry_info_t_snip] -->
/**
* Callback for H5Pset_object_flush_cb() in a file access property list
@@ -277,11 +274,6 @@ extern "C" {
*/
H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
/**
- * \example H5Fcreate.c
- * After creating an HDF5 file with H5Fcreate(), we close it with
- * H5Fclose().
- */
-/**
* \ingroup H5F
*
* \brief Creates an HDF5 file
@@ -321,7 +313,8 @@ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
* this file identifier should be closed by calling H5Fclose() when
* it is no longer needed.
*
- * \include H5Fcreate.c
+ * \par Example
+ * \snippet H5F_examples.c minimal
*
* \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use
* exactly one.
@@ -359,6 +352,11 @@ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id);
*
*/
H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Fcreate}
+ */
H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line,
const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id);
/**
@@ -408,6 +406,9 @@ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigne
* identifier should be closed by calling H5Fclose() when it is no
* longer needed.
*
+ * \par Example
+ * \snippet H5F_examples.c open
+ *
* \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use
* exactly one.
*
@@ -451,6 +452,11 @@ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigne
*
*/
H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Fopen}
+ */
H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line,
const char *filename, unsigned flags, hid_t access_plist, hid_t es_id);
/**
@@ -479,6 +485,11 @@ H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned
*
*/
H5_DLL hid_t H5Freopen(hid_t file_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Freopen}
+ */
H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id,
hid_t es_id);
/**
@@ -503,6 +514,9 @@ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigne
* global or local. Valid values are as follows:
* \scopes
*
+ * \par Example
+ * \snippet H5F_examples.c flush
+ *
* \attention HDF5 does not possess full control over buffering. H5Fflush()
* flushes the internal HDF5 buffers then asks the operating system
* (the OS) to flush the system buffers for the open files. After
@@ -511,13 +525,13 @@ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigne
*
*/
H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
-H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id,
- H5F_scope_t scope, hid_t es_id);
/**
- * \example H5Fclose.c
- * After creating an HDF5 file with H5Fcreate(), we close it with
- * H5Fclose().
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Fflush}
*/
+H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id,
+ H5F_scope_t scope, hid_t es_id);
/**
* \ingroup H5F
*
@@ -534,8 +548,8 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne
* identifier, or shared datatype identifier), the file will be fully
* closed and access will end.
*
- * Use H5Fclose() as shown in the following example:
- * \include H5Fclose.c
+ * \par Example
+ * \snippet H5F_examples.c minimal
*
* \note \Bold{Delayed close:} Note the following deviation from the
* above-described behavior. If H5Fclose() is called for a file but one
@@ -562,6 +576,11 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne
*
*/
H5_DLL herr_t H5Fclose(hid_t file_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Fclose}
+ */
H5_DLL herr_t H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id,
hid_t es_id);
/**
@@ -655,7 +674,7 @@ H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
* \note The function will not return an error if intent is NULL; it will
* simply do nothing.
*
- * \version 1.10.0 C function enhanced to work with SWMR functionality.
+ * \version 1.10.0 Function enhanced to work with SWMR functionality.
*
* \since 1.8.0
*
@@ -707,7 +726,7 @@ H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno);
* \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and
* groups.
*
- * \version 1.6.8, 1.8.2 C function return type changed to \c ssize_t.
+ * \version 1.6.8, 1.8.2 Function return type changed to \c ssize_t.
* \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types
* of objects to be counted. #H5F_OBJ_LOCAL restricts the
* search to objects opened through current file identifier.
@@ -745,9 +764,9 @@ H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
* To retrieve a count of open objects, use the H5Fget_obj_count()
* function. This count can be used to set the \p max_objs parameter.
*
- * \version 1.8.2 C function return type changed to \c ssize_t and \p
+ * \version 1.8.2 Function return type changed to \c ssize_t and \p
* max_objs parameter datatype changed to \c size_t.
- * \version 1.6.8 C function return type changed to \c ssize_t and \p
+ * \version 1.6.8 Function return type changed to \c ssize_t and \p
* max_objs parameter datatype changed to \c size_t.
* \since 1.6.0
*
@@ -798,6 +817,9 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
* attribute, then the file will be mounted at the location where the
* attribute, dataset, or named datatype is attached.
*
+ * \par Example
+ * \snippet H5F_examples.c mount
+ *
* \note To date, no file mount properties have been defined in HDF5. The
* proper value to pass for \p plist is #H5P_DEFAULT, indicating the
* default file mount property list.
@@ -868,8 +890,6 @@ H5_DLL hssize_t H5Fget_freespace(hid_t file_id);
* if any, the HDF5 portion of the file, and any data that may have
* been appended beyond the data written through the HDF5 library.
*
- * \version 1.6.3 Fortran subroutine introduced in this release.
- *
* \since 1.6.3
*
*/
@@ -948,9 +968,7 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
*
* \note \Bold{Recommended Reading:} This function is part of the file image
* operations feature set. It is highly recommended to study the guide
- * "HDF5 File Image Operations" before using this feature set.\n See the
- * "See Also" section below for links to other elements of HDF5 file
- * image operations. \todo Fix the references.
+ * \ref_file_image_ops before using this feature set.
*
* \attention H5Pget_file_image() will fail, returning a negative value, if the
* file is too large for the supplied buffer.
@@ -958,8 +976,6 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
* \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(),
* H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks()
*
- * \version 1.8.13 Fortran subroutine added in this release.
- *
* \since 1.8.0
*
*/
@@ -976,197 +992,18 @@ H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len);
* \ref H5AC-cache-config-t "here".
* \return \herr_t
*
+ * \note The \c in direction applies only to the H5AC_cache_config_t::version
+ * field. All other fields are out parameters.
+ *
* \details H5Fget_mdc_config() loads the current metadata cache configuration
* into the instance of H5AC_cache_config_t pointed to by the \p config_ptr
- * parameter.
- *
- * Note that the \c version field of \p config_ptr must be initialized
- * --this allows the library to support old versions of the H5AC_cache_config_t
- * structure.
- *
- * \par General configuration section
- * <table>
- * <tr>
- * <td><em>int</em> <code>version</code> </td>
- * <td>IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This field should
- * be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined in H5ACpublic.h).</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>rpt_fcn_enabled</code> </td>
- * <td><p>OUT: Boolean flag indicating whether the adaptive cache resize report function is enabled. This
- * field should almost always be set to disabled (<code>0</code>). Since resize algorithm activity is
- * reported via stdout, it MUST be set to disabled (<code>0</code>) on Windows machines.</p><p>The
- * report function is not supported code, and can be expected to change between versions of the
- * library. Use it at your own risk.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>open_trace_file</code> </td>
- * <td>OUT: Boolean field indicating whether the <code>trace_file_name</code> field should be used to
- * open a trace file for the cache. This field will always be set to <code>0</code> in this
- * context.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>close_trace_file</code> </td>
- * <td>OUT: Boolean field indicating whether the current trace file (if any) should be closed. This field
- * will always be set to <code>0</code> in this context.</td></tr>
- * <tr>
- * <td><em>char*</em><code>trace_file_name</code> </td>
- * <td>OUT: Full path name of the trace file to be opened if the <code>open_trace_file</code> field is
- * set to <code>1</code>. This field will always be set to the empty string in this context.</td></tr>
- * <tr>
- * <td><em>hbool_t</em> <code>evictions_enabled</code> </td>
- * <td>OUT: Boolean flag indicating whether metadata cache entry evictions are
- * enabled.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>set_initial_size</code> </td>
- * <td>OUT: Boolean flag indicating whether the cache should be created with a user specified initial
- * maximum size.<p>If the configuration is loaded from the cache, this flag will always be set
- * to <code>0</code>.</p></td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>initial_size</code> </td>
- * <td>OUT: Initial maximum size of the cache in bytes, if applicable.<p>If the configuration is loaded
- * from the cache, this field will contain the cache maximum size as of the time of the
- * call.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>min_clean_fraction</code> </td>
- * <td>OUT: Float value specifying the minimum fraction of the cache that must be kept either clean or
- * empty when possible.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>max_size</code> </td>
- * <td>OUT: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select
- * as the maximum cache size.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>min_size</code> </td>
- * <td>OUT: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select
- * as the maximum cache size.</td>
- * </tr>
- * <tr>
- * <td><em>long int</em> <code>epoch_length</code> </td>
- * <td>OUT: Number of cache accesses between runs of the adaptive cache resize
- * code.</td>
- * </tr>
- * </table>
- *
- * \par Increment configuration section
- * <table>
- * <tr>
- * <td><em>enum H5C_cache_incr_mode</em> <code>incr_mode</code> </td>
- * <td>OUT: Enumerated value indicating the operational mode of the automatic cache size increase code.
- * At present, only the following values are legal:<p>\c H5C_incr__off: Automatic cache size increase
- * is disabled.</p><p>\c H5C_incr__threshold: Automatic cache size increase is enabled using the hit
- * rate threshold algorithm.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>lower_hr_threshold</code> </td>
- * <td>OUT: Hit rate threshold used in the hit rate threshold cache size increase algorithm.</td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>increment</code> </td>
- * <td>OUT: The factor by which the current maximum cache size is multiplied to obtain an initial new
- * maximum cache size if a size increase is triggered in the hit rate threshold cache size increase
- * algorithm.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_max_increment</code> </td>
- * <td>OUT: Boolean flag indicating whether an upper limit will be applied to the size of cache size
- * increases.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>max_increment</code> </td>
- * <td>OUT: The maximum number of bytes by which the maximum cache size can be increased in a single step
- * -- if applicable.</td>
- * </tr>
- * <tr>
- * <td><em>enum H5C_cache_flash_incr_mode</em> <code>flash_incr_mode</code> </td>
- * <td>OUT: Enumerated value indicating the operational mode of the flash cache size increase code. At
- * present, only the following values are legal:<p>\c H5C_flash_incr__off: Flash cache size increase is
- * disabled.</p><p>\c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add
- * space algorithm.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>flash_threshold</code> </td>
- * <td>OUT: The factor by which the current maximum cache size is multiplied to obtain the minimum size
- * entry / entry size increase which may trigger a flash cache size
- * increase.</td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>flash_multiple</code> </td>
- * <td>OUT: The factor by which the size of the triggering entry / entry size increase is multiplied to
- * obtain the initial cache size increment. This increment may be reduced to reflect existing free
- * space in the cache and the <code>max_size</code> field above.</td>
- * </tr>
- * </table>
- *
- * \par Decrement configuration section
- * <table>
- * <tr><td colspan="2"><strong>Decrement configuration
- * section:</strong></td>
- * </tr>
- * <tr>
- * <td><em>enum H5C_cache_decr_mode</em> <code>decr_mode</code> </td>
- * <td>OUT: Enumerated value indicating the operational mode of the automatic cache size decrease code.
- * At present, the following values are legal:<p>H5C_decr__off: Automatic cache size decrease is
- * disabled, and the remaining decrement fields are ignored.</p><p>H5C_decr__threshold: Automatic
- * cache size decrease is enabled using the hit rate threshold algorithm.</p><p>H5C_decr__age_out:
- * Automatic cache size decrease is enabled using the ageout algorithm.</p>
- * <p>H5C_decr__age_out_with_threshold: Automatic cache size decrease is enabled using the ageout
- * with hit rate threshold algorithm</p></td>
- * </tr>
- * <tr><td><em>double</em> <code>upper_hr_threshold</code> </td>
- * <td>OUT: Upper hit rate threshold. This value is only used if the decr_mode is either
- * H5C_decr__threshold or H5C_decr__age_out_with_threshold.</td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>decrement</code> </td>
- * <td>OUT: Factor by which the current max cache size is multiplied to obtain an initial value for the
- * new cache size when cache size reduction is triggered in the hit rate threshold cache size reduction
- * algorithm.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_max_decrement</code> </td>
- * <td>OUT: Boolean flag indicating whether an upper limit should be applied to the size of cache size
- * decreases.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>max_decrement</code> </td>
- * <td>OUT: The maximum number of bytes by which cache size can be decreased if any single step, if
- * applicable.</td>
- * </tr>
- * <tr>
- * <td><em>int</em> <code>epochs_before_eviction</code> </td>
- * <td>OUT: The minimum number of epochs that an entry must reside unaccessed in cache before being
- * evicted under either of the ageout cache size reduction algorithms.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_empty_reserve</code> </td>
- * <td>OUT: Boolean flag indicating whether an empty reserve should be maintained under either of the
- * ageout cache size reduction algorithms.</td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>empty_reserve</code> </td>
- * <td>OUT: Empty reserve for use with the ageout cache size reduction algorithms, if applicable.</td>
- * </tr>
- * </table>
- *
- * \par Parallel configuration section
- * <table>
- * <tr><td><em>int</em> <code>dirty_bytes_threshold</code> </td>
- * <td>OUT: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the
- * metadata caches serving the target file in the parallel case.<p>Synchronization occurs whenever the
- * number of bytes of dirty metadata created since the last synchronization exceeds this
- * limit.</p></td>
- * </tr>
- * </table>
+ * parameter.\n
+ * The fields of the H5AC_cache_config_t structure are shown below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
*
* \since 1.8.0
*
- * \todo Fix the reference!
- *
*/
H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
/**
@@ -1183,242 +1020,13 @@ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
*
* \details H5Fset_mdc_config() attempts to configure the file's metadata cache
* according configuration supplied in \p config_ptr.
- *
- * \par General configuration fields
- * <table>
- * <tr>
- * <td><em>int</em> <code>version</code></td>
- * <td>IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This
- * field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined
- * in H5ACpublic.h).</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>rpt_fcn_enabled</code></td>
- * <td>IN: Boolean flag indicating whether the adaptive cache resize report function is enabled. This
- * field should almost always be set to disabled (<code>0</code>). Since resize algorithm activity is
- * reported via stdout, it MUST be set to disabled (<code>0</code>) on Windows machines.<p>The report
- * function is not supported code, and can be expected to change between versions of the library. Use
- * it at your own risk.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>open_trace_File</code></td>
- * <td>IN: Boolean field indicating whether the <code>trace_file_name</code> field should be used to open
- * a trace file for the cache.<p>The trace file is a debuging feature that allows the capture of top
- * level metadata cache requests for purposes of debugging and/or optimization. This field should
- * <p>This field should only normally be set to <code>0</code>, as trace file collection imposes
- * considerable overhead.</p> be set to <code>1</code> when the <code>trace_file_name</code> contains
- * the full path of the desired trace file, and either there is no open trace file on the cache, or the
- * <code>close_trace_file</code> field is also <code>1</code>.</p><p>The trace file feature is
- * unsupported unless used at the direction of The HDF Group. It is intended to allow The HDF Group to
- * collect a trace of cache activity in cases of occult failures and/or poor performance seen in the
- * field, so as to aid in reproduction in the lab. If you use it absent the direction of The HDF Group,
- * you are on your own.</p></td>
- * </tr>
- * <tr><td><em>hbool_t</em> <code>close_trace_file</code></td>
- * <td>IN: Boolean field indicating whether the current trace file (if any) should be closed.<p>See the
- * above comments on the <code>open_trace_file</code> field. This field should be set to
- * <code>0</code> unless there is an open trace file on the cache that you wish to close.</p><p>The
- * trace file feature is unsupported unless used at the direction of The HDF Group. It is intended to
- * allow The HDF Group to collect a trace of cache activity in cases of occult failures and/or poor
- * performance seen in the field, so as to aid in reproduction in the lab. If you use it absent the
- * direction of The HDF Group, you are on your own.</p></td>
- * </tr>
- * <tr>
- * <td><em>char</em> <code>trace_file_name[]</code></td>
- * <td>IN: Full path of the trace file to be opened if the <code>open_trace_file</code> field is set
- * to <code>1</code>.<p>In the parallel case, an ascii representation of the mpi rank of the process
- * will be appended to the file name to yield a unique trace file name for each process.</p><p>The
- * length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN characters.</p><p>The trace file
- * feature is unsupported unless used at the direction of The HDF Group. It is intended to allow The
- * HDF Group to collect a trace of cache activity in cases of occult failures and/or poor performance
- * seen in the field, so as to aid in reproduction in the lab. If you use it absent the direction of
- * The HDF Group, you are on your own.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>evictions_enabled</code></td>
- * <td>IN: A boolean flag indicating whether evictions from the metadata cache are enabled. This flag is
- * initially set to enabled (<code>1</code>).<p>In rare circumstances, the raw data throughput
- * requirements may be so high that the user wishes to postpone metadata writes so as to reserve I/O
- * throughput for raw data. The <code>evictions_enabled</code> field exists to allow this. However,
- * this is an extreme step, and you have no business doing it unless you have read the User Guide
- * section on metadata caching, and have considered all other options carefully.</p><p>The
- * <code>evictions_enabled</code> field may not be set to disabled (<code>0</code>) unless all adaptive
- * cache resizing code is disabled via the <code>incr_mode</code>, <code>flash_incr_mode</code>, and
- * <code>decr_mode</code> fields.</p><p>When this flag is set to disabled (<code>0</code>), the
- * metadata cache will not attempt to evict entries to make space for new entries, and thus will grow
- * without bound.</p><p>Evictions will be re-enabled when this field is set back to <code>1</code>.
- * This should be done as soon as possible.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>set_initial_size</code></td>
- * <td>IN: Boolean flag indicating whether the cache should be forced to the user specified initial
- * size.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>initial_size</code></td>
- * <td>IN: If <code>set_initial_size</code> is set to <code>1</code>, then <code>initial_size</code> must
- * contain the desired initial size in bytes. This value must lie in the closed interval
- * <code>[min_size, max_size]</code>. (see below)</td>
- * </tr>
- * <tr><td><em>double</em> <code>min_clean_fraction</code></td>
- * <td>IN: This field specifies the minimum fraction of the cache that must be kept either clean or
- * empty.<p>The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to start in the serial
- * case. In the parallel case, a larger value is needed -- see <a
- * href="/display/HDF5/Metadata+Caching+in+HDF5">Metadata Caching in HDF5</a> in the collection
- * "Advanced Topics in HDF5."</p></td>
- * </tr>
- * <tr><td><em>size_t</em> <code>max_size</code></td>
- * <td>IN: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select
- * as the maximum cache size.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>min_size</code></td>
- * <td>IN: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select
- * as the maximum cache size.</td>
- * </tr>
- * <tr><td><em>long int</em> <code>epoch_length</code></td>
- * <td>IN: Number of cache accesses between runs of the adaptive cache resize code. 50,000 is a good
- * starting number.</td>
- * </tr>
- * </table>
- *
- * \par Increment configuration fields
- * <table>
- * <tr>
- * <td><em>enum H5C_cache_incr_mode</em> <code>incr_mode</code></td>
- * <td>IN: Enumerated value indicating the operational mode of the automatic cache size increase code. At
- * present, only two values are legal:<p>\c H5C_incr__off: Automatic cache size increase is disabled,
- * and the remaining increment fields are ignored.</p><p>\c H5C_incr__threshold: Automatic cache size
- * increase is enabled using the hit rate threshold algorithm.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>lower_hr_threshold</code></td>
- * <td>IN: Hit rate threshold used by the hit rate threshold cache size increment algorithm.<p>When the
- * hit rate over an epoch is below this threshold and the cache is full, the maximum size of the
- * cache is multiplied by increment (below), and then clipped as necessary to stay within max_size, and
- * possibly max_increment.</p><p>This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good
- * starting point.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>increment</code></td>
- * <td>IN: Factor by which the hit rate threshold cache size increment algorithm multiplies the current
- * maximum cache size to obtain a tentative new cache size.<p>The actual cache size increase will be
- * clipped to satisfy the max_size specified in the general configuration, and possibly max_increment
- * below.</p><p>The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable
- * value.</p><p>If you set it to 1.0, you will effectively disable cache size increases.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_max_increment</code></td>
- * <td>IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size
- * increases.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>max_increment</code></td>
- * <td>IN: Maximum number of bytes by which cache size can be increased in a single step -- if
- * applicable.</td>
- * </tr>
- * <tr>
- * <td><em>enum H5C_cache_flash_incr_mode</em> <code>flash_incr_mode</code></td>
- * <td>IN: Enumerated value indicating the operational mode of the flash cache size increase code. At
- * present, only the following values are legal:<p>\c H5C_flash_incr__off: Flash cache size increase is
- * disabled.</p><p>\c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add
- * space algorithm.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>flash_threshold</code></td>
- * <td>IN: The factor by which the current maximum cache size is multiplied to obtain the minimum size
- * entry / entry size increase which may trigger a flash cache size increase.<p>At present, this value
- * must lie in the range [0.1, 1.0].</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>flash_multiple</code></td>
- * <td>IN: The factor by which the size of the triggering entry / entry size increase is multiplied to
- * obtain the initial cache size increment. This increment may be reduced to reflect existing free
- * space in the cache and the <code>max_size</code> field above.<p>At present, this field must lie in
- * the range [0.1, 10.0].</p></td>
- * </tr>
- * </table>
- *
- * \par Decrement configuration fields
- * <table>
- * <tr>
- * <td><em>enum H5C_cache_decr_mode</em> <code>decr_mode</code></td>
- * <td>IN: Enumerated value indicating the operational mode of the automatic cache size decrease code. At
- * present, the following values are legal:<p>\c H5C_decr__off: Automatic cache size decrease is
- * disabled.</p><p>\c H5C_decr__threshold: Automatic cache size decrease is enabled using the hit
- * rate threshold algorithm.</p><p>\c H5C_decr__age_out: Automatic cache size decrease is enabled using
- * the ageout algorithm.</p><p>\c H5C_decr__age_out_with_threshold: Automatic cache size decrease is
- * enabled using the ageout with hit rate threshold algorithm</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>upper_hr_threshold</code></td>
- * <td>IN: Hit rate threshold for the hit rate threshold and ageout with hit rate threshold cache size
- * decrement algorithms.<p>When \c decr_mode is \c H5C_decr__threshold, and the hit rate over a given
- * epoch exceeds the supplied threshold, the current maximum cache size is multiplied by decrement to
- * obtain a tentative new (and smaller) maximum cache size.</p><p>When \c decr_mode is \c
- * H5C_decr__age_out_with_threshold, there is no attempt to find and evict aged out entries unless the
- * hit rate in the previous epoch exceeded the supplied threshold.</p><p>This field must lie in the
- * interval [0.0, 1.0].</p><p>For \c H5C_incr__threshold, .9995 or .99995 is a good place to
- * start.</p><p>For \c H5C_decr__age_out_with_threshold, .999 might be more useful.</p></td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>decrement</code></td>
- * <td>IN: In the hit rate threshold cache size decrease algorithm, this parameter contains the factor by
- * which the current max cache size is multiplied to produce a tentative new cache size.<p>The actual
- * cache size decrease will be clipped to satisfy the min_size specified in the general configuration,
- * and possibly max_decrement below.</p><p>The parameter must be be in the interval
- * [0.0, 1.0].</p><p>If you set it to 1.0, you will effectively disable cache size decreases. 0.9 is a
- * reasonable starting point.</p></td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_max_decrement</code></td>
- * <td>IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size
- * decreases.</td>
- * </tr>
- * <tr>
- * <td><em>size_t</em> <code>max_decrement</code></td>
- * <td>IN: Maximum number of bytes by which the maximum cache size can be decreased in any single step --
- * if applicable.</td>
- * </tr>
- * <tr>
- * <td><em>int</em> <code>epochs_before_eviction</code></td>
- * <td>IN: In the ageout based cache size reduction algorithms, this field contains the minimum number of
- * epochs an entry must remain unaccessed in cache before the cache size reduction algorithm tries to
- * evict it. 3 is a reasonable value.</td>
- * </tr>
- * <tr>
- * <td><em>hbool_t</em> <code>apply_empty_reserve</code></td>
- * <td>IN: Boolean flag indicating whether the ageout based decrement algorithms will maintain a empty
- * reserve when decreasing cache size.</td>
- * </tr>
- * <tr>
- * <td><em>double</em> <code>empty_reserve</code></td>
- * <td>IN: Empty reserve as a fraction of maximum cache size if applicable.<p>When so directed, the
- * ageout based algorithms will not decrease the maximum cache size unless the empty reserve can be
- * met.</p><p>The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to
- * start.</p></td>
- * </tr>
- * </table>
- *
- * \par Parallel configuration fields
- * <table>
- * <tr>
- * <td><em>int</em> <code>dirty_bytes_threshold</code></td>
- * <td>IN: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the
- * metadata caches serving the target file in the parallel case.<p>Synchronization occurs whenever the
- * number of bytes of dirty metadata created since the last synchronization exceeds this
- * limit.</p><p>This field only applies to the parallel case. While it is ignored elsewhere, it can
- * still draw a value out of bounds error.</p><p>It must be consistant across all caches on any given
- * file.</p><p>By default, this field is set to 256 KB. It shouldn't be more than half the current
- * maximum cache size times the minimum clean fraction.</p></td>
- * </tr>
- * </table>
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
*
* \since 1.8.0
*
- * \todo Fix the MDC document reference!
*/
-H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr);
/**
* \ingroup MDC
*
@@ -1495,13 +1103,12 @@ H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_c
* is enabled. However, the call should be useful if you choose to control metadata cache size from your
* program.
*
- * See "Metadata Caching in HDF5" for details about the metadata cache and the adaptive cache resizing
+ * See \ref_mdc_in_hdf5 for details about the metadata cache and the adaptive cache resizing
* algorithms. If you have not read, understood, and thought about the material covered in that
* documentation,
* you should not be using this API call.
* \endparblock
*
- * \todo Fix the MDC document reference!
*/
H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id);
/**
@@ -1797,6 +1404,9 @@ H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
* For the parameters \p low and \p high, see the description for
* H5Pset_libver_bounds().
*
+ * \par Example
+ * \snippet H5F_examples.c libver_bounds
+ *
* \since 1.10.2
*
*/
@@ -1835,7 +1445,7 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t
* list, and H5Fget_mdc_logging_status() will return the current state of
* the logging flags.
*
- * The log format is described in the \Emph{Metadata Cache Logging} document.
+ * The log format is described in the \ref_mdc_logging document.
*
* \note Logging can only be started or stopped if metadata cache logging was enabled
* via H5Pset_mdc_log_options().\n
@@ -1849,8 +1459,6 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t
*
* \since 1.10.0
*
- * \todo Fix the document reference!
- *
*/
H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
/**
@@ -1887,7 +1495,7 @@ H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
* list, and H5Fget_mdc_logging_status() will return the current state of
* the logging flags.
*
- * The log format is described in the \Emph{Metadata Cache Logging} document.
+ * The log format is described in the \ref_mdc_logging document.
*
* \note Logging can only be started or stopped if metadata cache logging was enabled
* via H5Pset_mdc_log_options().\n
@@ -1933,7 +1541,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
* list, and H5Fget_mdc_logging_status() will return the current state of
* the logging flags.
*
- * The log format is described in the \Emph{Metadata Cache Logging} document.
+ * The log format is described in the \ref_mdc_logging document.
*
* \note Unlike H5Fstart_mdc_logging() and H5Fstop_mdc_logging(), this function can
* be called on any open file identifier.
@@ -1944,7 +1552,7 @@ H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hboo
/**
* \ingroup SWMR
*
- * \todo Finish this!
+ * \todo UFO?
*/
H5_DLL herr_t H5Fformat_convert(hid_t fid);
/**
@@ -1998,7 +1606,7 @@ H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], u
* \brief Obtains information about a cache image if it exists
*
* \file_id
- * \param[out] image_addr Offset of the cache image if it exists, or #HADDR_UNDEF if it does not
+ * \param[out] image_addr Offset of the cache image if it exists, or \c HADDR_UNDEF if it does not
* \param[out] image_size Length of the cache image if it exists, or 0 if it does not
* \returns \herr_t
*
@@ -2077,7 +1685,6 @@ H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize);
*
*/
H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize);
-H5_DLL herr_t H5Fwait(hid_t file_id);
#ifdef H5_HAVE_PARALLEL
/**
@@ -2139,11 +1746,10 @@ H5_DLL herr_t H5Fwait(hid_t file_id);
* the desired behavior.
* \endparblock
*
- * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5
+ * \see \ref_cons_semantics
*
* \since 1.8.9
*
- * \todo Fix the reference!
*/
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
/**
@@ -2163,15 +1769,15 @@ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
* Upon successful return, \p flag will be set to \c 1 if file access is set
* to atomic mode and \c 0 if file access is set to nonatomic mode.
*
- * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5
+ * \see \ref_cons_semantics
*
* \since 1.8.9
*
- * \todo Fix the reference!
*/
H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#endif /* H5_HAVE_PARALLEL */
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -2191,6 +1797,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#define H5Fflush_async_wrap H5_NO_EXPAND(H5Fflush_async)
#define H5Fclose_async_wrap H5_NO_EXPAND(H5Fclose_async)
#endif /* H5F_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -2199,14 +1806,14 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Macros */
-#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/
+#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /**< Print debug info \deprecated In which version? */
/* Typedefs */
/**
* Current "global" information about file
*/
-//! [H5F_info1_t_snip]
+//! <!-- [H5F_info1_t_snip] -->
typedef struct H5F_info1_t {
hsize_t super_ext_size; /**< Superblock extension size */
struct {
@@ -2214,7 +1821,7 @@ typedef struct H5F_info1_t {
H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */
} sohm;
} H5F_info1_t;
-//! [H5F_info1_t_snip]
+//! <!-- [H5F_info1_t_snip] -->
/* Function prototypes */
/**
@@ -2252,7 +1859,7 @@ typedef struct H5F_info1_t {
* header indexes. Each index might be either a B-tree or
* a list.
*
- * \version 1.10.0 C function H5Fget_info() renamed to H5Fget_info1() and
+ * \version 1.10.0 Function H5Fget_info() renamed to H5Fget_info1() and
* deprecated in this release.
*
* \since 1.8.0
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 04792b4..a625897 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -950,6 +950,29 @@ done:
} /* end H5F_get_eoa() */
/*-------------------------------------------------------------------------
+ * Function: H5F_shared_get_file_driver
+ *
+ * Purpose: Returns a pointer to the file driver structure of the
+ * file's 'shared' structure.
+ *
+ * Return: file handle on success/abort on failure (shouldn't fail)
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f_sh);
+ HDassert(file_handle);
+
+ *file_handle = f_sh->lf;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5F_shared_get_file_driver() */
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_vfd_handle
*
* Purpose: Returns a pointer to the file handle of the low-level file
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 3001644..4df0064 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -377,7 +377,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read)
/* Try detecting file's siganture */
/* (Don't leave before Bcast, to avoid hang on error) */
- H5E_BEGIN_TRY { status = H5FD_locate_signature(file, &super_addr); }
+ H5E_BEGIN_TRY
+ {
+ status = H5FD_locate_signature(file, &super_addr);
+ }
H5E_END_TRY;
/* Set superblock address to undefined on error */
@@ -1040,7 +1043,7 @@ done:
HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info")
/* Evict the driver info block from the cache */
- if (H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0)
+ if (sblock && H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block")
} /* end if */
diff --git a/src/H5G.c b/src/H5G.c
index 0163d65..deaf792 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -271,7 +271,7 @@ H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) {
+ H5ARG_TRACE9(__func__, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID")
@@ -475,7 +475,7 @@ H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID")
@@ -502,8 +502,9 @@ done:
hid_t
H5Gget_create_plist(hid_t group_id)
{
- H5VL_object_t *vol_obj = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", group_id);
@@ -512,11 +513,17 @@ H5Gget_create_plist(hid_t group_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_GCPL;
+ vol_cb_args.args.get_gcpl.gcpl_id = H5I_INVALID_HID;
+
/* Get the group creation property list for the group */
- if (H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) <
- 0)
+ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_gcpl.gcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_create_plist() */
@@ -538,9 +545,9 @@ H5G__get_info_api_common(hid_t loc_id, H5G_info_t *group_info /*out*/, void **to
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -551,13 +558,14 @@ H5G__get_info_api_common(hid_t loc_id, H5G_info_t *group_info /*out*/, void **to
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_self_args(loc_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_self_args(loc_id, vol_obj_ptr, &vol_cb_args.args.get_info.loc_params) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments")
+ vol_cb_args.args.get_info.ginfo = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -622,7 +630,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line,
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE6(FUNC, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0)
+ H5ARG_TRACE6(__func__, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -647,8 +655,8 @@ H5G__get_info_by_name_api_common(hid_t loc_id, const char *name, H5G_info_t *gro
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -656,13 +664,15 @@ H5G__get_info_by_name_api_common(hid_t loc_id, const char *name, H5G_info_t *gro
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr,
+ &vol_cb_args.args.get_info.loc_params) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments")
+ vol_cb_args.args.get_info.ginfo = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -728,7 +738,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE8(FUNC, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0)
+ H5ARG_TRACE8(__func__, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -754,8 +764,8 @@ H5G__get_info_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -763,14 +773,15 @@ H5G__get_info_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr,
+ &vol_cb_args.args.get_info.loc_params) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments")
+ vol_cb_args.args.get_info.ginfo = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -841,7 +852,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0)
+ H5ARG_TRACE11(__func__, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -931,7 +942,7 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -957,8 +968,9 @@ done:
herr_t
H5Gflush(hid_t group_id)
{
- H5VL_object_t *vol_obj; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
@@ -971,9 +983,12 @@ H5Gflush(hid_t group_id)
if (H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_FLUSH;
+ vol_cb_args.args.flush.grp_id = group_id;
+
/* Flush group's metadata to file */
- if (H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) <
- 0)
+ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
@@ -995,8 +1010,9 @@ done:
herr_t
H5Grefresh(hid_t group_id)
{
- H5VL_object_t *vol_obj; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
@@ -1009,9 +1025,12 @@ H5Grefresh(hid_t group_id)
if (H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_REFRESH;
+ vol_cb_args.args.refresh.grp_id = group_id;
+
/* Refresh group's metadata */
- if (H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- group_id) < 0)
+ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index eac7545..4713193 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -176,7 +176,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* magic */
- if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index a621f6e..0c0b5db 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -200,20 +200,20 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sep 6, 2005
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size)
+ H5_iter_order_t order, hsize_t idx, char *name, size_t name_size,
+ size_t *name_len)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -229,13 +229,13 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(ltable.lnks[idx].name);
+ *name_len = HDstrlen(ltable.lnks[idx].name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, ltable.lnks[idx].name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
done:
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index ec5cb71..753936b 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -169,7 +169,7 @@ typedef struct {
size_t name_size; /* Size of name buffer to fill */
/* upward */
- ssize_t name_len; /* Full length of name */
+ size_t name_len; /* Full length of name */
} H5G_bt2_ud_gnbi_t;
/*
@@ -185,7 +185,7 @@ typedef struct {
size_t name_size; /* Size of name buffer to fill */
/* upward */
- ssize_t name_len; /* Full length of name */
+ size_t name_len; /* Full length of name */
} H5G_fh_ud_gnbi_t;
/*
@@ -1046,12 +1046,12 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Get the length of the name */
- udata->name_len = (ssize_t)HDstrlen(lnk->name);
+ udata->name_len = HDstrlen(lnk->name);
/* Copy the name into the user's buffer, if given */
if (udata->name) {
- HDstrncpy(udata->name, lnk->name, MIN((size_t)(udata->name_len + 1), udata->name_size));
- if ((size_t)udata->name_len >= udata->name_size)
+ HDstrncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size));
+ if (udata->name_len >= udata->name_size)
udata->name[udata->name_size - 1] = '\0';
} /* end if */
@@ -1106,23 +1106,22 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sep 19 2006
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, char *name, size_t size)
+ hsize_t n, char *name, size_t name_size, size_t *name_len)
{
- H5HF_t * fheap = NULL; /* Fractal heap handle */
- H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
- haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
- ssize_t ret_value = -1; /* Return value */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5G_link_table_t ltable = {0, NULL}; /* Table of links */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1176,14 +1175,14 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
udata.f = f;
udata.fheap = fheap;
udata.name = name;
- udata.name_size = size;
+ udata.name_size = name_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)
HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
/* Set return value */
- ret_value = udata.name_len;
+ *name_len = udata.name_len;
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
/* Build the table of links for this group */
@@ -1195,13 +1194,13 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(ltable.lnks[n].name);
+ *name_len = HDstrlen(ltable.lnks[n].name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, ltable.lnks[n].name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
} /* end else */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index c73bfd7..7c0404f 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -141,10 +141,10 @@ H5G_map_obj_type(H5O_type_t obj_type)
* specified NAME. The group is opened for write access
* and it's object ID is returned.
*
- * The optional SIZE_HINT specifies how much file space to
- * reserve to store the names that will appear in this
- * group. If a non-positive value is supplied for the SIZE_HINT
- * then a default size is chosen.
+ * The SIZE_HINT parameter specifies how much file space to reserve
+ * to store the names that will appear in this group. This number
+ * must be less than or equal to UINT32_MAX. If zero is supplied
+ * for the SIZE_HINT then a default size is chosen.
*
* Note: Deprecated in favor of H5Gcreate2
*
@@ -174,6 +174,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
+ if (size_hint > UINT32_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX")
/* Check if we need to create a non-standard GCPL */
if (size_hint > 0) {
@@ -306,7 +308,8 @@ done:
herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iLl*s*s", cur_loc_id, type, cur_name, new_name);
@@ -324,20 +327,15 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create link */
if (type == H5L_TYPE_HARD) {
H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
+ H5VL_loc_params_t new_loc_params;
H5VL_object_t tmp_vol_obj; /* Temporary object */
- loc_params1.type = H5VL_OBJECT_BY_NAME;
- loc_params1.obj_type = H5I_get_type(cur_loc_id);
- loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Set up new location struct */
+ new_loc_params.type = H5VL_OBJECT_BY_NAME;
+ new_loc_params.loc_data.loc_by_name.name = new_name;
+ new_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
-
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -345,16 +343,24 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
tmp_vol_obj.data = NULL;
tmp_vol_obj.connector = vol_obj->connector;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = vol_obj->data;
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(cur_loc_id);
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.name = cur_name;
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- vol_obj->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if (type == H5L_TYPE_SOFT) {
H5VL_object_t * vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = new_name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
@@ -364,10 +370,13 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = cur_name;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- cur_name) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -388,7 +397,8 @@ done:
herr_t
H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sLli*s", cur_loc_id, cur_name, type, new_loc_id, new_name);
@@ -407,29 +417,31 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (type == H5L_TYPE_HARD) {
H5VL_object_t * vol_obj1; /* Object of loc_id */
H5VL_object_t * vol_obj2; /* Object of loc_id */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
+ H5VL_loc_params_t new_loc_params;
- loc_params1.type = H5VL_OBJECT_BY_NAME;
- loc_params1.obj_type = H5I_get_type(cur_loc_id);
- loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Set up new location struct */
+ new_loc_params.type = H5VL_OBJECT_BY_NAME;
+ new_loc_params.obj_type = H5I_get_type(new_loc_id);
+ new_loc_params.loc_data.loc_by_name.name = new_name;
+ new_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.obj_type = H5I_get_type(new_loc_id);
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
-
- /* get the location object */
+ /* Get the location objects */
if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = vol_obj1->data;
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(cur_loc_id);
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.name = cur_name;
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- vol_obj1->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj2, &new_loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if (type == H5L_TYPE_SOFT) {
@@ -441,6 +453,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (new_loc_id == H5L_SAME_LOC)
new_loc_id = cur_loc_id;
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = new_name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
@@ -450,10 +463,13 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = cur_name;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- cur_name) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -570,9 +586,10 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
@@ -594,9 +611,11 @@ H5Gunlink(hid_t loc_id, const char *name)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
/* Delete the link */
- if (H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -614,9 +633,10 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*szx", loc_id, name, size, buf);
@@ -629,6 +649,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
@@ -638,9 +659,13 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_VAL;
+ vol_cb_args.args.get_val.buf = buf;
+ vol_cb_args.args.get_val.buf_size = size;
+
/* Get the link value */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf,
- size) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -667,9 +692,11 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", loc_id, name, comment);
@@ -691,9 +718,14 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.set_comment.comment = comment;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_SET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Set the comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
@@ -726,10 +758,12 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t op_ret; /* Return value from operation */
- int ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ size_t comment_len = 0; /* Length of comment */
+ int ret_value; /* Return value */
FUNC_ENTER_API(-1)
H5TRACE4("Is", "i*szx", loc_id, name, bufsize, buf);
@@ -753,13 +787,20 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_comment.buf = buf;
+ obj_opt_args.get_comment.buf_size = bufsize;
+ obj_opt_args.get_comment.comment_len = &comment_len;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Get the comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value")
/* Set return value */
- ret_value = (int)op_ret;
+ ret_value = (int)comment_len;
done:
FUNC_LEAVE_API(ret_value)
@@ -792,12 +833,11 @@ done:
herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5G_link_iterate_t lnk_op; /* Link operator */
- hsize_t last_obj; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_group_optional_args_t grp_opt_args; /* Arguments for optional operation */
+ hsize_t last_obj = 0; /* Pointer to index value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*IsGi*x", loc_id, name, idx_p, op, op_data);
@@ -810,30 +850,28 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o
if (!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
- /* Set number of objects looked at to zero */
- last_obj = 0;
- idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p);
-
- /* Build link operator info */
- lnk_op.op_type = H5G_LINK_OP_OLD;
- lnk_op.op_func.op_old = op;
-
- /* Fill out location struct */
- 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 = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier")
+ /* Set up VOL callback arguments */
+ grp_opt_args.iterate_old.loc_params.type = H5VL_OBJECT_BY_NAME;
+ grp_opt_args.iterate_old.loc_params.loc_data.loc_by_name.name = name;
+ grp_opt_args.iterate_old.loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ grp_opt_args.iterate_old.loc_params.obj_type = H5I_get_type(loc_id);
+ grp_opt_args.iterate_old.idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p);
+ grp_opt_args.iterate_old.last_obj = &last_obj;
+ grp_opt_args.iterate_old.op = op;
+ grp_opt_args.iterate_old.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_GROUP_ITERATE_OLD;
+ vol_cb_args.args = &grp_opt_args;
+
/* Call private iteration function, through VOL callback */
- if ((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ if ((ret_value = H5VL_group_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) <
+ 0)
HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
- /* Set the index we stopped at */
+ /* Set value to return */
if (idx_p)
*idx_p = (int)last_obj;
@@ -860,11 +898,11 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5I_type_t id_type; /* Type of ID */
- H5VL_loc_params_t loc_params;
- H5G_info_t grp_info; /* Group information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t id_type; /* Type of ID */
+ H5G_info_t grp_info; /* Group information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", loc_id, num_objs);
@@ -876,17 +914,14 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/)
if (!num_objs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
- /* Fill in location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = id_type;
-
- /* Get group location */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_self_args(loc_id, &vol_obj, &vol_cb_args.args.get_info.loc_params) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments")
+ vol_cb_args.args.get_info.ginfo = &grp_info;
/* Retrieve the group's information */
- if (H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- &grp_info) < 0)
+ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
/* Set the number of objects [i.e. links] in the group */
@@ -916,9 +951,10 @@ done:
herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_group_optional_args_t grp_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
@@ -931,20 +967,22 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info");
- /* Retrieve object info */
- /* Fill out location struct */
- 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 = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the location object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Set up VOL callback arguments */
+ grp_opt_args.get_objinfo.loc_params.type = H5VL_OBJECT_BY_NAME;
+ grp_opt_args.get_objinfo.loc_params.loc_data.loc_by_name.name = name;
+ grp_opt_args.get_objinfo.loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ grp_opt_args.get_objinfo.loc_params.obj_type = H5I_get_type(loc_id);
+ grp_opt_args.get_objinfo.follow_link = follow_link;
+ grp_opt_args.get_objinfo.statbuf = statbuf;
+ vol_cb_args.op_type = H5VL_NATIVE_GROUP_GET_OBJINFO;
+ vol_cb_args.args = &grp_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &loc_params, (unsigned)follow_link, statbuf) < 0)
+ if (H5VL_group_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name);
done:
@@ -1087,7 +1125,10 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5
/* Get information about link to the object. If this fails, e.g.
* because the object is ".", just treat the object as a hard link. */
- H5E_BEGIN_TRY { ret = H5L_get_info(loc, name, &linfo); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5L_get_info(loc, name, &linfo);
+ }
H5E_END_TRY;
if (ret >= 0 && linfo.type != H5L_TYPE_HARD) {
@@ -1133,9 +1174,11 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ size_t name_len = 0; /* Length of object name */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ihxz", loc_id, idx, name, size);
@@ -1144,7 +1187,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info")
- /* Fill in location struct fields */
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = ".";
loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
@@ -1157,11 +1200,19 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_NAME;
+ vol_cb_args.args.get_name.name_size = size;
+ vol_cb_args.args.get_name.name = name;
+ vol_cb_args.args.get_name.name_len = &name_len;
+
/* Call internal function */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- name, size, &ret_value) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name")
+ /* Set the return value */
+ ret_value = (ssize_t)name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_objname_by_idx() */
@@ -1184,10 +1235,11 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_info2_t oinfo; /* Object info (contains object type) */
- H5G_obj_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5O_info2_t oinfo; /* Object info (contains object type) */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
@@ -1205,9 +1257,13 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = &oinfo;
+ vol_cb_args.args.get_info.fields = H5O_INFO_BASIC;
+
/* Retrieve the object's basic information (which includes its type) */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
/* Map to group object type */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index b26e308..2f1a2b4 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -384,11 +384,8 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
/* Reset the new entry */
H5G__ent_reset(ent);
- /*
- * Add the new name to the heap.
- */
- name_offset = H5HL_insert(f, heap, HDstrlen(name) + 1, name);
- if (0 == name_offset || UFAIL == name_offset)
+ /* Add the new name to the heap */
+ if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap")
ent->name_off = name_offset;
@@ -476,14 +473,12 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
size_t lnk_offset; /* Offset to sym-link value */
/* Insert link value into local heap */
- if (UFAIL ==
- (lnk_offset = H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name)))
+ if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap")
ent->type = H5G_CACHED_SLINK;
ent->cache.slink.lval_offset = lnk_offset;
- } /* end case */
- break;
+ } break;
case H5L_TYPE_ERROR:
case H5L_TYPE_EXTERNAL:
diff --git a/src/H5Gint.c b/src/H5Gint.c
index dab7a54..90a2c6b 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -38,6 +38,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
+#include "H5SLprivate.h" /* Skip lists */
/****************/
/* Local Macros */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 7d08b54..2844c66 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -53,12 +53,6 @@ typedef struct {
H5G_loc_t *loc; /* Group location to set */
} H5G_loc_fnd_t;
-/* User data for checking if an object exists */
-typedef struct {
- /* upward */
- htri_t exists; /* Whether the object exists */
-} H5G_loc_exists_t;
-
/* User data for looking up an object in a group by index */
typedef struct {
/* downward */
@@ -103,7 +97,7 @@ typedef struct {
size_t bufsize; /* Size of object comment buffer */
/* upward */
- ssize_t comment_size; /* Actual size of object comment */
+ size_t comment_size; /* Actual size of object comment */
} H5G_loc_gc_t;
/********************/
@@ -616,24 +610,26 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_
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 */
+ hbool_t *exists = (hbool_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Check if the name in this group resolved to a valid object */
if (obj_loc == NULL)
if (lnk)
- udata->exists = FALSE;
+ *exists = FALSE;
else
- udata->exists = FAIL;
+ HGOTO_ERROR(H5E_SYM, H5E_INTERNAL, FAIL, "no object or link info?")
else
- udata->exists = TRUE;
+ *exists = TRUE;
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__loc_exists_cb() */
/*-------------------------------------------------------------------------
@@ -649,28 +645,22 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_
*
*-------------------------------------------------------------------------
*/
-htri_t
-H5G_loc_exists(const H5G_loc_t *loc, const char *name)
+herr_t
+H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists)
{
- H5G_loc_exists_t udata; /* User data for traversal callback */
- htri_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args. */
HDassert(loc);
HDassert(name && *name);
-
- /* Set up user data for locating object */
- udata.exists = FALSE;
+ HDassert(exists);
/* 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, exists) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists")
- /* Set return value */
- ret_value = udata.exists;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc_exists() */
@@ -1024,7 +1014,7 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
else {
if (udata->comment && udata->bufsize)
HDstrncpy(udata->comment, comment.s, udata->bufsize);
- udata->comment_size = (ssize_t)HDstrlen(comment.s);
+ udata->comment_size = HDstrlen(comment.s);
H5O_msg_reset(H5O_NAME_ID, &comment);
}
@@ -1043,22 +1033,19 @@ done:
* Purpose: Retrieve the information for an object from a group location
* and path to that object
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
- *
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, August 30, 2007
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/, size_t bufsize)
+herr_t
+H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/, size_t bufsize,
+ size_t *comment_len)
{
- H5G_loc_gc_t udata; /* User data for traversal callback */
- ssize_t ret_value = -1; /* Return value */
+ H5G_loc_gc_t udata; /* User data for traversal callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1069,14 +1056,15 @@ H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*
/* Set up user data for locating object */
udata.comment = comment;
udata.bufsize = bufsize;
- udata.comment_size = (-1);
+ udata.comment_size = 0;
/* Traverse group hierarchy to locate object */
if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_get_comment_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object")
- /* Set the return value */
- ret_value = udata.comment_size;
+ /* Set value to return */
+ if (comment_len)
+ *comment_len = udata.comment_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h
index 219342d..a0e121d 100644
--- a/src/H5Gmodule.h
+++ b/src/H5Gmodule.h
@@ -29,11 +29,117 @@
#define H5_MY_PKG_ERR H5E_SYM
#define H5_MY_PKG_INIT YES
-/**
- * \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.
+/** \defgroup H5G H5G
+ *
+ * Use the functions in this module to manage HDF5 groups.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5G_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5G_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5G_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5G_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \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 2465f01..c139a4e 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -468,11 +468,10 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cached)
+herr_t
+H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name_len, hbool_t *cached)
{
- ssize_t len = 0; /* Length of object's name */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -481,14 +480,20 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
/* If the user path is available and it's not "hidden", use it */
if (loc->path->user_path_r != NULL && loc->path->obj_hidden == 0) {
+ size_t len; /* Length of object's name */
+
len = H5RS_len(loc->path->user_path_r);
if (name) {
- HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((size_t)(len + 1), size));
- if ((size_t)len >= size)
+ HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size));
+ if (len >= size)
name[size - 1] = '\0';
} /* end if */
+ /* Set name length, if requested */
+ if (name_len)
+ *name_len = len;
+
/* Indicate that the name is cached, if requested */
/* (Currently only used for testing - QAK, 2010/07/26) */
if (cached)
@@ -496,7 +501,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
} /* end if */
else if (!loc->path->obj_hidden) {
/* Search for name of object */
- if ((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0)
+ if (H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
/* Indicate that the name is _not_ cached, if requested */
@@ -505,9 +510,6 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
*cached = FALSE;
} /* end else */
- /* Set return value */
- ret_value = len;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_get_name() */
@@ -1152,28 +1154,29 @@ done:
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
+herr_t
+H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, size_t *name_len)
{
- H5G_gnba_iter_t udata; /* User data for iteration */
- H5G_loc_t root_loc; /* Root group's location */
- hbool_t found_obj = FALSE; /* If we found the object */
- herr_t status; /* Status from iteration */
- ssize_t ret_value = -1; /* Return value */
+ H5G_gnba_iter_t udata; /* User data for iteration */
+ size_t len; /* Length of path name */
+ H5G_loc_t root_loc; /* Root group's location */
+ hbool_t found_obj = FALSE; /* If we found the object */
+ herr_t status; /* Status from iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
- FUNC_ENTER_NOAPI((-1))
+ FUNC_ENTER_NOAPI(FAIL)
/* Construct a group location for root group of the file */
if (H5G_root_loc(f, &root_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location")
/* Check for root group being the object looked for */
if (root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) {
if (NULL == (udata.path = H5MM_strdup("")))
- HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string")
found_obj = TRUE;
} /* end if */
else {
@@ -1184,7 +1187,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Visit all the links in the file */
if ((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G__get_name_by_addr_cb,
&udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name")
else if (status > 0)
found_obj = TRUE;
} /* end else */
@@ -1192,7 +1195,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Check for finding the object */
if (found_obj) {
/* Set the length of the full path */
- ret_value = (ssize_t)(HDstrlen(udata.path) + 1); /* Length of path + 1 (for "/") */
+ len = HDstrlen(udata.path) + 1; /* Length of path + 1 (for "/") */
/* If there's a buffer provided, copy into it, up to the limit of its size */
if (name) {
@@ -1202,12 +1205,16 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Append the rest of the path */
/* (less one character, for the initial path separator) */
HDstrncat(name, udata.path, (size - 2));
- if ((size_t)ret_value >= size)
+ if (len >= size)
name[size - 1] = '\0';
} /* end if */
} /* end if */
else
- ret_value = 0;
+ len = 0;
+
+ /* Set path name length, if given */
+ if (name_len)
+ *name_len = len;
done:
/* Release resources */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 1ca6b14..66917c2 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -767,13 +767,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- char *name, size_t size)
+ char *name, size_t name_size, size_t *name_len)
{
- H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info message exists */
- ssize_t ret_value = -1; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ htri_t linfo_exists; /* Whether the link info message exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(oloc->addr, FAIL)
@@ -785,22 +785,21 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message")
if (linfo_exists) {
/* Check for creation order tracking, if creation order index lookup requested */
- if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (idx_type == H5_INDEX_CRT_ORDER)
/* Check if creation order is tracked */
if (!linfo.track_corder)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group")
- } /* end if */
/* Check for dense link storage */
if (H5F_addr_defined(linfo.fheap_addr)) {
/* Get the object's name from the dense link storage */
- if ((ret_value = H5G__dense_get_name_by_idx(oloc->file, &linfo, idx_type, order, n, name, size)) <
- 0)
+ if (H5G__dense_get_name_by_idx(oloc->file, &linfo, idx_type, order, n, name, name_size,
+ name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end if */
else {
/* Get the object's name from the link messages */
- if ((ret_value = H5G__compact_get_name_by_idx(oloc, &linfo, idx_type, order, n, name, size)) < 0)
+ if (H5G__compact_get_name_by_idx(oloc, &linfo, idx_type, order, n, name, name_size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end else */
} /* end if */
@@ -810,7 +809,7 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query")
/* Get the object's name from the symbol table */
- if ((ret_value = H5G__stab_get_name_by_idx(oloc, order, n, name, size)) < 0)
+ if (H5G__stab_get_name_by_idx(oloc, order, n, name, name_size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end else */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index bebbfe6..d108b03 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -30,12 +30,11 @@
#include "H5Gprivate.h"
/* Other private headers needed by this file */
-#include "H5B2private.h" /* v2 B-trees */
+#include "H5B2private.h" /* v2 B-trees */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5HFprivate.h" /* Fractal heaps */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5SLprivate.h" /* Skip lists */
+#include "H5HFprivate.h" /* Fractal heaps */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5Oprivate.h" /* Object headers */
/**************************/
/* Package Private Macros */
@@ -66,10 +65,10 @@
* symbol table entry.
*/
typedef enum H5G_cache_type_t {
- H5G_CACHED_ERROR = -1, /*force enum to be signed */
+ H5G_CACHED_ERROR = -1, /*force enum to be signed */
H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
H5G_CACHED_STAB = 1, /*symbol table, `stab' */
- H5G_CACHED_SLINK = 2, /*symbolic link */
+ H5G_CACHED_SLINK = 2, /*symbolic link */
H5G_NCACHED /*THIS MUST BE LAST */
} H5G_cache_type_t;
@@ -88,7 +87,7 @@ typedef union H5G_cache_t {
} stab;
struct {
- size_t lval_offset; /*link value offset */
+ size_t lval_offset; /*link value offset */
} slink;
} H5G_cache_t;
@@ -157,7 +156,7 @@ typedef struct {
typedef struct H5G_bt_common_t {
/* downward */
const char *name; /*points to temporary memory */
- H5HL_t * heap; /*symbol table heap */
+ H5HL_t * heap; /*symbol table heap */
} H5G_bt_common_t;
/*
@@ -204,10 +203,10 @@ typedef struct H5G_bt_lkp_t {
*/
typedef struct H5G_bt_it_it_t {
/* downward */
- H5HL_t * heap; /*symbol table heap */
- hsize_t skip; /*initial entries to skip */
- H5G_lib_iterate_t op; /*iteration operator */
- void * op_data; /*user-defined operator data */
+ H5HL_t * heap; /*symbol table heap */
+ hsize_t skip; /*initial entries to skip */
+ H5G_lib_iterate_t op; /*iteration operator */
+ void * op_data; /*user-defined operator data */
/* upward */
hsize_t *final_ent; /*final entry looked at */
@@ -359,14 +358,14 @@ H5_DLL herr_t H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hs
H5G_lib_iterate_t op, void *op_data);
H5_DLL herr_t H5G__stab_count(const struct H5O_loc_t *oloc, hsize_t *num_objs);
H5_DLL herr_t H5G__stab_bh_size(H5F_t *f, const H5O_stab_t *stab, H5_ih_info_t *bh_info);
-H5_DLL ssize_t H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
- size_t size);
-H5_DLL herr_t H5G__stab_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G__stab_remove_by_idx(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O_link_t *lnk);
-H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
- H5O_link_t *lnk);
+H5_DLL herr_t H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
+ size_t name_size, size_t *name_len);
+H5_DLL herr_t H5G__stab_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G__stab_remove_by_idx(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O_link_t *lnk);
+H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
+ H5O_link_t *lnk);
#ifndef H5_STRICT_FORMAT_CHECKS
H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab);
#endif /* H5_STRICT_FORMAT_CHECKS */
@@ -406,41 +405,42 @@ H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable);
H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk);
/* Functions that understand "compact" link storage */
-H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk);
-H5_DLL ssize_t H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
- char *name, size_t size);
-H5_DLL herr_t H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
- H5G_lib_iterate_t op, void *op_data);
-H5_DLL herr_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found,
- H5O_link_t *lnk);
+H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk);
+H5_DLL herr_t H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ char *name, size_t name_size, size_t *name_len);
+H5_DLL herr_t H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
+ H5G_lib_iterate_t op, void *op_data);
+H5_DLL herr_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found,
+ H5O_link_t *lnk);
H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
/* Functions that understand "dense" link storage */
-H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, H5G_link_table_t *ltable);
-H5_DLL herr_t H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline);
-H5_DLL herr_t H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t *found,
- H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
- void *op_data);
-H5_DLL ssize_t H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name, size_t size);
-H5_DLL herr_t H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
- const char *name);
-H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link);
+H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, H5G_link_table_t *ltable);
+H5_DLL herr_t H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline);
+H5_DLL herr_t H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t *found,
+ H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
+ void *op_data);
+H5_DLL herr_t H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name, size_t name_size,
+ size_t *name_len);
+H5_DLL herr_t H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
+ const char *name);
+H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link);
/* Functions that understand group objects */
H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc /*out*/);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index b9f83c4..d1725f6 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -29,9 +29,9 @@
#include "H5Gpublic.h"
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Bprivate.h" /* B-trees */
-#include "H5Fprivate.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Bprivate.h" /* B-trees */
+#include "H5Fprivate.h" /* File access */
#include "H5RSprivate.h" /* Reference-counted strings */
/*
@@ -42,7 +42,7 @@
((sizeof_size) + /*offset of name into heap */ \
(sizeof_addr) + /*address of object header */ \
4 + /*entry type */ \
- 4 + /*reserved */ \
+ 4 + /*reserved */ \
H5G_SIZEOF_SCRATCH) /*scratch pad space */
#define H5G_SIZEOF_ENTRY_FILE(F) H5G_SIZEOF_ENTRY(H5F_SIZEOF_ADDR(F), H5F_SIZEOF_SIZE(F))
@@ -130,7 +130,7 @@ typedef enum {
typedef int H5G_own_loc_t;
/* Structure to store information about the name an object was opened with */
-typedef struct {
+typedef struct H5G_name_t {
H5RS_str_t *full_path_r; /* Path to object, as seen from root of current file mounting hierarchy */
H5RS_str_t *user_path_r; /* Path to object, as opened by user */
unsigned obj_hidden; /* Whether the object is visible in group hier. */
@@ -144,7 +144,7 @@ struct H5O_link_t;
* The "location" of an object in a group hierarchy. This points to an object
* location and a group hierarchy path for the object.
*/
-typedef struct {
+typedef struct H5G_loc_t {
struct H5O_loc_t *oloc; /* Object header location */
H5G_name_t * path; /* Group hierarchy path */
} H5G_loc_t;
@@ -227,16 +227,17 @@ H5_DLL herr_t H5G_link_to_info(const struct H5O_loc_t *link_loc, const struct H5
/*
* Functions that understand group objects
*/
-H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, struct H5O_link_t *obj_lnk,
- hbool_t adj_link, H5O_type_t obj_type, const void *crt_info);
-H5_DLL ssize_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name, size_t size);
-H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk);
-H5_DLL hid_t H5G_get_create_plist(const H5G_t *grp);
+H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, struct H5O_link_t *obj_lnk,
+ hbool_t adj_link, H5O_type_t obj_type, const void *crt_info);
+H5_DLL herr_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name, size_t name_size,
+ size_t *name_len);
+H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk);
+H5_DLL hid_t H5G_get_create_plist(const H5G_t *grp);
/*
* These functions operate on symbol table nodes.
@@ -253,35 +254,37 @@ H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *en
/*
* These functions operate on group hierarchy names.
*/
-H5_DLL herr_t H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name);
-H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
- H5RS_str_t *src_full_path_r, H5F_t *dst_file, H5RS_str_t *dst_full_path_r);
-H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
-H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth);
-H5_DLL herr_t H5G_name_free(H5G_name_t *name);
-H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cached);
-H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char *name, size_t size);
+H5_DLL herr_t H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name);
+H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
+ H5RS_str_t *src_full_path_r, H5F_t *dst_file, H5RS_str_t *dst_full_path_r);
+H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
+H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5G_name_free(H5G_name_t *name);
+H5_DLL herr_t H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name_len,
+ hbool_t *cached);
+H5_DLL herr_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char *name, size_t size,
+ size_t *name_len);
H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name);
/*
* These functions operate on group "locations"
*/
-H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth);
-H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/);
-H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5G_loc_t *obj_loc /*out*/);
-H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/,
- unsigned fields);
-H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo /*out*/,
- unsigned fields);
-H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment);
-H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/,
- size_t bufsize);
-H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/);
+H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5G_loc_t *obj_loc /*out*/);
+H5_DLL herr_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
+H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/,
+ unsigned fields);
+H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo /*out*/,
+ unsigned fields);
+H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment);
+H5_DLL herr_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/,
+ size_t bufsize, size_t *comment_len);
+H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
/*
* These functions operate on the root group
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 68786dc..d9c29f6 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -41,24 +41,31 @@
/* Public Typedefs */
/*******************/
-/* Types of link storage for groups */
+//! <!-- [H5G_storage_t_snip] -->
+/**
+ * Types of link storage for groups
+ */
typedef enum H5G_storage_type_t {
- H5G_STORAGE_TYPE_UNKNOWN = -1, /* Unknown link storage type */
- H5G_STORAGE_TYPE_SYMBOL_TABLE, /* Links in group are stored with a "symbol table" */
- /* (this is sometimes called "old-style" groups) */
- H5G_STORAGE_TYPE_COMPACT, /* Links are stored in object header */
- H5G_STORAGE_TYPE_DENSE /* Links are stored in fractal heap & indexed with v2 B-tree */
+ H5G_STORAGE_TYPE_UNKNOWN = -1, /**< Unknown link storage type */
+ H5G_STORAGE_TYPE_SYMBOL_TABLE, /**< Links in group are stored with a "symbol table" */
+ /**< (this is sometimes called "old-style" groups) */
+ H5G_STORAGE_TYPE_COMPACT, /**< Links are stored in object header */
+ H5G_STORAGE_TYPE_DENSE /**< Links are stored in fractal heap & indexed with v2 B-tree */
} H5G_storage_type_t;
+//! <!-- [H5G_storage_t_snip] -->
-/* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */
-//! [H5G_info_t_snip]
+//! <!-- [H5G_info_t_snip] -->
+/**
+ * Information struct for group for
+ * H5Gget_info(), H5Gget_info_by_name(), and H5Gget_info_by_idx()
+ */
typedef struct H5G_info_t {
- H5G_storage_type_t storage_type; /* Type of storage for links in group */
- hsize_t nlinks; /* Number of links in group */
- int64_t max_corder; /* Current max. creation order value for group */
- hbool_t mounted; /* Whether group has a file mounted on it */
+ H5G_storage_type_t storage_type; /**< Type of storage for links in group */
+ hsize_t nlinks; /**< Number of links in group */
+ int64_t max_corder; /**< Current max. creation order value for group */
+ hbool_t mounted; /**< Whether group has a file mounted on it */
} H5G_info_t;
-//! [H5G_info_t_snip]
+//! <!-- [H5G_info_t_snip] -->
/********************/
/* Public Variables */
@@ -120,24 +127,8 @@ H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcp
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gcreate2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] name Name of the group to create
- * \lcpl_id
- * \gcpl_id
- * \gapl_id
- * \es_id
- *
- * \return \hid_t{group}
- *
- * \see H5Gcreate2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gcreate}
*/
H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t es_id);
@@ -223,22 +214,8 @@ H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gopen2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] name Name of the group to open
- * \gapl_id
- * \es_id
- *
- * \return \hid_t{group}
- *
- * \see H5Gopen2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gopen}
*/
H5_DLL hid_t H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t gapl_id, hid_t es_id);
@@ -296,21 +273,8 @@ H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo);
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gget_info()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[out] ginfo Struct in which group information is returned
- * \es_id
- *
- * \return \hid_t{group}
- *
- * \see H5Gget_info()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gget_info}
*/
H5_DLL herr_t H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
H5G_info_t *ginfo /*out*/, hid_t es_id);
@@ -351,23 +315,8 @@ H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *gi
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gget_info_by_name()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] name Name of the group to query
- * \param[out] ginfo Struct in which group information is returned
- * \lapl_id
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Gget_info_by_name()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gget_info_by_name}
*/
H5_DLL herr_t H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t loc_id, const char *name, H5G_info_t *ginfo /*out*/,
@@ -423,29 +372,8 @@ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gcreate2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \fgdta_loc_id
- * \param[in] group_name Name of the group to query
- * \param[in] idx_type Transient index identifying object
- * \param[in] order Transient index identifying object
- * \param[in] n Position in the index of the group to query
- * \param[out] ginfo Struct in which group information is returned
- * \lapl_id
- * \es_id
- *
- * \return Returns
- * \li The size of the object name if successful, or
- * \li 0 if no name is associated with the group identifier, or
- * \li negative value, if failure occurred
- *
- * \see H5Gcreate2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gget_info_by_idx}
*/
H5_DLL herr_t H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t loc_id, const char *group_name, H5_index_t idx_type,
@@ -523,33 +451,23 @@ H5_DLL herr_t H5Grefresh(hid_t group_id);
* Failure to release a group with this call will result in
* resource leaks.
*
- * \since 1.0.0
+ * \par Example
+ * \snippet H5F_examples.c mount
*
- * \version 1.4.0 Fortran function introduced in this release
+ * \since 1.0.0
*
*/
H5_DLL herr_t H5Gclose(hid_t group_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5G
- *
- * \brief Asynchronous version of H5Gcreate2()
- *
- * \app_file
- * \app_func
- * \app_line
- * \group_id
- * \es_id
- *
- * \return \herr_t
- *
- * \see H5Gcreate2()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Gclose}
*/
H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
hid_t es_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -571,6 +489,7 @@ H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigne
#define H5Gget_info_by_idx_async_wrap H5_NO_EXPAND(H5Gget_info_by_idx_async)
#define H5Gclose_async_wrap H5_NO_EXPAND(H5Gclose_async)
#endif /* H5G_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -595,60 +514,647 @@ H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigne
/* Typedefs */
-/*
+//! <!-- [H5G_obj_t_snip] -->
+/**
* An object has a certain type. The first few numbers are reserved for use
* internally by HDF5. Users may add their own types with higher values. The
- * values are never stored in the file -- they only exist while an
- * application is running. An object may satisfy the `isa' function for more
- * than one type.
+ * values are never stored in the file -- they only exist while an application
+ * is running. An object may satisfy the `isa' function for more than one type.
+ *
+ * \deprecated
*/
typedef enum H5G_obj_t {
- H5G_UNKNOWN = -1, /* Unknown object type */
- H5G_GROUP, /* Object is a group */
- H5G_DATASET, /* Object is a dataset */
- H5G_TYPE, /* Object is a named data type */
- H5G_LINK, /* Object is a symbolic link */
- H5G_UDLINK, /* Object is a user-defined link */
- H5G_RESERVED_5, /* Reserved for future use */
- H5G_RESERVED_6, /* Reserved for future use */
- H5G_RESERVED_7 /* Reserved for future use */
+ H5G_UNKNOWN = -1, /**< Unknown object type */
+ H5G_GROUP, /**< Object is a group */
+ H5G_DATASET, /**< Object is a dataset */
+ H5G_TYPE, /**< Object is a named data type */
+ H5G_LINK, /**< Object is a symbolic link */
+ H5G_UDLINK, /**< Object is a user-defined link */
+ H5G_RESERVED_5, /**< Reserved for future use */
+ H5G_RESERVED_6, /**< Reserved for future use */
+ H5G_RESERVED_7 /**< Reserved for future use */
} H5G_obj_t;
+//! <!-- [H5G_obj_t_snip] -->
-/** Define the operator function pointer for for H5Giterate() */
-//! [H5G_iterate_t_snip]
+//! <!-- [H5G_iterate_t_snip] -->
+/**
+ * Callback for H5Giterate()
+ *
+ * \deprecated
+ */
typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data);
-//! [H5G_iterate_t_snip]
+//! <!-- [H5G_iterate_t_snip] -->
-/** Information about an object */
-//! [H5G_stat_t_snip]
+//! <!-- [H5G_stat_t_snip] -->
+/**
+ * Information about an object
+ *
+ * \deprecated
+ */
typedef struct H5G_stat_t {
- unsigned long fileno[2]; /*file number */
- unsigned long objno[2]; /*object number */
- unsigned nlink; /*number of hard links to object*/
- H5G_obj_t type; /*basic object type */
- time_t mtime; /*modification time */
- size_t linklen; /*symbolic link value length */
- H5O_stat_t ohdr; /* Object header information */
+ unsigned long fileno[2]; /**< file number */
+ unsigned long objno[2]; /**< object number */
+ unsigned nlink; /**< number of hard links to object*/
+ H5G_obj_t type; /**< basic object type */
+ time_t mtime; /**< modification time */
+ size_t linklen; /**< symbolic link value length */
+ H5O_stat_t ohdr; /**< Object header information */
} H5G_stat_t;
-//! [H5G_stat_t_snip]
+//! <!-- [H5G_stat_t_snip] -->
/* Function prototypes */
-H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint);
-H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name);
-H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id,
- const char *new_name);
-H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name);
-H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name);
-H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/);
-H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
-H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf);
-H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data);
-H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
-H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
- H5G_stat_t *statbuf /*out*/);
-H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a new group and links it into the file
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to create
+ * \param[in] size_hint The number of bytes to reserve for the names
+ * that will appear in the group
+ *
+ * \return \hid_t{group}
+ *
+ * \deprecated This function is deprecated in favor of H5Gcreate2().
+ *
+ * \details H5Gcreate1() creates a new group with the specified name at the
+ * specified location, \p loc_id. \p loc_id may be a file, group,
+ * dataset, named datatype or attribute. If an attribute, dataset, or
+ * named datatype is specified for \p loc_id then the group will be
+ * created at the location where the attribute, dataset, or named
+ * datatype is attached. The name, name, must not already be taken by
+ * some other object and all parent groups must already exist.
+ *
+ * \p name can be a relative path based at \p loc_id or an absolute
+ * path from the root of the file. Use of this function requires that
+ * any intermediate groups specified in the path already exist.
+ *
+ * The length of a group name, or of the name of any object within a
+ * group, is not limited.
+ *
+ * \p size_hint is a hint for the number of bytes to reserve to store
+ * the names which will be eventually added to the new group. This
+ * value must be between 0 and UINT32_MAX (inclusive). If this
+ * parameter is zero, a default value will be used.
+ *
+ * The return value is a group identifier for the open group. This
+ * group identifier should be closed by calling H5Gclose() when it is
+ * no longer needed.
+ *
+ * See H5Gcreate_anon() for a discussion of the differences between
+ * H5Gcreate1() and H5Gcreate_anon().
+ *
+ * \par Example
+ * \snippet H5F_examples.c mount
+ *
+ * \version 1.8.0 Function H5Gcreate() renamed to H5Gcreate1() and deprecated
+ * in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Opens an existing group for modification and returns a group
+ * identifier for that group
+ *
+ * \fgdta_loc_id
+ * \param[in] name Name of the group to open
+ *
+ * \return \hid_t{group}
+ *
+ * \deprecated This function is deprecated in favor of H5Gopen2().
+ *
+ * \details H5Gopen1() opens an existing group, \p name, at the location
+ * specified by \p loc_id.
+ *
+ * H5Gopen1() returns a group identifier for the group that was
+ * opened. This group identifier should be released by calling
+ * H5Gclose() when it is no longer needed.
+ *
+ * \version 1.8.0 The function H5Gopen() was renamed to H5Gopen1()
+ * and deprecated in this release.
+ * \since 1.0.0
+ *
+ */
+H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a link of the specified type from \p new_name to \p
+ * cur_name
+ *
+ * \fg_loc_id{cur_loc_id}
+ * \param[in] type Link type
+ * \param[in] cur_name Name of the existing object
+ * \param[in] new_name New name for the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Glink() creates a new name for an object that has some current
+ * name, possibly one of many names it currently has.
+ *
+ * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify
+ * the name of an existing object and both names are interpreted
+ * relative to \p cur_loc_id, which is either a file identifier or a
+ * group identifier.
+ *
+ * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything
+ * and is interpreted at lookup time relative to the group which
+ * contains the final component of \p new_name. For instance, if \p
+ * cur_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a
+ * request is made for \Code{./x/y/bar}, then the actual object looked
+ * up is \Code{./x/y/./foo}.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Creates a link of the specified type from \p cur_name to \p
+ * new_name
+ *
+ * \fg_loc_id{cur_loc_id}
+ * \param[in] cur_name Name of the existing object
+ * \param[in] type Link type
+ * \fg_loc_id{new_loc_id}
+ * \param[in] new_name New name for the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Glink2() creates a new name for an object that has some current
+ * name, possibly one of many names it currently has.
+ *
+ * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify the
+ * name of an existing object and both names are interpreted relative
+ * to \p cur_loc_id and \p new_loc_id, respectively, which are either
+ * file identifiers or group identifiers.
+ *
+ * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything
+ * and is interpreted at lookup time relative to the group which
+ * contains the final component of \p new_name. For instance, if \p
+ * current_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a
+ * request is made for \Code{./x/y/bar}, then the actual object looked
+ * up is \Code{./x/y/./foo}.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id,
+ const char *new_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Renames an object within an HDF5 file
+ *
+ * \fg_loc_id{src_loc_id}
+ * \param[in] src_name Object's original name
+ * \param[in] dst_name Object's new name
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Gmove() renames an object within an HDF5 file. The original name,
+ * \p src_name, is unlinked from the group graph and the new name, \p
+ * dst_name, is inserted as an atomic operation. Both names are
+ * interpreted relative to \p loc_id, which is either a file or a group
+ * identifier.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gmove(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Renames an object within an HDF5 file
+ *
+ * \fg_loc_id{src_loc_id}
+ * \param[in] src_name Object's original name
+ * \fg_loc_id{dst_loc_id}
+ * \param[in] dst_name Object's new name
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated.
+ *
+ * \details H5Gmove2() renames an object within an HDF5 file. The original name,
+ * \p src_name, is unlinked from the group graph and the new name, \p
+ * dst_name, is inserted as an atomic operation.
+ *
+ * \p src_name and \p dst_name are interpreted relative to \p
+ * src_loc_id and \p dst_loc_id, respectively, which are either file or
+ * group identifiers.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gmove2(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Removes the link to an object from a group
+ *
+ * \fg_loc_id{loc_id}
+ * \param[in] name Name of the object to unlink
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Ldelete().
+ *
+ * \details H5Gunlink() removes the object specified by \p name from the group
+ * graph and decrements the link count for the object to which \p name
+ * points. This action eliminates any association between name and the
+ * object to which name pointed.
+ *
+ * Object headers keep track of how many hard links refer to an object;
+ * when the link count reaches zero, the object can be removed from the
+ * file. Objects which are open are not removed until all identifiers
+ * to the object are closed.
+ *
+ * If the link count reaches zero, all file space associated with the
+ * object will be released, i.e., identified in memory as freespace. If
+ * any object identifier is open for the object, the space will not be
+ * released until after the object identifier is closed.
+ *
+ * Note that space identified as freespace is available for re-use only
+ * as long as the file remains open; once a file has been closed, the
+ * HDF5 library loses track of freespace. See “Freespace Management” in
+ * the HDF5 User's Guide for further details.
+ *
+ * \attention Exercise care in moving groups as it is possible to render data in
+ * a file inaccessible with H5Gunlink(). See The Group Interface in the
+ * HDF5 User's Guide.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns the name of the object that the symbolic link points to
+ *
+ * \fg_loc_id{loc_id}
+ * \param[in] name Symbolic link to the object whose name is to be returned
+ * \param[in] size Maximum number of characters of value to be returned
+ * \param[out] buf A buffer to hold the name of the object being sought
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Lget_val().
+ *
+ * \details H5Gget_linkval() returns up to size characters of the name of the
+ * object that the symbolic link name points to.
+ *
+ * The parameter \p loc_id is a file or group identifier.
+ *
+ * The parameter \p name must be a symbolic link pointing to the
+ * desired object and must be defined relative to \p loc_id.
+ *
+ * If size is smaller than the size of the returned object name, then
+ * the name stored in the buffer value will not be \c NULL terminated.
+ *
+ * This function fails if \p name is not a symbolic link. The presence
+ * of a symbolic link can be tested by passing zero for \p size and \p
+ * NULL for value.
+ *
+ * This function should be used only after H5Lget_info1() (or the
+ * deprecated function H5Gget_objinfo()) has been called to verify that
+ * name is a symbolic link.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Sets comment for specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object whose comment is to be set or reset
+ * name must be \Code{'.'} (dot) if \p loc_id fully specifies
+ * the object for which the comment is to be set.
+ * \param[in] comment The new comment
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Oset_comment().
+ *
+ * \details H5Gset_comment() sets the comment for the object specified by \p
+ * loc_id and name to comment. Any previously existing comment is
+ * overwritten.
+ *
+ * \p loc_id can specify any object in the file. name can be one of the
+ * following:
+ * \li The name of the object relative to \p loc_id
+ * \li An absolute name of the object, starting from \c /, the file’s
+ * root group
+ * \li A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * If \p comment is the empty string or a null pointer, the comment
+ * message is removed from the object.
+ *
+ * Comments should be relatively short, null-terminated, ASCII strings.
+ *
+ * Comments can be attached to any object that has an object header,
+ * e.g., datasets, groups, and named datatypes, but not symbolic links.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Retrieves comment for specified object
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object whose comment is to be set or reset
+ * name must be \Code{'.'} (dot) if \p loc_id fully specifies
+ * the object for which the comment is to be set.
+ * \param[in] bufsize Maximum number of comment characters to be returned in \p buf.
+ * \param[in] buf The comment
+ *
+ * \return Returns the number of characters in the comment, counting the \c NULL
+ * terminator, if successful; the value returned may be larger than
+ * \p bufsize. Otherwise returns a negative value.
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Oget_comment().
+ *
+ * \details H5Gget_comment() retrieves the comment for the the object specified
+ * by \p loc_id and \p name. The comment is returned in the buffer \p
+ * buf.
+ *
+ * \p loc_id can specify any object in the file. name can be one of the
+ * following:
+ * \li The name of the object relative to \p loc_id
+ * \li An absolute name of the object, starting from \c /, the file’s
+ * root group
+ * \li A dot (\c .), if \p loc_id fully specifies the object
+ *
+ * At most bufsize characters, including a null-terminator, are
+ * returned in \p buf. The returned value is not null-terminated if the
+ * comment is longer than the supplied buffer. If the size of the
+ * comment is unknown, a preliminary \p H5Gget_comment() call will
+ * return the size of the comment, including space for the
+ * null-terminator.
+ *
+ * If an object does not have a comment, the empty string is returned
+ * in comment.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Iterates over the entries of a group invoking a callback for each
+ * entry encountered
+ *
+ * \fg_loc_id
+ * \param[in] name Group over which the iteration is performed
+ * \param[in,out] idx Location at which to begin the iteration
+ * \param[in] op Operation to be performed on an object at each step of the
+ * iteration
+ * \param[in,out] op_data Data associated with the operation
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function
+ * H5Literate1().
+ *
+ * \details H5Giterate() iterates over the members of name in the file or group
+ * specified with \p loc_id. For each object in the group, the \p
+ * op_data and some additional information, specified below, are passed
+ * to the operator function. The iteration begins with the \p idx
+ * object in the group and the next element to be processed by the
+ * operator is returned in \p idx. If \p idx is NULL, then the iterator
+ * starts at the first group member; since no stopping point is
+ * returned in this case, the iterator cannot be restarted if one of
+ * the calls to its operator returns non-zero. H5Giterate() does not
+ * recursively follow links into subgroups of the specified group.
+ *
+ * The prototype for \ref H5G_iterate_t is:
+ * \snippet this H5G_iterate_t_snip
+ *
+ * The operation receives the group identifier for the group being
+ * iterated over, \p group, the name of the current object within
+ * the group, \p name, and the pointer to the operator data
+ * passed in to H5Giterate(), \p op_data.
+ *
+ * The return values from an operator are:
+ * \li Zero causes the iterator to continue, returning zero when all
+ * group members have been processed.
+ * \li Positive causes the iterator to immediately return that positive
+ * value, indicating short-circuit success. The iterator can be
+ * restarted at the next group member.
+ * \li Negative causes the iterator to immediately return that value,
+ * indicating failure. The iterator can be restarted at the next
+ * group member.
+ *
+ * H5Giterate() assumes that the membership of the group identified by
+ * \p name remains unchanged through the iteration. If the membership
+ * changes during the iteration, the function's behavior is undefined.
+ *
+ * H5Giterate() is not recursive. In particular, if a member of \p name
+ * is found to be a group, call it \c subgroup_a, H5Giterate() does not
+ * examine the members of \c subgroup_a. When recursive iteration is
+ * required, the application must handle the recursion, explicitly
+ * calling H5Giterate() on discovered subgroups.
+
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns number of objects in the group specified by its identifier
+ *
+ * \fg_loc_id
+ * \param[out] num_objs Number of objects in the group
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the function H5Gget_info().
+ *
+ * \details H5Gget_num_objs() returns number of objects in a group. Group is
+ * specified by its identifier \p loc_id. If a file identifier is
+ * passed in, then the number of objects in the root group is returned.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ *
+ */
+H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns information about an object.
+ *
+ * \fgdt_loc_id
+ * \param[in] name Name of the object for which status is being sought
+ * \param[in] follow_link Link flag
+ * \param[out] statbuf Buffer in which to return information about the object
+ *
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated in favor of the functions H5Oget_info()
+ * and H5Lget_info1().
+ *
+ * \details H5Gget_objinfo() returns information about the specified object
+ * through the \p statbuf argument.
+ *
+ * A file or group identifier, \p loc_id, and an object name, \p name,
+ * relative to \p loc_id, are commonly used to specify the
+ * object. However, if the object identifier is already known to the
+ * application, an alternative approach is to use that identifier, \c
+ * obj_id, in place of \p loc_id, and a dot (\c .) in place of \p
+ * name. Thus, the alternative versions of the first portion of an
+ * H5Gget_objinfo() call would be as follows:
+ * \code
+ * H5Gget_objinfo (loc_id name ...)
+ * H5Gget_objinfo (obj_id . ...)
+ * \endcode
+ *
+ * If the object is a symbolic link and follow_link is zero (0), then
+ * the information returned describes the link itself; otherwise the
+ * link is followed and the information returned describes the object
+ * to which the link points. If \p follow_link is non-zero but the
+ * final symbolic link is dangling (does not point to anything), then
+ * an error is returned. The \p statbuf fields are undefined for an
+ * error. The existence of an object can be tested by calling this
+ * function with a \c NULL \p statbuf.
+ *
+ * H5Gget_objinfo() fills in the following data structure (defined in
+ * H5Gpublic.h):
+ * \snippet this H5G_stat_t_snip
+ *
+ * where \ref H5O_stat_t (defined in H5Opublic.h) is:
+ * \snippet H5Opublic.h H5O_stat_t_snip
+ *
+ * \attention Some systems will be able to record the time accurately but unable
+ * to retrieve the correct time; such systems (e.g., Irix64) will
+ * report an \c mtime value of 0 (zero).
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \version 1.6.1 Two new fields were added to the \ref H5G_stat_t struct in
+ * this release.
+ *
+ */
+H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
+ H5G_stat_t *statbuf /*out*/);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns a name of an object specified by an index
+ *
+ * \fg_loc_id
+ * \param[in] idx Transient index identifying object
+ * \param[in,out] name Pointer to user-provided buffer the object name
+ * \param[in] size Name length
+ *
+ * \return Returns the size of the object name if successful, or 0 if no name is
+ * associated with the group identifier. Otherwise returns a negative
+ * value.
+ *
+ * \deprecated This function is deprecated in favor of the function H5Lget_name_by_idx().
+ *
+ * \details H5Gget_objname_by_idx() returns a name of the object specified by
+ * the index \p idx in the group \p loc_id.
+ *
+ * The group is specified by a group identifier \p loc_id. If
+ * preferred, a file identifier may be passed in \p loc_id; that file's
+ * root group will be assumed.
+ *
+ * \p idx is the transient index used to iterate through the objects in
+ * the group. The value of \p idx is any nonnegative number less than
+ * the total number of objects in the group, which is returned by the
+ * function H5Gget_num_objs(). Note that this is a transient index; an
+ * object may have a different index each time a group is opened.
+ *
+ * The object name is returned in the user-specified buffer \p name.
+ *
+ * If the size of the provided buffer \p name is less or equal the
+ * actual object name length, the object name is truncated to
+ * \Code{max_size - 1} characters.
+ *
+ * Note that if the size of the object's name is unkown, a preliminary
+ * call to H5Gget_objname_by_idx() with \p name set to \c NULL will
+ * return the length of the object's name. A second call to
+ * H5Gget_objname_by_idx() can then be used to retrieve the actual
+ * name.
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \since 1.6.0
+ *
+ */
+H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size);
+/**
+ *-------------------------------------------------------------------------
+ * \ingroup H5G
+ *
+ * \brief Returns the type of an object specified by an index
+ *
+ * \fg_loc_id
+ * \param[in] idx Transient index identifying object
+ *
+ * \return Returns the type of the object if successful. Otherwise returns a
+ * negative value.
+ *
+ * \deprecated This function is deprecated in favor of the function H5Oget_info().
+ *
+ * \details H5Gget_objtype_by_idx() returns the type of the object specified by
+ * the index \p idx in the group \p loc_id.
+ *
+ * The group is specified by a group identifier \p loc_id. If
+ * preferred, a file identifier may be passed in \p loc_id; that file's
+ * root group will be assumed.
+ *
+ * \p idx is the transient index used to iterate through the objects in
+ * the group. This parameter is described in more detail in the
+ * discussion of H5Gget_objname_by_idx().
+ *
+ * \version 1.8.0 Function deprecated in this release.
+ * \version 1.6.0 The function return type changed from \c int to the enumerated
+ * type \ref H5G_obj_t.
+ * \since 1.6.0
+ *
+ */
H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 34f9610..ca74aa5 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -150,11 +150,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")
/* Insert name into the heap */
- if (UFAIL == (name_offset = H5HL_insert(f, heap, (size_t)1, "")))
+ if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap")
- /*
- * B-tree's won't work if the first name isn't at the beginning
+ /* B-trees won't work if the first name isn't at the beginning
* of the heap.
*/
HDassert(0 == name_offset);
@@ -706,22 +705,22 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Raymond Lu
* Nov 20, 2002
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name, size_t size)
+herr_t
+H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
+ size_t name_size, size_t *name_len)
{
- H5HL_t * heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gnbi_t udata; /* Iteration information */
- hbool_t udata_valid = FALSE; /* Whether iteration information is valid */
- ssize_t ret_value = -1; /* Return value */
+ H5HL_t * heap = NULL; /* Pointer to local heap */
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ H5G_bt_it_gnbi_t udata; /* Iteration information */
+ hbool_t udata_valid = FALSE; /* Whether iteration information is valid */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
@@ -768,13 +767,13 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(udata.name);
+ *name_len = HDstrlen(udata.name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, udata.name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, udata.name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
done:
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 9f0dca2..7ae41ed 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -616,14 +616,14 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
/* Retrieve a copy of the user path and put it into the buffer */
if (obj_path->user_path_r) {
- ssize_t len = H5RS_len(obj_path->user_path_r);
+ size_t len = H5RS_len(obj_path->user_path_r);
/* Set the user path, if given */
if (user_path)
- HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (size_t)(len + 1));
+ HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1));
/* Set the length of the path */
- *user_path_len = (size_t)len;
+ *user_path_len = len;
/* Set the user path hidden flag */
*obj_hidden = obj_path->obj_hidden;
diff --git a/src/H5HF.c b/src/H5HF.c
index 73281a4..1f4cc26 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -429,7 +429,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 'tiny' object's length")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -489,7 +489,7 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p)
*obj_off_p = (hsize_t)0;
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -552,7 +552,7 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -628,7 +628,7 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'tiny' object not supported yet")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -696,7 +696,7 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -759,7 +759,7 @@ H5HF_remove(H5HF_t *fh, const void *_id)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 7d29ede..fde5a4f 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -209,7 +209,7 @@ H5HF__hdr_prefix_decode(H5HF_hdr_t *hdr, const uint8_t **image_ref)
HDassert(image);
/* Magic number */
- if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "wrong fractal heap header signature")
image += H5_SIZEOF_MAGIC;
@@ -992,7 +992,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED
HDassert(iblock->size == len);
/* Magic number */
- if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap indirect block signature")
image += H5_SIZEOF_MAGIC;
@@ -1831,7 +1831,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo
image = dblock->blk;
/* Magic number */
- if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap direct block signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index cc61aa1..8dbb3f4 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -140,7 +140,7 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth)
id_type = 'T';
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
@@ -543,7 +543,7 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
amount_free = 0;
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:",
- ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) /
+ (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) /
(double)(dblock->size - blk_prefix_size)));
/*
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index 628dcc4..4adb47a 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -397,7 +397,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_
HDfprintf(
stderr,
"%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n",
- FUNC, min_dblock_size, next_size);
+ __func__, min_dblock_size, next_size);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet")
} /* end if */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 893a65d..8d189e8 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -34,7 +34,6 @@
#include "H5B2private.h" /* v2 B-trees */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FSprivate.h" /* Free space manager */
-#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index e0e1f2e..379e6f6 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -122,7 +122,7 @@ H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, const H5F_t *f)
HDassert(f);
/* Magic number */
- if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad global heap collection signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5HL.c b/src/H5HL.c
index 50d24c3..1f2369a 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -98,11 +98,15 @@ H5FL_BLK_DEFINE(lheap_chunk);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/))
-
+herr_t
+H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/)
+{
H5HL_t * heap = NULL; /* Heap created */
H5HL_prfx_t *prfx = NULL; /* Heap prefix */
hsize_t total_size = 0; /* Total heap size on disk */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
/* check arguments */
HDassert(f);
@@ -115,12 +119,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h
/* Allocate new heap structure */
if (NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f))))
- H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate new heap struct");
/* Allocate file space */
total_size = heap->prfx_size + size_hint;
if (HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, total_size)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory");
/* Initialize info */
heap->single_cache_obj = TRUE;
@@ -128,52 +132,52 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h
heap->dblk_size = size_hint;
if (size_hint)
if (NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* free list */
if (size_hint) {
if (NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
heap->freelist->offset = 0;
heap->freelist->size = size_hint;
heap->freelist->prev = heap->freelist->next = NULL;
heap->free_block = 0;
- } /* end if */
+ }
else {
heap->freelist = NULL;
heap->free_block = H5HL_FREE_NULL;
- } /* end else */
+ }
/* Allocate the heap prefix */
if (NULL == (prfx = H5HL__prfx_new(heap)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Add to cache */
if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix");
/* Set address to return */
*addr_p = heap->prfx_addr;
- CATCH
+done:
if (ret_value < 0) {
*addr_p = HADDR_UNDEF;
if (prfx) {
if (FAIL == H5HL__prfx_dest(prfx))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix");
- } /* end if */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix");
+ }
else {
if (heap) {
if (H5F_addr_defined(heap->prfx_addr))
if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size))
- H5E_THROW(H5E_CANTFREE, "can't release heap data?");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?");
if (FAIL == H5HL__dest(heap))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap");
- } /* end if */
- } /* end else */
- } /* end if */
-
-END_FUNC(PRIV) /* end H5HL_create() */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap");
+ }
+ }
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_create() */
/*-------------------------------------------------------------------------
* Function: H5HL__minimize_heap_space
@@ -188,16 +192,19 @@ END_FUNC(PRIV) /* end H5HL_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap))
-
+static herr_t
+H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap)
+{
size_t new_heap_size = heap->dblk_size; /* New size of heap */
+ herr_t ret_value = SUCCEED;
- /* check args */
+ FUNC_ENTER_STATIC
+
+ /* Check args */
HDassert(f);
HDassert(heap);
- /*
- * Check to see if we can reduce the size of the heap in memory by
+ /* Check to see if we can reduce the size of the heap in memory by
* eliminating free blocks at the tail of the buffer before flushing the
* buffer out.
*/
@@ -211,29 +218,25 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
if (tmp_fl->offset + tmp_fl->size == heap->dblk_size) {
last_fl = tmp_fl;
break;
- } /* end if */
+ }
- /*
- * Found free block at the end of the buffer, decide what to do
+ /* Found free block at the end of the buffer, decide what to do
* about it
*/
if (last_fl) {
- /*
- * If the last free block's size is more than half the memory
+ /* If the last free block's size is more than half the memory
* buffer size (and the memory buffer is larger than the
* minimum size), reduce or eliminate it.
*/
if (last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) {
- /*
- * Reduce size of buffer until it's too small or would
+ /* Reduce size of buffer until it's too small or would
* eliminate the free block
*/
while (new_heap_size > H5HL_MIN_HEAP &&
new_heap_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f)))
new_heap_size /= 2;
- /*
- * Check if reducing the memory buffer size would
+ /* Check if reducing the memory buffer size would
* eliminate the free block
*/
if (new_heap_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) {
@@ -246,31 +249,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
- } /* end if */
+ }
else {
- /*
- * Set the size of the memory buffer to the start
+ /* Set the size of the memory buffer to the start
* of the free list
*/
new_heap_size = last_fl->offset;
/* Eliminate the free block from the list */
last_fl = H5HL__remove_free(heap, last_fl);
- } /* end else */
- } /* end if */
+ }
+ }
else {
/* Truncate the free block */
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
HDassert(last_fl->size == H5HL_ALIGN(last_fl->size));
- } /* end else */
- } /* end if */
- } /* end if */
- } /* end if */
+ }
+ }
+ }
+ }
- /*
- * If the heap grew smaller than disk storage then move the
+ /* If the heap grew smaller than disk storage then move the
* data segment of the heap to another contiguous block of disk
* storage.
*/
@@ -279,17 +280,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
/* Resize the memory buffer */
if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Reallocate data block in file */
if (FAIL == H5HL__dblk_realloc(f, heap, new_heap_size))
- H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed");
+ }
- CATCH
- /* No special processing on errors */
-
-END_FUNC(STATIC) /* H5HL__minimize_heap_space() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5HL__minimize_heap_space() */
/*-------------------------------------------------------------------------
* Function: H5HL_protect
@@ -304,20 +304,24 @@ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags))
-
+H5HL_t *
+H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags)
+{
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_dblk_t * dblk = NULL; /* Local heap data block */
H5HL_t * heap = NULL; /* Heap data structure */
unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */
unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */
+ H5HL_t * ret_value = NULL;
- /* check arguments */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- /* only the H5AC__READ_ONLY_FLAG may appear in flags */
+ /* Only the H5AC__READ_ONLY_FLAG may appear in flags */
HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
/* Construct the user data for protect callback */
@@ -328,7 +332,7 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Protect the local heap prefix */
if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -344,12 +348,12 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Protect the local heap data block */
if (NULL ==
(dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block");
/* Set the flag for pinning the data block when unprotecting it */
dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG;
- } /* end if */
- } /* end if */
+ }
+ }
/* Increment # of times heap is protected */
heap->prots++;
@@ -357,16 +361,17 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Set return value */
ret_value = heap;
- CATCH
+done:
/* Release the prefix from the cache, now pinned */
if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix");
/* Release the data block from the cache, now pinned */
if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block");
-END_FUNC(PRIV) /* end H5HL_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_protect() */
/*-------------------------------------------------------------------------
* Function: H5HL_offset_into
@@ -374,26 +379,31 @@ END_FUNC(PRIV) /* end H5HL_protect() */
* Purpose: Called directly after the call to H5HL_protect so that
* a pointer to the object in the heap can be obtained.
*
- * Return: Success: Valid pointer.
- * Failure: Can't fail
+ * Return: Success: Valid pointer
+ * Failure: NULL
*
* Programmer: Bill Wendling
* Sept. 17, 2003
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, void *, NULL, NULL, H5HL_offset_into(const H5HL_t *heap, size_t offset))
+void *
+H5HL_offset_into(const H5HL_t *heap, size_t offset)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
/* Sanity check */
HDassert(heap);
if (offset >= heap->dblk_size)
- H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to offset into local heap data block");
ret_value = heap->dblk_image + offset;
- CATCH
-/* No special processing on errors */
-END_FUNC(PRIV) /* end H5HL_offset_into() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_offset_into() */
/*-------------------------------------------------------------------------
* Function: H5HL_unprotect
@@ -407,9 +417,14 @@ END_FUNC(PRIV) /* end H5HL_offset_into() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
+herr_t
+H5HL_unprotect(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(heap);
/* Decrement # of times heap is protected */
@@ -421,8 +436,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
if (heap->single_cache_obj) {
/* Mark local heap prefix as evictable again */
if (FAIL == H5AC_unpin_entry(heap->prfx))
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block");
+ }
else {
/* Sanity check */
HDassert(heap->dblk);
@@ -430,14 +445,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
/* Mark local heap data block as evictable again */
/* (data block still pins prefix) */
if (FAIL == H5AC_unpin_entry(heap->dblk))
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block");
- } /* end else */
- } /* end if */
-
- CATCH
- /* No special processing on errors */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block");
+ }
+ }
-END_FUNC(PRIV) /* end H5HL_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5HL__remove_free
@@ -452,7 +466,12 @@ END_FUNC(PRIV) /* end H5HL_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl))
+static H5HL_free_t *
+H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl)
+{
+ H5HL_free_t *ret_value = NULL;
+
+ FUNC_ENTER_STATIC_NOERR
if (fl->prev)
fl->prev->next = fl->next;
@@ -465,7 +484,8 @@ BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap
/* H5FL_FREE always returns NULL so we can't check for errors */
ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl);
-END_FUNC(STATIC) /* end H5HL__remove_free() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__remove_free() */
/*-------------------------------------------------------------------------
* Function: H5HL__dirty
@@ -479,9 +499,14 @@ END_FUNC(STATIC) /* end H5HL__remove_free() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap))
+static herr_t
+H5HL__dirty(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
HDassert(heap);
HDassert(heap->prfx);
@@ -491,44 +516,50 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap))
HDassert(heap->dblk);
if (FAIL == H5AC_mark_entry_dirty(heap->dblk))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty");
+ }
/* Mark heap prefix as dirty */
if (FAIL == H5AC_mark_entry_dirty(heap->prfx))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty");
- CATCH
- /* No special processing on errors */
-
-END_FUNC(STATIC) /* end H5HL__dirty() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dirty() */
/*-------------------------------------------------------------------------
* Function: H5HL_insert
*
* Purpose: Inserts a new item into the heap.
*
- * Return: Success: Offset of new item within heap.
- * Failure: UFAIL
+ * Return: Success: SUCCEED
+ * Offset set to location of new item within heap
+ *
+ * Failure: FAIL
+ * Offset set to SIZE_MAX
*
* Programmer: Robb Matzke
* Jul 17 1997
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
- H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
-
+herr_t
+H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out)
+{
H5HL_free_t *fl = NULL, *last_fl = NULL;
- size_t offset = 0;
size_t need_size;
+ size_t offset = 0;
hbool_t found;
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(buf_size > 0);
HDassert(buf);
+ HDassert(offset_out);
/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
@@ -537,22 +568,20 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
* if an error occurs -QAK)
*/
if (FAIL == H5HL__dirty(heap))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty");
- /*
- * In order to keep the free list descriptors aligned on word boundaries,
+ /* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
* a word.
*/
need_size = H5HL_ALIGN(buf_size);
- /*
- * Look for a free slot large enough for this object and which would
+ /* Look for a free slot large enough for this object and which would
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) {
if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) {
- /* a big enough free block was found */
+ /* A big enough free block was found */
offset = fl->offset;
fl->offset += need_size;
fl->size -= need_size;
@@ -562,20 +591,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
break;
}
else if (fl->size == need_size) {
- /* free block of exact size found */
+ /* Free block of exact size found */
offset = fl->offset;
fl = H5HL__remove_free(heap, fl);
found = TRUE;
break;
}
else if (!last_fl || last_fl->offset < fl->offset) {
- /* track free space that's closest to end of heap */
+ /* Track free space that's closest to end of heap */
last_fl = fl;
}
- } /* end for */
+ }
- /*
- * If no free chunk was large enough, then allocate more space and
+ /* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
* can extend that free chunk. Otherwise we'll have to make another
* free chunk. If the heap must expand, we double its size.
@@ -587,7 +615,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
htri_t was_extended; /* Whether the local heap's data segment on disk was extended */
/* At least double the heap's size, making certain there's enough room
- * for the new object */
+ * for the new object
+ */
need_more = MAX(need_size, heap->dblk_size);
/* If there is no last free block or it's not at the end of the heap,
@@ -610,7 +639,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
was_extended = H5MF_try_extend(f, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size),
(hsize_t)need_more);
if (FAIL == was_extended)
- H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap");
/* Check if we extended the heap data block in file */
if (was_extended == TRUE) {
@@ -618,22 +647,22 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
if (heap->single_cache_obj) {
/* Resize prefix+data block */
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache");
+ }
else {
/* Resize 'standalone' data block */
if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache");
- } /* end else */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache");
+ }
/* Note new size */
heap->dblk_size = new_dblk_size;
- } /* end if */
+ }
else { /* ...if we can't, allocate a new chunk & release the old */
/* Reallocate data block in file */
if (FAIL == H5HL__dblk_realloc(f, heap, new_dblk_size))
- H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed");
+ }
/* If the last free list in the heap is at the end of the heap, extend it */
if (last_fl && last_fl->offset + last_fl->size == old_dblk_size) {
@@ -655,16 +684,15 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
#endif
last_fl = H5HL__remove_free(heap, last_fl);
}
- } /* end if */
+ }
else {
- /*
- * Create a new free list element large enough that we can
+ /* Create a new free list element large enough that we can
* take some space out of it right away.
*/
offset = old_dblk_size;
if (need_more - need_size >= H5HL_SIZEOF_FREE(f)) {
if (NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
fl->offset = old_dblk_size + need_size;
fl->size = need_more - need_size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
@@ -681,7 +709,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
(unsigned long)(need_more - need_size), __LINE__);
#endif
}
- } /* end else */
+ }
#ifdef H5HL_DEBUG
if (H5DEBUG(HL)) {
@@ -690,23 +718,21 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
}
#endif
if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Clear new section so junk doesn't appear in the file */
/* (Avoid clearing section which will be overwritten with newly inserted data) */
HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size)));
- } /* end if */
+ }
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
- /* Set return value */
- ret_value = offset;
-
- CATCH
- /* No special processing on errors */
+ *offset_out = offset;
-END_FUNC(PRIV) /* H5HL_insert() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5HL_insert() */
/*-------------------------------------------------------------------------
* Function: H5HL_remove
@@ -731,11 +757,15 @@ END_FUNC(PRIV) /* H5HL_insert() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size))
+herr_t
+H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size)
+{
+ H5HL_free_t *fl = NULL;
+ herr_t ret_value = SUCCEED;
- H5HL_free_t *fl = NULL;
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(size > 0);
@@ -746,17 +776,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
HDassert(offset < heap->dblk_size);
HDassert(offset + size <= heap->dblk_size);
- /* Mark heap as dirty in cache */
- /* (A bit early in the process, but it's difficult to determine in the
+ /* Mark heap as dirty in cache
+ *
+ * (A bit early in the process, but it's difficult to determine in the
* code below where to mark the heap as dirty, especially in error cases,
* so we just accept that an extra flush of the heap info could occur
* if an error occurs -QAK)
*/
if (FAIL == H5HL__dirty(heap))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty");
- /*
- * Check if this chunk can be prepended or appended to an already
+ /* Check if this chunk can be prepended or appended to an already
* free chunk. It might also fall between two chunks in such a way
* that all three chunks can be combined into one.
*/
@@ -779,17 +809,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
fl2 = H5HL__remove_free(heap, fl2);
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
}
- H5_LEAVE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
fl2 = fl2->next;
}
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
}
- H5_LEAVE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
else if (fl->offset + fl->size == offset) {
fl->size += size;
@@ -802,20 +832,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
fl2 = H5HL__remove_free(heap, fl2);
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
- } /* end if */
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
+ }
+ HGOTO_DONE(SUCCEED)
+ }
fl2 = fl2->next;
- } /* end while */
+ }
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
- } /* end if */
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
+ }
+ HGOTO_DONE(SUCCEED)
+ }
fl = fl->next;
- } /* end while */
+ }
/*
* The amount which is being removed must be large enough to
@@ -828,14 +858,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size);
}
#endif
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_DONE(SUCCEED)
+ }
- /*
- * Add an entry to the free list.
- */
+ /* Add an entry to the free list */
if (NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
fl->offset = offset;
fl->size = size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
@@ -848,12 +876,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size))
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
- CATCH
- /* No special processing on exit */
-
-END_FUNC(PRIV) /* end H5HL_remove() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_remove() */
/*-------------------------------------------------------------------------
* Function: H5HL_delete
@@ -867,15 +894,19 @@ END_FUNC(PRIV) /* end H5HL_remove() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr))
-
+herr_t
+H5HL_delete(H5F_t *f, haddr_t addr)
+{
H5HL_t * heap = NULL; /* Local heap to delete */
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_dblk_t * dblk = NULL; /* Local heap data block */
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
@@ -888,7 +919,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -898,21 +929,22 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)
/* Protect the local heap data block */
if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap,
H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block");
/* Set the flags for releasing the prefix and data block */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
+done:
/* Release the data block from the cache, now deleted */
if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block");
/* Release the prefix from the cache, now deleted */
if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_delete() */
/*-------------------------------------------------------------------------
* Function: H5HL_get_size
@@ -926,13 +958,17 @@ END_FUNC(PRIV) /* end H5HL_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size))
+herr_t
+H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size)
+{
+ 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 = NULL; /* Heap data structure */
+ herr_t ret_value = SUCCEED;
- 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 = NULL; /* Heap data structure */
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(size);
@@ -946,7 +982,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -954,11 +990,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add
/* Set the size to return */
*size = heap->dblk_size;
- CATCH
+done:
if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_get_size() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_get_size() */
/*-------------------------------------------------------------------------
* Function: H5HL_heapsize
@@ -973,13 +1010,17 @@ END_FUNC(PRIV) /* end H5HL_get_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size))
+herr_t
+H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size)
+{
+ 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 = NULL; /* Heap data structure */
+ herr_t ret_value = SUCCEED;
- 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 = NULL; /* Heap data structure */
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(heap_size);
@@ -993,7 +1034,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -1001,8 +1042,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add
/* Accumulate the size of the local heap */
*heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size);
- CATCH
+done:
if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_heapsize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_heapsize() */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 05a45f1..9eb390b 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -161,7 +161,7 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t *
HDassert(udata);
/* Check magic number */
- if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature")
image += H5_SIZEOF_MAGIC;
@@ -250,7 +250,7 @@ H5HL__fl_deserialize(H5HL_t *heap)
heap->freelist = fl;
tail = fl;
fl = NULL;
- } /* end while */
+ }
done:
if (ret_value < 0)
@@ -296,7 +296,7 @@ H5HL__fl_serialize(const H5HL_t *heap)
H5F_ENCODE_LENGTH_LEN(image, H5HL_FREE_NULL, heap->sizeof_size)
H5F_ENCODE_LENGTH_LEN(image, fl->size, heap->sizeof_size)
- } /* end for */
+ }
FUNC_LEAVE_NOAPI_VOID
@@ -450,13 +450,13 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED
/* Build free list */
if (H5HL__fl_deserialize(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
- } /* end if */
+ }
else
/* Note that the heap should _NOT_ be a single
* object in the cache
*/
heap->single_cache_obj = FALSE;
- } /* end if */
+ }
/* Set return value */
ret_value = prfx;
@@ -467,12 +467,12 @@ done:
if (prfx) {
if (FAIL == H5HL__prfx_dest(prfx))
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix");
- } /* end if */
+ }
else {
if (heap && FAIL == H5HL__dest(heap))
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap");
- } /* end else */
- } /* end if */
+ }
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL__cache_prefix_deserialize() */
@@ -588,7 +588,7 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image,
gap = heap->prfx_size - (size_t)(image - (uint8_t *)_image);
HDmemset(image, 0, gap);
image += gap;
- } /* end if */
+ }
/* Serialize the free list into the heap data's image */
H5HL__fl_serialize(heap);
@@ -598,14 +598,14 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len);
- } /* end if */
+ }
else {
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
/* Clear rest of local heap */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
- } /* end else */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL__cache_prefix_serialize() */
@@ -736,7 +736,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h
/* Build free list */
if (FAIL == H5HL__fl_deserialize(heap))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list");
- } /* end if */
+ }
/* Set return value */
ret_value = dblk;
@@ -892,7 +892,7 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing)
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
break;
- } /* end switch */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index d0cfa96..305014b 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -44,14 +44,17 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
- H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth))
-
+herr_t
+H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
+{
H5HL_t * h = NULL;
int free_block;
H5HL_free_t *freelist;
uint8_t * marker = NULL;
size_t amount_free = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* check arguments */
HDassert(f);
@@ -61,7 +64,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
HDassert(fwidth >= 0);
if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load/protect local heap")
HDfprintf(stream, "%*sLocal Heap...\n", indent, "");
HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size);
@@ -73,7 +76,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
* the heap.
*/
if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, "");
for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) {
@@ -92,26 +95,27 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
if (marker[freelist->offset + i])
overlap++;
marker[freelist->offset + i] = 1;
- } /* end for */
+ }
if (overlap)
HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
else
amount_free += freelist->size;
- } /* end else */
- } /* end for */
+ }
+ }
if (h->dblk_size)
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:",
- ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
+ (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
/* Print the data in a VMS-style octal dump */
H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
- CATCH
+done:
if (h && FAIL == H5HL_unprotect(h))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release/unprotect local heap")
if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker)))
- H5E_THROW(H5E_CANTFREE, "can't free marker buffer");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free marker buffer")
-END_FUNC(PRIV) /* end H5HL_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_debug() */
diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c
index f771de5..9e6fc4a 100644
--- a/src/H5HLdblk.c
+++ b/src/H5HLdblk.c
@@ -81,20 +81,24 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap))
+H5HL_dblk_t *
+H5HL__dblk_new(H5HL_t *heap)
+{
+ H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ H5HL_dblk_t *ret_value = NULL;
- H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
/* Allocate new local heap data block */
if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap data block")
/* Increment ref. count on heap data structure */
if (FAIL == H5HL__inc_rc(heap))
- H5E_THROW(H5E_CANTINC, "can't increment heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the data block */
dblk->heap = heap;
@@ -103,13 +107,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap))
/* Set the return value */
ret_value = dblk;
- CATCH
+done:
/* Ensure that the data block memory is deallocated on errors */
if (!ret_value && dblk != NULL)
/* H5FL_FREE always returns NULL so we can't check for errors */
dblk = H5FL_FREE(H5HL_dblk_t, dblk);
-END_FUNC(PKG) /* end H5HL__dblk_new() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5HL__dblk_new() */
/*-------------------------------------------------------------------------
* Function: H5HL__dblk_dest
@@ -123,7 +128,12 @@ END_FUNC(PKG) /* end H5HL__dblk_new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk))
+herr_t
+H5HL__dblk_dest(H5HL_dblk_t *dblk)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(dblk);
@@ -135,18 +145,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk))
/* Decrement ref. count on heap data structure */
if (FAIL == H5HL__dec_rc(dblk->heap))
- H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from data block */
dblk->heap = NULL;
- } /* end if */
+ }
- CATCH
+done:
/* Free local heap data block */
/* H5FL_FREE always returns NULL so we can't check for errors */
dblk = H5FL_FREE(H5HL_dblk_t, dblk);
-END_FUNC(PKG) /* end H5HL__dblk_dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dblk_dest() */
/*-------------------------------------------------------------------------
* Function: H5HL__dblk_realloc
@@ -160,14 +171,18 @@ END_FUNC(PKG) /* end H5HL__dblk_dest() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size))
-
+herr_t
+H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size)
+{
H5HL_dblk_t *dblk; /* Local heap data block */
haddr_t old_addr; /* Old location of heap data block */
haddr_t new_addr; /* New location of heap data block */
size_t old_heap_size; /* Old size of heap data block */
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
HDassert(heap);
HDassert(new_heap_size > 0);
@@ -176,12 +191,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
old_heap_size = heap->dblk_size;
H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t);
if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)old_heap_size))
- H5E_THROW(H5E_CANTFREE, "can't free old local heap data");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free old local heap data");
/* Allocate new space on disk */
H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t);
if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, (hsize_t)new_heap_size)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for local heap");
/* Update heap info*/
heap->dblk_addr = new_addr;
@@ -197,8 +212,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
/* Resize the heap prefix in the cache */
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache");
+ }
else {
/* Sanity check */
HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr));
@@ -206,50 +221,49 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
/* Resize the heap data block in the cache */
if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0)
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache");
- } /* end else */
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap (data block) in cache");
+ }
+ }
else {
/* Check if heap data block was contiguous w/prefix previously */
if (heap->single_cache_obj) {
/* Create new heap data block */
if (NULL == (dblk = H5HL__dblk_new(heap)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block");
/* Resize current heap prefix */
heap->prfx_size = H5HL_SIZEOF_HDR(f);
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache");
/* Insert data block into cache (pinned) */
if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG))
- H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block");
dblk = NULL;
/* Reset 'single cache object' flag */
heap->single_cache_obj = FALSE;
- } /* end if */
+ }
else {
/* Resize the heap data block in the cache */
/* (ignore [unlikely] case where heap data block ends up
* contiguous w/heap prefix again.
*/
if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache");
/* Relocate the heap data block in the cache */
if (FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr))
- H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache");
-
- } /* end else */
- } /* end else */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move heap data block in cache");
+ }
+ }
- CATCH
+done:
/* Restore old heap address & size on errors */
if (FAIL == ret_value) {
heap->dblk_addr = old_addr;
heap->dblk_size = old_heap_size;
- } /* end if */
-
-END_FUNC(PKG) /* end H5HL__dblk_realloc() */
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dblk_realloc() */
diff --git a/src/H5HLint.c b/src/H5HLint.c
index 069bad8..42d6744 100644
--- a/src/H5HLint.c
+++ b/src/H5HLint.c
@@ -80,10 +80,13 @@ H5FL_DEFINE_STATIC(H5HL_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
- H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size))
+H5HL_t *
+H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
+{
+ H5HL_t *heap = NULL; /* New local heap */
+ H5HL_t *ret_value = NULL;
- H5HL_t *heap = NULL; /* New local heap */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(sizeof_size > 0);
@@ -92,7 +95,7 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
/* Allocate new local heap structure */
if (NULL == (heap = H5FL_CALLOC(H5HL_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Initialize non-zero fields */
heap->sizeof_size = sizeof_size;
@@ -102,12 +105,13 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
/* Set the return value */
ret_value = heap;
- CATCH
+done:
if (!ret_value && heap != NULL)
if (NULL == (heap = H5FL_FREE(H5HL_t, heap)))
- H5E_THROW(H5E_CANTFREE, "can't free heap memory");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't free heap memory")
-END_FUNC(PKG) /* end H5HL__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__new() */
/*-------------------------------------------------------------------------
* Function: H5HL__inc_rc
@@ -121,7 +125,10 @@ END_FUNC(PKG) /* end H5HL__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap))
+herr_t
+H5HL__inc_rc(H5HL_t *heap)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* check arguments */
HDassert(heap);
@@ -129,7 +136,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap))
/* Increment heap's ref. count */
heap->rc++;
-END_FUNC(PKG) /* end H5HL__inc_rc() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL__inc_rc() */
/*-------------------------------------------------------------------------
* Function: H5HL__dec_rc
@@ -143,7 +151,12 @@ END_FUNC(PKG) /* end H5HL__inc_rc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap))
+herr_t
+H5HL__dec_rc(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
@@ -151,12 +164,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap))
/* Decrement heap's ref. count */
heap->rc--;
- CATCH
/* Check if we should destroy the heap */
if (heap->rc == 0 && FAIL == H5HL__dest(heap))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap");
-END_FUNC(PKG) /* end H5HL__dec_rc() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dec_rc() */
/*-------------------------------------------------------------------------
* Function: H5HL__dest
@@ -170,7 +184,12 @@ END_FUNC(PKG) /* end H5HL__dec_rc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap))
+herr_t
+H5HL__dest(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
@@ -181,20 +200,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap))
HDassert(heap->prfx == NULL);
HDassert(heap->dblk == NULL);
- CATCH
+ /* Use DONE errors here to try to free as much as possible */
if (heap->dblk_image)
if (NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data block image");
while (heap->freelist) {
H5HL_free_t *fl;
fl = heap->freelist;
heap->freelist = fl->next;
if (NULL != (fl = H5FL_FREE(H5HL_free_t, fl)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap free list");
- } /* end while */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap free list");
+ }
if (NULL != (heap = H5FL_FREE(H5HL_t, heap)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap");
-END_FUNC(PKG) /* end H5HL__dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dest() */
diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h
index dbac1b9..0ba3b1c 100644
--- a/src/H5HLpkg.h
+++ b/src/H5HLpkg.h
@@ -54,7 +54,7 @@ H5FL_BLK_EXTERN(lheap_chunk);
#define H5_MY_PKG H5HL
#define H5_MY_PKG_ERR H5E_HEAP
#define H5_MY_PKG_INIT NO
-#endif /* H5HL_PACKAGE */
+#endif
#define H5HL_SIZEOF_HDR(F) \
H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \
diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c
index 90f6c74..03e3999 100644
--- a/src/H5HLprfx.c
+++ b/src/H5HLprfx.c
@@ -80,20 +80,24 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap))
+H5HL_prfx_t *
+H5HL__prfx_new(H5HL_t *heap)
+{
+ H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ H5HL_prfx_t *ret_value = NULL;
- H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
/* Allocate new local heap prefix */
if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap prefix")
/* Increment ref. count on heap data structure */
if (FAIL == H5HL__inc_rc(heap))
- H5E_THROW(H5E_CANTINC, "can't increment heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the prefix */
prfx->heap = heap;
@@ -102,13 +106,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap))
/* Set the return value */
ret_value = prfx;
- CATCH
+done:
/* Ensure that the prefix memory is deallocated on errors */
if (!ret_value && prfx != NULL)
/* H5FL_FREE always returns NULL so we can't check for errors */
prfx = H5FL_FREE(H5HL_prfx_t, prfx);
-END_FUNC(PKG) /* end H5HL__prfx_new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__prfx_new() */
/*-------------------------------------------------------------------------
* Function: H5HL__prfx_dest
@@ -122,7 +127,12 @@ END_FUNC(PKG) /* end H5HL__prfx_new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx))
+herr_t
+H5HL__prfx_dest(H5HL_prfx_t *prfx)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(prfx);
@@ -134,15 +144,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx))
/* Decrement ref. count on heap data structure */
if (FAIL == H5HL__dec_rc(prfx->heap))
- H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from prefix */
prfx->heap = NULL;
- } /* end if */
+ }
- CATCH
+done:
/* Free prefix memory */
/* H5FL_FREE always returns NULL so we can't check for errors */
prfx = H5FL_FREE(H5HL_prfx_t, prfx);
-END_FUNC(PKG) /* end H5HL__prfx_dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__prfx_dest() */
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 739e761..02e07eb 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -57,7 +57,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/);
H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr);
H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size);
H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size);
-H5_DLL size_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf);
+H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset);
H5_DLL void * H5HL_offset_into(const H5HL_t *heap, size_t offset);
H5_DLL H5HL_t *H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags);
H5_DLL herr_t H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size);
@@ -66,4 +66,4 @@ H5_DLL herr_t H5HL_unprotect(H5HL_t *heap);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth);
-#endif
+#endif /* H5HLprivate_H */
diff --git a/src/H5I.c b/src/H5I.c
index 1973354..954a86b 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -925,9 +925,11 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj = NULL; /* Object stored in ID */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object stored in ID */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
@@ -940,11 +942,19 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* 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)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iget_name() */
diff --git a/src/H5Idbg.c b/src/H5Idbg.c
index 8894230..8bf8ecb 100644
--- a/src/H5Idbg.c
+++ b/src/H5Idbg.c
@@ -30,7 +30,6 @@
#include "H5Gprivate.h" /* Groups */
#include "H5Ipkg.h" /* IDs */
#include "H5RSprivate.h" /* Reference-counted strings */
-#include "H5SLprivate.h" /* Skip Lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
@@ -86,6 +85,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
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) {
@@ -110,9 +110,9 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_DATATYPE: {
const H5T_t *dt = (const H5T_t *)info->object;
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
path = H5T_nameof((const H5T_t *)object);
break;
@@ -173,6 +173,9 @@ H5I_dump_ids_for_type(H5I_type_t 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);
@@ -182,7 +185,17 @@ H5I_dump_ids_for_type(H5I_type_t type)
/* List */
if (type_info->id_count > 0) {
HDfprintf(stderr, " List:\n");
- H5SL_iterate(type_info->ids, H5I__id_dump_cb, &type);
+ /* 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
diff --git a/src/H5Idevelop.h b/src/H5Idevelop.h
new file mode 100644
index 0000000..3cd951e
--- /dev/null
+++ b/src/H5Idevelop.h
@@ -0,0 +1,139 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5I (ID management) developer
+ * support routines.
+ */
+
+#ifndef _H5Idevelop_H
+#define _H5Idevelop_H
+
+/* Include package's public header */
+#include "H5Ipublic.h" /* ID management */
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/**
+ * 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] -->
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5Idevelop_H */
diff --git a/src/H5Iint.c b/src/H5Iint.c
index a025331..86a2810 100644
--- a/src/H5Iint.c
+++ b/src/H5Iint.c
@@ -29,7 +29,6 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
-#include "H5SLprivate.h" /* Skip Lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
@@ -75,7 +74,7 @@ typedef struct {
/********************/
static void * H5I__unwrap(void *object, H5I_type_t type);
-static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
+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);
@@ -96,6 +95,9 @@ 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 */
/*****************************/
@@ -131,7 +133,7 @@ H5I_term_package(void)
/* 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->ids)
+ 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 */
@@ -139,7 +141,7 @@ H5I_term_package(void)
for (i = 0; i < H5I_next_type_g; i++) {
type_info = H5I_type_info_array_g[i];
if (type_info) {
- HDassert(NULL == type_info->ids);
+ HDassert(NULL == type_info->hash_table);
type_info = H5MM_xfree(type_info);
H5I_type_info_array_g[i] = NULL;
in_use++;
@@ -196,8 +198,7 @@ H5I_register_type(const H5I_class_t *cls)
type_info->id_count = 0;
type_info->nextid = cls->reserved;
type_info->last_id_info = NULL;
- if (NULL == (type_info->ids = H5SL_create(H5SL_TYPE_HID, NULL)))
- HGOTO_ERROR(H5E_ID, H5E_CANTCREATE, FAIL, "skip list creation failed")
+ type_info->hash_table = NULL;
}
/* Increment the count of the times this type has been initialized */
@@ -205,13 +206,9 @@ H5I_register_type(const H5I_class_t *cls)
done:
/* Clean up on error */
- if (ret_value < 0) {
- if (type_info) {
- if (type_info->ids)
- H5SL_close(type_info->ids);
+ if (ret_value < 0)
+ if (type_info)
H5MM_free(type_info);
- }
- }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_register_type() */
@@ -311,7 +308,9 @@ H5I__unwrap(void *object, H5I_type_t type)
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_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)
@@ -328,33 +327,57 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
udata.force = force;
udata.app_ref = app_ref;
- /* Attempt to free all ids in the type */
- if (H5SL_try_free_safe(udata.type_info->ids, H5I__clear_type_cb, &udata) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, FAIL, "can't free ids in type")
+ /* 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__clear_type_cb
+ * Function: H5I__mark_node
*
- * Purpose: Attempts to free the specified ID, calling the free
- * function for the object.
+ * Purpose: Attempts to mark the node for freeing and calls the free
+ * function for the object, if any
*
- * Return: TRUE/FALSE/FAIL
+ * Return: SUCCEED/FAIL
*
* Programmer: Neil Fortner
* Friday, July 10, 2015
*
*-------------------------------------------------------------------------
*/
-static htri_t
-H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
+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 */
- htri_t ret_value = FALSE; /* Return value */
+ 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
@@ -368,7 +391,7 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
*/
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")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (info->is_future) {
/* Discard the future object */
if ((info->discard_cb)((void *)info->object) < 0) {
@@ -383,12 +406,12 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
#endif /* H5I_DEBUG */
/* Indicate node should be removed from list */
- ret_value = TRUE;
+ mark = TRUE;
}
}
else {
/* Indicate node should be removed from list */
- ret_value = TRUE;
+ mark = TRUE;
}
}
else {
@@ -406,28 +429,28 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
#endif /* H5I_DEBUG */
/* Indicate node should be removed from list */
- ret_value = TRUE;
+ mark = TRUE;
}
}
else {
/* Indicate node should be removed from list */
- ret_value = TRUE;
+ mark = TRUE;
}
}
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Remove ID if requested */
- if (ret_value) {
- /* Free ID info */
- info = H5FL_FREE(H5I_id_info_t, info);
+ 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(ret_value)
-} /* end H5I__clear_type_cb() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5I__mark_node() */
/*-------------------------------------------------------------------------
* Function: H5I__destroy_type
@@ -461,16 +484,18 @@ H5I__destroy_type(H5I_type_t type)
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_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);
- if (H5SL_close(type_info->ids) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list")
- type_info->ids = NULL;
+ HASH_CLEAR(hh, type_info->hash_table);
+ type_info->hash_table = NULL;
type_info = H5MM_xfree(type_info);
@@ -528,10 +553,10 @@ H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, H5I_future_r
info->is_future = (NULL != realize_cb);
info->realize_cb = realize_cb;
info->discard_cb = discard_cb;
+ info->marked = FALSE;
/* Insert into the type */
- if (H5SL_insert(type_info->ids, info, &info->id) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list")
+ HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info);
type_info->id_count++;
type_info->nextid++;
@@ -640,10 +665,10 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h
info->is_future = FALSE;
info->realize_cb = NULL;
info->discard_cb = NULL;
+ info->marked = FALSE;
/* Insert into the type */
- if (H5SL_insert(type_info->ids, info, &info->id) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list")
+ HASH_ADD(hh, type_info->hash_table, id, sizeof(hid_t), info);
type_info->id_count++;
/* Set the most recent ID to this object */
@@ -680,9 +705,9 @@ H5I_subst(hid_t id, const void *new_object)
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")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Set the new object pointer for the ID */
info->object = new_object;
@@ -714,9 +739,9 @@ H5I_object(hid_t id)
/* General lookup of the ID */
if (NULL != (info = H5I__find_id(id))) {
/* Get the object pointer to return */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -750,9 +775,9 @@ H5I_object_verify(hid_t id, H5I_type_t type)
/* 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")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -897,19 +922,28 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
/* Sanity check */
HDassert(type_info);
- /* Get the ID node for the ID */
- if (NULL == (info = (H5I_id_info_t *)H5SL_remove(type_info->ids, &id)))
- HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from skip list")
+ /* 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")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
- info = H5FL_FREE(H5I_id_info_t, info);
+ if (!H5I_marking_g)
+ info = H5FL_FREE(H5I_id_info_t, info);
/* Decrement the number of IDs in the type */
(type_info->id_count)--;
@@ -1006,7 +1040,7 @@ H5I__dec_ref(hid_t id, void **request)
/* Get the ID's type */
type_info = H5I_type_info_array_g[H5I_TYPE(id)];
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_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 */
@@ -1016,7 +1050,7 @@ H5I__dec_ref(hid_t id, void **request)
} /* end if */
else
ret_value = -1;
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
else {
--(info->count);
@@ -1495,9 +1529,9 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
/* 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")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Invoke callback function */
cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata);
@@ -1552,8 +1586,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
/* 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 */
- herr_t iter_status; /* Iteration status */
+ 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;
@@ -1562,8 +1597,16 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
iter_udata.obj_type = type;
/* Iterate over IDs */
- if ((iter_status = H5SL_iterate(type_info->ids, H5I__iterate_cb, &iter_udata)) < 0)
- HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed")
+ 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:
@@ -1604,15 +1647,14 @@ H5I__find_id(hid_t id)
if (type_info->last_id_info && type_info->last_id_info->id == id)
id_info = type_info->last_id_info;
else {
- /* Locate the ID node for the ID */
- id_info = (H5I_id_info_t *)H5SL_search(type_info->ids, &id);
+ 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")
+ H5_GCC_CLANG_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 */
@@ -1644,7 +1686,7 @@ H5I__find_id(hid_t id)
id_info->realize_cb = NULL;
id_info->discard_cb = NULL;
}
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Set return value */
ret_value = id_info;
@@ -1679,9 +1721,9 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
HDassert(udata);
/* Get a pointer to the VOL connector's data */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Check for a match */
if (object == udata->object) {
@@ -1721,8 +1763,9 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
/* 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 */
- herr_t iter_status; /* Iteration status */
+ 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;
@@ -1730,8 +1773,14 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
udata.ret_id = H5I_INVALID_HID;
/* Iterate over IDs for the ID type */
- if ((iter_status = H5SL_iterate(type_info->ids, H5I__find_id_cb, &udata)) < 0)
- HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed")
+ 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;
}
diff --git a/src/H5Imodule.h b/src/H5Imodule.h
index 8db31c8..08f8bb0 100644
--- a/src/H5Imodule.h
+++ b/src/H5Imodule.h
@@ -30,8 +30,85 @@
#define H5_MY_PKG_INIT NO
/**\defgroup H5I H5I
- * \brief Identifier Interface
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage identifiers defined by the HDF5
+ * library. See \ref H5IUD for user-defined identifiers and identifier
+ * types.
+ *
+ * HDF5 identifiers are usually created as a side-effect of creating HDF5
+ * entities such as groups, datasets, attributes, or property lists.
+ *
+ * Identifiers defined by the HDF5 library can be used to retrieve information
+ * such as path names and reference counts, and their validity can be checked.
+ *
+ * Identifiers can be updated by manipulating their reference counts.
+ *
+ * Unused identifiers should be reclaimed by closing the associated item, e.g.,
+ * HDF5 object, or decrementing the reference count to 0.
+ *
+ * \note Identifiers (of type \ref hid_t) are run-time auxiliaries and
+ * not persisted in the file.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup H5IUD User-defined ID Types
+ * \ingroup H5I
+ *
+ * The \ref H5I module contains functions to define new identifier types.
+ * For convenience, handles of type \ref hid_t can then be associated with the
+ * new identifier types and user objects.
+ *
+ * New identifier types can be created by registering a new identifier type
+ * with the HDF5 library. Once a new identifier type has bee registered,
+ * it can be used to generate identifiers for user objects.
+ *
+ * User-defined identifier types can be searched and iterated.
+ *
+ * Like library-defined identifiers, user-defined identifiers \Emph{and}
+ * identifier types are reference counted, and the reference counts can be
+ * manipulated accordingly.
+ *
+ * User-defined identifiers no longer in use should be deleted or reclaimed,
+ * and identifier types should be destroyed if they are no longer required.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c create_ud
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c read_ud
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c update_ud
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c delete_ud
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5Imodule_H */
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index 4cec8c6..e93ec74 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -29,8 +29,14 @@
/* Get package's private header */
#include "H5Iprivate.h"
-/* Other private headers needed by this file */
-#include "H5SLprivate.h" /* Skip Lists */
+/* 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 */
@@ -72,6 +78,10 @@ typedef struct H5I_id_info_t {
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 */
@@ -81,7 +91,7 @@ typedef struct H5I_type_info_t {
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 */
- H5SL_t * ids; /* Pointer to skip list that stores IDs */
+ H5I_id_info_t * hash_table; /* Hash table pointer for this ID type */
} H5I_type_info_t;
/*****************************/
@@ -91,12 +101,13 @@ typedef struct H5I_type_info_t {
/* 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 */
+/* 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;
/******************************/
@@ -116,4 +127,4 @@ H5_DLL H5I_id_info_t *H5I__find_id(hid_t id);
H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached);
#endif /* H5I_TESTING */
-#endif /*_H5Ipkg_H*/
+#endif /*H5Ipkg_H*/
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index d1b6248..831ff76 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -20,8 +20,9 @@
#ifndef H5Iprivate_H
#define H5Iprivate_H
-/* Include package's public header */
+/* Include package's public headers */
#include "H5Ipublic.h"
+#include "H5Idevelop.h"
/* Private headers needed by this file */
#include "H5private.h"
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index be347e4..8d4dbf8 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -32,6 +32,7 @@
* 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 */
@@ -53,6 +54,7 @@ typedef enum H5I_type_t {
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 IDs to return to users
@@ -86,30 +88,16 @@ typedef herr_t (*H5I_free_t)(void *, void **);
/**
* The type of a function to compare objects & keys
*/
-//! [H5I_search_func_t_snip]
+//! <!-- [H5I_search_func_t_snip] -->
typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key);
-//! [H5I_search_func_t_snip]
+//! <!-- [H5I_search_func_t_snip] -->
/**
* The type of H5Iiterate() callback functions
*/
-//! [H5I_iterate_func_t_snip]
+//! <!-- [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]
+//! <!-- [H5I_iterate_func_t_snip] -->
#ifdef __cplusplus
extern "C" {
@@ -118,7 +106,7 @@ extern "C" {
/* Public API functions */
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Registers an object under a type and returns an ID for it
*
@@ -140,83 +128,7 @@ extern "C" {
*/
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 \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
+ * \ingroup H5IUD
*
* \brief Returns the object referenced by an ID
*
@@ -239,7 +151,7 @@ H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_
*/
H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Removes an ID from its type
*
@@ -278,12 +190,7 @@ H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t type);
* \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:
- * \types
- *
- * If no valid type can be determined or the identifier submitted is
+ * \p id. 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
@@ -479,7 +386,7 @@ H5_DLL int H5Idec_ref(hid_t id);
*/
H5_DLL int H5Iget_ref(hid_t id);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Creates and returns a new ID type
*
@@ -511,7 +418,7 @@ H5_DLL int H5Iget_ref(hid_t id);
*/
H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Deletes all identifiers of the given type
*
@@ -535,7 +442,7 @@ H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free
*/
H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Removes an identifier type and all identifiers within that type
*
@@ -558,7 +465,7 @@ H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
*/
H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Increments the reference count on an ID type
*
@@ -577,7 +484,7 @@ H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
*/
H5_DLL int H5Iinc_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Decrements the reference count on an identifier type
*
@@ -597,7 +504,7 @@ H5_DLL int H5Iinc_type_ref(H5I_type_t type);
*/
H5_DLL int H5Idec_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Retrieves the reference count on an ID type
*
@@ -616,7 +523,7 @@ H5_DLL int H5Idec_type_ref(H5I_type_t type);
*/
H5_DLL int H5Iget_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Finds the memory referred to by an ID within the given ID type such
* that some criterion is satisfied
@@ -657,7 +564,7 @@ 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);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Calls a callback for each member of the identifier type specified
*
@@ -686,7 +593,7 @@ 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);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Returns the number of identifiers in a given identifier type
*
@@ -706,7 +613,7 @@ 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);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Determines whether an identifier type is registered
*
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 71ef3f8..80738a9 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -71,6 +71,7 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
H5G_loc_t loc; /* Object location */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ size_t name_len = 0; /* Length of name */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
@@ -86,7 +87,7 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
/* Set wrapper info in API context */
if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ HGOTO_ERROR(H5E_ID, H5E_CANTSET, (-1), "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Get object location */
@@ -94,13 +95,16 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
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)
+ if (H5G_get_name(&loc, name, size, &name_len, cached) < 0)
HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)name_len;
+
done:
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_ID, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+ HDONE_ERROR(H5E_ID, H5E_CANTRESET, (-1), "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/H5L.c b/src/H5L.c
index 171c128..065cc5c 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -21,17 +21,13 @@
/* 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 "H5ESprivate.h" /* Event Sets */
-#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lpkg.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL */
@@ -40,96 +36,14 @@
/* Local Macros */
/****************/
-#define H5L_MIN_TABLE_SIZE 32 /* Minimum size of the user-defined link type table if it is allocated */
-
/******************/
/* Local Typedefs */
/******************/
-/* User data for path traversal routine for getting link info by name */
-typedef struct {
- H5L_info2_t *linfo; /* Buffer to return to user */
-} H5L_trav_gi_t;
-
-/* User data for path traversal callback to creating a link */
-typedef struct {
- H5F_t * file; /* Pointer to the file */
- H5P_genplist_t * lc_plist; /* Link creation property list */
- H5G_name_t * path; /* Path to object being linked */
- H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */
- H5O_link_t * lnk; /* Pointer to link information to insert */
-} H5L_trav_cr_t;
-
-/* User data for path traversal routine for moving and renaming a link */
-typedef struct {
- const char * dst_name; /* Destination name for moving object */
- H5T_cset_t cset; /* Char set for new name */
- const H5G_loc_t *dst_loc; /* Destination location for moving object */
- unsigned dst_target_flags; /* Target flags for destination object */
- hbool_t copy; /* TRUE if this is a copy operation */
- size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */
-} H5L_trav_mv_t;
-
-/* User data for path traversal routine for moving and renaming an object */
-typedef struct {
- H5F_t * file; /* Pointer to the file */
- H5O_link_t *lnk; /* Pointer to link information to insert */
- hbool_t copy; /* TRUE if this is a copy operation */
-} H5L_trav_mv2_t;
-
-/* User data for path traversal routine for checking if a link exists */
-typedef struct {
- /* Down */
- char *sep; /* Pointer to next separator in the string */
-
- /* Up */
- hbool_t *exists; /* Whether the link exists or not */
-} H5L_trav_le_t;
-
-/* User data for path traversal routine for getting link value */
-typedef struct {
- size_t size; /* Size of user buffer */
- void * buf; /* User buffer */
-} H5L_trav_gv_t;
-
/********************/
/* Local Prototypes */
/********************/
-static int H5L__find_class_idx(H5L_type_t id);
-static herr_t H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path,
- H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id);
-static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size);
-static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
-static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/);
static herr_t H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id, void **token_ptr,
H5VL_object_t **_vol_obj_ptr);
@@ -151,9 +65,6 @@ static herr_t H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_it
/* Package Variables */
/*********************/
-/* Package initialization variable */
-hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -162,99 +73,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
-/* Information about user-defined links */
-static size_t H5L_table_alloc_g = 0;
-static size_t H5L_table_used_g = 0;
-static H5L_class_t *H5L_table_g = NULL;
-
-/*-------------------------------------------------------------------------
- * Function: H5L_init
- *
- * Purpose: Initialize the interface from some other package.
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: James Laird
- * Thursday, July 13, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_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 H5L_init() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__init_package
- *
- * Purpose: Initialize information specific to H5L interface.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Tuesday, January 24, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__init_package(void)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Initialize user-defined link classes */
- if (H5L_register_external() < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_init_package() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_term_package
- *
- * Purpose: Terminate any resources allocated in H5L__init_package.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Tuesday, January 24, 2006
- *
- *-------------------------------------------------------------------------
- */
-int
-H5L_term_package(void)
-{
- int n = 0;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if (H5_PKG_INIT_VAR) {
- /* Free the table of link types */
- if (H5L_table_g) {
- H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g);
- H5L_table_used_g = H5L_table_alloc_g = 0;
- n++;
- } /* end if */
-
- /* Mark the interface as uninitialized */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(n)
-} /* H5L_term_package() */
-
/*-------------------------------------------------------------------------
* Function: H5Lmove
*
@@ -330,14 +148,28 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary source VOL object */
- tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
- tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
+ if (vol_obj1) {
+ tmp_vol_obj.connector = vol_obj1->connector;
+ tmp_vol_obj.data = vol_obj1->data;
+ } /* end if */
+ else {
+ HDassert(vol_obj2);
+
+ tmp_vol_obj.connector = vol_obj2->connector;
+ tmp_vol_obj.data = NULL;
+ } /* end else */
/* Move the link */
if (H5VL_link_move(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id,
@@ -420,14 +252,28 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary source VOL object */
- tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
- tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
+ if (vol_obj1) {
+ tmp_vol_obj.connector = vol_obj1->connector;
+ tmp_vol_obj.data = vol_obj1->data;
+ } /* end if */
+ else {
+ HDassert(vol_obj2);
+
+ tmp_vol_obj.connector = vol_obj2->connector;
+ tmp_vol_obj.data = NULL;
+ } /* end else */
/* Copy the link */
if (H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id,
@@ -454,8 +300,9 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -468,6 +315,7 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string")
if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
+ /* link_name is verified in H5VL_setup_name_args() */
/* Get the link creation property list */
if (H5P_DEFAULT == lcpl_id)
@@ -480,15 +328,17 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* link_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(link_loc_id, link_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) <
- 0)
+ if (H5VL_setup_name_args(link_loc_id, link_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = link_target;
+
/* Create the link */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, *vol_obj_ptr, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, token_ptr, link_target) < 0)
+ if (H5VL_link_create(&vol_cb_args, *vol_obj_ptr, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
@@ -565,7 +415,7 @@ H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_li
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0)
+ H5ARG_TRACE9(__func__, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -583,31 +433,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name,
+H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr)
{
- H5VL_object_t * vol_obj1 = NULL; /* Object of cur_loc_id */
- H5VL_object_t * vol_obj2 = NULL; /* Object of new_loc_id */
+ H5VL_object_t * curr_vol_obj = NULL; /* Object of cur_loc_id */
+ H5VL_object_t * link_vol_obj = NULL; /* Object of link_loc_id */
H5VL_object_t tmp_vol_obj; /* Temporary object */
H5VL_object_t * tmp_vol_obj_ptr = &tmp_vol_obj; /* Ptr to temporary object */
H5VL_object_t **tmp_vol_obj_ptr_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj_ptr); /* Ptr to ptr to temporary object */
- H5VL_loc_params_t loc_params1; /* Location parameters for cur_loc_id object access */
- H5VL_loc_params_t loc_params2; /* Location parameters for new_loc_id object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t link_loc_params; /* Location parameters for link_loc_id object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check arguments */
- if (cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
+ if (cur_loc_id == H5L_SAME_LOC && link_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
if (!cur_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL")
if (!*cur_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string")
- if (!new_name)
+ if (!link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL")
- if (!*new_name)
+ if (!*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string")
if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -623,40 +473,59 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t new_lo
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set up current & new location structs */
- loc_params1.type = H5VL_OBJECT_BY_NAME;
- loc_params1.obj_type = H5I_get_type(cur_loc_id);
- loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = lapl_id;
-
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.obj_type = H5I_get_type(new_loc_id);
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up new location struct */
+ link_loc_params.type = H5VL_OBJECT_BY_NAME;
+ link_loc_params.obj_type = H5I_get_type(link_loc_id);
+ link_loc_params.loc_data.loc_by_name.name = link_name;
+ link_loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
if (H5L_SAME_LOC != cur_loc_id)
/* Get the current location object */
- if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
+ if (NULL == (curr_vol_obj = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- if (H5L_SAME_LOC != new_loc_id)
+ if (H5L_SAME_LOC != link_loc_id)
/* Get the new location object */
- if (NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id)))
+ if (NULL == (link_vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (curr_vol_obj && link_vol_obj) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, curr_vol_obj->connector->cls,
+ link_vol_obj->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary VOL object */
- (*tmp_vol_obj_ptr_ptr)->data = (vol_obj2 ? (vol_obj2->data) : NULL);
- (*tmp_vol_obj_ptr_ptr)->connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+ if (curr_vol_obj)
+ (*tmp_vol_obj_ptr_ptr)->connector = curr_vol_obj->connector;
+ else {
+ HDassert(link_vol_obj);
+
+ (*tmp_vol_obj_ptr_ptr)->connector = link_vol_obj->connector;
+ } /* end else */
+ if (link_vol_obj)
+ (*tmp_vol_obj_ptr_ptr)->data = link_vol_obj->data;
+ else
+ (*tmp_vol_obj_ptr_ptr)->data = NULL;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = (curr_vol_obj ? curr_vol_obj->data : NULL);
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type =
+ (H5L_SAME_LOC != cur_loc_id ? H5I_get_type(cur_loc_id) : H5I_BADID);
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.name = cur_name;
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Create the link */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, *tmp_vol_obj_ptr_ptr, &loc_params2, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, token_ptr, (vol_obj1 ? vol_obj1->data : NULL),
- &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, *tmp_vol_obj_ptr_ptr, &link_loc_params, lcpl_id, lapl_id,
+ H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@@ -716,12 +585,11 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li
const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
hid_t lapl_id, hid_t es_id)
{
- H5VL_object_t vol_obj; /* Object for loc_id */
- H5VL_object_t * vol_obj_ptr = &vol_obj; /* Pointer to object for loc_id */
- H5VL_object_t **vol_obj_ptr_ptr = &vol_obj_ptr; /* Pointer to object pointer */
- void * token = NULL; /* Request token for async operation */
- void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t vol_obj; /* Object for loc_id */
+ H5VL_object_t *vol_obj_ptr = &vol_obj; /* Pointer to object for loc_id */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE10("e", "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id,
@@ -733,14 +601,14 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li
/* Creates a hard link asynchronously */
if (H5L__create_hard_api_common(cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, token_ptr,
- vol_obj_ptr_ptr) < 0)
+ &vol_obj_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create hard link")
/* If a token was created, add the token to the event set */
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj_ptr->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -772,16 +640,16 @@ herr_t
H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- char * norm_obj_name = NULL; /* Pointer to normalized current name */
- void * ext_link_buf = NULL; /* Buffer to contain external link */
- size_t buf_size; /* Size of buffer to hold external link */
- size_t file_name_len; /* Length of file name string */
- size_t norm_obj_name_len; /* Length of normalized object name string */
- uint8_t * p; /* Pointer into external link buffer */
- H5L_type_t link_type = H5L_TYPE_EXTERNAL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ char * norm_obj_name = NULL; /* Pointer to normalized current name */
+ void * ext_link_buf = NULL; /* Buffer to contain external link */
+ size_t buf_size; /* Size of buffer to hold external link */
+ size_t file_name_len; /* Length of file name string */
+ size_t norm_obj_name_len; /* Length of normalized object name string */
+ uint8_t * p; /* Pointer into external link buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*s*si*sii", file_name, obj_name, link_loc_id, link_name, lcpl_id, lapl_id);
@@ -832,10 +700,15 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_UD;
+ vol_cb_args.args.ud.type = H5L_TYPE_EXTERNAL;
+ vol_cb_args.args.ud.buf = ext_link_buf;
+ vol_cb_args.args.ud.buf_size = buf_size;
+
/* Create an external link */
- if (H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, ext_link_buf,
- buf_size) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
@@ -873,9 +746,10 @@ herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata,
size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, udata_size, lcpl_id, lapl_id);
@@ -908,9 +782,15 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Create external link */
- if (H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, udata, udata_size) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_UD;
+ vol_cb_args.args.ud.type = link_type;
+ vol_cb_args.args.ud.buf = udata;
+ vol_cb_args.args.ud.buf_size = udata_size;
+
+ /* Create user-defined link */
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -933,8 +813,9 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -942,12 +823,14 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok
/* name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
- /* Unlink */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, token_ptr) <
- 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
+ /* Delete link */
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -1020,7 +903,7 @@ H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1046,8 +929,9 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1060,13 +944,15 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, TRUE, lapl_id, vol_obj_ptr, &loc_params) <
+ 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
/* Delete the link */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, token_ptr) <
- 0)
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -1145,7 +1031,7 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1175,9 +1061,10 @@ done:
herr_t
H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, 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 */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id);
@@ -1190,18 +1077,23 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* Get the location object */
+ /* Get the VOL object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_VAL;
+ vol_cb_args.args.get_val.buf = buf;
+ vol_cb_args.args.get_val.buf_size = size;
+
/* Get the link value */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf,
- size) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
@@ -1230,9 +1122,10 @@ herr_t
H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
void *buf /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, buf, size, lapl_id);
@@ -1249,6 +1142,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1257,13 +1151,17 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the VOL object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_VAL;
+ vol_cb_args.args.get_val.buf = buf;
+ vol_cb_args.args.get_val.buf_size = size;
+
/* Get the link value */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf,
- size) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -1286,8 +1184,9 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1297,12 +1196,15 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for link existence")
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_EXISTS;
+ vol_cb_args.args.exists.exists = exists;
+
/* Check for the existence of the link */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, token_ptr,
- exists) < 0)
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1374,7 +1276,7 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
if (H5ES_insert(es_id, vol_obj->connector, token,
/* clang-format off */
- H5ARG_TRACE8(FUNC, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0)
+ H5ARG_TRACE8(__func__, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1398,9 +1300,10 @@ done:
herr_t
H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*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 */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
@@ -1413,18 +1316,22 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = linfo;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- linfo) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1449,9 +1356,10 @@ herr_t
H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5L_info2_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id);
@@ -1468,6 +1376,7 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1476,13 +1385,16 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = linfo;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- linfo) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1603,8 +1515,8 @@ done:
htri_t
H5Lis_registered(H5L_type_t id)
{
- size_t i; /* Local index variable */
- htri_t ret_value = FALSE; /* Return value */
+ hbool_t is_registered = FALSE;
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "Ll", id);
@@ -1614,11 +1526,10 @@ H5Lis_registered(H5L_type_t id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number")
/* Is the link class already registered? */
- for (i = 0; i < H5L_table_used_g; i++)
- if (H5L_table_g[i].id == id) {
- ret_value = TRUE;
- break;
- } /* end if */
+ if (H5L_is_registered(id, &is_registered) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "could not determine registration status of UD link type")
+
+ ret_value = is_registered ? TRUE : FALSE;
done:
FUNC_LEAVE_API(ret_value)
@@ -1646,9 +1557,11 @@ ssize_t
H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ size_t link_name_len = 0; /* Length of the link name string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id);
@@ -1665,7 +1578,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info")
- /* Fill in location struct fields */
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1674,15 +1587,23 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* Get the location object */
+ /* Get the VOL object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_NAME;
+ vol_cb_args.args.get_name.name_size = size;
+ vol_cb_args.args.get_name.name = name;
+ vol_cb_args.args.get_name.name_len = &link_name_len;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- name, size, &ret_value) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name")
+ /* Set the return value */
+ ret_value = (ssize_t)link_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Lget_name_by_idx() */
@@ -1702,10 +1623,11 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord
{
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
- (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1724,10 +1646,18 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord
if (H5VL_setup_self_args(group_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- token_ptr, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, op,
- op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ token_ptr)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1763,7 +1693,7 @@ H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t
/* Iterate over links synchronously */
if ((ret_value = H5L__iterate_api_common(group_id, idx_type, order, idx_p, op, op_data, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "asynchronous link iteration failed")
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "synchronous link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1812,7 +1742,7 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line,
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1846,9 +1776,10 @@ herr_t
H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hLI*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id);
@@ -1879,9 +1810,18 @@ H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_name.name = group_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1919,10 +1859,11 @@ done:
herr_t
H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoLI*x", group_id, idx_type, order, op, op_data);
@@ -1946,9 +1887,18 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1987,9 +1937,10 @@ herr_t
H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoLI*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id);
@@ -2020,9 +1971,18 @@ H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
loc_params.loc_data.loc_by_name.name = group_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Visit the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -2110,1984 +2070,3 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags,
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Lunpack_elink_val() */
-
-/*
- *-------------------------------------------------------------------------
- *-------------------------------------------------------------------------
- * N O A P I F U N C T I O N S B E Y O N D T H I S P O I N T
- *-------------------------------------------------------------------------
- *-------------------------------------------------------------------------
- */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__find_class_idx
- *
- * Purpose: Given a link class ID, return the offset in the global array
- * that holds all the registered link classes.
- *
- * Return: Success: Non-negative index of entry in global
- * link class table.
- * Failure: Negative
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5L__find_class_idx(H5L_type_t id)
-{
- size_t i; /* Local index variable */
- int ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- for (i = 0; i < H5L_table_used_g; i++)
- if (H5L_table_g[i].id == id)
- HGOTO_DONE((int)i)
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__find_class_idx */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_find_class
- *
- * Purpose: Given a link class ID return a pointer to a global struct that
- * defines the link class.
- *
- * Return: Success: Ptr to entry in global link class table.
- * Failure: NULL
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-const H5L_class_t *
-H5L_find_class(H5L_type_t id)
-{
- int idx; /* Filter index in global table */
- H5L_class_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Get the index in the global table */
- if ((idx = H5L__find_class_idx(id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class")
-
- /* Set return value */
- ret_value = H5L_table_g + idx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_find_class */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_register
- *
- * Purpose: Registers a class of user-defined links, or changes the
- * behavior of an existing class.
- *
- * See H5Lregister for full documentation.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_register(const H5L_class_t *cls)
-{
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(cls);
- HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX);
-
- /* Is the link type already registered? */
- for (i = 0; i < H5L_table_used_g; i++)
- if (H5L_table_g[i].id == cls->id)
- break;
-
- /* Filter not already registered */
- if (i >= H5L_table_used_g) {
- if (H5L_table_used_g >= H5L_table_alloc_g) {
- size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g));
- H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t)));
- if (!table)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table")
- H5L_table_g = table;
- H5L_table_alloc_g = n;
- } /* end if */
-
- /* Initialize */
- i = H5L_table_used_g++;
- } /* end if */
-
- /* Copy link class info into table */
- H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_register */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_unregister
- *
- * Purpose: Unregisters a class of user-defined links.
- *
- * See H5Lunregister for full documentation.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, July 10, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_unregister(H5L_type_t id)
-{
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(id >= 0 && id <= H5L_TYPE_MAX);
-
- /* Is the filter already registered? */
- for (i = 0; i < H5L_table_used_g; i++)
- if (H5L_table_g[i].id == id)
- break;
-
- /* Fail if filter not found */
- if (i >= H5L_table_used_g)
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered")
-
- /* Remove filter from table */
- /* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i));
- H5L_table_used_g--;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_unregister() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_link
- *
- * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for
- * full documentation.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Tuesday, December 13, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id)
-{
- H5O_link_t lnk; /* Link to insert */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(new_loc);
- HDassert(obj_loc);
- HDassert(new_name && *new_name);
-
- /* The link callback will check that the object isn't being hard linked
- * into a different file, so we don't need to do it here (there could be
- * external links along the path).
- */
-
- /* Construct link information for eventual insertion */
- lnk.type = H5L_TYPE_HARD;
- lnk.u.hard.addr = obj_loc->oloc->addr;
-
- /* Create the link */
- if (H5L__create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_link() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_link_object
- *
- * Purpose: Creates a new object and a link to it.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, April 9, 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id)
-{
- H5O_link_t lnk; /* Link to insert */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(new_loc);
- HDassert(new_name && *new_name);
- HDassert(ocrt_info);
-
- /* The link callback will check that the object isn't being hard linked
- * into a different file, so we don't need to do it here (there could be
- * external links along the path).
- */
-
- /* Construct link information for eventual insertion */
- lnk.type = H5L_TYPE_HARD;
-
- /* Create the link */
- if (H5L__create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_link_object() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__link_cb
- *
- * Purpose: Callback for creating a link to an object.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, September 19, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *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*/)
-{
- H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */
- H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */
- hid_t grp_id = FAIL; /* Id for this group (passed to user callback */
- H5G_loc_t temp_loc; /* For UD callback */
- hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */
- hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name in this group resolved to a valid location */
- /* (which is not what we want) */
- if (obj_loc != NULL)
- HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists")
-
- /* Check for crossing file boundaries with a new hard link */
- if (udata->lnk->type == H5L_TYPE_HARD) {
- /* Check for creating an object */
- /* (only for hard links) */
- if (udata->ocrt_info) {
- H5G_loc_t new_loc; /* Group location for new object */
-
- /* Create new object at this location */
- if (NULL ==
- (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type,
- udata->ocrt_info->crt_info, &new_loc)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object")
-
- /* Set address for hard link */
- udata->lnk->u.hard.addr = new_loc.oloc->addr;
-
- /* Set object path to use for setting object name (below) */
- udata->path = new_loc.path;
-
- /* Indicate that an object was created */
- obj_created = TRUE;
- } /* end if */
- else {
- /* Check that both objects are in same file */
- if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
- } /* end else */
- } /* end if */
-
- /* Set 'standard' aspects of link */
- udata->lnk->corder =
- 0; /* Will be re-written during group insertion, if the group is tracking creation order */
- udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */
-
- /* Check for non-default link creation properties */
- if (udata->lc_plist) {
- /* Get character encoding property */
- if (H5CX_get_encoding(&udata->lnk->cset) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property")
- } /* end if */
- else
- udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
-
- /* Set the link's name correctly */
- /* Casting away const OK -QAK */
- udata->lnk->name = (char *)name;
-
- /* Insert link into group */
- if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE,
- udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN,
- udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
-
- /* Set object's path if it has been passed in and is not set */
- if (udata->path != NULL && udata->path->user_path_r == NULL)
- if (H5G_name_set(grp_loc->path, udata->path, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name")
-
- /* If link is a user-defined link, trigger its creation callback if it has one */
- if (udata->lnk->type >= H5L_TYPE_UD_MIN) {
- const H5L_class_t *link_class; /* User-defined link class */
-
- /* Get the link class for this type of link. */
- if (NULL == (link_class = H5L_find_class(udata->lnk->type)))
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link")
-
- if (link_class->create_func != NULL) {
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
-
- /* Create a temporary location (or else H5G_open will do a shallow
- * copy and wipe out grp_loc)
- */
- H5G_name_reset(&temp_path);
- if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
-
- temp_loc.oloc = &temp_oloc;
- temp_loc.path = &temp_path;
- temp_loc_init = TRUE;
-
- /* Set up location for user-defined callback */
- if (NULL == (grp = H5G_open(&temp_loc)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group")
-
- /* Make callback */
- if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size,
- H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed")
- } /* end if */
- } /* end if */
-
-done:
- /* Check if an object was created */
- if (obj_created) {
- H5O_loc_t oloc; /* Object location for created object */
-
- /* Set up object location */
- HDmemset(&oloc, 0, sizeof(oloc));
- oloc.file = grp_loc->oloc->file;
- oloc.addr = udata->lnk->u.hard.addr;
-
- /* Decrement refcount on new object's object header in memory */
- if (H5O_dec_rc_by_loc(&oloc) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
- } /* end if */
-
- /* Close the location given to the user callback if it was created */
- if (grp_id >= 0) {
- if (H5I_dec_app_ref(grp_id) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
- } /* end if */
- else if (grp != NULL) {
- if (H5G_close(grp) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback")
- } /* end if */
- else if (temp_loc_init)
- H5G_loc_free(&temp_loc);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__link_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__create_real
- *
- * Purpose: Creates a link at a path location
- *
- * lnk should have linkclass-specific information already
- * set, but this function will take care of setting name.
- *
- * obj_path can be NULL if the object's path doesn't need to
- * be set, and obj_file can be NULL if the object is not a
- * hard link.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, December 5, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file,
- H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id)
-{
- char * norm_link_name = NULL; /* Pointer to normalized link name */
- unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */
- H5P_genplist_t *lc_plist = NULL; /* Link creation property list */
- H5L_trav_cr_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check args */
- HDassert(link_loc);
- HDassert(link_name && *link_name);
- HDassert(lnk);
- HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX);
-
- /* Get normalized link name */
- if ((norm_link_name = H5G_normalize(link_name)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
-
- /* Check for flags present in creation property list */
- if (lcpl_id != H5P_DEFAULT) {
- unsigned crt_intmd_group;
-
- /* Get link creation property list */
- if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get intermediate group creation property */
- if (H5CX_get_intermediate_group(&crt_intmd_group) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
-
- if (crt_intmd_group > 0)
- target_flags |= H5G_CRT_INTMD_GROUP;
- } /* end if */
-
- /* Set up user data
- * FILE is used to make sure that hard links don't cross files, and
- * should be NULL for other link types.
- * LC_PLIST is a pointer to the link creation property list.
- * PATH is a pointer to the path of the object being inserted if this is
- * a hard link; this is used to set the paths to objects when they are
- * created. For other link types, this is NULL.
- * OCRT_INFO is a pointer to the structure for object creation.
- * LNK is the link struct passed into this function. At this point all
- * of its fields should be populated except for name, which is set when
- * inserting it in the callback.
- */
- udata.file = obj_file;
- udata.lc_plist = lc_plist;
- udata.path = obj_path;
- udata.ocrt_info = ocrt_info;
- udata.lnk = lnk;
-
- /* Traverse the destination path & create new link */
- if (H5G_traverse(link_loc, link_name, target_flags, H5L__link_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link")
-
-done:
- /* Free the normalized path name */
- if (norm_link_name)
- H5MM_xfree(norm_link_name);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__create_real() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__create_hard
- *
- * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, April 6, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc, const char *link_name,
- hid_t lcpl_id)
-{
- char * norm_cur_name = NULL; /* Pointer to normalized current name */
- H5F_t * link_file = NULL; /* Pointer to file to link to */
- H5O_link_t lnk; /* Link to insert */
- H5G_loc_t obj_loc; /* Location of object to link to */
- H5G_name_t path; /* obj_loc's path*/
- H5O_loc_t oloc; /* obj_loc's oloc */
- hbool_t loc_valid = FALSE;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check args */
- HDassert(cur_loc);
- HDassert(cur_name && *cur_name);
- HDassert(link_loc);
- HDassert(link_name && *link_name);
-
- /* Get normalized copy of the current name */
- if ((norm_cur_name = H5G_normalize(cur_name)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
-
- /* Set up link data specific to hard links */
- lnk.type = H5L_TYPE_HARD;
-
- /* Get object location for object pointed to */
- obj_loc.path = &path;
- obj_loc.oloc = &oloc;
- H5G_loc_reset(&obj_loc);
- if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found")
- loc_valid = TRUE;
-
- /* Construct link information for eventual insertion */
- lnk.u.hard.addr = obj_loc.oloc->addr;
-
- /* Set destination's file information */
- link_file = obj_loc.oloc->file;
-
- /* Create actual link to the object. Pass in NULL for the path, since this
- * function shouldn't change an object's user path. */
- if (H5L__create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
-
-done:
- /* Free the object header location */
- if (loc_valid)
- if (H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location")
-
- /* Free the normalized path name */
- if (norm_cur_name)
- H5MM_xfree(norm_cur_name);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__create_hard() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__create_soft
- *
- * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Robb Matzke
- * Monday, April 6, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id)
-{
- char * norm_target = NULL; /* Pointer to normalized current name */
- H5O_link_t lnk; /* Link to insert */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check args */
- HDassert(link_loc);
- HDassert(target_path && *target_path);
- HDassert(link_name && *link_name);
-
- /* Get normalized copy of the link target */
- if ((norm_target = H5G_normalize(target_path)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
-
- /* Set up link data specific to soft links */
- lnk.type = H5L_TYPE_SOFT;
- lnk.u.soft.name = norm_target;
-
- /* Create actual link to the object */
- if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
-
-done:
- /* Free the normalized target name */
- if (norm_target)
- H5MM_xfree(norm_target);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__create_soft() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__create_ud
- *
- * Purpose: Creates a user-defined link. See H5Lcreate_ud for
- * full documentation.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Friday, May 19, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data, size_t ud_data_size,
- H5L_type_t type, hid_t lcpl_id)
-{
- H5O_link_t lnk; /* Link to insert */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check args */
- HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
- HDassert(link_loc);
- HDassert(link_name && *link_name);
- HDassert(ud_data_size == 0 || ud_data);
-
- /* Initialize the link struct's pointer to its udata buffer */
- lnk.u.ud.udata = NULL;
-
- /* Make sure that this link class is registered */
- if (H5L__find_class_idx(type) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library")
-
- /* Fill in UD link-specific information in the link struct*/
- if (ud_data_size > 0) {
- lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size);
- H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t)ud_data_size);
- } /* end if */
- else
- lnk.u.ud.udata = NULL;
-
- lnk.u.ud.size = ud_data_size;
- lnk.type = type;
-
- /* Create actual link to the object */
- if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object")
-
-done:
- /* Free the link's udata buffer if it's been allocated */
- H5MM_xfree(lnk.u.ud.udata);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__create_ud() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_val_real
- *
- * Purpose: Retrieve link value from a link object
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 13 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(lnk);
-
- /* Check for soft link */
- if (H5L_TYPE_SOFT == lnk->type) {
- /* Copy to output buffer */
- if (size > 0 && buf) {
- HDstrncpy((char *)buf, lnk->u.soft.name, size);
- if (HDstrlen(lnk->u.soft.name) >= size)
- ((char *)buf)[size - 1] = '\0';
- } /* end if */
- } /* end if */
- /* Check for user-defined link */
- else if (lnk->type >= H5L_TYPE_UD_MIN) {
- const H5L_class_t *link_class; /* User-defined link class */
-
- /* Get the link class for this type of link. It's okay if the class
- * isn't registered, though--we just can't give any more information
- * about it
- */
- link_class = H5L_find_class(lnk->type);
-
- if (link_class != NULL && link_class->query_func != NULL) {
- if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure")
- } /* end if */
- else if (buf && size > 0)
- ((char *)buf)[0] = '\0';
- } /* end if */
- else
- HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_val_real() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_val_cb
- *
- * Purpose: Callback for retrieving link value or udata.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, September 20, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
-{
- H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name in this group resolved to a valid link */
- if (lnk == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
-
- /* Retrieve the value for the link */
- if (H5L__get_val_real(lnk, udata->buf, udata->size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
-
-done:
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_val_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_val
- *
- * Purpose: Returns the value of a symbolic link or the udata for a
- * user-defined link.
- *
- * Return: Success: Non-negative, with at most SIZE bytes of the
- * link value copied into the BUF buffer. If the
- * link value is larger than SIZE characters
- * counting the null terminator then the BUF
- * result will not be null terminated.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Monday, April 13, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size)
-{
- H5L_trav_gv_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Set up user data for retrieving information */
- udata.size = size;
- udata.buf = buf;
-
- /* Traverse the group hierarchy to locate the object to get info about */
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L__get_val() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_val_by_idx_cb
- *
- * Purpose: Callback for retrieving a link's value according to an
- * index's order.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 13 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_val_by_idx_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*/)
-{
- H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
- H5O_link_t fnd_lnk; /* Link within group */
- hbool_t lnk_copied = FALSE; /* Whether the link was copied */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name of the group resolved to a valid object */
- if (obj_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
-
- /* Query link */
- if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
- lnk_copied = TRUE;
-
- /* Retrieve the value for the link */
- if (H5L__get_val_real(&fnd_lnk, udata->buf, udata->size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
-
-done:
- /* Reset the link information, if we have a copy */
- if (lnk_copied)
- H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_val_by_idx_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_val_by_idx
- *
- * Purpose: Internal routine to query a link value according to the
- * index within a group
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, void *buf /*out*/, size_t size)
-{
- H5L_trav_gvbi_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Set up user data for retrieving information */
- udata.idx_type = idx_type;
- udata.order = order;
- udata.n = n;
- udata.buf = buf;
- udata.size = size;
-
- /* Traverse the group hierarchy to locate the object to get info about */
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_by_idx_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n)
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_val_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__delete_cb
- *
- * Purpose: Callback for deleting a link. This routine
- * actually deletes the link
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, September 19, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
- H5G_loc_t H5_ATTR_UNUSED *obj_loc, void H5_ATTR_UNUSED *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
- /* Check if the group resolved to a valid link */
- if (grp_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
-
- /* Check if the name in this group resolved to a valid link */
- if (name == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
-
- /* Check for non-existent (NULL) link.
- * Note that this can also occur when attempting to remove '.'
- */
- if (lnk == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL,
- "callback link pointer is NULL (specified link may be '.' or not exist)")
-
- /* Remove the link from the group */
- if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
-
-done:
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__delete_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__delete
- *
- * Purpose: Delete a link from a group.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Thursday, September 17, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__delete(const H5G_loc_t *loc, const char *name)
-{
- char * norm_name = NULL; /* Pointer to normalized name */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Get normalized copy of the name */
- if ((norm_name = H5G_normalize(name)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
-
- /* Set up user data for unlink operation */
- if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_cb,
- NULL) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object")
-
-done:
- /* Free the normalized path name */
- if (norm_name)
- H5MM_xfree(norm_name);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__delete() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__delete_by_idx_cb
- *
- * Purpose: Callback for removing a link according to an index's order.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 13 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__delete_by_idx_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*/)
-{
- H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_TAG((obj_loc) ? (obj_loc->oloc->addr) : HADDR_UNDEF)
-
- /* Check if the name of the group resolved to a valid object */
- if (obj_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
-
- /* Delete link */
- if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order,
- udata->n) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
-
-done:
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5L__delete_by_idx_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__delete_by_idx
- *
- * Purpose: Internal routine to delete a link according to its index
- * within a group.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n)
-{
- H5L_trav_rmbi_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Set up user data for unlink operation */
- udata.idx_type = idx_type;
- udata.order = order;
- udata.n = n;
-
- /* Traverse the group hierarchy to remove the link */
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT,
- H5L__delete_by_idx_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__delete_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__move_dest_cb
- *
- * Purpose: Second callback for moving and renaming an object. This routine
- * inserts a new link into the group returned by the traversal.
- * It is called by H5L__move_cb.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, April 3, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *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*/)
-{
- H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */
- H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */
- hid_t grp_id = FAIL; /* ID for this group (passed to user callback */
- H5G_loc_t temp_loc; /* For UD callback */
- hbool_t temp_loc_init = FALSE;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Make sure an object with this name doesn't already exist */
- if (obj_loc != NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists")
-
- /* Check for crossing file boundaries with a new hard link */
- if (udata->lnk->type == H5L_TYPE_HARD)
- /* Check that both objects are in same file */
- if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
-
- /* Give the object its new name */
- /* Casting away const okay -JML */
- HDassert(udata->lnk->name == NULL);
- udata->lnk->name = (char *)name;
-
- /* Insert the link into the group */
- if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
-
- /* If the link was a user-defined link, call its move callback if it has one */
- if (udata->lnk->type >= H5L_TYPE_UD_MIN) {
- const H5L_class_t *link_class; /* User-defined link class */
-
- /* Get the link class for this type of link. */
- if (NULL == (link_class = H5L_find_class(udata->lnk->type)))
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered")
-
- if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) {
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
-
- /* Create a temporary location (or else H5G_open will do a shallow
- * copy and wipe out grp_loc)
- */
- H5G_name_reset(&temp_path);
- if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
-
- temp_loc.oloc = &temp_oloc;
- temp_loc.path = &temp_path;
- temp_loc_init = TRUE;
-
- /* Set up location for user-defined callback */
- if (NULL == (grp = H5G_open(&temp_loc)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID")
-
- if (udata->copy) {
- if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata,
- udata->lnk->u.ud.size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error")
- } /* end if */
- else {
- if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata,
- udata->lnk->u.ud.size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error")
- } /* end else */
- } /* end if */
- } /* end if */
-
-done:
- /* Close the location given to the user callback if it was created */
- if (grp_id >= 0) {
- if (H5I_dec_app_ref(grp_id) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
- } /* end if */
- else if (grp != NULL) {
- if (H5G_close(grp) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback")
- } /* end if */
- else if (temp_loc_init)
- H5G_loc_free(&temp_loc);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- /* Reset the "name" field in udata->lnk because it is owned by traverse()
- * and must not be manipulated after traverse closes */
- udata->lnk->name = NULL;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__move_dest_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__move_cb
- *
- * Purpose: Callback for moving and renaming an object. This routine
- * replaces the names of open objects with the moved object
- * in the path
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Friday, April 3, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc,
- void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
-{
- H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */
- H5L_trav_mv2_t udata_out; /* User data for H5L__move_dest_cb traversal */
- char * orig_name = NULL; /* The name of the link in this group */
- hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name in this group resolved to a valid link */
- if (obj_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
-
- /* Check for operations on '.' */
- if (lnk == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy")
-
- /* Set up user data for move_dest_cb */
- if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL)))
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved")
-
- /* In this special case, the link's name is going to be replaced at its
- * destination, so we should free it here.
- */
- udata_out.lnk->name = (char *)H5MM_xfree(udata_out.lnk->name);
- link_copied = TRUE;
-
- udata_out.lnk->cset = udata->cset;
- udata_out.file = grp_loc->oloc->file;
- udata_out.copy = udata->copy;
-
- /* Keep a copy of link's name (it's "owned" by the H5G_traverse() routine) */
- orig_name = H5MM_xstrdup(name);
-
- /* Reset the # of soft / UD links that can be traversed, so that the second
- * (destination) traversal has the correct value
- */
- if (H5CX_set_nlinks(udata->orig_nlinks) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse")
-
- /* Insert the link into its new location */
- if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb,
- &udata_out) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
-
- /* If this is a move and not a copy operation, change the object's name and remove the old link */
- if (!udata->copy) {
- H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */
-
- /* Make certain that the destination name is a full (not relative) path */
- if (*(udata->dst_name) != '/') {
- HDassert(udata->dst_loc->path->full_path_r);
-
- /* Create reference counted string for full dst path */
- if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r,
- udata->dst_name)) == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name")
- } /* end if */
- else
- dst_name_r = H5RS_wrap(udata->dst_name);
- HDassert(dst_name_r);
-
- /* Fix names up */
- if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r,
- udata->dst_loc->oloc->file, dst_name_r) < 0) {
- H5RS_decr(dst_name_r);
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name")
- } /* end if */
-
- /* Remove the old link */
- if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name) < 0) {
- H5RS_decr(dst_name_r);
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name")
- } /* end if */
-
- H5RS_decr(dst_name_r);
- } /* end if */
-
-done:
- /* Cleanup */
- if (orig_name)
- H5MM_xfree(orig_name);
-
- /* If udata_out.lnk was copied, free any memory allocated
- * In this special case, the H5L__move_dest_cb callback resets the name
- * so H5O_msg_free shouldn't try to free it
- */
- if (link_copied)
- H5O_msg_free(H5O_LINK_ID, udata_out.lnk);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__move_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__move
- *
- * Purpose: Atomically move or copy a link.
- *
- * Creates a copy of a link in a new destination with a new name.
- * SRC_LOC and SRC_NAME together define the link's original
- * location, while DST_LOC and DST_NAME together define its
- * final location.
- *
- * If copy_flag is FALSE, the original link is removed
- * (effectively moving the link).
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, May 1, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name,
- hbool_t copy_flag, hid_t lcpl_id)
-{
- unsigned dst_target_flags = H5G_TARGET_NORMAL;
- H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
- H5P_genplist_t *lc_plist; /* Link creation property list */
- H5L_trav_mv_t udata; /* User data for traversal */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity check */
- HDassert(src_loc);
- HDassert(dst_loc);
- HDassert(src_name && *src_name);
- HDassert(dst_name && *dst_name);
-
- /* Check for flags present in creation property list */
- if (lcpl_id != H5P_DEFAULT) {
- unsigned crt_intmd_group;
-
- if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get intermediate group creation property */
- if (H5CX_get_intermediate_group(&crt_intmd_group) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
-
- /* Set target flags for source and destination */
- if (crt_intmd_group > 0)
- dst_target_flags |= H5G_CRT_INTMD_GROUP;
-
- /* Get character encoding property */
- if (H5CX_get_encoding(&char_encoding) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
- } /* end if */
-
- /* Set up user data */
- udata.dst_loc = dst_loc;
- udata.dst_name = dst_name;
- udata.dst_target_flags = dst_target_flags;
- udata.cset = char_encoding;
- udata.copy = copy_flag;
-
- /* Retrieve the original # of soft / UD links that can be traversed, so
- * that the countdown can be reset after the first path is traversed.
- */
- if (H5CX_get_nlinks(&udata.orig_nlinks) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
-
- /* Do the move */
- if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb,
- &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__move() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__exists_final_cb
- *
- * Purpose: Callback for checking whether a link exists, as the final
- * component of a path
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, March 16 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name,
- const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/)
-{
- H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Check if the name in this group resolved to a valid link */
- *udata->exists = (hbool_t)(lnk != NULL);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5L__exists_final_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__exists_inter_cb
- *
- * Purpose: Callback for checking whether a link exists, as an intermediate
- * component of a path
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, December 31 2015
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name,
- const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/,
- H5G_own_loc_t *own_loc /*out*/)
-{
- H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name in this group resolved to a valid link */
- if (lnk != NULL) {
- /* Check for more components to the path */
- if (udata->sep) {
- H5G_traverse_t cb_func; /* Callback function for tranversal */
- char * next; /* Pointer to next component name */
-
- /* Look for another separator */
- next = udata->sep;
- if (NULL == (udata->sep = HDstrchr(udata->sep, '/')))
- cb_func = H5L__exists_final_cb;
- else {
- /* Chew through adjacent separators, if present */
- do {
- *udata->sep = '\0';
- udata->sep++;
- } while ('/' == *udata->sep);
- cb_func = H5L__exists_inter_cb;
- } /* end else */
- if (H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists")
- } /* end if */
- else
- *udata->exists = TRUE;
- } /* end if */
- else
- *udata->exists = FALSE;
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__exists_inter_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_exists_tolerant
- *
- * Purpose: Returns whether a link exists in a group
- *
- * Note: Same as H5L__exists, except that missing links are reported
- * as 'FALSE' instead of causing failures
- *
- * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, December 31 2015
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists)
-{
- H5L_trav_le_t udata; /* User data for traversal */
- H5G_traverse_t cb_func; /* Callback function for tranversal */
- char * name_copy = NULL; /* Duplicate of name */
- char * name_trav; /* Name to traverse */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(loc);
- HDassert(name);
- HDassert(exists);
-
- /* Copy the name and skip leading '/'s */
- name_trav = name_copy = H5MM_strdup(name);
- while ('/' == *name_trav)
- name_trav++;
-
- /* A path of "/" will always exist in a file */
- if ('\0' == *name_trav)
- *exists = TRUE;
- else {
- /* Set up user data & correct callback */
- udata.exists = exists;
- if (NULL == (udata.sep = HDstrchr(name_trav, '/')))
- cb_func = H5L__exists_final_cb;
- else {
- /* Chew through adjacent separators, if present */
- do {
- *udata.sep = '\0';
- udata.sep++;
- } while ('/' == *udata.sep);
- cb_func = H5L__exists_inter_cb;
- } /* end else */
-
- /* Traverse the group hierarchy to locate the link to check */
- if (H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists")
- }
-
-done:
- /* Release duplicated string */
- H5MM_xfree(name_copy);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L_exists_tolerant() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__exists
- *
- * Purpose: Returns whether a link exists in a group
- *
- * Note: Same as H5L_exists_tolerant, except that missing links are reported
- * as failures
- *
- * Return: Non-negative on success, with *exists set/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, March 16 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists)
-{
- H5L_trav_le_t udata; /* User data for traversal */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Sanity checks */
- HDassert(loc);
- HDassert(name);
- HDassert(exists);
-
- /* A path of "/" will always exist in a file */
- if (0 == HDstrcmp(name, "/"))
- *exists = TRUE;
- else {
- /* Traverse the group hierarchy to locate the object to get info about */
- udata.exists = exists;
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist")
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L__exists() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_info_cb
- *
- * Purpose: Callback for retrieving a link's metadata
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: James Laird
- * Monday, April 17 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk,
- H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
-{
- H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name in this group resolved to a valid link */
- if (lnk == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
-
- /* Get information from the link */
- if (H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
-
-done:
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_info_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_get_info
- *
- * Purpose: Returns metadata about a link.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: James Laird
- * Monday, April 17 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/)
-{
- H5L_trav_gi_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- udata.linfo = linfo;
-
- /* Traverse the group hierarchy to locate the object to get info about */
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5L_get_info() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_info_by_idx_cb
- *
- * Purpose: Callback for retrieving a link's metadata according to an
- * index's order.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, November 6 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_info_by_idx_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*/)
-{
- H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */
- H5O_link_t fnd_lnk; /* Link within group */
- hbool_t lnk_copied = FALSE; /* Whether the link was copied */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name of the group resolved to a valid object */
- if (obj_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
-
- /* Query link */
- if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
- lnk_copied = TRUE;
-
- /* Get information from the link */
- if (H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
-
-done:
- /* Reset the link information, if we have a copy */
- if (lnk_copied)
- H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
-
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_info_by_idx_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_info_by_idx
- *
- * Purpose: Internal routine to retrieve link info according to an
- * index's order.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, H5L_info2_t *linfo /*out*/)
-{
- H5L_trav_gibi_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
- HDassert(linfo);
-
- /* Set up user data for callback */
- udata.idx_type = idx_type;
- udata.order = order;
- udata.n = n;
- udata.linfo = linfo;
-
- /* Traverse the group hierarchy to locate the object to get info about */
- if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_info_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_name_by_idx_cb
- *
- * Purpose: Callback for retrieving a link's name according to an
- * index's order.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, November 11 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_name_by_idx_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*/)
-{
- H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check if the name of the group resolved to a valid object */
- if (obj_loc == NULL)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
-
- /* Query link */
- if ((udata->name_len = H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n,
- udata->name, udata->size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
-
-done:
- /* Indicate that this callback didn't take ownership of the group *
- * location for the object */
- *own_loc = H5G_OWN_NONE;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_name_by_idx_cb() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__get_name_by_idx
- *
- * Purpose: Internal routine to retrieve link name according to an
- * index's order.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, char *name /*out*/, size_t size)
-{
- H5L_trav_gnbi_t udata; /* User data for callback */
- ssize_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check arguments */
- HDassert(loc);
- HDassert(group_name && *group_name);
-
- /* Set up user data for callback */
- udata.idx_type = idx_type;
- udata.order = order;
- udata.n = n;
- udata.name = name;
- udata.size = size;
- udata.name_len = -1;
-
- /* Traverse the group hierarchy to locate the link to get name of */
- if (H5G_traverse(loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_name_by_idx_cb, &udata) <
- 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name")
-
- /* Set the return value */
- ret_value = udata.name_len;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__get_name_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L__link_copy_file
- *
- * Purpose: Copy a link and the object it points to from one file to
- * another.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Sep 29 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
- H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
-{
- H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
- const H5O_link_t *src_lnk = _src_lnk; /* Source link */
- hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
- hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */
- H5G_loc_t tmp_src_loc; /* Group location holding target object */
- H5G_name_t tmp_src_path; /* Path for target object */
- H5O_loc_t tmp_src_oloc; /* Object location for target object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* check arguments */
- HDassert(dst_file);
- HDassert(src_lnk);
- HDassert(dst_lnk);
- HDassert(cpy_info);
-
- /* Expand soft or external link, if requested */
- if ((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) ||
- (H5L_TYPE_EXTERNAL == src_lnk->type && cpy_info->expand_ext_link)) {
- H5G_loc_t lnk_grp_loc; /* Group location holding link */
- H5G_name_t lnk_grp_path; /* Path for link */
- htri_t tar_exists; /* Whether the target object exists */
-
- /* Set up group location for link */
- H5G_name_reset(&lnk_grp_path);
- lnk_grp_loc.path = &lnk_grp_path;
- lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
-
- /* Check if the target object exists */
- if ((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists")
-
- if (tar_exists) {
- /* Make a temporary copy of the link, so that it will not change the
- * info in the cache when we change it to a hard link */
- if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message")
-
- /* Set up group location for target object. Let H5G_traverse expand
- * the link. */
- tmp_src_loc.path = &tmp_src_path;
- tmp_src_loc.oloc = &tmp_src_oloc;
- if (H5G_loc_reset(&tmp_src_loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location")
-
- /* Find the target object */
- if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object")
- expanded_link_open = TRUE;
-
- /* Convert symbolic link to hard link */
- if (tmp_src_lnk.type == H5L_TYPE_SOFT)
- tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name);
- else if (tmp_src_lnk.u.ud.size > 0)
- tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata);
- tmp_src_lnk.type = H5L_TYPE_HARD;
- tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr;
- src_lnk = &tmp_src_lnk;
- } /* end if */
- } /* end if */
-
- /* Copy src link information to dst link information */
- if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk))
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message")
- dst_lnk_init = TRUE;
-
- /* Check if object in source group is a hard link & copy it */
- if (H5L_TYPE_HARD == src_lnk->type) {
- H5O_loc_t new_dst_oloc; /* Copied object location in destination */
-
- /* Set up copied object location to fill in */
- H5O_loc_reset(&new_dst_oloc);
- new_dst_oloc.file = dst_file;
-
- if (!expanded_link_open) {
- /* Build temporary object location for source */
- H5O_loc_reset(&tmp_src_oloc);
- tmp_src_oloc.file = src_oloc->file;
- tmp_src_oloc.addr = src_lnk->u.hard.addr;
- } /* end if */
- HDassert(H5F_addr_defined(tmp_src_oloc.addr));
-
- /* Copy the shared object from source to destination */
- /* Don't care about obj_type or udata because those are only important
- * for old style groups */
- if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object")
-
- /* Copy new destination object's information for eventual insertion */
- dst_lnk->u.hard.addr = new_dst_oloc.addr;
- } /* end if */
-
-done:
- /* Check if we used a temporary src link */
- if (src_lnk != _src_lnk) {
- HDassert(src_lnk == &tmp_src_lnk);
- H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk);
- } /* end if */
- if (ret_value < 0)
- if (dst_lnk_init)
- H5O_msg_reset(H5O_LINK_ID, dst_lnk);
- /* Check if we need to free the temp source oloc */
- if (expanded_link_open)
- if (H5G_loc_free(&tmp_src_loc) < 0)
- HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L__link_copy_file() */
-
-/*-------------------------------------------------------------------------
- * Function: H5L_iterate
- *
- * Purpose: Iterates through links in a group
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t *idx_p, H5L_iterate2_t op, void *op_data)
-{
- H5G_link_iterate_t lnk_op; /* Link operator */
- hsize_t last_lnk; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity checks */
- HDassert(loc);
- HDassert(group_name);
- HDassert(op);
-
- /* Set up iteration beginning/end info */
- idx = (idx_p == NULL ? 0 : *idx_p);
- last_lnk = 0;
-
- /* Build link operator info */
- lnk_op.op_type = H5G_LINK_OP_NEW;
- lnk_op.op_func.op_new = op;
-
- /* Iterate over the links */
- if ((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
-
- /* Set the index we stopped at */
- if (idx_p)
- *idx_p = last_lnk;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5L_iterate() */
diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c
index df4c384..01e77f9 100644
--- a/src/H5Ldeprec.c
+++ b/src/H5Ldeprec.c
@@ -141,12 +141,13 @@ herr_t
H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate1_t op,
void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIo*hLi*x", group_id, idx_type, order, idx_p, op, op_data);
@@ -181,10 +182,18 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p,
- H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -219,11 +228,12 @@ herr_t
H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hLi*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id);
@@ -265,10 +275,18 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -293,11 +311,12 @@ done:
herr_t
H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_info2_t linfo2; /* New-style link info */
- hbool_t is_native_vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
@@ -310,12 +329,13 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -326,9 +346,12 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL,
"H5Lget_info1 is only meant to be used with the native VOL connector")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = &linfo2;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &linfo2) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
/* Copy the new-style members into the old-style struct */
@@ -376,11 +399,12 @@ herr_t
H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5L_info1_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_info2_t linfo2; /* New-style link info */
- hbool_t is_native_vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id);
@@ -397,6 +421,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -405,7 +430,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -416,9 +441,12 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL,
"H5Lget_info_by_idx1 is only meant to be used with the native VOL connector")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = &linfo2;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &linfo2) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
/* Copy the new-style members into the old-style struct */
@@ -479,12 +507,13 @@ done:
herr_t
H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoLi*x", group_id, idx_type, order, op, op_data);
@@ -519,10 +548,18 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -563,11 +600,12 @@ herr_t
H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoLi*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id);
@@ -609,10 +647,18 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Visit the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
diff --git a/src/H5Ldevelop.h b/src/H5Ldevelop.h
new file mode 100644
index 0000000..43ed7de
--- /dev/null
+++ b/src/H5Ldevelop.h
@@ -0,0 +1,314 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5L (link) developer
+ * support routines.
+ */
+
+#ifndef _H5Ldevelop_H
+#define _H5Ldevelop_H
+
+/* Include package's public header */
+#include "H5Lpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/**
+ * \brief Current version of the H5L_class_t struct
+ */
+#define H5L_LINK_CLASS_T_VERS 1
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* The H5L_class_t struct can be used to override the behavior of a
+ * "user-defined" link class. Users should populate the struct with callback
+ * functions defined below.
+ */
+/* Callback prototypes for user-defined links */
+/**
+ * \brief Link creation callback
+ */
+typedef herr_t (*H5L_create_func_t)(const char *link_name, hid_t loc_group, const void *lnkdata,
+ size_t lnkdata_size, hid_t lcpl_id);
+/**
+ * \brief Callback for link move
+ */
+typedef herr_t (*H5L_move_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
+ size_t lnkdata_size);
+/**
+ * \brief Callback for link copy
+ */
+typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
+ size_t lnkdata_size);
+/**
+ * \brief Callback during link traversal
+ */
+typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
+ size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id);
+/**
+ * \brief Callback for link deletion
+ */
+typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, const void *lnkdata,
+ size_t lnkdata_size);
+/**
+ * \brief Callback for querying the link.
+ *
+ * Returns the size of the buffer needed.
+ */
+typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size,
+ void *buf /*out*/, size_t buf_size);
+
+/**
+ * \brief Link prototype
+ *
+ * The H5L_class_t struct can be used to override the behavior of a
+ * "user-defined" link class. Users should populate the struct with callback
+ * functions defined elsewhere.
+ */
+//! <!-- [H5L_class_t_snip] -->
+typedef struct {
+ int version; /**< Version number of this struct */
+ H5L_type_t id; /**< Link type ID */
+ const char * comment; /**< Comment for debugging */
+ H5L_create_func_t create_func; /**< Callback during link creation */
+ H5L_move_func_t move_func; /**< Callback after moving link */
+ H5L_copy_func_t copy_func; /**< Callback after copying link */
+ H5L_traverse_func_t trav_func; /**< Callback during link traversal */
+ H5L_delete_func_t del_func; /**< Callback for link deletion */
+ H5L_query_func_t query_func; /**< Callback for queries */
+} H5L_class_t;
+//! <!-- [H5L_class_t_snip] -->
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup H5LA
+ *
+ * \brief Registers a user-defined link class or changes behavior of an
+ * existing class
+ *
+ * \param[in] cls Pointer to a buffer containing the struct describing the
+ * user-defined link class
+ *
+ * \return \herr_t
+ *
+ * \details H5Lregister() registers a class of user-defined links, or changes
+ * the behavior of an existing class.
+ *
+ * \p cls is a pointer to a buffer containing a copy of the
+ * H5L_class_t struct. This struct is defined in H5Lpublic.h as
+ * follows:
+ * \snippet this H5L_class_t_snip
+ *
+ * The class definition passed with \p cls must include at least the
+ * following:
+ * \li An H5L_class_t version (which should be #H5L_LINK_CLASS_T_VERS)
+ * \li A link class identifier, \c class_id
+ * \li A traversal function, \c trav_func
+ *
+ * Remaining \c struct members are optional and may be passed as NULL.
+ *
+ * The link class passed in \c class_id must be in the user-definable
+ * range between #H5L_TYPE_UD_MIN and #H5L_TYPE_UD_MAX
+ * (see the table below) and will override
+ * any existing link class with that identifier.
+ *
+ * As distributed, valid values of \c class_id used in HDF5 include
+ * the following (defined in H5Lpublic.h):
+ * \link_types
+ *
+ * The hard and soft link class identifiers cannot be modified or
+ * reassigned, but the external link class is implemented as an
+ * example in the user-definable link class identifier range.
+ * H5Lregister() is used to register additional link classes. It could
+ * also be used to modify the behavior of the external link class,
+ * though that is not recommended.
+ *
+ * The following table summarizes existing link types and values and
+ * the reserved and user-definable link class identifier value ranges.
+ * <table>
+ * <tr>
+ * <th>Link class identifier or Value range</th>
+ * <th>Description</th>
+ * <th>Link class or label</th>
+ * </tr>
+ * <tr>
+ * <td>0 to 63</td>
+ * <td>Reserved range</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>64 to 255</td>
+ * <td>User-definable range</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>64</td>
+ * <td>Minimum user-defined value</td>
+ * <td>#H5L_TYPE_UD_MIN</td>
+ * </tr>
+ * <tr>
+ * <td>64</td>
+ * <td>External link</td>
+ * <td>#H5L_TYPE_EXTERNAL</td>
+ * </tr>
+ * <tr>
+ * <td>255</td>
+ * <td>Maximum user-defined value</td>
+ * <td>#H5L_TYPE_UD_MAX</td>
+ * </tr>
+ * <tr>
+ * <td>255</td>
+ * <td>Maximum value</td>
+ * <td>#H5L_TYPE_MAX</td>
+ * </tr>
+ * <tr>
+ * <td>-1</td>
+ * <td>Error</td>
+ * <td>#H5L_TYPE_ERROR</td>
+ * </tr>
+ * </table>
+ *
+ * Note that HDF5 internally registers user-defined link classes only
+ * by the numeric value of the link class identifier. An application,
+ * on the other hand, will generally use a name for a user-defined
+ * class, if for no other purpose than as a variable name. Assume,
+ * for example, that a complex link type is registered with the link
+ * class identifier 73 and that the code includes the following
+ * assignment:
+ * \code
+ * H5L_TYPE_COMPLEX_A = 73
+ * \endcode
+ * The application can refer to the link class with a term,
+ * \c H5L_TYPE_COMPLEX_A, that conveys meaning to a human reviewing
+ * the code, while HDF5 recognizes it by the more cryptic numeric
+ * identifier, 73.
+ *
+ * \attention Important details and considerations include the following:
+ * \li If you plan to distribute files or software with a
+ * user-defined link class, please contact the Help Desk at
+ * The HDF Group to help prevent collisions between \c class_id
+ * values. See below.
+ * \li As distributed with HDF5, the external link class is
+ * implemented as an example of a user-defined link class with
+ * #H5L_TYPE_EXTERNAL equal to #H5L_TYPE_UD_MIN. \c class_id in
+ * the H5L_class_t \c struct must not equal #H5L_TYPE_UD_MIN
+ * unless you intend to overwrite or modify the behavior of
+ * external links.
+ * \li H5Lregister() can be used only with link class identifiers
+ * in the user-definable range (see table above).
+ * \li The hard and soft links defined by the HDF5 library,
+ * #H5L_TYPE_HARD and #H5L_TYPE_SOFT, reside in the reserved
+ * range below #H5L_TYPE_UD_MIN and cannot be redefined or
+ * modified.
+ * \li H5Lis_registered() can be used to determine whether a desired
+ * link class identifier is available. \Emph{Note that this
+ * function will tell you only whether the link class identifier
+ * has been registered with the installed copy of HDF5; it
+ * cannot tell you whether the link class has been registered
+ * with The HDF Group.}
+ * \li #H5L_TYPE_MAX is the maximum allowed value for a link type
+ * identifier.
+ * \li #H5L_TYPE_UD_MIN equals #H5L_TYPE_EXTERNAL.
+ * \li #H5L_TYPE_UD_MAX equals #H5L_TYPE_MAX.
+ * \li #H5L_TYPE_ERROR indicates that an error has occurred.
+ *
+ * \note \Bold{Registration with The HDF Group:}\n
+ * There are sometimes reasons to take a broader approach to registering
+ * a user-defined link class than just invoking H5Lregister(). For
+ * example:
+ * \li A user-defined link class is intended for use across an
+ * organization, among collaborators, or across a community of users.
+ * \li An application or library overlying HDF5 invokes a user-defined
+ * link class that must be shipped with the software.
+ * \li Files are distributed that make use of a user-defined link class.
+ * \li Or simply, a specific user-defined link class is thought to be
+ * widely useful.
+ *
+ * In such cases, you are encouraged to register that link class with
+ * The HDF Group's Helpdesk. The HDF Group maintains a registry of known
+ * user-defined link classes and tracks the selected link class
+ * identifiers. This registry is intended to reduce the risk of
+ * collisions between \c class_id values and to help coordinate the use
+ * of specialized link classes.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
+/**
+ * \ingroup H5LA
+ *
+ * \brief Unregisters a class of user-defined links
+ *
+ * \param[in] id User-defined link class identifier
+ *
+ * \return \herr_t
+ *
+ * \details H5Lunregister() unregisters a class of user-defined links,
+ * preventing them from being traversed, queried, moved, etc.
+ *
+ * \note A link class can be re-registered using H5Lregister().
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Lunregister(H5L_type_t id);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Previous versions of the H5L_class_t struct */
+#define H5L_LINK_CLASS_T_VERS_0 0
+
+/** Callback during link traversal */
+typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
+ size_t lnkdata_size, hid_t lapl_id);
+
+/** User-defined link types */
+typedef struct {
+ int version; /**< Version number of this struct */
+ H5L_type_t id; /**< Link type ID */
+ const char * comment; /**< Comment for debugging */
+ H5L_create_func_t create_func; /**< Callback during link creation */
+ H5L_move_func_t move_func; /**< Callback after moving link */
+ H5L_copy_func_t copy_func; /**< Callback after copying link */
+ H5L_traverse_0_func_t trav_func; /**< Callback during link traversal */
+ H5L_delete_func_t del_func; /**< Callback for link deletion */
+ H5L_query_func_t query_func; /**< Callback for queries */
+} H5L_class_0_t;
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#endif /* _H5Ldevelop_H */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index eccd2c6..2f7c7eb 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -173,30 +173,30 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
/* Make callback if it exists */
if (cb_info.func) {
- const char *parent_file_name; /* Parent file name */
- ssize_t group_name_len; /* Length of parent group name */
+ const char *parent_file_name; /* Parent file name */
+ size_t group_name_len = 0; /* Length of parent group name */
/* Get parent file name */
parent_file_name = H5F_OPEN_NAME(loc.oloc->file);
/* Query length of parent group name */
- if ((group_name_len = H5G_get_name(&loc, NULL, (size_t)0, NULL)) < 0)
+ if (H5G_get_name(&loc, NULL, (size_t)0, &group_name_len, NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name")
/* Account for null terminator */
group_name_len++;
/* Check if we need to allocate larger buffer */
- if ((size_t)group_name_len > sizeof(local_group_name)) {
- if (NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len)))
+ if (group_name_len > sizeof(local_group_name)) {
+ if (NULL == (parent_group_name = (char *)H5MM_malloc(group_name_len)))
HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID,
- "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len)
+ "can't allocate buffer to hold group name, group_name_len = %zu", group_name_len)
} /* end if */
else
parent_group_name = local_group_name;
/* Get parent group name */
- if (H5G_get_name(&loc, parent_group_name, (size_t)group_name_len, NULL) < 0)
+ if (H5G_get_name(&loc, parent_group_name, group_name_len, NULL, NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name")
/* Make callback */
diff --git a/src/H5Lint.c b/src/H5Lint.c
new file mode 100644
index 0000000..346c37d
--- /dev/null
+++ b/src/H5Lint.c
@@ -0,0 +1,2285 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Lmodule.h" /* This source code file is part of the H5L module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lpkg.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* File objects */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VLprivate.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+#define H5L_MIN_TABLE_SIZE 32 /* Minimum size of the user-defined link type table if it is allocated */
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* User data for path traversal routine for getting link info by name */
+typedef struct {
+ H5L_info2_t *linfo; /* Buffer to return to user */
+} H5L_trav_gi_t;
+
+/* User data for path traversal routine for getting link value by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ size_t size; /* Size of user buffer */
+
+ /* Out */
+ void *buf; /* User buffer */
+} H5L_trav_gvbi_t;
+
+/* User data for path traversal routine for getting link info by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+
+ /* Out */
+ H5L_info2_t *linfo; /* Buffer to return to user */
+} H5L_trav_gibi_t;
+
+/* User data for path traversal routine for removing link by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+} H5L_trav_rmbi_t;
+
+/* User data for path traversal routine for getting name by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ size_t size; /* Size of name buffer */
+
+ /* Out */
+ char * name; /* Buffer to return name to user */
+ size_t name_len; /* Length of full name */
+} H5L_trav_gnbi_t;
+
+/* User data for path traversal callback to creating a link */
+typedef struct {
+ H5F_t * file; /* Pointer to the file */
+ H5P_genplist_t * lc_plist; /* Link creation property list */
+ H5G_name_t * path; /* Path to object being linked */
+ H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */
+ H5O_link_t * lnk; /* Pointer to link information to insert */
+} H5L_trav_cr_t;
+
+/* User data for path traversal routine for moving and renaming a link */
+typedef struct {
+ const char * dst_name; /* Destination name for moving object */
+ H5T_cset_t cset; /* Char set for new name */
+ const H5G_loc_t *dst_loc; /* Destination location for moving object */
+ unsigned dst_target_flags; /* Target flags for destination object */
+ hbool_t copy; /* TRUE if this is a copy operation */
+ size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */
+} H5L_trav_mv_t;
+
+/* User data for path traversal routine for moving and renaming an object */
+typedef struct {
+ H5F_t * file; /* Pointer to the file */
+ H5O_link_t *lnk; /* Pointer to link information to insert */
+ hbool_t copy; /* TRUE if this is a copy operation */
+} H5L_trav_mv2_t;
+
+/* User data for path traversal routine for checking if a link exists */
+typedef struct {
+ /* Down */
+ char *sep; /* Pointer to next separator in the string */
+
+ /* Up */
+ hbool_t *exists; /* Whether the link exists or not */
+} H5L_trav_le_t;
+
+/* User data for path traversal routine for getting link value */
+typedef struct {
+ size_t size; /* Size of user buffer */
+ void * buf; /* User buffer */
+} H5L_trav_gv_t;
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static int H5L__find_class_idx(H5L_type_t id);
+static herr_t H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path,
+ H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id);
+static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size);
+static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Information about user-defined links */
+static size_t H5L_table_alloc_g = 0;
+static size_t H5L_table_used_g = 0;
+static H5L_class_t *H5L_table_g = NULL;
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_init
+ *
+ * Purpose: Initialize the interface from some other package.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: James Laird
+ * Thursday, July 13, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_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 H5L_init() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__init_package
+ *
+ * Purpose: Initialize information specific to H5L interface.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, January 24, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Initialize user-defined link classes */
+ if (H5L_register_external() < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_init_package() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_term_package
+ *
+ * Purpose: Terminate any resources allocated in H5L__init_package.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, January 24, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5L_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if (H5_PKG_INIT_VAR) {
+ /* Free the table of link types */
+ if (H5L_table_g) {
+ H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g);
+ H5L_table_used_g = H5L_table_alloc_g = 0;
+ n++;
+ } /* end if */
+
+ /* Mark the interface as uninitialized */
+ if (0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* H5L_term_package() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__find_class_idx
+ *
+ * Purpose: Given a link class ID, return the offset in the global array
+ * that holds all the registered link classes.
+ *
+ * Return: Success: Non-negative index of entry in global
+ * link class table.
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5L__find_class_idx(H5L_type_t id)
+{
+ size_t i; /* Local index variable */
+ int ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ for (i = 0; i < H5L_table_used_g; i++)
+ if (H5L_table_g[i].id == id)
+ HGOTO_DONE((int)i)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__find_class_idx */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_find_class
+ *
+ * Purpose: Given a link class ID return a pointer to a global struct that
+ * defines the link class.
+ *
+ * Return: Success: Ptr to entry in global link class table.
+ * Failure: NULL
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5L_class_t *
+H5L_find_class(H5L_type_t id)
+{
+ int idx; /* Filter index in global table */
+ H5L_class_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the index in the global table */
+ if ((idx = H5L__find_class_idx(id)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class")
+
+ /* Set return value */
+ ret_value = H5L_table_g + idx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_find_class */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_register
+ *
+ * Purpose: Registers a class of user-defined links, or changes the
+ * behavior of an existing class.
+ *
+ * See H5Lregister for full documentation.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_register(const H5L_class_t *cls)
+{
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(cls);
+ HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX);
+
+ /* Is the link type already registered? */
+ for (i = 0; i < H5L_table_used_g; i++)
+ if (H5L_table_g[i].id == cls->id)
+ break;
+
+ /* Filter not already registered */
+ if (i >= H5L_table_used_g) {
+ if (H5L_table_used_g >= H5L_table_alloc_g) {
+ size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g));
+ H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t)));
+ if (!table)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table")
+ H5L_table_g = table;
+ H5L_table_alloc_g = n;
+ } /* end if */
+
+ /* Initialize */
+ i = H5L_table_used_g++;
+ } /* end if */
+
+ /* Copy link class info into table */
+ H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_register */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_unregister
+ *
+ * Purpose: Unregisters a class of user-defined links.
+ *
+ * See H5Lunregister for full documentation.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, July 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_unregister(H5L_type_t id)
+{
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(id >= 0 && id <= H5L_TYPE_MAX);
+
+ /* Is the filter already registered? */
+ for (i = 0; i < H5L_table_used_g; i++)
+ if (H5L_table_g[i].id == id)
+ break;
+
+ /* Fail if filter not found */
+ if (i >= H5L_table_used_g)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered")
+
+ /* Remove filter from table */
+ /* Don't worry about shrinking table size (for now) */
+ HDmemmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i));
+ H5L_table_used_g--;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_unregister() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_is_registered
+ *
+ * Purpose: Tests whether a user-defined link class has been registered
+ * or not.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_is_registered(H5L_type_t id, hbool_t *is_registered)
+{
+ size_t i; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check args */
+ HDassert(is_registered);
+
+ /* Is the link class already registered? */
+ *is_registered = FALSE;
+ for (i = 0; i < H5L_table_used_g; i++)
+ if (H5L_table_g[i].id == id) {
+ *is_registered = TRUE;
+ break;
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5L_is_registered() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_link
+ *
+ * Purpose: Creates a link from OBJ_ID to CUR_NAME. See H5Olink() for
+ * full documentation.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, December 13, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id)
+{
+ H5O_link_t lnk; /* Link to insert */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(new_loc);
+ HDassert(obj_loc);
+ HDassert(new_name && *new_name);
+
+ /* The link callback will check that the object isn't being hard linked
+ * into a different file, so we don't need to do it here (there could be
+ * external links along the path).
+ */
+
+ /* Construct link information for eventual insertion */
+ lnk.type = H5L_TYPE_HARD;
+ lnk.u.hard.addr = obj_loc->oloc->addr;
+
+ /* Create the link */
+ if (H5L__create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_link() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_link_object
+ *
+ * Purpose: Creates a new object and a link to it.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, April 9, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id)
+{
+ H5O_link_t lnk; /* Link to insert */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(new_loc);
+ HDassert(new_name && *new_name);
+ HDassert(ocrt_info);
+
+ /* The link callback will check that the object isn't being hard linked
+ * into a different file, so we don't need to do it here (there could be
+ * external links along the path).
+ */
+
+ /* Construct link information for eventual insertion */
+ lnk.type = H5L_TYPE_HARD;
+
+ /* Create the link */
+ if (H5L__create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_link_object() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__link_cb
+ *
+ * Purpose: Callback for creating a link to an object.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 19, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *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*/)
+{
+ H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */
+ H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */
+ hid_t grp_id = FAIL; /* Id for this group (passed to user callback */
+ H5G_loc_t temp_loc; /* For UD callback */
+ hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */
+ hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid location */
+ /* (which is not what we want) */
+ if (obj_loc != NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists")
+
+ /* Check for crossing file boundaries with a new hard link */
+ if (udata->lnk->type == H5L_TYPE_HARD) {
+ /* Check for creating an object */
+ /* (only for hard links) */
+ if (udata->ocrt_info) {
+ H5G_loc_t new_loc; /* Group location for new object */
+
+ /* Create new object at this location */
+ if (NULL ==
+ (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type,
+ udata->ocrt_info->crt_info, &new_loc)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object")
+
+ /* Set address for hard link */
+ udata->lnk->u.hard.addr = new_loc.oloc->addr;
+
+ /* Set object path to use for setting object name (below) */
+ udata->path = new_loc.path;
+
+ /* Indicate that an object was created */
+ obj_created = TRUE;
+ } /* end if */
+ else {
+ /* Check that both objects are in same file */
+ if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
+ } /* end else */
+ } /* end if */
+
+ /* Set 'standard' aspects of link */
+ udata->lnk->corder =
+ 0; /* Will be re-written during group insertion, if the group is tracking creation order */
+ udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */
+
+ /* Check for non-default link creation properties */
+ if (udata->lc_plist) {
+ /* Get character encoding property */
+ if (H5CX_get_encoding(&udata->lnk->cset) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property")
+ } /* end if */
+ else
+ udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
+
+ /* Set the link's name correctly */
+ /* Casting away const OK -QAK */
+ udata->lnk->name = (char *)name;
+
+ /* Insert link into group */
+ if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE,
+ udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN,
+ udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
+
+ /* Set object's path if it has been passed in and is not set */
+ if (udata->path != NULL && udata->path->user_path_r == NULL)
+ if (H5G_name_set(grp_loc->path, udata->path, name) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name")
+
+ /* If link is a user-defined link, trigger its creation callback if it has one */
+ if (udata->lnk->type >= H5L_TYPE_UD_MIN) {
+ const H5L_class_t *link_class; /* User-defined link class */
+
+ /* Get the link class for this type of link. */
+ if (NULL == (link_class = H5L_find_class(udata->lnk->type)))
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link")
+
+ if (link_class->create_func != NULL) {
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
+ /* Create a temporary location (or else H5G_open will do a shallow
+ * copy and wipe out grp_loc)
+ */
+ H5G_name_reset(&temp_path);
+ if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
+
+ temp_loc.oloc = &temp_oloc;
+ temp_loc.path = &temp_path;
+ temp_loc_init = TRUE;
+
+ /* Set up location for user-defined callback */
+ if (NULL == (grp = H5G_open(&temp_loc)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group")
+
+ /* Make callback */
+ if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size,
+ H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed")
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Check if an object was created */
+ if (obj_created) {
+ H5O_loc_t oloc; /* Object location for created object */
+
+ /* Set up object location */
+ HDmemset(&oloc, 0, sizeof(oloc));
+ oloc.file = grp_loc->oloc->file;
+ oloc.addr = udata->lnk->u.hard.addr;
+
+ /* Decrement refcount on new object's object header in memory */
+ if (H5O_dec_rc_by_loc(&oloc) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
+ } /* end if */
+
+ /* Close the location given to the user callback if it was created */
+ if (grp_id >= 0) {
+ if (H5I_dec_app_ref(grp_id) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
+ } /* end if */
+ else if (grp != NULL) {
+ if (H5G_close(grp) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback")
+ } /* end if */
+ else if (temp_loc_init)
+ H5G_loc_free(&temp_loc);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__link_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__create_real
+ *
+ * Purpose: Creates a link at a path location
+ *
+ * lnk should have linkclass-specific information already
+ * set, but this function will take care of setting name.
+ *
+ * obj_path can be NULL if the object's path doesn't need to
+ * be set, and obj_file can be NULL if the object is not a
+ * hard link.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 5, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file,
+ H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id)
+{
+ char * norm_link_name = NULL; /* Pointer to normalized link name */
+ unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */
+ H5P_genplist_t *lc_plist = NULL; /* Link creation property list */
+ H5L_trav_cr_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check args */
+ HDassert(link_loc);
+ HDassert(link_name && *link_name);
+ HDassert(lnk);
+ HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX);
+
+ /* Get normalized link name */
+ if ((norm_link_name = H5G_normalize(link_name)) == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
+
+ /* Check for flags present in creation property list */
+ if (lcpl_id != H5P_DEFAULT) {
+ unsigned crt_intmd_group;
+
+ /* Get link creation property list */
+ if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get intermediate group creation property */
+ if (H5CX_get_intermediate_group(&crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
+
+ if (crt_intmd_group > 0)
+ target_flags |= H5G_CRT_INTMD_GROUP;
+ } /* end if */
+
+ /* Set up user data
+ * FILE is used to make sure that hard links don't cross files, and
+ * should be NULL for other link types.
+ * LC_PLIST is a pointer to the link creation property list.
+ * PATH is a pointer to the path of the object being inserted if this is
+ * a hard link; this is used to set the paths to objects when they are
+ * created. For other link types, this is NULL.
+ * OCRT_INFO is a pointer to the structure for object creation.
+ * LNK is the link struct passed into this function. At this point all
+ * of its fields should be populated except for name, which is set when
+ * inserting it in the callback.
+ */
+ udata.file = obj_file;
+ udata.lc_plist = lc_plist;
+ udata.path = obj_path;
+ udata.ocrt_info = ocrt_info;
+ udata.lnk = lnk;
+
+ /* Traverse the destination path & create new link */
+ if (H5G_traverse(link_loc, link_name, target_flags, H5L__link_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link")
+
+done:
+ /* Free the normalized path name */
+ if (norm_link_name)
+ H5MM_xfree(norm_link_name);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__create_real() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__create_hard
+ *
+ * Purpose: Creates a hard link from NEW_NAME to CUR_NAME.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc, const char *link_name,
+ hid_t lcpl_id)
+{
+ char * norm_cur_name = NULL; /* Pointer to normalized current name */
+ H5F_t * link_file = NULL; /* Pointer to file to link to */
+ H5O_link_t lnk; /* Link to insert */
+ H5G_loc_t obj_loc; /* Location of object to link to */
+ H5G_name_t path; /* obj_loc's path*/
+ H5O_loc_t oloc; /* obj_loc's oloc */
+ hbool_t loc_valid = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ HDassert(cur_loc);
+ HDassert(cur_name && *cur_name);
+ HDassert(link_loc);
+ HDassert(link_name && *link_name);
+
+ /* Get normalized copy of the current name */
+ if ((norm_cur_name = H5G_normalize(cur_name)) == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
+
+ /* Set up link data specific to hard links */
+ lnk.type = H5L_TYPE_HARD;
+
+ /* Get object location for object pointed to */
+ obj_loc.path = &path;
+ obj_loc.oloc = &oloc;
+ H5G_loc_reset(&obj_loc);
+ if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found")
+ loc_valid = TRUE;
+
+ /* Construct link information for eventual insertion */
+ lnk.u.hard.addr = obj_loc.oloc->addr;
+
+ /* Set destination's file information */
+ link_file = obj_loc.oloc->file;
+
+ /* Create actual link to the object. Pass in NULL for the path, since this
+ * function shouldn't change an object's user path. */
+ if (H5L__create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
+
+done:
+ /* Free the object header location */
+ if (loc_valid)
+ if (H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location")
+
+ /* Free the normalized path name */
+ if (norm_cur_name)
+ H5MM_xfree(norm_cur_name);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__create_hard() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__create_soft
+ *
+ * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 6, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id)
+{
+ char * norm_target = NULL; /* Pointer to normalized current name */
+ H5O_link_t lnk; /* Link to insert */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ HDassert(link_loc);
+ HDassert(target_path && *target_path);
+ HDassert(link_name && *link_name);
+
+ /* Get normalized copy of the link target */
+ if ((norm_target = H5G_normalize(target_path)) == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
+
+ /* Set up link data specific to soft links */
+ lnk.type = H5L_TYPE_SOFT;
+ lnk.u.soft.name = norm_target;
+
+ /* Create actual link to the object */
+ if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
+
+done:
+ /* Free the normalized target name */
+ if (norm_target)
+ H5MM_xfree(norm_target);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__create_soft() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__create_ud
+ *
+ * Purpose: Creates a user-defined link. See H5Lcreate_ud for
+ * full documentation.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Friday, May 19, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data, size_t ud_data_size,
+ H5L_type_t type, hid_t lcpl_id)
+{
+ H5O_link_t lnk; /* Link to insert */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check args */
+ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
+ HDassert(link_loc);
+ HDassert(link_name && *link_name);
+ HDassert(ud_data_size == 0 || ud_data);
+
+ /* Initialize the link struct's pointer to its udata buffer */
+ lnk.u.ud.udata = NULL;
+
+ /* Make sure that this link class is registered */
+ if (H5L__find_class_idx(type) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library")
+
+ /* Fill in UD link-specific information in the link struct*/
+ if (ud_data_size > 0) {
+ lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size);
+ H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t)ud_data_size);
+ } /* end if */
+ else
+ lnk.u.ud.udata = NULL;
+
+ lnk.u.ud.size = ud_data_size;
+ lnk.type = type;
+
+ /* Create actual link to the object */
+ if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object")
+
+done:
+ /* Free the link's udata buffer if it's been allocated */
+ H5MM_xfree(lnk.u.ud.udata);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__create_ud() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_val_real
+ *
+ * Purpose: Retrieve link value from a link object
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(lnk);
+
+ /* Check for soft link */
+ if (H5L_TYPE_SOFT == lnk->type) {
+ /* Copy to output buffer */
+ if (size > 0 && buf) {
+ HDstrncpy((char *)buf, lnk->u.soft.name, size);
+ if (HDstrlen(lnk->u.soft.name) >= size)
+ ((char *)buf)[size - 1] = '\0';
+ } /* end if */
+ } /* end if */
+ /* Check for user-defined link */
+ else if (lnk->type >= H5L_TYPE_UD_MIN) {
+ const H5L_class_t *link_class; /* User-defined link class */
+
+ /* Get the link class for this type of link. It's okay if the class
+ * isn't registered, though--we just can't give any more information
+ * about it
+ */
+ link_class = H5L_find_class(lnk->type);
+
+ if (link_class != NULL && link_class->query_func != NULL) {
+ if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure")
+ } /* end if */
+ else if (buf && size > 0)
+ ((char *)buf)[0] = '\0';
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_val_real() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_val_cb
+ *
+ * Purpose: Callback for retrieving link value or udata.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, September 20, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
+{
+ H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if (lnk == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
+
+ /* Retrieve the value for the link */
+ if (H5L__get_val_real(lnk, udata->buf, udata->size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_val_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_val
+ *
+ * Purpose: Returns the value of a symbolic link or the udata for a
+ * user-defined link.
+ *
+ * Return: Success: Non-negative, with at most SIZE bytes of the
+ * link value copied into the BUF buffer. If the
+ * link value is larger than SIZE characters
+ * counting the null terminator then the BUF
+ * result will not be null terminated.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Monday, April 13, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size)
+{
+ H5L_trav_gv_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Set up user data for retrieving information */
+ udata.size = size;
+ udata.buf = buf;
+
+ /* Traverse the group hierarchy to locate the object to get info about */
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L__get_val() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_val_by_idx_cb
+ *
+ * Purpose: Callback for retrieving a link's value according to an
+ * index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_val_by_idx_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*/)
+{
+ H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
+ H5O_link_t fnd_lnk; /* Link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name of the group resolved to a valid object */
+ if (obj_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Query link */
+ if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
+ lnk_copied = TRUE;
+
+ /* Retrieve the value for the link */
+ if (H5L__get_val_real(&fnd_lnk, udata->buf, udata->size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value")
+
+done:
+ /* Reset the link information, if we have a copy */
+ if (lnk_copied)
+ H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_val_by_idx_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_val_by_idx
+ *
+ * Purpose: Internal routine to query a link value according to the
+ * index within a group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * December 27, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, void *buf /*out*/, size_t size)
+{
+ H5L_trav_gvbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Set up user data for retrieving information */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+ udata.buf = buf;
+ udata.size = size;
+
+ /* Traverse the group hierarchy to locate the object to get info about */
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_by_idx_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_val_by_idx() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__delete_cb
+ *
+ * Purpose: Callback for deleting a link. This routine
+ * actually deletes the link
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 19, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk,
+ H5G_loc_t H5_ATTR_UNUSED *obj_loc, void H5_ATTR_UNUSED *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the group resolved to a valid link */
+ if (grp_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Check if the name in this group resolved to a valid link */
+ if (name == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Check for non-existent (NULL) link.
+ * Note that this can also occur when attempting to remove '.'
+ */
+ if (lnk == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL,
+ "callback link pointer is NULL (specified link may be '.' or not exist)")
+
+ /* Remove the link from the group */
+ if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__delete_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__delete
+ *
+ * Purpose: Delete a link from a group.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Thursday, September 17, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__delete(const H5G_loc_t *loc, const char *name)
+{
+ char * norm_name = NULL; /* Pointer to normalized name */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Get normalized copy of the name */
+ if ((norm_name = H5G_normalize(name)) == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name")
+
+ /* Set up user data for unlink operation */
+ if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_cb,
+ NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object")
+
+done:
+ /* Free the normalized path name */
+ if (norm_name)
+ H5MM_xfree(norm_name);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__delete_by_idx_cb
+ *
+ * Purpose: Callback for removing a link according to an index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__delete_by_idx_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*/)
+{
+ H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_TAG((obj_loc) ? (obj_loc->oloc->addr) : HADDR_UNDEF)
+
+ /* Check if the name of the group resolved to a valid object */
+ if (obj_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Delete link */
+ if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order,
+ udata->n) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5L__delete_by_idx_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__delete_by_idx
+ *
+ * Purpose: Internal routine to delete a link according to its index
+ * within a group.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * December 27, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n)
+{
+ H5L_trav_rmbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Set up user data for unlink operation */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+
+ /* Traverse the group hierarchy to remove the link */
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT,
+ H5L__delete_by_idx_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__delete_by_idx() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__move_dest_cb
+ *
+ * Purpose: Second callback for moving and renaming an object. This routine
+ * inserts a new link into the group returned by the traversal.
+ * It is called by H5L__move_cb.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, April 3, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *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*/)
+{
+ H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */
+ H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */
+ hid_t grp_id = FAIL; /* ID for this group (passed to user callback */
+ H5G_loc_t temp_loc; /* For UD callback */
+ hbool_t temp_loc_init = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Make sure an object with this name doesn't already exist */
+ if (obj_loc != NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists")
+
+ /* Check for crossing file boundaries with a new hard link */
+ if (udata->lnk->type == H5L_TYPE_HARD)
+ /* Check that both objects are in same file */
+ if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
+
+ /* Give the object its new name */
+ /* Casting away const okay -JML */
+ HDassert(udata->lnk->name == NULL);
+ udata->lnk->name = (char *)name;
+
+ /* Insert the link into the group */
+ if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
+
+ /* If the link was a user-defined link, call its move callback if it has one */
+ if (udata->lnk->type >= H5L_TYPE_UD_MIN) {
+ const H5L_class_t *link_class; /* User-defined link class */
+
+ /* Get the link class for this type of link. */
+ if (NULL == (link_class = H5L_find_class(udata->lnk->type)))
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered")
+
+ if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) {
+ H5O_loc_t temp_oloc;
+ H5G_name_t temp_path;
+
+ /* Create a temporary location (or else H5G_open will do a shallow
+ * copy and wipe out grp_loc)
+ */
+ H5G_name_reset(&temp_path);
+ if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
+
+ temp_loc.oloc = &temp_oloc;
+ temp_loc.path = &temp_path;
+ temp_loc_init = TRUE;
+
+ /* Set up location for user-defined callback */
+ if (NULL == (grp = H5G_open(&temp_loc)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+ if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID")
+
+ if (udata->copy) {
+ if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata,
+ udata->lnk->u.ud.size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error")
+ } /* end if */
+ else {
+ if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata,
+ udata->lnk->u.ud.size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error")
+ } /* end else */
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Close the location given to the user callback if it was created */
+ if (grp_id >= 0) {
+ if (H5I_dec_app_ref(grp_id) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback")
+ } /* end if */
+ else if (grp != NULL) {
+ if (H5G_close(grp) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback")
+ } /* end if */
+ else if (temp_loc_init)
+ H5G_loc_free(&temp_loc);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ /* Reset the "name" field in udata->lnk because it is owned by traverse()
+ * and must not be manipulated after traverse closes */
+ udata->lnk->name = NULL;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__move_dest_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__move_cb
+ *
+ * Purpose: Callback for moving and renaming an object. This routine
+ * replaces the names of open objects with the moved object
+ * in the path
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Friday, April 3, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc,
+ void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
+{
+ H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */
+ H5L_trav_mv2_t udata_out; /* User data for H5L__move_dest_cb traversal */
+ char * orig_name = NULL; /* The name of the link in this group */
+ hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if (obj_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Check for operations on '.' */
+ if (lnk == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy")
+
+ /* Set up user data for move_dest_cb */
+ if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved")
+
+ /* In this special case, the link's name is going to be replaced at its
+ * destination, so we should free it here.
+ */
+ udata_out.lnk->name = (char *)H5MM_xfree(udata_out.lnk->name);
+ link_copied = TRUE;
+
+ udata_out.lnk->cset = udata->cset;
+ udata_out.file = grp_loc->oloc->file;
+ udata_out.copy = udata->copy;
+
+ /* Keep a copy of link's name (it's "owned" by the H5G_traverse() routine) */
+ orig_name = H5MM_xstrdup(name);
+
+ /* Reset the # of soft / UD links that can be traversed, so that the second
+ * (destination) traversal has the correct value
+ */
+ if (H5CX_set_nlinks(udata->orig_nlinks) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse")
+
+ /* Insert the link into its new location */
+ if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb,
+ &udata_out) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link")
+
+ /* If this is a move and not a copy operation, change the object's name and remove the old link */
+ if (!udata->copy) {
+ H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */
+
+ /* Make certain that the destination name is a full (not relative) path */
+ if (*(udata->dst_name) != '/') {
+ HDassert(udata->dst_loc->path->full_path_r);
+
+ /* Create reference counted string for full dst path */
+ if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r,
+ udata->dst_name)) == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name")
+ } /* end if */
+ else
+ dst_name_r = H5RS_wrap(udata->dst_name);
+ HDassert(dst_name_r);
+
+ /* Fix names up */
+ if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r,
+ udata->dst_loc->oloc->file, dst_name_r) < 0) {
+ H5RS_decr(dst_name_r);
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name")
+ } /* end if */
+
+ /* Remove the old link */
+ if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name) < 0) {
+ H5RS_decr(dst_name_r);
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name")
+ } /* end if */
+
+ H5RS_decr(dst_name_r);
+ } /* end if */
+
+done:
+ /* Cleanup */
+ if (orig_name)
+ H5MM_xfree(orig_name);
+
+ /* If udata_out.lnk was copied, free any memory allocated
+ * In this special case, the H5L__move_dest_cb callback resets the name
+ * so H5O_msg_free shouldn't try to free it
+ */
+ if (link_copied)
+ H5O_msg_free(H5O_LINK_ID, udata_out.lnk);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__move_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__move
+ *
+ * Purpose: Atomically move or copy a link.
+ *
+ * Creates a copy of a link in a new destination with a new name.
+ * SRC_LOC and SRC_NAME together define the link's original
+ * location, while DST_LOC and DST_NAME together define its
+ * final location.
+ *
+ * If copy_flag is FALSE, the original link is removed
+ * (effectively moving the link).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, May 1, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name,
+ hbool_t copy_flag, hid_t lcpl_id)
+{
+ unsigned dst_target_flags = H5G_TARGET_NORMAL;
+ H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */
+ H5P_genplist_t *lc_plist; /* Link creation property list */
+ H5L_trav_mv_t udata; /* User data for traversal */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(src_loc);
+ HDassert(dst_loc);
+ HDassert(src_name && *src_name);
+ HDassert(dst_name && *dst_name);
+
+ /* Check for flags present in creation property list */
+ if (lcpl_id != H5P_DEFAULT) {
+ unsigned crt_intmd_group;
+
+ if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get intermediate group creation property */
+ if (H5CX_get_intermediate_group(&crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
+
+ /* Set target flags for source and destination */
+ if (crt_intmd_group > 0)
+ dst_target_flags |= H5G_CRT_INTMD_GROUP;
+
+ /* Get character encoding property */
+ if (H5CX_get_encoding(&char_encoding) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
+ } /* end if */
+
+ /* Set up user data */
+ udata.dst_loc = dst_loc;
+ udata.dst_name = dst_name;
+ udata.dst_target_flags = dst_target_flags;
+ udata.cset = char_encoding;
+ udata.copy = copy_flag;
+
+ /* Retrieve the original # of soft / UD links that can be traversed, so
+ * that the countdown can be reset after the first path is traversed.
+ */
+ if (H5CX_get_nlinks(&udata.orig_nlinks) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse")
+
+ /* Do the move */
+ if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb,
+ &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__move() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__exists_final_cb
+ *
+ * Purpose: Callback for checking whether a link exists, as the final
+ * component of a path
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 16 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name,
+ const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/)
+{
+ H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check if the name in this group resolved to a valid link */
+ *udata->exists = (hbool_t)(lnk != NULL);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5L__exists_final_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__exists_inter_cb
+ *
+ * Purpose: Callback for checking whether a link exists, as an intermediate
+ * component of a path
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 31 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name,
+ const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/,
+ H5G_own_loc_t *own_loc /*out*/)
+{
+ H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if (lnk != NULL) {
+ /* Check for more components to the path */
+ if (udata->sep) {
+ H5G_traverse_t cb_func; /* Callback function for tranversal */
+ char * next; /* Pointer to next component name */
+
+ /* Look for another separator */
+ next = udata->sep;
+ if (NULL == (udata->sep = HDstrchr(udata->sep, '/')))
+ cb_func = H5L__exists_final_cb;
+ else {
+ /* Chew through adjacent separators, if present */
+ do {
+ *udata->sep = '\0';
+ udata->sep++;
+ } while ('/' == *udata->sep);
+ cb_func = H5L__exists_inter_cb;
+ } /* end else */
+ if (H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists")
+ } /* end if */
+ else
+ *udata->exists = TRUE;
+ } /* end if */
+ else
+ *udata->exists = FALSE;
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__exists_inter_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_exists_tolerant
+ *
+ * Purpose: Returns whether a link exists in a group
+ *
+ * Note: Same as H5L__exists, except that missing links are reported
+ * as 'FALSE' instead of causing failures
+ *
+ * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 31 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists)
+{
+ H5L_trav_le_t udata; /* User data for traversal */
+ H5G_traverse_t cb_func; /* Callback function for tranversal */
+ char * name_copy = NULL; /* Duplicate of name */
+ char * name_trav; /* Name to traverse */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(loc);
+ HDassert(name);
+ HDassert(exists);
+
+ /* Copy the name and skip leading '/'s */
+ name_trav = name_copy = H5MM_strdup(name);
+ while ('/' == *name_trav)
+ name_trav++;
+
+ /* A path of "/" will always exist in a file */
+ if ('\0' == *name_trav)
+ *exists = TRUE;
+ else {
+ /* Set up user data & correct callback */
+ udata.exists = exists;
+ if (NULL == (udata.sep = HDstrchr(name_trav, '/')))
+ cb_func = H5L__exists_final_cb;
+ else {
+ /* Chew through adjacent separators, if present */
+ do {
+ *udata.sep = '\0';
+ udata.sep++;
+ } while ('/' == *udata.sep);
+ cb_func = H5L__exists_inter_cb;
+ } /* end else */
+
+ /* Traverse the group hierarchy to locate the link to check */
+ if (H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists")
+ }
+
+done:
+ /* Release duplicated string */
+ H5MM_xfree(name_copy);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L_exists_tolerant() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__exists
+ *
+ * Purpose: Returns whether a link exists in a group
+ *
+ * Note: Same as H5L_exists_tolerant, except that missing links are reported
+ * as failures
+ *
+ * Return: Non-negative on success, with *exists set/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 16 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists)
+{
+ H5L_trav_le_t udata; /* User data for traversal */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(loc);
+ HDassert(name);
+ HDassert(exists);
+
+ /* A path of "/" will always exist in a file */
+ if (0 == HDstrcmp(name, "/"))
+ *exists = TRUE;
+ else {
+ /* Traverse the group hierarchy to locate the object to get info about */
+ udata.exists = exists;
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L__exists() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_info_cb
+ *
+ * Purpose: Callback for retrieving a link's metadata
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, April 17 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk,
+ H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/)
+{
+ H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name in this group resolved to a valid link */
+ if (lnk == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist")
+
+ /* Get information from the link */
+ if (H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_info_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_get_info
+ *
+ * Purpose: Returns metadata about a link.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: James Laird
+ * Monday, April 17 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/)
+{
+ H5L_trav_gi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ udata.linfo = linfo;
+
+ /* Traverse the group hierarchy to locate the object to get info about */
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5L_get_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_info_by_idx_cb
+ *
+ * Purpose: Callback for retrieving a link's metadata according to an
+ * index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 6 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_info_by_idx_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*/)
+{
+ H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */
+ H5O_link_t fnd_lnk; /* Link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name of the group resolved to a valid object */
+ if (obj_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Query link */
+ if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
+ lnk_copied = TRUE;
+
+ /* Get information from the link */
+ if (H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info")
+
+done:
+ /* Reset the link information, if we have a copy */
+ if (lnk_copied)
+ H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
+
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_info_by_idx_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_info_by_idx
+ *
+ * Purpose: Internal routine to retrieve link info according to an
+ * index's order.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, H5L_info2_t *linfo /*out*/)
+{
+ H5L_trav_gibi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ HDassert(loc);
+ HDassert(name && *name);
+ HDassert(linfo);
+
+ /* Set up user data for callback */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+ udata.linfo = linfo;
+
+ /* Traverse the group hierarchy to locate the object to get info about */
+ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_info_by_idx() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_name_by_idx_cb
+ *
+ * Purpose: Callback for retrieving a link's name according to an
+ * index's order.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 11 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5L__get_name_by_idx_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*/)
+{
+ H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check if the name of the group resolved to a valid object */
+ if (obj_loc == NULL)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
+
+ /* Query link */
+ if (H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, udata->name,
+ udata->size, &udata->name_len) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
+
+done:
+ /* Indicate that this callback didn't take ownership of the group *
+ * location for the object */
+ *own_loc = H5G_OWN_NONE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_name_by_idx_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__get_name_by_idx
+ *
+ * Purpose: Internal routine to retrieve link name according to an
+ * index's order.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, char *name /*out*/, size_t size, size_t *link_name_len)
+{
+ H5L_trav_gnbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
+ HDassert(loc);
+ HDassert(group_name && *group_name);
+ HDassert(link_name_len);
+
+ /* Set up user data for callback */
+ udata.idx_type = idx_type;
+ udata.order = order;
+ udata.n = n;
+ udata.name = name;
+ udata.size = size;
+ udata.name_len = 0;
+
+ /* Traverse the group hierarchy to locate the link to get name of */
+ if (H5G_traverse(loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_name_by_idx_cb, &udata) <
+ 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name")
+
+ /* Set the return value */
+ *link_name_len = udata.name_len;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__get_name_by_idx() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L__link_copy_file
+ *
+ * Purpose: Copy a link and the object it points to from one file to
+ * another.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sep 29 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
+ H5O_link_t *dst_lnk, H5O_copy_t *cpy_info)
+{
+ H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */
+ const H5O_link_t *src_lnk = _src_lnk; /* Source link */
+ hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */
+ hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */
+ H5G_loc_t tmp_src_loc; /* Group location holding target object */
+ H5G_name_t tmp_src_path; /* Path for target object */
+ H5O_loc_t tmp_src_oloc; /* Object location for target object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* check arguments */
+ HDassert(dst_file);
+ HDassert(src_lnk);
+ HDassert(dst_lnk);
+ HDassert(cpy_info);
+
+ /* Expand soft or external link, if requested */
+ if ((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) ||
+ (H5L_TYPE_EXTERNAL == src_lnk->type && cpy_info->expand_ext_link)) {
+ H5G_loc_t lnk_grp_loc; /* Group location holding link */
+ H5G_name_t lnk_grp_path; /* Path for link */
+ hbool_t tar_exists = FALSE; /* Whether the target object exists */
+
+ /* Set up group location for link */
+ H5G_name_reset(&lnk_grp_path);
+ lnk_grp_loc.path = &lnk_grp_path;
+ lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
+
+ /* Check if the target object exists */
+ if (H5G_loc_exists(&lnk_grp_loc, src_lnk->name, &tar_exists) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists")
+
+ if (tar_exists) {
+ /* Make a temporary copy of the link, so that it will not change the
+ * info in the cache when we change it to a hard link */
+ if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message")
+
+ /* Set up group location for target object. Let H5G_traverse expand
+ * the link. */
+ tmp_src_loc.path = &tmp_src_path;
+ tmp_src_loc.oloc = &tmp_src_oloc;
+ if (H5G_loc_reset(&tmp_src_loc) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location")
+
+ /* Find the target object */
+ if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object")
+ expanded_link_open = TRUE;
+
+ /* Convert symbolic link to hard link */
+ if (tmp_src_lnk.type == H5L_TYPE_SOFT)
+ tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name);
+ else if (tmp_src_lnk.u.ud.size > 0)
+ tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata);
+ tmp_src_lnk.type = H5L_TYPE_HARD;
+ tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr;
+ src_lnk = &tmp_src_lnk;
+ } /* end if */
+ } /* end if */
+
+ /* Copy src link information to dst link information */
+ if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message")
+ dst_lnk_init = TRUE;
+
+ /* Check if object in source group is a hard link & copy it */
+ if (H5L_TYPE_HARD == src_lnk->type) {
+ H5O_loc_t new_dst_oloc; /* Copied object location in destination */
+
+ /* Set up copied object location to fill in */
+ H5O_loc_reset(&new_dst_oloc);
+ new_dst_oloc.file = dst_file;
+
+ if (!expanded_link_open) {
+ /* Build temporary object location for source */
+ H5O_loc_reset(&tmp_src_oloc);
+ tmp_src_oloc.file = src_oloc->file;
+ tmp_src_oloc.addr = src_lnk->u.hard.addr;
+ } /* end if */
+ HDassert(H5F_addr_defined(tmp_src_oloc.addr));
+
+ /* Copy the shared object from source to destination */
+ /* Don't care about obj_type or udata because those are only important
+ * for old style groups */
+ if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object")
+
+ /* Copy new destination object's information for eventual insertion */
+ dst_lnk->u.hard.addr = new_dst_oloc.addr;
+ } /* end if */
+
+done:
+ /* Check if we used a temporary src link */
+ if (src_lnk != _src_lnk) {
+ HDassert(src_lnk == &tmp_src_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk);
+ } /* end if */
+ if (ret_value < 0)
+ if (dst_lnk_init)
+ H5O_msg_reset(H5O_LINK_ID, dst_lnk);
+ /* Check if we need to free the temp source oloc */
+ if (expanded_link_open)
+ if (H5G_loc_free(&tmp_src_loc) < 0)
+ HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__link_copy_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5L_iterate
+ *
+ * Purpose: Iterates through links in a group
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t *idx_p, H5L_iterate2_t op, void *op_data)
+{
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ hsize_t last_lnk; /* Index of last object looked at */
+ hsize_t idx; /* Internal location to hold index */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity checks */
+ HDassert(loc);
+ HDassert(group_name);
+ HDassert(op);
+
+ /* Set up iteration beginning/end info */
+ idx = (idx_p == NULL ? 0 : *idx_p);
+ last_lnk = 0;
+
+ /* Build link operator info */
+ lnk_op.op_type = H5G_LINK_OP_NEW;
+ lnk_op.op_func.op_new = op;
+
+ /* Iterate over the links */
+ if ((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+
+ /* Set the index we stopped at */
+ if (idx_p)
+ *idx_p = last_lnk;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L_iterate() */
diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h
index 54b94a4..cffd25c 100644
--- a/src/H5Lmodule.h
+++ b/src/H5Lmodule.h
@@ -30,11 +30,34 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5L H5L
- * \brief Link Interface
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage HDF5 links and link types.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5L_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5L_examples.c iter_cb
+ * \snippet{lineno} H5L_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5L_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5L_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
* \defgroup TRAV Link Traversal
* \ingroup H5L
+ * \defgroup H5LA Advanced Link Functions
+ * \ingroup H5L
*/
#endif /* H5Lmodule_H */
diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h
index 7057e30..36a4d12 100644
--- a/src/H5Lpkg.h
+++ b/src/H5Lpkg.h
@@ -53,26 +53,27 @@
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id);
-H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, const char *cur_name,
- hid_t lcpl_id);
-H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data,
- size_t ud_data_size, H5L_type_t type, hid_t lcpl_id);
-H5_DLL herr_t H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
-H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/);
-H5_DLL ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size);
-H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size);
-H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size);
-H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc,
- const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
-H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
- H5O_link_t *dst_lnk, H5O_copy_t *cpy_info);
+H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc,
+ const char *link_name, hid_t lcpl_id);
+H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, const char *cur_name,
+ hid_t lcpl_id);
+H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data,
+ size_t ud_data_size, H5L_type_t type, hid_t lcpl_id);
+H5_DLL herr_t H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
+H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/);
+H5_DLL herr_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
+ size_t *name_len);
+H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size);
+H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size);
+H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc,
+ const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
+H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name);
+H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
+ H5O_link_t *dst_lnk, H5O_copy_t *cpy_info);
#endif /* H5Lpkg_H */
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 740fc1e..98e3051 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -18,8 +18,9 @@
#ifndef H5Lprivate_H
#define H5Lprivate_H
-/* Include package's public header */
+/* Include package's public headers */
#include "H5Lpublic.h"
+#include "H5Ldevelop.h"
/* Private headers needed by this file */
#include "H5Gprivate.h" /* Groups */
@@ -51,50 +52,6 @@
/* Library Private Typedefs */
/****************************/
-/* User data for path traversal routine for getting link value by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
- size_t size; /* Size of user buffer */
-
- /* Out */
- void *buf; /* User buffer */
-} H5L_trav_gvbi_t;
-
-/* User data for path traversal routine for getting link info by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
-
- /* Out */
- H5L_info2_t *linfo; /* Buffer to return to user */
-} H5L_trav_gibi_t;
-
-/* User data for path traversal routine for getting name by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
- size_t size; /* Size of name buffer */
-
- /* Out */
- char * name; /* Buffer to return name to user */
- ssize_t name_len; /* Length of full name */
-} H5L_trav_gnbi_t;
-
-/* User data for path traversal routine for removing link by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
-} H5L_trav_rmbi_t;
-
/* Structure for external link traversal callback property */
typedef struct H5L_elink_cb_t {
H5L_elink_traverse_t func;
@@ -123,6 +80,7 @@ H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx
/* User-defined link functions */
H5_DLL herr_t H5L_register(const H5L_class_t *cls);
H5_DLL herr_t H5L_unregister(H5L_type_t id);
+H5_DLL herr_t H5L_is_registered(H5L_type_t id, hbool_t *is_registered);
H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
#endif /* H5Lprivate_H */
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index d5ec346..72b0182 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -39,17 +39,12 @@
*
* The maximum length of a link's name is encoded in a 32-bit unsigned integer.
*/
-#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
+#define H5L_MAX_LINK_NAME_LEN UINT32_MAX
/**
* \brief Macro to indicate operation occurs on same location
*/
-#define H5L_SAME_LOC (hid_t)0
-
-/**
- * \brief Current version of the H5L_class_t struct
- */
-#define H5L_LINK_CLASS_T_VERS 1
+#define H5L_SAME_LOC 0 /* (hid_t) */
#ifdef __cplusplus
extern "C" {
@@ -92,7 +87,7 @@ typedef enum {
/**
* \brief Information struct for links
*/
-//! [H5L_info2_t_snip]
+//! <!-- [H5L_info2_t_snip] -->
typedef struct {
H5L_type_t type; /**< Type of link */
hbool_t corder_valid; /**< Indicate if creation order is valid */
@@ -103,75 +98,16 @@ typedef struct {
size_t val_size; /**< Size of a soft link or user-defined link value */
} u;
} H5L_info2_t;
-//! [H5L_info2_t_snip]
-
-/* The H5L_class_t struct can be used to override the behavior of a
- * "user-defined" link class. Users should populate the struct with callback
- * functions defined below.
- */
-/* Callback prototypes for user-defined links */
-/**
- * \brief Link creation callback
- */
-typedef herr_t (*H5L_create_func_t)(const char *link_name, hid_t loc_group, const void *lnkdata,
- size_t lnkdata_size, hid_t lcpl_id);
-/**
- * \brief Callback for link move
- */
-typedef herr_t (*H5L_move_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
- size_t lnkdata_size);
-/**
- * \brief Callback for link copy
- */
-typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata,
- size_t lnkdata_size);
-/**
- * \brief Callback during link traversal
- */
-typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
- size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id);
-/**
- * \brief Callback for link deletion
- */
-typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, const void *lnkdata,
- size_t lnkdata_size);
-/**
- * \brief Callback for querying the link.
- *
- * Returns the size of the buffer needed.
- */
-typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size,
- void *buf /*out*/, size_t buf_size);
-
-/**
- * \brief Link prototype
- *
- * The H5L_class_t struct can be used to override the behavior of a
- * "user-defined" link class. Users should populate the struct with callback
- * functions defined elsewhere.
- */
-//! [H5L_class_t_snip]
-typedef struct {
- int version; /**< Version number of this struct */
- H5L_type_t id; /**< Link type ID */
- const char * comment; /**< Comment for debugging */
- H5L_create_func_t create_func; /**< Callback during link creation */
- H5L_move_func_t move_func; /**< Callback after moving link */
- H5L_copy_func_t copy_func; /**< Callback after copying link */
- H5L_traverse_func_t trav_func; /**< Callback during link traversal */
- H5L_delete_func_t del_func; /**< Callback for link deletion */
- H5L_query_func_t query_func; /**< Callback for queries */
-} H5L_class_t;
-//! [H5L_class_t_snip]
+//! <!-- [H5L_info2_t_snip] -->
/**
* \brief Prototype for H5Literate2(), H5Literate_by_name2() operator
*
* The H5O_token_t version is used in the VOL layer and future public API calls.
*/
-//! [H5L_iterate2_t_snip]
+//! <!-- [H5L_iterate2_t_snip] -->
typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
-//! [H5L_iterate2_t_snip]
+//! <!-- [H5L_iterate2_t_snip] -->
/**
* \brief Callback for external link traversal
@@ -201,8 +137,6 @@ typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lmove() moves a link within an HDF5 file. The original link,
* \p src_name, is removed from \p src_loc and the new link,
* \p dst_name, is inserted at dst_loc. This change is
@@ -321,8 +255,6 @@ H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lcreate_hard() creates a new hard link to a pre-existing object
* in an HDF5 file.
*
@@ -357,6 +289,11 @@ H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const
*/
H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, const char *dst_name,
hid_t lcpl_id, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Lcreate_hard}
+ */
H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id,
const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id);
@@ -373,8 +310,6 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lcreate_soft() creates a new soft link to an object in an HDF5
* file.
*
@@ -426,6 +361,11 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u
*/
H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id,
hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Lcreate_soft}
+ */
H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_line,
const char *link_target, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id, hid_t es_id);
@@ -440,8 +380,6 @@ H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, u
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Ldelete() removes the link specified by \p name from the location
* \p loc_id.
*
@@ -468,6 +406,11 @@ H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, u
*
*/
H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ldelete}
+ */
H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t lapl_id, hid_t es_id);
/**
@@ -484,8 +427,6 @@ H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsign
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group
* according to the specified order, \p order, in the specified index,
* \p index.
@@ -500,6 +441,11 @@ H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsign
*/
H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ldelete_by_idx}
+ */
H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id);
@@ -516,8 +462,6 @@ H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func,
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lget_val() returns tha value of link \p name. For smbolic links,
* this is the path to which the link points, including the null
* terminator. For external and user-defined links, it is the link
@@ -575,8 +519,6 @@ H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in
* a group, according to the specified order, \p order, within an
* index, \p index.
@@ -630,8 +572,6 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lexists() allows an application to determine whether the link \p
* name exists in the location specified by \p loc_id. The link may be
* of any type; only the presence of a link with that name is checked.
@@ -707,6 +647,11 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t
*
*/
H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Lexists}
+ */
H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id);
/**
@@ -721,8 +666,6 @@ H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsign
*
* \return \herr_t
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lget_info2() returns information about the specified link through
* the \p linfo argument.
*
@@ -830,8 +773,6 @@ H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, h
*
* \see H5Lget_info2()
*
- * \todo Document H5Lget_info_by_idx()
- *
*/
H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id);
@@ -957,6 +898,11 @@ H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index
*/
H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
H5L_iterate2_t op, void *op_data);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Literate}
+ */
H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op,
void *op_data, hid_t es_id);
@@ -1240,179 +1186,6 @@ H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t
/**
* \ingroup H5LA
*
- * \brief Registers a user-defined link class or changes behavior of an
- * existing class
- *
- * \param[in] cls Pointer to a buffer containing the struct describing the
- * user-defined link class
- *
- * \return \herr_t
- *
- * \details H5Lregister() registers a class of user-defined links, or changes
- * the behavior of an existing class.
- *
- * \p cls is a pointer to a buffer containing a copy of the
- * H5L_class_t struct. This struct is defined in H5Lpublic.h as
- * follows:
- * \snippet this H5L_class_t_snip
- *
- * The class definition passed with \p cls must include at least the
- * following:
- * \li An H5L_class_t version (which should be #H5L_LINK_CLASS_T_VERS)
- * \li A link class identifier, \c class_id
- * \li A traversal function, \c trav_func
- *
- * Remaining \c struct members are optional and may be passed as NULL.
- *
- * The link class passed in \c class_id must be in the user-definable
- * range between #H5L_TYPE_UD_MIN and #H5L_TYPE_UD_MAX
- * (see the table below) and will override
- * any existing link class with that identifier.
- *
- * As distributed, valid values of \c class_id used in HDF5 include
- * the following (defined in H5Lpublic.h):
- * \link_types
- *
- * The hard and soft link class identifiers cannot be modified or
- * reassigned, but the external link class is implemented as an
- * example in the user-definable link class identifier range.
- * H5Lregister() is used to register additional link classes. It could
- * also be used to modify the behavior of the external link class,
- * though that is not recommended.
- *
- * The following table summarizes existing link types and values and
- * the reserved and user-definable link class identifier value ranges.
- * <table>
- * <tr>
- * <th>Link class identifier or Value range</th>
- * <th>Description</th>
- * <th>Link class or label</th>
- * </tr>
- * <tr>
- * <td>0 to 63</td>
- * <td>Reserved range</td>
- * <td></td>
- * </tr>
- * <tr>
- * <td>64 to 255</td>
- * <td>User-definable range</td>
- * <td></td>
- * </tr>
- * <tr>
- * <td>64</td>
- * <td>Minimum user-defined value</td>
- * <td>#H5L_TYPE_UD_MIN</td>
- * </tr>
- * <tr>
- * <td>64</td>
- * <td>External link</td>
- * <td>#H5L_TYPE_EXTERNAL</td>
- * </tr>
- * <tr>
- * <td>255</td>
- * <td>Maximum user-defined value</td>
- * <td>#H5L_TYPE_UD_MAX</td>
- * </tr>
- * <tr>
- * <td>255</td>
- * <td>Maximum value</td>
- * <td>#H5L_TYPE_MAX</td>
- * </tr>
- * <tr>
- * <td>-1</td>
- * <td>Error</td>
- * <td>#H5L_TYPE_ERROR</td>
- * </tr>
- * </table>
- *
- * Note that HDF5 internally registers user-defined link classes only
- * by the numeric value of the link class identifier. An application,
- * on the other hand, will generally use a name for a user-defined
- * class, if for no other purpose than as a variable name. Assume,
- * for example, that a complex link type is registered with the link
- * class identifier 73 and that the code includes the following
- * assignment:
- * \code
- * H5L_TYPE_COMPLEX_A = 73
- * \endcode
- * The application can refer to the link class with a term,
- * \c H5L_TYPE_COMPLEX_A, that conveys meaning to a human reviewing
- * the code, while HDF5 recognizes it by the more cryptic numeric
- * identifier, 73.
- *
- * \attention Important details and considerations include the following:
- * \li If you plan to distribute files or software with a
- * user-defined link class, please contact the Help Desk at
- * The HDF Group to help prevent collisions between \c class_id
- * values. See below.
- * \li As distributed with HDF5, the external link class is
- * implemented as an example of a user-defined link class with
- * #H5L_TYPE_EXTERNAL equal to #H5L_TYPE_UD_MIN. \c class_id in
- * the H5L_class_t \c struct must not equal #H5L_TYPE_UD_MIN
- * unless you intend to overwrite or modify the behavior of
- * external links.
- * \li H5Lregister() can be used only with link class identifiers
- * in the user-definable range (see table above).
- * \li The hard and soft links defined by the HDF5 library,
- * #H5L_TYPE_HARD and #H5L_TYPE_SOFT, reside in the reserved
- * range below #H5L_TYPE_UD_MIN and cannot be redefined or
- * modified.
- * \li H5Lis_registered() can be used to determine whether a desired
- * link class identifier is available. \Emph{Note that this
- * function will tell you only whether the link class identifier
- * has been registered with the installed copy of HDF5; it
- * cannot tell you whether the link class has been registered
- * with The HDF Group.}
- * \li #H5L_TYPE_MAX is the maximum allowed value for a link type
- * identifier.
- * \li #H5L_TYPE_UD_MIN equals #H5L_TYPE_EXTERNAL.
- * \li #H5L_TYPE_UD_MAX equals #H5L_TYPE_MAX.
- * \li #H5L_TYPE_ERROR indicates that an error has occurred.
- *
- * \note \Bold{Registration with The HDF Group:}\n
- * There are sometimes reasons to take a broader approach to registering
- * a user-defined link class than just invoking H5Lregister(). For
- * example:
- * \li A user-defined link class is intended for use across an
- * organization, among collaborators, or across a community of users.
- * \li An application or library overlying HDF5 invokes a user-defined
- * link class that must be shipped with the software.
- * \li Files are distributed that make use of a user-defined link class.
- * \li Or simply, a specific user-defined link class is thought to be
- * widely useful.
- *
- * In such cases, you are encouraged to register that link class with
- * The HDF Group's Helpdesk. The HDF Group maintains a registry of known
- * user-defined link classes and tracks the selected link class
- * identifiers. This registry is intended to reduce the risk of
- * collisions between \c class_id values and to help coordinate the use
- * of specialized link classes.
- *
- * \since 1.8.0
- *
- */
-H5_DLL herr_t H5Lregister(const H5L_class_t *cls);
-/**
- * \ingroup H5LA
- *
- * \brief Unregisters a class of user-defined links
- *
- * \param[in] id User-defined link class identifier
- *
- * \return \herr_t
- *
- * \details H5Lunregister() unregisters a class of user-defined links,
- * preventing them from being traversed, queried, moved, etc.
- *
- * \note A link class can be re-registered using H5Lregister().
- *
- * \since 1.8.0
- *
- */
-H5_DLL herr_t H5Lunregister(H5L_type_t id);
-/**
- * \ingroup H5LA
- *
* \brief Determines whether a class of user-defined links is registered
*
* \param[in] id User-defined link class identifier
@@ -1607,6 +1380,7 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si
H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id,
const char *link_name, hid_t lcpl_id, hid_t lapl_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1628,6 +1402,7 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi
#define H5Lexists_async_wrap H5_NO_EXPAND(H5Lexists_async)
#define H5Literate_async_wrap H5_NO_EXPAND(H5Literate_async)
#endif /* H5L_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -1637,13 +1412,12 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi
/* Macros */
-/* Previous versions of the H5L_class_t struct */
-#define H5L_LINK_CLASS_T_VERS_0 0
-
/* Typedefs */
-/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */
-//! [H5L_info1_t_snip]
+//! <!-- [H5L_info1_t_snip] -->
+/**
+ * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1())
+ */
typedef struct {
H5L_type_t type; /**< Type of link */
hbool_t corder_valid; /**< Indicate if creation order is valid */
@@ -1654,29 +1428,12 @@ typedef struct {
size_t val_size; /**< Size of a soft link or UD link value */
} u;
} H5L_info1_t;
-//! [H5L_info1_t_snip]
-
-/** Callback during link traversal */
-typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata,
- size_t lnkdata_size, hid_t lapl_id);
-
-/** User-defined link types */
-typedef struct {
- int version; /**< Version number of this struct */
- H5L_type_t id; /**< Link type ID */
- const char * comment; /**< Comment for debugging */
- H5L_create_func_t create_func; /**< Callback during link creation */
- H5L_move_func_t move_func; /**< Callback after moving link */
- H5L_copy_func_t copy_func; /**< Callback after copying link */
- H5L_traverse_0_func_t trav_func; /**< Callback during link traversal */
- H5L_delete_func_t del_func; /**< Callback for link deletion */
- H5L_query_func_t query_func; /**< Callback for queries */
-} H5L_class_0_t;
+//! <!-- [H5L_info1_t_snip] -->
/** Prototype for H5Literate1() / H5Literate_by_name1() operator */
-//! [H5L_iterate1_t_snip]
+//! <!-- [H5L_iterate1_t_snip] -->
typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data);
-//! [H5L_iterate1_t_snip]
+//! <!-- [H5L_iterate1_t_snip] -->
/* Function prototypes */
/**
@@ -1694,8 +1451,6 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_
* \deprecated As of HDF5-1.12 this function has been deprecated in favor of
* the function H5Lget_info2() or the macro H5Lget_info().
*
- * \todo We need to get the location ID story straight!
- *
* \details H5Lget_info1() returns information about the specified link through
* the \p linfo argument.
*
diff --git a/src/H5M.c b/src/H5M.c
index 552d3fc..b890a5c 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -211,15 +211,20 @@ H5M_term_package(void)
static herr_t
H5M__close_cb(H5VL_object_t *map_vol_obj, void **request)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(map_vol_obj);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
/* Close the map */
- if (H5VL_optional(map_vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, request) < 0)
+ if (H5VL_optional(map_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, request) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map");
/* Free the VOL object */
@@ -251,8 +256,9 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -274,14 +280,24 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
else if (TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID")
- /* Set up object access arguments */
- if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, TRUE, &mapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback arguments */
+ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, TRUE, &mapl_id, vol_obj_ptr, &map_args.create.loc_params) <
+ 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
+ map_args.create.name = name;
+ map_args.create.lcpl_id = lcpl_id;
+ map_args.create.key_type_id = key_type_id;
+ map_args.create.val_type_id = val_type_id;
+ map_args.create.mcpl_id = mcpl_id;
+ map_args.create.mapl_id = mapl_id;
+ map_args.create.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_CREATE;
+ vol_cb_args.args = &map_args;
/* Create the map */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params, name,
- lcpl_id, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+ map = map_args.create.map;
/* Get an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0)
@@ -289,9 +305,14 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(*vol_obj_ptr, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5M__create_api_common() */
@@ -369,7 +390,7 @@ H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) {
+ H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID")
@@ -407,10 +428,11 @@ done:
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)
{
- void * map = NULL; /* map object from VOL connector */
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * map = NULL; /* map object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "iiiii", loc_id, key_type_id, val_type_id, mcpl_id, mapl_id);
@@ -430,13 +452,24 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ map_args.create.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.create.loc_params.obj_type = H5I_get_type(loc_id);
+ map_args.create.name = NULL;
+ map_args.create.lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ map_args.create.key_type_id = key_type_id;
+ map_args.create.val_type_id = val_type_id;
+ map_args.create.mcpl_id = mcpl_id;
+ map_args.create.mapl_id = mapl_id;
+ map_args.create.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_CREATE;
+ vol_cb_args.args = &map_args;
/* Create the map */
- if (H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, NULL,
- H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+ map = map_args.create.map;
/* Get an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
@@ -444,9 +477,14 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Mcreate_anon() */
@@ -470,8 +508,9 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -481,14 +520,20 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
- /* Set up object access arguments */
- if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, FALSE, &mapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback arguments */
+ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, FALSE, &mapl_id, vol_obj_ptr, &map_args.open.loc_params) <
+ 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
+ map_args.open.name = name;
+ map_args.open.mapl_id = mapl_id;
+ map_args.open.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_OPEN;
+ vol_cb_args.args = &map_args;
/* Open the map */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_OPEN, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params, name,
- mapl_id, &map) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map")
+ map = map_args.create.map;
/* Register an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0)
@@ -496,9 +541,14 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(*vol_obj_ptr, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5M__open_api_common() */
@@ -521,9 +571,7 @@ done:
hid_t
H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
{
- void * map = NULL; /* map object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, mapl_id);
@@ -533,11 +581,6 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map synchronously")
done:
- /* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Mopen() */
@@ -576,7 +619,7 @@ H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID")
@@ -670,7 +713,7 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -697,8 +740,10 @@ done:
hid_t
H5Mget_key_type(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -707,10 +752,18 @@ H5Mget_key_type(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
- /* get the datatype */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_KEY_TYPE,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_KEY_TYPE;
+ map_args.get.args.get_key_type.type_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
+ /* Get the key datatype */
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get key datatype")
+
+ /* Set return value */
+ ret_value = map_args.get.args.get_key_type.type_id;
done:
FUNC_LEAVE_API(ret_value)
@@ -732,8 +785,10 @@ done:
hid_t
H5Mget_val_type(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -742,10 +797,18 @@ H5Mget_val_type(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
- /* get the datatype */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_VAL_TYPE,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_VAL_TYPE;
+ map_args.get.args.get_val_type.type_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
+ /* Get the value datatype */
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get value datatype")
+
+ /* Set return value */
+ ret_value = map_args.get.args.get_val_type.type_id;
done:
FUNC_LEAVE_API(ret_value)
@@ -767,8 +830,10 @@ done:
hid_t
H5Mget_create_plist(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -777,11 +842,19 @@ H5Mget_create_plist(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_MCPL;
+ map_args.get.args.get_mcpl.mcpl_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the map creation property list */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MCPL,
- &ret_value) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties")
+ /* Set return value */
+ ret_value = map_args.get.args.get_mcpl.mcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mget_create_plist() */
@@ -805,8 +878,10 @@ done:
hid_t
H5Mget_access_plist(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -815,11 +890,19 @@ H5Mget_access_plist(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_MAPL;
+ map_args.get.args.get_mapl.mapl_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the map access property list */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MAPL,
- &ret_value) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+ /* Set return value */
+ ret_value = map_args.get.args.get_mapl.mapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mget_access_plist() */
@@ -839,8 +922,10 @@ done:
herr_t
H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("e", "ixi", map_id, count, dxpl_id);
@@ -858,9 +943,19 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_COUNT;
+ map_args.get.args.get_count.count = 0;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the number of key-value pairs stored in the map */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_COUNT, count) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get KV pair count for map")
+
+ /* Set value to return */
+ if (count)
+ *count = map_args.get.args.get_count.count;
done:
FUNC_LEAVE_API(ret_value)
@@ -882,7 +977,9 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -905,9 +1002,16 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.put.key_mem_type_id = key_mem_type_id;
+ map_args.put.key = key;
+ map_args.put.value_mem_type_id = val_mem_type_id;
+ map_args.put.value = value;
+ vol_cb_args.op_type = H5VL_MAP_PUT;
+ vol_cb_args.args = &map_args;
+
/* Set the key/value pair */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_PUT, dxpl_id, token_ptr, key_mem_type_id, key, val_mem_type_id,
- value) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair")
done:
@@ -984,7 +1088,7 @@ H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1008,7 +1112,9 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1031,9 +1137,16 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.get_val.key_mem_type_id = key_mem_type_id;
+ map_args.get_val.key = key;
+ map_args.get_val.value_mem_type_id = val_mem_type_id;
+ map_args.get_val.value = value;
+ vol_cb_args.op_type = H5VL_MAP_GET_VAL;
+ vol_cb_args.args = &map_args;
+
/* Get the value for the key */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_GET_VAL, dxpl_id, token_ptr, key_mem_type_id, key,
- val_mem_type_id, value) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map")
done:
@@ -1113,7 +1226,7 @@ H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1137,8 +1250,10 @@ done:
herr_t
H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*x*bi", map_id, key_mem_type_id, key, exists, dxpl_id);
@@ -1160,11 +1275,21 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.exists.key_mem_type_id = key_mem_type_id;
+ map_args.exists.key = key;
+ map_args.exists.exists = FALSE;
+ vol_cb_args.op_type = H5VL_MAP_EXISTS;
+ vol_cb_args.args = &map_args;
+
/* Check if key exists */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_EXISTS, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key,
- exists)) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists")
+ /* Set value to return */
+ if (exists)
+ *exists = map_args.exists.exists;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mexists() */
@@ -1203,9 +1328,10 @@ done:
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)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*hiMI*xi", map_id, idx, key_mem_type_id, op, op_data, dxpl_id);
@@ -1229,14 +1355,23 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(map_id);
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_ITER;
+ map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(map_id);
+ map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.op = op;
+ map_args.specific.args.iterate.op_data = op_data;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Iterate over keys */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params,
- H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to iterate over keys")
+ if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_MAP, H5E_BADITER, "unable to iterate over keys");
+
+ /* Set value to return */
+ if (idx)
+ *idx = map_args.specific.args.iterate.idx;
done:
FUNC_LEAVE_API(ret_value)
@@ -1277,9 +1412,10 @@ 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)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*s*hiMI*xii", loc_id, map_name, idx, key_mem_type_id, op, op_data, dxpl_id, lapl_id);
@@ -1307,16 +1443,25 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_m
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.obj_type = H5I_get_type(loc_id);
- loc_params.loc_data.loc_by_name.name = map_name;
- loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_ITER;
+ map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_NAME;
+ map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(loc_id);
+ map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.name = map_name;
+ map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.op = op;
+ map_args.specific.args.iterate.op_data = op_data;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Iterate over keys */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params,
- H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
+ if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_MAP, H5E_BADITER, "unable to ierate over keys");
+
+ /* Set value to return */
+ if (idx)
+ *idx = map_args.specific.args.iterate.idx;
done:
FUNC_LEAVE_API(ret_value)
@@ -1340,9 +1485,10 @@ done:
herr_t
H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "ii*xi", map_id, key_mem_type_id, key, dxpl_id);
@@ -1364,13 +1510,17 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(map_id);
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_DELETE;
+ map_args.specific.args.del.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.specific.args.del.loc_params.obj_type = H5I_get_type(map_id);
+ map_args.specific.args.del.key_mem_type_id = key_mem_type_id;
+ map_args.specific.args.del.key = key;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Delete the key/value pair */
- if (H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_DELETE,
- key_mem_type_id, key) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair")
done:
diff --git a/src/H5MF.c b/src/H5MF.c
index 16da9e6..66bf823 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -542,7 +542,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type)
H5AC_set_ring(fsm_ring, &orig_ring);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC);
+ HDfprintf(stderr, "%s: Before deleting free space manager\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Delete free space manager for this type */
@@ -597,7 +597,7 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type)
HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC);
+ HDfprintf(stderr, "%s: Before closing free space manager\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Close an existing free space structure for the file */
@@ -653,7 +653,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio
H5AC_set_ring(fsm_ring, &orig_ring);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", FUNC,
+ HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", __func__,
node->sect_info.addr, node->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Add the section */
@@ -706,7 +706,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "error locating free space in file")
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section found = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: section found = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Check for actually finding section */
@@ -721,7 +721,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h
/* Check for eliminating the section */
if (node->sect_info.size == size) {
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: freeing node\n", FUNC);
+ HDfprintf(stderr, "%s: freeing node\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Free section node */
@@ -734,7 +734,8 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h
node->sect_info.size -= size;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size);
+ HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", __func__,
+ node->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Re-add the section to the free-space manager */
@@ -777,7 +778,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
+ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check arguments */
@@ -789,7 +790,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Check 1.0\n", FUNC);
+ HDfprintf(stderr, "%s: Check 1.0\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Set the ring type in the API context */
@@ -826,7 +827,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
/* If no space is found from the free-space manager, continue further action */
if (!H5F_addr_defined(ret_value)) {
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
+ HDfprintf(stderr, "%s: Check 2.0\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN);
@@ -841,7 +842,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
} /* end if */
HDassert(H5F_addr_defined(ret_value));
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Check 3.0\n", FUNC);
+ HDfprintf(stderr, "%s: Check 3.0\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
done:
@@ -850,7 +851,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF__sects_dump(f, stderr);
@@ -890,7 +891,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
+ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype);
@@ -987,7 +988,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
done:
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF__sects_dump(f, stderr);
@@ -1033,7 +1034,7 @@ H5MF_alloc_tmp(H5F_t *f, hsize_t size)
FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size);
+ HDfprintf(stderr, "%s: size = %Hu\n", __func__, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -1085,8 +1086,8 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type,
- addr, size);
+ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__,
+ (unsigned)alloc_type, addr, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check arguments */
@@ -1135,13 +1136,13 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
* space is at the end of the file
*/
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: fs_addr = %a\n", FUNC, f->shared->fs_addr[fs_type]);
+ HDfprintf(stderr, "%s: fs_addr = %a\n", __func__, f->shared->fs_addr[fs_type]);
#endif /* H5MF_ALLOC_DEBUG_MORE */
if (!H5F_addr_defined(f->shared->fs_addr[fs_type])) {
htri_t status; /* "can absorb" status for section into */
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC);
+ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Try to shrink the file or absorb the block into a block aggregator */
if ((status = H5MF_try_shrink(f, alloc_type, addr, size)) < 0)
@@ -1151,7 +1152,8 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
HGOTO_DONE(SUCCEED)
else if (size < f->shared->fs_threshold) {
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size);
+ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr,
+ size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
HGOTO_DONE(SUCCEED)
} /* end else-if */
@@ -1168,7 +1170,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
*/
if (f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || !H5F_HAVE_FREE_SPACE_MANAGER(f)) {
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size);
+ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr, size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
HGOTO_DONE(SUCCEED)
} /* end if */
@@ -1191,7 +1193,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
HDassert(f->shared->fs_man[fs_type]);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", FUNC);
+ HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Add to the free space for the file */
@@ -1200,7 +1202,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
node = NULL;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC);
+ HDfprintf(stderr, "%s: After H5FS_sect_add()\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
else {
@@ -1233,7 +1235,7 @@ done:
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF__sects_dump(f, stderr);
@@ -1277,8 +1279,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", FUNC,
- (unsigned)alloc_type, addr, size, extra_requested);
+ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n",
+ __func__, (unsigned)alloc_type, addr, size, extra_requested);
#endif /* H5MF_ALLOC_DEBUG */
/* Sanity check */
@@ -1330,7 +1332,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi
if ((ret_value = H5F__try_extend(f, map_type, end, extra_requested + frag_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file")
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: extended = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* If extending at EOA succeeds: */
@@ -1368,7 +1370,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block")
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
@@ -1394,7 +1396,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL,
"error extending block in free space manager")
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
@@ -1405,7 +1407,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi
if (frag_size <= H5F_PGEND_META_THRES(f) && extra_requested <= frag_size)
ret_value = TRUE;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", __func__,
+ ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
} /* end if */
@@ -1417,7 +1420,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
#ifdef H5MF_ALLOC_DEBUG_DUMP
H5MF__sects_dump(f, stderr);
@@ -1442,18 +1445,18 @@ done:
htri_t
H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
{
- H5MF_free_section_t * node = NULL; /* Free space section pointer */
- H5MF_sect_ud_t udata; /* User data for callback */
- H5FS_section_class_t *sect_cls; /* Section class */
- H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
- H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
- H5F_mem_page_t fs_type; /* Free space type */
- htri_t ret_value = FALSE; /* Return value */
+ H5MF_free_section_t * node = NULL; /* Free space section pointer */
+ H5MF_sect_ud_t udata; /* User data for callback */
+ const H5FS_section_class_t *sect_cls; /* Section class */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
+ H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */
+ H5F_mem_page_t fs_type; /* Free space type */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type,
- addr, size);
+ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__,
+ (unsigned)alloc_type, addr, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check arguments */
@@ -1509,7 +1512,7 @@ done:
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5MF_try_shrink() */
@@ -1533,7 +1536,7 @@ H5MF_close(H5F_t *f)
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering\n", FUNC);
+ HDfprintf(stderr, "%s: Entering\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -1551,7 +1554,7 @@ H5MF_close(H5F_t *f)
done:
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving\n", FUNC);
+ HDfprintf(stderr, "%s: Leaving\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5MF_close() */
@@ -1577,7 +1580,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type)
FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering\n", FUNC);
+ HDfprintf(stderr, "%s: Entering\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -1589,7 +1592,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type)
HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC,
+ HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__,
(unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -1599,7 +1602,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager")
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC,
+ HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__,
(unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -1610,7 +1613,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type)
done:
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving\n", FUNC);
+ HDfprintf(stderr, "%s: Leaving\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__close_delete() */
@@ -1639,7 +1642,7 @@ H5MF_try_close(H5F_t *f)
FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering\n", FUNC);
+ HDfprintf(stderr, "%s: Entering\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -1718,7 +1721,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving\n", FUNC);
+ HDfprintf(stderr, "%s: Leaving\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5MF_try_close() */
@@ -1746,7 +1749,7 @@ H5MF__close_aggrfs(H5F_t *f)
FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering\n", FUNC);
+ HDfprintf(stderr, "%s: Entering\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -1884,7 +1887,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving\n", FUNC);
+ HDfprintf(stderr, "%s: Leaving\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF__close_aggrfs() */
@@ -1912,7 +1915,7 @@ H5MF__close_pagefs(H5F_t *f)
FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Entering\n", FUNC);
+ HDfprintf(stderr, "%s: Entering\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/* check args */
@@ -2059,7 +2062,7 @@ done:
H5AC_set_ring(orig_ring, NULL);
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Leaving\n", FUNC);
+ HDfprintf(stderr, "%s: Leaving\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF__close_pagefs() */
@@ -2323,15 +2326,15 @@ done:
* Purpose: To retrieve free-space section information for
* paged or non-paged aggregation
*
- * Return: Success: Number of free sections
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info)
+herr_t
+H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info,
+ size_t *sect_count)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
@@ -2340,9 +2343,9 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
H5MF_sect_iter_ud_t sect_udata; /* User data for callback */
H5F_mem_page_t start_type, end_type; /* Memory types to iterate over */
H5F_mem_page_t ty; /* Memory type for iteration */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, (-1))
+ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
/* check args */
HDassert(f);
@@ -2404,7 +2407,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
if (!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) {
if (H5MF__open_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't open the free space manager")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager")
HDassert(f->shared->fs_man[ty]);
fs_started = TRUE;
} /* end if */
@@ -2412,7 +2415,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Check if there's free space sections of this type */
if (f->shared->fs_man[ty])
if (H5MF__get_free_sects(f, f->shared->fs_man[ty], &sect_udata, &nums) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1),
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
"can't get section info for the free space manager")
/* Increment total # of sections */
@@ -2421,13 +2424,13 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Close the free space manager of this type, if we started it here */
if (fs_started)
if (H5MF__close_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, (-1), "can't close file free space")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space")
if ((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT))
ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2);
} /* end for */
- /* Set return value */
- ret_value = (ssize_t)total_sects;
+ /* Set value to return */
+ *sect_count = total_sects;
done:
/* Reset the ring in the API context */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 68cd263..77345c9 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -92,7 +92,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
+ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size);
#endif /* H5MF_AGGR_DEBUG */
/* check arguments */
@@ -120,7 +120,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size)
done:
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size);
#endif /* H5MF_AGGR_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
@@ -150,7 +150,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F
FUNC_ENTER_STATIC
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
+ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size);
#endif /* H5MF_AGGR_DEBUG */
/* check args */
@@ -199,7 +199,8 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F
H5FD_mem_t alloc_type, other_alloc_type; /* Current aggregator & 'other' aggregator types */
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_size, aggr->size);
+ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", __func__, aggr->addr, aggr->tot_size,
+ aggr->size);
#endif /* H5MF_AGGR_DEBUG */
/* Turn off alignment if allocation < threshold */
@@ -267,7 +268,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F
/* Allocate another block */
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: Allocating block\n", FUNC);
+ HDfprintf(stderr, "%s: Allocating block\n", __func__);
#endif /* H5MF_AGGR_DEBUG */
if (aggr_frag_size > (ext_size - size))
@@ -387,7 +388,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F
done:
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value);
#endif /* H5MF_AGGR_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF__aggr_alloc() */
@@ -722,7 +723,7 @@ done:
tmp_addr = aggr->addr;
tmp_size = aggr->size;
#ifdef H5MF_AGGR_DEBUG
- HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", FUNC, tmp_addr, tmp_size);
+ HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", __func__, tmp_addr, tmp_size);
#endif /* H5MF_AGGR_DEBUG */
/* Reset aggregator block information */
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index 7b89fd8..6ccbe78 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -210,7 +210,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG)
#ifdef H5MF_ALLOC_DEBUG
- HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
+ HDfprintf(stderr, "%s: Dumping file free space sections\n", __func__);
#endif /* H5MF_ALLOC_DEBUG */
/*
@@ -223,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 = %" PRIuHADDR "\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 */
@@ -267,7 +267,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
#ifdef H5MF_ALLOC_DEBUG
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));
+ __func__, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve 'small data' aggregator info, if available */
@@ -275,7 +275,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
#ifdef H5MF_ALLOC_DEBUG
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));
+ __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 */
@@ -318,7 +318,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream)
} /* end else */
done:
- HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC);
+ HDfprintf(stderr, "%s: Done dumping file free space sections\n", __func__);
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5MF__sects_dump() */
#endif /* H5MF_ALLOC_DEBUG_DUMP */
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h
index 4e7717d..f34c73e 100644
--- a/src/H5MFpkg.h
+++ b/src/H5MFpkg.h
@@ -168,9 +168,9 @@ typedef struct H5MF_fs_t {
/*****************************/
/* H5MF single section inherits serializable properties from H5FS_section_class_t */
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1];
-H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1];
+H5_DLLVAR const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1];
/******************************/
/* Package Private Prototypes */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 292e85c..65e6e94 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -56,7 +56,8 @@ H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size);
H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size);
H5_DLL herr_t H5MF_try_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested);
H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size);
-H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info);
+H5_DLL herr_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info,
+ size_t *sect_count);
/* File 'temporary' space allocation routines */
H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 8d4704e..69b2ca0 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -81,7 +81,7 @@ static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *udata);
/*********************/
/* Class info for "simple" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_SIMPLE, /* Section type */
0, /* Extra serialized size */
@@ -107,7 +107,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
}};
/* Class info for "small" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_SMALL, /* Section type */
0, /* Extra serialized size */
@@ -133,7 +133,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
}};
/* Class info for "large" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Class variables */
H5MF_FSPACE_SECT_LARGE, /* Section type */
0, /* Extra serialized size */
@@ -472,7 +472,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
/* Set the shrinking type */
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr,
+ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr,
sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -496,7 +496,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
/* Set the aggregator to operate on */
udata->aggr = &(udata->f->shared->meta_aggr);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC,
+ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", __func__,
sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -517,7 +517,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
/* Set the aggregator to operate on */
udata->aggr = &(udata->f->shared->sdata_aggr);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC,
+ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", __func__,
sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -625,7 +625,7 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr,
+ HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", __func__, (*sect)->sect_info.addr,
(*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
@@ -646,14 +646,14 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
*flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE;
*flags |= H5FS_PAGE_END_NO_ADD;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section is dropped\n", FUNC);
+ HDfprintf(stderr, "%s: section is dropped\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
/* Adjust the section if it is not at page end but its size + prem is at page end */
else if (prem <= H5F_PGEND_META_THRES(udata->f)) {
(*sect)->sect_info.size += prem;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr,
+ HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", __func__, (*sect)->sect_info.addr,
(*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
} /* end if */
@@ -702,7 +702,7 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section
ret_value = FALSE;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
@@ -806,7 +806,7 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
@@ -894,7 +894,7 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
/* Set the shrinking type */
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
- HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr,
+ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr,
sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
diff --git a/src/H5MM.c b/src/H5MM.c
index d17db16..b4447f6 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -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/H5Mmodule.h b/src/H5Mmodule.h
index 8b4f11f..848f63f 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
+ *
+ * \todo Describe the map life cycle.
+ *
+ * \details \Bold{The interface can only be used with the HDF5 VOL connectors that
+ * implement map objects.} The native HDF5 library does not support this
+ * feature.
+ *
+ * While the HDF5 data model is a flexible way to store data, some
+ * applications require a more general way to index information. HDF5
+ * effectively uses key-value stores internally for a variety of
+ * purposes, but it does not expose a generic key-value store to the
+ * API. The Map APIs provide this capability to the HDF5 applications
+ * in the form of HDF5 map objects. These Map objects contain
+ * application-defined key-value stores, to which key-value pairs can
+ * be added, and from which values can be retrieved by key.
+ *
+ * HDF5 VOL connectors with support for map objects:
+ * - DAOS
+ *
+ * \par Example:
+ * \code
+ * hid_t file_id, fapl_id, map_id, vls_type_id;
+ * const char *names[2] = ["Alice", "Bob"];
+ * uint64_t IDs[2] = [25385486, 34873275];
+ * uint64_t val_out;
+ *
+ * <HDF5 VOL setup code ....>
+ *
+ * vls_type_id = H5Tcopy(H5T_C_S1);
+ * H5Tset_size(vls_type_id, H5T_VARIABLE);
+ * file_id = H5Fcreate("file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ * map_id = H5Mcreate(file_id, "map", vls_type_id, H5T_NATIVE_UINT64, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ * H5Mput(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &IDs[0], H5P_DEFAULT);
+ * H5Mput(map_id, vls_type_id, &names[1], H5T_NATIVE_UINT64, &IDs[1], H5P_DEFAULT);
+ * H5Mget(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &val_out, H5P_DEFAULT);
+ * if(val_out != IDs[0])
+ * ERROR;
+ * H5Mclose(map_id);
+ * H5Tclose(vls_type_id);
+ * H5Fclose(file_id);
+ * \endcode
+ *
+ */
+
#endif /* H5Dmodule_H */
diff --git a/src/H5Mpkg.h b/src/H5Mpkg.h
index b31beeb..be6749b 100644
--- a/src/H5Mpkg.h
+++ b/src/H5Mpkg.h
@@ -44,4 +44,4 @@
/* Package Private Prototypes */
/******************************/
-#endif /*_H5Dpkg_H*/
+#endif /*H5Dpkg_H*/
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index 1a2524e..e62434a 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -21,10 +21,9 @@
#include "H5Mpublic.h"
/* Private headers needed by this file */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5Zprivate.h" /* Data filters */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Zprivate.h" /* Data filters */
/**************************/
/* Library Private Macros */
diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h
index 4d8bef4..3f94edb 100644
--- a/src/H5Mpublic.h
+++ b/src/H5Mpublic.h
@@ -25,6 +25,7 @@
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
+#include "H5VLconnector.h"
/*****************/
/* Public Macros */
@@ -61,8 +62,121 @@ 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] -->
+
+/* Parameters for map operations */
+typedef union H5VL_map_args_t {
+ /* H5VL_MAP_CREATE */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ const char * name; /* Name of new map object */
+ hid_t lcpl_id; /* Link creation property list for map */
+ hid_t key_type_id; /* Datatype for map keys */
+ hid_t val_type_id; /* Datatype for map values */
+ hid_t mcpl_id; /* Map creation property list */
+ hid_t mapl_id; /* Map access property list */
+ void * map; /* Pointer to newly created map object (OUT) */
+ } create;
+
+ /* H5VL_MAP_OPEN */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ const char * name; /* Name of new map object */
+ hid_t mapl_id; /* Map access property list */
+ void * map; /* Pointer to newly created map object (OUT) */
+ } open;
+
+ /* H5VL_MAP_GET_VAL */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hid_t value_mem_type_id; /* Memory datatype for value */
+ void * value; /* Buffer for value (OUT) */
+ } get_val;
+
+ /* H5VL_MAP_EXISTS */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hbool_t exists; /* Flag indicating whether key exists in map (OUT) */
+ } exists;
+
+ /* H5VL_MAP_PUT */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hid_t value_mem_type_id; /* Memory datatype for value */
+ const void *value; /* Pointer to value */
+ } put;
+
+ /* H5VL_MAP_GET */
+ struct {
+ H5VL_map_get_t get_type; /* 'get' operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_MAP_GET_MAPL */
+ struct {
+ hid_t mapl_id; /* Map access property list ID (OUT) */
+ } get_mapl;
+
+ /* H5VL_MAP_GET_MCPL */
+ struct {
+ hid_t mcpl_id; /* Map creation property list ID (OUT) */
+ } get_mcpl;
+
+ /* H5VL_MAP_GET_KEY_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID for map's keys (OUT) */
+ } get_key_type;
+
+ /* H5VL_MAP_GET_VAL_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID for map's values (OUT) */
+ } get_val_type;
+
+ /* H5VL_MAP_GET_COUNT */
+ struct {
+ hsize_t count; /* # of KV pairs in map (OUT) */
+ } get_count;
+ } args;
+ } get;
+
+ /* H5VL_MAP_SPECIFIC */
+ struct {
+ H5VL_map_specific_t specific_type; /* 'specific' operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_MAP_ITER */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ hsize_t idx; /* Start/end iteration index (IN/OUT) */
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ H5M_iterate_t op; /* Iteration callback routine */
+ void * op_data; /* Pointer to callback context */
+ } iterate;
+
+ /* H5VL_MAP_DELETE */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void * key; /* Pointer to key */
+ } del;
+ } args;
+ } specific;
+
+ /* H5VL_MAP_OPTIONAL */
+ /* Unused */
+
+ /* H5VL_MAP_CLOSE */
+ /* No args */
+} H5VL_map_args_t;
/********************/
/* Public Variables */
@@ -81,40 +195,400 @@ 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);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Mclose}
+ */
H5_DLL herr_t H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id,
hid_t es_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 ASYNC
+ * \async_variant_of{H5Mput}
+ */
H5_DLL herr_t H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, 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, hid_t es_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 ASYNC
+ * \async_variant_of{H5Mget}
+ */
H5_DLL herr_t H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, 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, hid_t es_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);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -133,6 +607,7 @@ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hi
#define H5Mput_async_wrap H5_NO_EXPAND(H5Mput_async)
#define H5Mget_async_wrap H5_NO_EXPAND(H5Mget_async)
#endif /* H5M_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5O.c b/src/H5O.c
index ab39ec0..db3ff31 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -70,7 +70,7 @@ static herr_t H5O__copy_api_common(hid_t src_loc_id, const char *src_name, hid_t
H5VL_object_t **_vol_obj_ptr);
static herr_t H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr);
static herr_t H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_ptr);
-static htri_t H5O__close_check_common(hid_t object_id);
+static htri_t H5O__close_check_type(hid_t object_id);
/*********************/
/* Package Variables */
@@ -112,7 +112,7 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token
/* name is checked in this H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Open the object */
@@ -201,7 +201,7 @@ H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID")
@@ -239,7 +239,7 @@ H5O__open_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t idx
/* Check args */
/* group_name, idx_type, order are checked in H5VL_setup_idx-args() */
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr,
&loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
@@ -334,7 +334,7 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) {
+ H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID")
@@ -448,6 +448,7 @@ H5O__copy_api_common(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, c
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
+ /* Setup and check args */
if (H5VL_setup_loc_args(src_loc_id, &vol_obj1, &loc_params1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
@@ -593,7 +594,7 @@ H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -616,19 +617,23 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- /* Check args */
-
+ /* Setup and check args */
if (H5VL_setup_loc_args(obj_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_FLUSH;
+ vol_cb_args.args.flush.obj_id = obj_id;
+
/* Flush the object */
- if (H5VL_object_specific(*vol_obj_ptr, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT,
- token_ptr, obj_id) < 0)
+ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
@@ -695,7 +700,7 @@ H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -718,19 +723,23 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- /* Check args */
-
+ /* Setup and check args */
if (H5VL_setup_loc_args(oid, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_REFRESH;
+ vol_cb_args.args.refresh.obj_id = oid;
+
/* Refresh the object */
- if (H5VL_object_specific(*vol_obj_ptr, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT,
- token_ptr, oid) < 0)
+ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
done:
@@ -797,7 +806,7 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line,
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -829,12 +838,12 @@ done:
herr_t
H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj1 = NULL; /* object of obj_id */
- H5VL_object_t * vol_obj2 = NULL; /* object of new_loc_id */
- H5VL_object_t tmp_vol_obj; /* Temporary object */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj1 = NULL; /* object of obj_id */
+ H5VL_object_t * vol_obj2 = NULL; /* object of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t new_loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id);
@@ -864,36 +873,45 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params1.type = H5VL_OBJECT_BY_SELF;
- loc_params1.obj_type = H5I_get_type(obj_id);
-
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.obj_type = H5I_get_type(new_loc_id);
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up new location struct */
+ new_loc_params.type = H5VL_OBJECT_BY_NAME;
+ new_loc_params.obj_type = H5I_get_type(new_loc_id);
+ new_loc_params.loc_data.loc_by_name.name = new_name;
+ new_loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- if (H5L_SAME_LOC != obj_id)
- /* get the location object */
- if (NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Get the first location object */
+ if (NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
if (H5L_SAME_LOC != new_loc_id)
/* get the location object */
if (NULL == (vol_obj2 = H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary VOL object */
tmp_vol_obj.data = vol_obj2->data;
- tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+ tmp_vol_obj.connector = vol_obj1->connector;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = vol_obj1->data;
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_SELF;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(obj_id);
/* Create a link to the object */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, lcpl_id, lapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -923,9 +941,10 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -941,9 +960,13 @@ H5Oincr_refcount(hid_t object_id)
if (H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT;
+ vol_cb_args.args.change_rc.delta = 1;
+
/* Change the object's reference count */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, 1) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -973,9 +996,10 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -991,9 +1015,13 @@ H5Odecr_refcount(hid_t object_id)
if (H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT;
+ vol_cb_args.args.change_rc.delta = -1;
+
/* Change the object's reference count */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, -1) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -1016,9 +1044,11 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- htri_t ret_value = FAIL; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ hbool_t obj_exists = FALSE; /* Whether object exists */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
@@ -1043,11 +1073,18 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_EXISTS;
+ vol_cb_args.args.exists.exists = &obj_exists;
+
/* Check if the object exists */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
+ /* Set return value */
+ ret_value = (htri_t)obj_exists;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oexists_by_name() */
@@ -1067,9 +1104,10 @@ done:
herr_t
H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixIu", loc_id, oinfo, fields);
@@ -1088,9 +1126,13 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = oinfo;
+ vol_cb_args.args.get_info.fields = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- oinfo, fields) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1114,8 +1156,9 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1127,12 +1170,16 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi
/* "name" is checked in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = oinfo;
+ vol_cb_args.args.get_info.fields = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(*vol_obj_ptr, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr,
- oinfo, fields) < 0)
+ if (H5VL_object_get(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1183,14 +1230,13 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a
hid_t es_id)
{
H5VL_object_t *vol_obj = NULL; /* Object for loc_id */
- void * token = NULL; /* Request token for async operation */
- void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- /* clang-format off */
- H5TRACE9("e", "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id);
- /* clang-format on */
+ H5TRACE9("e", "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id,
+ es_id);
/* Set up request token pointer for asynchronous operation */
if (H5ES_NONE != es_id)
@@ -1204,7 +1250,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE9(FUNC, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0)
+ H5ARG_TRACE9(__func__, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1230,9 +1276,10 @@ herr_t
H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5O_info2_t *oinfo /*out*/, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
@@ -1253,6 +1300,7 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set location struct fields */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1265,9 +1313,13 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = oinfo;
+ vol_cb_args.args.get_info.fields = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- oinfo, fields) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1289,9 +1341,11 @@ done:
herr_t
H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixIu", loc_id, oinfo, fields);
@@ -1310,9 +1364,15 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
done:
@@ -1335,9 +1395,11 @@ herr_t
H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo /*out*/, unsigned fields,
hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id);
@@ -1366,9 +1428,15 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name)
done:
@@ -1393,9 +1461,11 @@ herr_t
H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5O_native_info_t *oinfo /*out*/, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
@@ -1416,6 +1486,7 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set location struct fields */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1428,9 +1499,15 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
done:
@@ -1457,9 +1534,11 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", obj_id, comment);
@@ -1476,9 +1555,14 @@ H5Oset_comment(hid_t obj_id, const char *comment)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up VOL callback arguments */
+ obj_opt_args.set_comment.comment = comment;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_SET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* (Re)set the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
@@ -1505,9 +1589,11 @@ done:
herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id);
@@ -1530,9 +1616,14 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.set_comment.comment = comment;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_SET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* (Re)set the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
@@ -1558,9 +1649,12 @@ done:
ssize_t
H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ size_t comment_len = 0; /* Length of comment string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, comment, bufsize);
@@ -1573,11 +1667,21 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_comment.buf = comment;
+ obj_opt_args.get_comment.buf_size = bufsize;
+ obj_opt_args.get_comment.comment_len = &comment_len;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
+ /* Set return value */
+ ret_value = (ssize_t)comment_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment() */
@@ -1601,9 +1705,12 @@ done:
ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, size_t bufsize, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ size_t comment_len = 0; /* Length of comment string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*sxzi", loc_id, name, comment, bufsize, lapl_id);
@@ -1626,11 +1733,21 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_comment.buf = comment;
+ obj_opt_args.get_comment.buf_size = bufsize;
+ obj_opt_args.get_comment.comment_len = &comment_len;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
+ /* Set return value */
+ ret_value = (ssize_t)comment_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment_by_name() */
@@ -1674,9 +1791,10 @@ herr_t
H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, void *op_data,
unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIoOI*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -1699,10 +1817,17 @@ H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = op;
+ vol_cb_args.args.visit.op_data = op_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) <
- 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1748,9 +1873,10 @@ herr_t
H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIoOI*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id);
@@ -1783,10 +1909,17 @@ H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = op;
+ vol_cb_args.args.visit.op_data = op_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) <
- 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1794,23 +1927,23 @@ done:
} /* end H5Ovisit_by_name3() */
/*-------------------------------------------------------------------------
- * Function: H5O__close_check_common
+ * Function: H5O__close_check_type
*
* Purpose: This is the common function to validate an object
- * when closing it.
+ * before closing it.
*
* Return: TRUE/FALSE/FAIL
*
*-------------------------------------------------------------------------
*/
static htri_t
-H5O__close_check_common(hid_t object_id)
+H5O__close_check_type(hid_t object_id)
{
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
- /* Get the type of the object and close it in the correct way */
+ /* Check for closeable object */
switch (H5I_get_type(object_id)) {
case H5I_GROUP:
case H5I_DATATYPE:
@@ -1836,14 +1969,13 @@ H5O__close_check_common(hid_t object_id)
case H5I_EVENTSET:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FALSE,
- "not a valid file object ID (dataset, group, or datatype)")
+ HGOTO_DONE(FALSE);
break;
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O__close_api_common() */
+} /* H5O__close_check_type() */
/*-------------------------------------------------------------------------
* Function: H5Oclose
@@ -1871,7 +2003,7 @@ H5Oclose(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* Validate the object type before closing */
- if (H5O__close_check_common(object_id) <= 0)
+ if (H5O__close_check_type(object_id) <= 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object")
if (H5I_dec_app_ref(object_id) < 0)
@@ -1903,7 +2035,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
H5TRACE5("e", "*s*sIuii", app_file, app_func, app_line, object_id, es_id);
/* Validate the object type before closing */
- if (H5O__close_check_common(object_id) <= 0)
+ if (H5O__close_check_type(object_id) <= 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object")
/* Prepare for possible asynchronous operation */
@@ -1931,7 +2063,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1943,7 +2075,7 @@ done:
} /* end H5Oclose_async() */
/*-------------------------------------------------------------------------
- * Function: H5O_disable_mdc_flushes
+ * Function: H5O__disable_mdc_flushes
*
* Purpose: Private version of the metadata cache cork function.
*
@@ -1952,18 +2084,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_disable_mdc_flushes(H5O_loc_t *oloc)
+H5O__disable_mdc_flushes(H5O_loc_t *oloc)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
if (H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object");
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5O_disable_mdc_flushes() */
+} /* H5O__disable_mdc_flushes() */
/*-------------------------------------------------------------------------
* Function: H5Odisable_mdc_flushes
@@ -1982,9 +2114,10 @@ done:
herr_t
H5Odisable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE1("e", "i", object_id);
@@ -2001,9 +2134,13 @@ H5Odisable_mdc_flushes(hid_t object_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES;
+ vol_cb_args.args = NULL;
+
/* Cork the object */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object");
done:
@@ -2011,7 +2148,7 @@ done:
} /* H5Odisable_mdc_flushes() */
/*-------------------------------------------------------------------------
- * Function: H5O_enable_mdc_flushes
+ * Function: H5O__enable_mdc_flushes
*
* Purpose: Private version of the metadata cache uncork function.
*
@@ -2020,18 +2157,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_enable_mdc_flushes(H5O_loc_t *oloc)
+H5O__enable_mdc_flushes(H5O_loc_t *oloc)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
if (H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object");
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5O_enable_mdc_flushes() */
+} /* H5O__enable_mdc_flushes() */
/*-------------------------------------------------------------------------
* Function: H5Oenable_mdc_flushes
@@ -2050,9 +2187,10 @@ done:
herr_t
H5Oenable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE1("e", "i", object_id);
@@ -2069,9 +2207,13 @@ H5Oenable_mdc_flushes(hid_t object_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES;
+ vol_cb_args.args = NULL;
+
/* Uncork the object */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object");
done:
@@ -2079,7 +2221,7 @@ done:
} /* H5Oenable_mdc_flushes() */
/*-------------------------------------------------------------------------
- * Function: H5O_are_mdc_flushes_disabled
+ * Function: H5O__are_mdc_flushes_disabled
*
* Purpose: Private version of cork status getter.
*
@@ -2088,11 +2230,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled)
+H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
HDassert(are_disabled);
@@ -2101,7 +2243,7 @@ H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_are_mdc_flushes_disabled() */
+} /* H5O__are_mdc_flushes_disabled() */
/*-------------------------------------------------------------------------
* Function: H5Oare_mdc_flushes_disabled
@@ -2123,9 +2265,11 @@ done:
herr_t
H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "i*b", object_id, are_disabled);
@@ -2146,9 +2290,14 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ obj_opt_args.are_mdc_flushes_disabled.flag = are_disabled;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED;
+ vol_cb_args.args = &obj_opt_args;
+
/* Get the cork status */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, are_disabled) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status");
done:
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 98bbf0b..bad89ae 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -1234,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) {
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index a903cc1..3aae0cb 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -78,8 +78,8 @@ static herr_t H5O__cache_chk_free_icr(void *thing);
static herr_t H5O__prefix_deserialize(const uint8_t *image, H5O_cache_ud_t *udata);
/* Chunk routines */
-static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
- H5O_common_cache_ud_t *udata, hbool_t *dirty);
+static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image,
+ size_t len, H5O_common_cache_ud_t *udata, hbool_t *dirty);
static herr_t H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno);
/* Misc. routines */
@@ -287,7 +287,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty)
+H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty)
{
H5O_t * oh = NULL; /* Object header read in */
H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */
@@ -333,7 +333,7 @@ H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void
oh->proxy = NULL;
/* Parse the first chunk */
- if (H5O__chunk_deserialize(oh, udata->common.addr, udata->chunk0_size, (const uint8_t *)image,
+ if (H5O__chunk_deserialize(oh, udata->common.addr, udata->chunk0_size, (const uint8_t *)image, len,
&(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk")
@@ -736,7 +736,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty)
+H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty)
{
H5O_chunk_proxy_t * chk_proxy = NULL; /* Chunk proxy object */
H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */
@@ -763,7 +763,7 @@ H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len,
HDassert(udata->common.cont_msg_info);
/* Parse the chunk */
- if (H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, (const uint8_t *)image,
+ if (H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, (const uint8_t *)image, len,
&(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk")
@@ -1275,7 +1275,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
+H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image, size_t len,
H5O_common_cache_ud_t *udata, hbool_t *dirty)
{
const uint8_t *chunk_image; /* Pointer into buffer to decode */
@@ -1295,6 +1295,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
HDassert(oh);
HDassert(H5F_addr_defined(addr));
HDassert(image);
+ HDassert(len);
HDassert(udata->f);
HDassert(udata->cont_msg_info);
@@ -1315,14 +1316,16 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
oh->chunk[chunkno].addr = addr;
if (chunkno == 0)
/* First chunk's 'image' includes room for the object header prefix */
- oh->chunk[0].size = len + (size_t)H5O_SIZEOF_HDR(oh);
+ oh->chunk[0].size = chunk_size + (size_t)H5O_SIZEOF_HDR(oh);
else
- oh->chunk[chunkno].size = len;
+ oh->chunk[chunkno].size = chunk_size;
if (NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed")
oh->chunk[chunkno].chunk_proxy = NULL;
/* Copy disk image into chunk's image */
+ if (len < oh->chunk[chunkno].size)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "attempted to copy too many disk image bytes into buffer")
H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
/* Point into chunk image to decode */
@@ -1335,7 +1338,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 */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 5e13f9f..7def20a 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -122,8 +122,6 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
H5O_info1_t oinfo; /* Deprecated object info struct */
unsigned dm_fields; /* Fields for data model query */
unsigned nat_fields; /* Fields for native query */
- H5VL_object_t * vol_obj; /* Object of obj_id */
- H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -160,24 +158,34 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
oinfo.num_attrs = oinfo2->num_attrs;
}
- /* Fill out location struct */
- 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 = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(obj_id);
-
- /* Get the location object */
- if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
-
/* Check for retrieving native information */
nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
if (nat_fields) {
- H5O_native_info_t nat_info; /* Native object info */
+ H5VL_object_t * vol_obj; /* Object of obj_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */
+ H5O_native_info_t nat_info; /* Native object info */
+
+ /* Fill out location struct */
+ 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 = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(obj_id);
+
+ /* Get the location object */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = nat_fields;
+ obj_opt_args.get_native_info.ninfo = &nat_info;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
/* Retrieve the object's native information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, &nat_info, nat_fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
/* Set the native fields */
@@ -228,11 +236,16 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
/* Check for retrieving data model information */
dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS);
if (dm_fields) {
- H5O_info2_t dm_info; /* Data model object info */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5O_info2_t dm_info; /* Data model object info */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = &dm_info;
+ vol_cb_args.args.get_info.fields = dm_fields;
/* Retrieve the object's data model information */
- if (H5VL_object_get(vol_obj, loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &dm_info, dm_fields) < 0)
+ if (H5VL_object_get(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
/* Set the data model fields */
@@ -265,11 +278,19 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
/* Check for retrieving native information */
nat_fields = fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
if (nat_fields) {
- H5O_native_info_t nat_info; /* Native object info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5O_native_info_t nat_info; /* Native object info */
+
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = nat_fields;
+ obj_opt_args.get_native_info.ninfo = &nat_info;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
/* Retrieve the object's native information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, loc_params, &nat_info, nat_fields) < 0)
+ if (H5VL_object_optional(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
/* Set the native fields */
@@ -751,10 +772,11 @@ done:
herr_t
H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoOi*x", obj_id, idx_type, order, op, op_data);
@@ -780,10 +802,17 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
shim_data.fields = H5O_INFO_ALL;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = H5O_INFO_ALL;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, H5O_INFO_ALL)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -826,10 +855,11 @@ herr_t
H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoOi*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id);
@@ -865,10 +895,17 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
shim_data.fields = H5O_INFO_ALL;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = H5O_INFO_ALL;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, H5O_INFO_ALL)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -914,11 +951,12 @@ herr_t
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data,
unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIoOi*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -954,10 +992,17 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
shim_data.fields = fields;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, fields)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1003,11 +1048,12 @@ herr_t
H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIoOi*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id);
@@ -1053,10 +1099,17 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
shim_data.fields = fields;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, fields)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 1ecaf36..d950249 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -466,7 +466,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if (UFAIL == (name_offset = H5HL_insert(file_dst, heap, (size_t)1, "")))
+ if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
HDassert(0 == name_offset);
@@ -483,10 +483,10 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
/* copy the name from the source */
for (idx = 0; idx < efl_src->nused; idx++) {
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
- if (UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert(
- file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name)))
+ if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
+ &(efl_dst->slot[idx].name_offset)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
- } /* end for */
+ }
/* Set return value */
ret_value = efl_dst;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 695673f..5068039 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -196,8 +196,9 @@ 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_STATIC
@@ -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);
@@ -311,10 +315,11 @@ 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_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_STATIC
@@ -335,8 +340,10 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag
/* 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)
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index ea25550..801ef01 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -48,7 +48,7 @@
/* Local Prototypes */
/********************/
static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag);
-static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc);
+static herr_t H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid);
/*************/
/* Functions */
@@ -193,7 +193,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
+H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
{
H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
@@ -202,7 +202,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
FUNC_ENTER_NOAPI(FAIL)
/* If the file is opened with write access, no need to perform refresh actions. */
- if (!(H5F_INTENT(oloc.file) & H5F_ACC_RDWR)) {
+ if (!(H5F_INTENT(oloc->file) & H5F_ACC_RDWR)) {
H5G_loc_t obj_loc;
H5O_loc_t obj_oloc;
H5G_name_t obj_path;
@@ -217,7 +217,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
/* "Fake" another open object in the file, so that it doesn't get closed
* if this object is the only thing holding the file open.
*/
- H5F_incr_nopen_objs(oloc.file);
+ H5F_incr_nopen_objs(oloc->file);
objs_incr = TRUE;
/* Save important datatype state */
@@ -239,11 +239,11 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
connector->nrefs++;
/* Close object & evict its metadata */
- if ((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0)
+ if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
/* Re-open the object, re-fetching its metadata */
- if ((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0)
+ if (H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
/* Restore the number of references on the VOL connector */
@@ -258,7 +258,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
done:
if (objs_incr)
- H5F_decr_nopen_objs(oloc.file);
+ H5F_decr_nopen_objs(oloc->file);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata() */
@@ -283,8 +283,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
+H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid)
{
+ H5F_t * file; /* Local copy of the object's file pointer */
haddr_t tag = 0; /* Tag for object */
hbool_t corked = FALSE; /* Whether object's metadata is corked */
herr_t ret_value = SUCCEED; /* Return value */
@@ -305,28 +306,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
/* Retrieve tag for object */
- if (H5O__oh_tag(&oloc, &tag) < 0)
+ if (H5O__oh_tag(oloc, &tag) < 0)
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)
+ if (H5AC_cork(oloc->file, tag, H5AC__GET_CORKED, &corked) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status")
+ /* Hold a copy of the object's file pointer, since closing the object will
+ * invalidate the file pointer in the oloc.
+ */
+ file = oloc->file;
/* Close the object */
if (H5I_dec_ref(oid) < 0)
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)
+ if (H5F_flush_tagged_metadata(file, tag) < 0)
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)
+ if (H5F_evict_tagged_metadata(file, tag) < 0)
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)
+ if (H5AC_cork(file, tag, H5AC__SET_CORK, &corked) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object")
done:
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 44c4985..b60f589 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -91,11 +91,12 @@ 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)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t 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 */
+ H5O_fsinfo_t * fsinfo = NULL; /* File space info message */
+ H5F_mem_page_t ptype; /* Memory type for iteration */
+ unsigned vers; /* message version */
+ const uint8_t *p_end = p + p_size;
void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -136,8 +137,12 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
fsinfo->threshold = threshold;
if (HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size")
- for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++)
+ for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
+ if (p + H5_SIZEOF_HADDR_T > p_end)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL,
+ "ran off end of input buffer while decoding")
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type - 1]));
+ }
break;
case H5F_FILE_SPACE_ALL:
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 5fa9c6a..f24d0bb 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -449,12 +449,16 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init
#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
if (size_hint > 4294967295UL)
oh->flags |= H5O_HDR_CHUNK0_8;
- else
-#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
- if (size_hint > 65535)
+ else if (size_hint > 65535)
oh->flags |= H5O_HDR_CHUNK0_4;
else if (size_hint > 255)
oh->flags |= H5O_HDR_CHUNK0_2;
+#else
+ if (size_hint > 65535)
+ oh->flags |= H5O_HDR_CHUNK0_4;
+ else if (size_hint > 255)
+ oh->flags |= H5O_HDR_CHUNK0_2;
+#endif
}
else {
/* Reset unused time fields */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 4020b23..651e317 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -17,7 +17,7 @@
* 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,
@@ -887,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
*
*-------------------------------------------------------------------------
diff --git a/src/H5Omodule.h b/src/H5Omodule.h
index 134aa92..8afba29 100644
--- a/src/H5Omodule.h
+++ b/src/H5Omodule.h
@@ -30,9 +30,46 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5O H5O
- * \brief Object Interface
*
- * \todo Describe concisely what the functions in this module are about.
+ * Use the functions in this module to manage HDF5 objects.
+ *
+ * HDF5 objects (groups, datasets, datatype objects) are usually created
+ * using functions in the object-specific modules (\ref H5G, \ref H5D,
+ * \ref H5T). However, new objects can also be created by copying existing
+ * objects.
+ *
+ * Many functions in this module are variations on object introspection,
+ * that is, the retrieval of detailed information about HDF5 objects in a file.
+ * Objects in an HDF5 file can be "visited" in an iterative fashion.
+ *
+ * HDF5 objects are usually updated using functions in the object-specific
+ * modules. However, there are certain generic object properties, such as
+ * reference counts, that can be manipulated using functions in this module.
+ *
+ * HDF5 objects are deleted as a side effect of rendering them unreachable
+ * from the root group. The net effect is the diminution of the object's
+ * reference count to zero, which can (but should not usually) be effected
+ * by a function in this module.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5O_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5O_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5O_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5O_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
*/
#endif /* H5Omodule_H */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 6e203bb..331fcf6 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -581,6 +581,11 @@ H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_pr
H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
+/* Cache corking functions */
+H5_DLL herr_t H5O__disable_mdc_flushes(H5O_loc_t *oloc);
+H5_DLL herr_t H5O__enable_mdc_flushes(H5O_loc_t *oloc);
+H5_DLL herr_t H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled);
+
/* Collect storage info for btree and heap */
H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 65f0308..050bd49 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -981,15 +981,10 @@ H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t
/* Object metadata flush/refresh routines */
H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id);
-H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc);
+H5_DLL herr_t H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid);
H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver,
hbool_t start_swmr);
-/* Cache corking functions */
-H5_DLL herr_t H5O_disable_mdc_flushes(H5O_loc_t *oloc);
-H5_DLL herr_t H5O_enable_mdc_flushes(H5O_loc_t *oloc);
-H5_DLL herr_t H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled);
-
/* Object copying routines */
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
H5O_copy_t *cpy_info, hbool_t inc_depth, H5O_type_t *obj_type,
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 04ef35b..d9d0500 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -35,14 +35,14 @@
/*****************/
/* Flags for object copy (H5Ocopy) */
-#define H5O_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /* Copy only immediate members */
-#define H5O_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /* Expand soft links into new objects */
-#define H5O_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /* Expand external links into new objects */
-#define H5O_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /* Copy objects that are pointed by references */
-#define H5O_COPY_WITHOUT_ATTR_FLAG (0x0010u) /* Copy object without copying attributes */
-#define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /* Copy NULL messages (empty space) */
-#define H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG (0x0040u) /* Merge committed datatypes in dest file */
-#define H5O_COPY_ALL (0x007Fu) /* All object copying flags (for internal checking) */
+#define H5O_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /**< Copy only immediate members */
+#define H5O_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /**< Expand soft links into new objects */
+#define H5O_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /**< Expand external links into new objects */
+#define H5O_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /**< Copy objects that are pointed by references */
+#define H5O_COPY_WITHOUT_ATTR_FLAG (0x0010u) /**< Copy object without copying attributes */
+#define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /**< Copy NULL messages (empty space) */
+#define H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG (0x0040u) /**< Merge committed datatypes in dest file */
+#define H5O_COPY_ALL (0x007Fu) /**< All object copying flags (for internal checking) */
/* Flags for shared message indexes.
* Pass these flags in using the mesg_type_flags parameter in
@@ -51,25 +51,27 @@
* but we need to assign each kind of message to a different bit so that
* one index can hold multiple types.)
*/
-#define H5O_SHMESG_NONE_FLAG 0x0000 /* No shared messages */
-#define H5O_SHMESG_SDSPACE_FLAG ((unsigned)1 << 0x0001) /* Simple Dataspace Message. */
-#define H5O_SHMESG_DTYPE_FLAG ((unsigned)1 << 0x0003) /* Datatype Message. */
-#define H5O_SHMESG_FILL_FLAG ((unsigned)1 << 0x0005) /* Fill Value Message. */
-#define H5O_SHMESG_PLINE_FLAG ((unsigned)1 << 0x000b) /* Filter pipeline message. */
-#define H5O_SHMESG_ATTR_FLAG ((unsigned)1 << 0x000c) /* Attribute Message. */
+#define H5O_SHMESG_NONE_FLAG 0x0000 /**< No shared messages */
+#define H5O_SHMESG_SDSPACE_FLAG ((unsigned)1 << 0x0001) /**< Simple Dataspace Message. */
+#define H5O_SHMESG_DTYPE_FLAG ((unsigned)1 << 0x0003) /**< Datatype Message. */
+#define H5O_SHMESG_FILL_FLAG ((unsigned)1 << 0x0005) /**< Fill Value Message. */
+#define H5O_SHMESG_PLINE_FLAG ((unsigned)1 << 0x000b) /**< Filter pipeline message. */
+#define H5O_SHMESG_ATTR_FLAG ((unsigned)1 << 0x000c) /**< Attribute Message. */
#define H5O_SHMESG_ALL_FLAG \
(H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_FILL_FLAG | H5O_SHMESG_PLINE_FLAG | \
H5O_SHMESG_ATTR_FLAG)
+/* clang-format off */
/* Object header status flag definitions */
-#define H5O_HDR_CHUNK0_SIZE 0x03 /* 2-bit field indicating # of bytes to store the size of chunk 0's data */
-#define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x04 /* Attribute creation order is tracked */
-#define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x08 /* Attribute creation order has index */
-#define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x10 /* Non-default attribute storage phase change values stored */
-#define H5O_HDR_STORE_TIMES 0x20 /* Store access, modification, change & birth times for object */
+#define H5O_HDR_CHUNK0_SIZE 0x03 /**< 2-bit field indicating # of bytes to store the size of chunk 0's data */
+#define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x04 /**< Attribute creation order is tracked */
+#define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x08 /**< Attribute creation order has index */
+#define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x10 /**< Non-default attribute storage phase change values stored */
+#define H5O_HDR_STORE_TIMES 0x20 /**< Store access, modification, change & birth times for object */
#define H5O_HDR_ALL_FLAGS \
(H5O_HDR_CHUNK0_SIZE | H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | \
H5O_HDR_ATTR_STORE_PHASE_CHANGE | H5O_HDR_STORE_TIMES)
+/* clang-format on */
/* Maximum shared message values. Number of indexes is 8 to allow room to add
* new types of messages.
@@ -81,22 +83,20 @@
* Theses flags determine which fields will be filled in in the H5O_info_t
* struct.
*/
-#define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */
-#define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */
-#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */
+#define H5O_INFO_BASIC 0x0001u /**< Fill in the fileno, addr, type, and rc fields */
+#define H5O_INFO_TIME 0x0002u /**< Fill in the atime, mtime, ctime, and btime fields */
+#define H5O_INFO_NUM_ATTRS 0x0004u /**< Fill in the num_attrs field */
#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS)
-/* Flags for H5Oget_native_info.
- * Theses flags determine which fields will be filled in in the H5O_native_info_t
- * struct.
+//! <!-- [H5O_native_info_fields_snip] -->
+/**
+ * Flags for H5Oget_native_info(). Theses flags determine which fields will be
+ * filled in in the \ref H5O_native_info_t struct.
*/
-//! [H5O_native_info_fields_snip]
-
-#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */
-#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_NATIVE_INFO_HDR 0x0008u /**< Fill in the hdr field */
+#define H5O_NATIVE_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field */
#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE)
-
-//! [H5O_native_info_fields_snip]
+//! <!-- [H5O_native_info_fields_snip] -->
/* Convenience macro to check if the token is the 'undefined' token value */
#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t)))
@@ -105,95 +105,115 @@
/* Public Typedefs */
/*******************/
-//! [H5O_type_t_snip]
-
-/* Types of objects in file */
+//! <!-- [H5O_type_t_snip] -->
+/**
+ * Types of objects in file
+ */
typedef enum H5O_type_t {
- H5O_TYPE_UNKNOWN = -1, /* Unknown object type */
- H5O_TYPE_GROUP, /* Object is a group */
- H5O_TYPE_DATASET, /* Object is a dataset */
- H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */
- H5O_TYPE_MAP, /* Object is a map */
- H5O_TYPE_NTYPES /* Number of different object types (must be last!) */
+ H5O_TYPE_UNKNOWN = -1, /**< Unknown object type */
+ H5O_TYPE_GROUP, /**< Object is a group */
+ H5O_TYPE_DATASET, /**< Object is a dataset */
+ H5O_TYPE_NAMED_DATATYPE, /**< Object is a named data type */
+ H5O_TYPE_MAP, /**< Object is a map */
+ H5O_TYPE_NTYPES /**< Number of different object types (must be last!) */
} H5O_type_t;
+//! <!-- [H5O_type_t_snip] -->
-//! [H5O_type_t_snip]
-
-/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
-//! [H5O_hdr_info_t_snip]
-
+//! <!-- [H5O_hdr_info_t_snip] -->
+/**
+ * Information struct for object header metadata (for
+ * H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx())
+ */
typedef struct H5O_hdr_info_t {
- unsigned version; /* Version number of header format in file */
- unsigned nmesgs; /* Number of object header messages */
- unsigned nchunks; /* Number of object header chunks */
- unsigned flags; /* Object header status flags */
+ unsigned version; /**< Version number of header format in file */
+ unsigned nmesgs; /**< Number of object header messages */
+ unsigned nchunks; /**< Number of object header chunks */
+ unsigned flags; /**< Object header status flags */
struct {
- hsize_t total; /* Total space for storing object header in file */
- hsize_t meta; /* Space within header for object header metadata information */
- hsize_t mesg; /* Space within header for actual message information */
- hsize_t free; /* Free space within object header */
+ hsize_t total; /**< Total space for storing object header in file */
+ hsize_t meta; /**< Space within header for object header metadata information */
+ hsize_t mesg; /**< Space within header for actual message information */
+ hsize_t free; /**< Free space within object header */
} space;
struct {
- uint64_t present; /* Flags to indicate presence of message type in header */
- uint64_t shared; /* Flags to indicate message type is shared in header */
+ uint64_t present; /**< Flags to indicate presence of message type in header */
+ uint64_t shared; /**< Flags to indicate message type is shared in header */
} mesg;
} H5O_hdr_info_t;
+//! <!-- [H5O_hdr_info_t_snip] -->
-//! [H5O_hdr_info_t_snip]
-
-//! [H5O_info2_t_snip]
-
-/* Data model information struct for objects */
-/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */
+//! <!-- [H5O_info2_t_snip] -->
+/**
+ * Data model information struct for objects
+ * (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3)
+ */
typedef struct H5O_info2_t {
- unsigned long fileno; /* File number that object is located in */
- H5O_token_t token; /* Token representing the object */
- H5O_type_t type; /* Basic object type (group, dataset, etc.) */
- unsigned rc; /* Reference count of object */
- time_t atime; /* Access time */
- time_t mtime; /* Modification time */
- time_t ctime; /* Change time */
- time_t btime; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
+ unsigned long fileno; /**< File number that object is located in */
+ H5O_token_t token; /**< Token representing the object */
+ H5O_type_t type; /**< Basic object type (group, dataset, etc.) */
+ unsigned rc; /**< Reference count of object */
+ time_t atime; /**< Access time */
+ time_t mtime; /**< Modification time */
+ time_t ctime; /**< Change time */
+ time_t btime; /**< Birth time */
+ hsize_t num_attrs; /**< Number of attributes attached to object */
} H5O_info2_t;
+//! <!-- [H5O_info2_t_snip] -->
-//! [H5O_info2_t_snip]
-
-//! [H5O_native_info_t_snip]
-
-/* Native file format information struct for objects */
-/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */
+//! <!-- [H5O_native_info_t_snip] -->
+/**
+ * Native file format information struct for objects.
+ * (For H5Oget_native_info(), H5Oget_native_info_by_name(), H5Oget_native_info_by_idx())
+ */
typedef struct H5O_native_info_t {
- H5O_hdr_info_t hdr; /* Object header information */
- /* Extra metadata storage for obj & attributes */
+ H5O_hdr_info_t hdr; /**< Object header information */
struct {
- H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
- } meta_size;
+ H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */
+ } meta_size; /**< Extra metadata storage for obj & attributes */
} H5O_native_info_t;
+//! <!-- [H5O_native_info_t_snip] -->
-//! [H5O_native_info_t_snip]
-
-/* Typedef for message creation indexes */
+/**
+ * Typedef for message creation indexes
+ */
typedef uint32_t H5O_msg_crt_idx_t;
-/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */
-//! [H5O_iterate2_t_snip]
-
+//! <!-- [H5O_iterate2_t_snip] -->
+/**
+ * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3)
+ *
+ * \param[in] obj Object that serves as the root of the iteration;
+ * the same value as the H5Ovisit3() \c obj_id parameter
+ * \param[in] name Name of object, relative to \p obj, being examined at current
+ * step of the iteration
+ * \param[out] info Information about that object
+ * \param[in,out] op_data User-defined pointer to data required by the application
+ * in processing the object; a pass-through of the \c op_data
+ * pointer provided with the H5Ovisit3() function call
+ * \return \herr_t_iter
+ *
+ */
typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data);
+//! <!-- [H5O_iterate2_t_snip] -->
-//! [H5O_iterate2_t_snip]
-
+//! <!-- [H5O_mcdt_search_ret_t_snip] -->
typedef enum H5O_mcdt_search_ret_t {
- H5O_MCDT_SEARCH_ERROR = -1, /* Abort H5Ocopy */
- H5O_MCDT_SEARCH_CONT, /* Continue the global search of all committed datatypes in the destination file */
- H5O_MCDT_SEARCH_STOP /* Stop the search, but continue copying. The committed datatype will be copied but
- not merged. */
+ H5O_MCDT_SEARCH_ERROR = -1, /**< Abort H5Ocopy */
+ H5O_MCDT_SEARCH_CONT, /**< Continue the global search of all committed datatypes in the destination file
+ */
+ H5O_MCDT_SEARCH_STOP /**< Stop the search, but continue copying. The committed datatype will be copied
+ but not merged. */
} H5O_mcdt_search_ret_t;
+//! <!-- [H5O_mcdt_search_ret_t_snip] -->
-/* Callback to invoke when completing the search for a matching committed datatype from the committed dtype
- * list */
+//! <!-- [H5O_mcdt_search_cb_t_snip] -->
+/**
+ * Callback to invoke when completing the search for a matching committed
+ * datatype from the committed dtype list
+ */
typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data);
+//! <!-- [H5O_mcdt_search_cb_t_snip] -->
/********************/
/* Public Variables */
@@ -249,6 +269,11 @@ extern "C" {
*
*/
H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Oopen}
+ */
H5_DLL hid_t H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t lapl_id, hid_t es_id);
@@ -332,6 +357,11 @@ H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token);
*/
H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Oopen_by_idx}
+ */
H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, hid_t lapl_id, hid_t es_id);
@@ -442,28 +472,7 @@ H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
* \return \herr_t
*
* \details H5Oget_info3() specifies an object by its identifier, \p loc_id , and
- * retrieves the metadata describing that object in \p oinfo , an H5O_info2_t \c struct.
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows :
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * The H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by H5O_type_t.
+ * retrieves the metadata describing that object in \p oinfo.
*
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
@@ -512,29 +521,6 @@ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields);
* \p loc_id and \p name, respectively, and retrieves the metadata
* describing that object in \p oinfo, an H5O_info2_t struct.
*
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
- *
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * The H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by H5O_type_t.
- *
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
* These flags are defined in the H5Opublic.h file:
@@ -553,6 +539,11 @@ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields);
*/
H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields,
hid_t lapl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Oget_info_by_name}
+ */
H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line,
hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/,
unsigned fields, hid_t lapl_id, hid_t es_id);
@@ -585,34 +576,6 @@ H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_fu
* If \p loc_id fully specifies the group in which the object resides,
* \p group_name can be a dot (\c .).
*
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
- *
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by #H5O_type_t.
- *
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
* These flags are defined in the H5Opublic.h file:
@@ -645,11 +608,7 @@ H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index
* \return \herr_t
*
* \details H5Oget_native_info() retrieves the native file format information for an object
- * specified by \p loc_id. The information is retrieved into the
- * buffer specified by \p oinfo, which is defined as a \c struct of
- * type H5O_native_info_t in H5Opublic.h:
- *
- * \snippet this H5O_native_info_t_snip
+ * specified by \p loc_id.
*
* The \p fields parameter indicates which fields to fill in
* H5O_native_info_t. Possible values defined in H5Opublic.h are:
@@ -680,12 +639,9 @@ H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigne
*
* \return \herr_t
*
- * \details H5Oget_native_info_by_name() retrieves the native file format information for an object
- * specified by \p loc_id and the name \p name. The information is
- * retrieved into the buffer specified by \p oinfo, which is defined
- * as a \c struct of type H5O_native_info_t in H5Opublic.h:
- *
- * \snippet this H5O_native_info_t_snip
+ * \details H5Oget_native_info_by_name() retrieves the native file format
+ * information for an object specified by \p loc_id and the name \p
+ * name.
*
* The \p fields parameter which fields to fill in H5O_native_info_t.
* Possible values defined in H5Opublic.h are:
@@ -724,16 +680,7 @@ H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_nat
* specified by \p loc_id, group name, \p group_name, the index by which
* objects in the group are tracked, \p idx_type, the order by which
* the index is to be traversed, \p order , and an object's position
- * \p n within that index. The information is retrieved into the
- * buffer specified by \p oinfo, which is defined as a \c struct of
- * type H5O_native_info_t in H5Opublic.h:
- * \snippet this H5O_native_info_t_snip
- *
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
+ * \p n within that index.
*
* The \p fields parameter indicates which fields to fill in H5O_native_info_t.
* Possible values defined in H5Opublic.h are:
@@ -968,7 +915,6 @@ H5_DLL herr_t H5Odecr_refcount(hid_t object_id);
* - H5Pset_copy_object()
* - H5Pset_create_intermediate_group()
* - H5Pset_mcdt_search_cb()
- * .
* - Copying Committed Datatypes with #H5Ocopy - A comprehensive
* discussion of copying committed datatypes (PDF) in
* Advanced Topics in HDF5
@@ -980,6 +926,11 @@ H5_DLL herr_t H5Odecr_refcount(hid_t object_id);
*/
H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ocopy}
+ */
H5_DLL herr_t H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid_t src_loc_id,
const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id,
hid_t lcpl_id, hid_t es_id);
@@ -1209,11 +1160,8 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
- *
+ * unnecessary, so the iteration may begin more quickly.
+
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
* a value indicating iteration in creation order and a group is
@@ -1223,62 +1171,7 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate2_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info2_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object; a pass-through of the \c op_data pointer
- * provided with the H5Ovisit() function call</td>
- * </tr>
- * </table>
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
- * \snippet this H5O_info2_t_snip
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t enum indicates the object type and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p obj_id
- * refers only to the types specified by #H5O_type_t.
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
+ * along the index specified in \p idx_type.
*
* The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data
* required to process objects in the course of the iteration. This pointer
@@ -1302,24 +1195,6 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \par Example
* An example snippet from test/links.c:
* \snippet links.c H5Ovisit3_snip
@@ -1384,10 +1259,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -1398,49 +1270,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate2_t_snip
- *
- * The parameters of this callback function have the following
- * values or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info2_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object</td>
- * </tr>
- * </table>
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
- * \snippet this H5O_info2_t_snip
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t enum indicates the object type and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
+ * along the index specified in \p idx_type.
*
* The H5Ovisit_by_name3() \p op_data parameter is a user-defined
* pointer to the data required to process objects in the course
@@ -1468,24 +1298,6 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \par Example
* An example snippet from test/links.c:
* \snippet links.c H5Ovisit_by_name3_snip
@@ -1522,6 +1334,11 @@ H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t i
*
*/
H5_DLL herr_t H5Oclose(hid_t object_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Oclose}
+ */
H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id,
hid_t es_id);
@@ -1547,31 +1364,21 @@ H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigne
* files. After that, the OS is responsible for ensuring that
* the data is actually flushed to disk.
*
- * \par See Also:
- * - H5Dflush()
- * - H5Drefresh()
- * - H5Oflush()
- * - H5Grefresh()
- * - H5Oflush()
- * - H5Orefresh()
- * - H5Tflush()
- * - H5Trefresh()
- * \par
- * - \c H5DOappend()
- * - H5Fstart_swmr_write()
- * - H5Pget_append_flush()
- * - H5Pget_object_flush_cb()
- * - H5Pset_append_flush()
- * - H5Pset_object_flush_cb()
- * \par
- * - H5Oare_mdc_flushes_disabled()
- * - H5Odisable_mdc_flushes()
- * - H5Oenable_mdc_flushes()
+ * \see H5Dflush(), H5Drefresh(), H5Oflush(), H5Grefresh(), H5Oflush(),
+ * H5Orefresh(), H5Tflush(), H5Trefresh()
+ * \see H5DOappend(), H5Fstart_swmr_write(), H5Pget_append_flush(),
+ * H5Pget_object_flush_cb(), H5Pset_append_flush(), H5Pset_object_flush_cb()
+ * \see H5Oare_mdc_flushes_disabled(), H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes()
*
* \since 1.10.0
*
*/
H5_DLL herr_t H5Oflush(hid_t obj_id);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Oflush}
+ */
H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id,
hid_t es_id);
/**
@@ -1599,6 +1406,11 @@ H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigne
*
*/
H5_DLL herr_t H5Orefresh(hid_t oid);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup ASYNC
+ * \async_variant_of{H5Orefresh}
+ */
H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, hid_t oid,
hid_t es_id);
@@ -1628,21 +1440,17 @@ H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsig
* HDF5 object level (datasets, groups, committed datatypes)
* and the entire metadata cache level.
*
- * \note HDF5 objects include datasets, groups, and committed datatypes.
- * Only #hid_t identifiers that represent these objects can be passed to the function.
- * \note Passing in a #hid_t identifier that represents any other HDF5 entity is
- * considered an error.
- * \note It is an error to pass an HDF5 file identifier
- * (obtained from H5Fopen() or H5Fcreate())
- * to this function.
- * \note Misuse of this function can cause the cache to exhaust
- * available memory.
- * \note Objects can be returned to the default automatic flush behavior
- * with H5Oenable_mdc_flushes().
- * \note Flush prevention only pertains to new or dirty metadata entries.
- * Clean entries can be evicted from the cache.
- * \note Calling this function on an object that has already had flushes
- * disabled will return an error.
+ * \note HDF5 objects include datasets, groups, and committed datatypes. Only
+ * #hid_t identifiers that represent these objects can be passed to the
+ * function. Passing in a #hid_t identifier that represents any other
+ * HDF5 entity is considered an error. It is an error to pass an HDF5
+ * file identifier (obtained from H5Fopen() or H5Fcreate()) to this
+ * function. Misuse of this function can cause the cache to exhaust
+ * available memory. Objects can be returned to the default automatic
+ * flush behavior with H5Oenable_mdc_flushes(). Flush prevention only
+ * pertains to new or dirty metadata entries. Clean entries can be
+ * evicted from the cache. Calling this function on an object that has
+ * already had flushes disabled will return an error.
*
* \since 1.10.0
*
@@ -1672,28 +1480,18 @@ H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
* metadata cache level.
*
*
- * \note HDF5 objects include datasets, groups, and committed datatypes.
- * Only #hid_t identifiers that represent these objects can be
- * passed to the function.
- *
- * \note Passing in a #hid_t identifier that represents any other HDF5 entity
- * is considered an error.
- *
- * \note It is an error to pass an HDF5 file identifier
- * (obtained from H5Fopen() or H5Fcreate())
- * to this function.
- *
- * \note Using this function on an object that has not had flushes disabled
- * is considered an error. The state of an object can be determined
- * with H5Oare_mdc_flushes_disabled().
- *
- * \note An object will be returned to the default flush algorithm when it is closed.
- *
- * \note All objects will be returned to the default flush algorithm when
- * the file is closed.
- *
- * \note An object’s entries will not necessarily be flushed as a result of
- * calling this function.
+ * \note HDF5 objects include datasets, groups, and committed datatypes. Only
+ * #hid_t identifiers that represent these objects can be passed to the
+ * function. Passing in a #hid_t identifier that represents any other
+ * HDF5 entity is considered an error. It is an error to pass an HDF5
+ * file identifier (obtained from H5Fopen() or H5Fcreate()) to this
+ * function. Using this function on an object that has not had flushes
+ * disabled is considered an error. The state of an object can be
+ * determined with H5Oare_mdc_flushes_disabled(). An object will be
+ * returned to the default flush algorithm when it is closed. All objects
+ * will be returned to the default flush algorithm when the file is
+ * closed. An object’s entries will not necessarily be flushed as a
+ * result of calling this function.
*
* \since 1.10.0
*
@@ -1829,6 +1627,7 @@ H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **tok
*/
H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1852,6 +1651,7 @@ H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t
#define H5Orefresh_async_wrap H5_NO_EXPAND(H5Orefresh_async)
#define H5Ocopy_async_wrap H5_NO_EXPAND(H5Ocopy_async)
#endif
+/// \endcond
/* The canonical 'undefined' token value */
#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g)
@@ -1866,53 +1666,66 @@ H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g;
/* Macros */
/* Deprecated flags for earlier versions of H5Oget_info* */
-#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */
-#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_INFO_HDR 0x0008u /**< Fill in the hdr field */
+#define H5O_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field */
#undef H5O_INFO_ALL
#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE)
/* Typedefs */
-/* A struct that's part of the H5G_stat_t structure (deprecated) */
-//! [H5O_stat_t_snip]
+//! <!-- [H5O_stat_t_snip] -->
+/**
+ * A struct that's part of the \ref H5G_stat_t structure
+ * \deprecated
+ */
typedef struct H5O_stat_t {
- hsize_t size; /* Total size of object header in file */
- hsize_t free; /* Free space within object header */
- unsigned nmesgs; /* Number of object header messages */
- unsigned nchunks; /* Number of object header chunks */
+ hsize_t size; /**< Total size of object header in file */
+ hsize_t free; /**< Free space within object header */
+ unsigned nmesgs; /**< Number of object header messages */
+ unsigned nchunks; /**< Number of object header chunks */
} H5O_stat_t;
-//! [H5O_stat_t_snip]
+//! <!-- [H5O_stat_t_snip] -->
-//! [H5O_info1_t_snip]
-
-/* Information struct for object */
-/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */
+//! <!-- [H5O_info1_t_snip] -->
+/**
+ * Information struct for object (For H5Oget_info(), H5Oget_info_by_name(),
+ * H5Oget_info_by_idx() versions 1 & 2.)
+ */
typedef struct H5O_info1_t {
- unsigned long fileno; /* File number that object is located in */
- haddr_t addr; /* Object address in file */
- H5O_type_t type; /* Basic object type (group, dataset, etc.) */
- unsigned rc; /* Reference count of object */
- time_t atime; /* Access time */
- time_t mtime; /* Modification time */
- time_t ctime; /* Change time */
- time_t btime; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
- H5O_hdr_info_t hdr; /* Object header information */
+ unsigned long fileno; /**< File number that object is located in */
+ haddr_t addr; /**< Object address in file */
+ H5O_type_t type; /**< Basic object type (group, dataset, etc.) */
+ unsigned rc; /**< Reference count of object */
+ time_t atime; /**< Access time */
+ time_t mtime; /**< Modification time */
+ time_t ctime; /**< Change time */
+ time_t btime; /**< Birth time */
+ hsize_t num_attrs; /**< Number of attributes attached to object */
+ H5O_hdr_info_t hdr; /**< Object header information */
/* Extra metadata storage for obj & attributes */
struct {
- H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- H5_ih_info_t attr; /* v2 B-tree & heap for attributes */
+ H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */
} meta_size;
} H5O_info1_t;
+//! <!-- [H5O_info1_t_snip] -->
-//! [H5O_info1_t_snip]
-
-/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */
-//! [H5O_iterate1_t_snip]
-
+//! <!-- [H5O_iterate1_t_snip] -->
+/**
+ * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2)
+ *
+ * \param[in] obj Object that serves as the root of the iteration;
+ * the same value as the H5Ovisit1() \c obj_id parameter
+ * \param[in] name Name of object, relative to \p obj, being examined at current
+ * step of the iteration
+ * \param[out] info Information about that object
+ * \param[in,out] op_data User-defined pointer to data required by the application
+ * in processing the object
+ * \return \herr_t_iter
+ *
+ */
typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data);
-
-//! [H5O_iterate1_t_snip]
+//! <!-- [H5O_iterate1_t_snip] -->
/* Function prototypes */
@@ -1982,36 +1795,7 @@ H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
* the function H5Oget_info3() or the macro #H5Oget_info.
*
* \details H5Oget_info1() specifies an object by its identifier, \p loc_id , and
- * retrieves the metadata describing that object in \p oinfo ,
- * defined as a \c struct of type H5O_info1_t :
- *
- * \snippet this H5O_info1_t_snip
- *
- * Note the following about H5O_info1_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- * - The fields nested in the \c meta_size field are for internal library use only.
- *
- * The #H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by #H5O_type_t.
- *
- * An H5O_hdr_info_t \c struct holds object header metadata and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_hdr_info_t_snip
- *
- * Valid values for the \c version field are \c H5O_VERSION_1 and \c H5O_VERSION_2.
- * Version 2 of the object header is smaller and more efficient than version 1.
- *
- * Please be aware that the information held by H5O_hdr_info_t may only be useful to
- * developers with extensive HDF5 experience.
+ * retrieves the metadata describing that object in \p oinfo.
*
* \note If you are iterating through a lot of different objects to
* retrieve information via the H5Oget_info() family of routines,
@@ -2111,16 +1895,6 @@ H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *
* If \p loc_id fully specifies the group in which the object resides,
* \p group_name can be a dot (\c .).
*
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
- *
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info1_t .
- * \snippet this H5O_info1_t_snip
- *
* The link access property list, \c lapl_id, is not currently used;
* it should be passed in as #H5P_DEFAULT.
*
@@ -2316,10 +2090,7 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
@@ -2330,56 +2101,7 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate1_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit1() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info1_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object</td>
- * </tr>
- * </table>
- *
- * The H5O_info1_t \c struct is defined in H5Opublic.h:
- * \snippet this H5O_info1_t_snip
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
- *
- * The H5Ovisit1() \p op_data parameter is a user-defined pointer to the data
- * required to process objects in the course of the iteration. This pointer
- * is passed back to each step of the iteration in the callback
- * function’s \p op_data parameter.
+ * along the index specified in \p idx_type.
*
* H5Lvisit1() and H5Ovisit1() are companion functions: one for
* examining and operating on links; the other for examining
@@ -2393,24 +2115,6 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \version 1.10.5 The macro #H5Ovisit was removed and the function
* H5Ovisit1() was copied to H5Ovisit().
* \version 1.10.3 Function H5Ovisit() was copied to H5Ovisit1(),
@@ -2478,10 +2182,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -2492,10 +2193,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
+ * along the index specified in \p idx_type.
*
* The \p op callback function and the effect of the callback
* function’s return value on the application are described
@@ -2525,24 +2223,6 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \version 1.10.5 The macro #H5Ovisit_by_name was removed and the function
* H5Ovisit_by_name1() was copied to #H5Ovisit_by_name.
* \version 1.10.3 The H5Ovisit_by_name() function was renamed to H5Ovisit_by_name1(),
@@ -2605,10 +2285,7 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
@@ -2619,57 +2296,7 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate1_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit1() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info1_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object; a pass-through of the \c op_data pointer
- * provided with the H5Ovisit() function call</td>
- * </tr>
- * </table>
- *
- * The H5O_info1_t \c struct is defined in H5Opublic.h and
- * described in the H5Oget_info1() function entry.
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
- *
- * The H5Ovisit2() \p op_data parameter is a user-defined pointer to the data
- * required to process objects in the course of the iteration. This pointer
- * is passed back to each step of the iteration in the callback
- * function’s \p op_data parameter.
+ * along the index specified in \p idx_type.
*
* The \p fields parameter contains flags to determine which fields will
* be retrieved by the \p op callback function. These flags are defined
@@ -2688,23 +2315,6 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
*
* \since 1.10.3
*
@@ -2769,10 +2379,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -2783,10 +2390,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
+ * along the index specified in \p idx_type.
*
* The \p op callback function and the effect of the callback
* function’s return value on the application are described
@@ -2821,24 +2425,6 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \since 1.10.3
*
*/
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 2cdf6ec..dab989f 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -106,12 +106,13 @@ H5FL_ARR_EXTERN(hsize_t);
--------------------------------------------------------------------------*/
static void *
H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p)
{
- H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */
- unsigned flags, version;
- unsigned i; /* Local counting variable */
- void * ret_value = NULL; /* Return value */
+ H5S_extent_t * sdim = NULL; /* New extent dimensionality structure */
+ unsigned flags, version;
+ unsigned i; /* Local counting variable */
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -161,6 +162,13 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
/* Decode dimension sizes */
if (sdim->rank > 0) {
+ /* Ensure that rank doesn't cause reading passed buffer's end,
+ due to possible data corruption */
+ uint8_t sizeof_size = H5F_SIZEOF_SIZE(f);
+ if (p + (sizeof_size * sdim->rank - 1) > p_end) {
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+ }
+
if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -170,6 +178,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
if (flags & H5S_VALID_MAX) {
if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Ensure that rank doesn't cause reading passed buffer's end */
+ if (p + (sizeof_size * sdim->rank - 1) > p_end)
+ HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end")
+
for (i = 0; i < sdim->rank; i++)
H5F_DECODE_LENGTH(f, p, sdim->max[i]);
} /* end if */
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 0e774cf..f164db3 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -44,7 +44,7 @@
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void *
+static inline void *
H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
const uint8_t *p)
{
@@ -103,7 +103,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_shared_t *sh_mesg =
@@ -158,7 +158,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE size_t
+static inline size_t
H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
{
const H5O_shared_t *sh_mesg =
@@ -211,7 +211,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
{
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
@@ -262,7 +262,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
{
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
@@ -312,7 +312,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void *
+static inline void *
H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, hbool_t *recompute_size,
unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata)
{
@@ -375,7 +375,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src,
H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info)
{
@@ -445,7 +445,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE herr_t
+static inline herr_t
H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
{
const H5O_shared_t *sh_mesg =
diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h
index 1a8b307..2fc70c6 100644
--- a/src/H5PBprivate.h
+++ b/src/H5PBprivate.h
@@ -99,4 +99,4 @@ H5_DLL herr_t H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsig
unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
H5_DLL herr_t H5PB_print_stats(const H5PB_t *page_buf);
-#endif /* !_H5PBprivate_H */
+#endif /* H5PBprivate_H */
diff --git a/src/H5PL.c b/src/H5PL.c
index 06443f3..30b6c52 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -359,7 +359,7 @@ H5PLget(unsigned int idx, char *path_buf, size_t buf_size)
/* If the path buffer is not NULL, copy the path to the buffer */
if (path_buf) {
- HDstrncpy(path_buf, path, MIN((size_t)(path_len + 1), buf_size));
+ HDstrncpy(path_buf, path, buf_size);
if ((size_t)path_len >= buf_size)
path_buf[buf_size - 1] = '\0';
} /* end if */
diff --git a/src/H5PLint.c b/src/H5PLint.c
index cf6135d..848bd1d 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -144,7 +144,7 @@ H5PL__init_package(void)
* to ignore plugins. The special symbol H5PL_NO_PLUGIN (defined in
* H5PLpublic.h) means we don't want to load plugins.
*/
- if (NULL != (env_var = HDgetenv("HDF5_PLUGIN_PRELOAD")))
+ if (NULL != (env_var = HDgetenv(HDF5_PLUGIN_PRELOAD)))
if (!HDstrcmp(env_var, H5PL_NO_PLUGIN)) {
H5PL_plugin_control_mask_g = 0;
H5PL_allow_plugins_g = FALSE;
@@ -236,11 +236,18 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled")
break;
+
case H5PL_TYPE_VOL:
if ((H5PL_plugin_control_mask_g & H5PL_VOL_PLUGIN) == 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL,
"Virtual Object Layer (VOL) driver plugins disabled")
break;
+
+ case H5PL_TYPE_VFD:
+ if ((H5PL_plugin_control_mask_g & H5PL_VFD_PLUGIN) == 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual File Driver (VFD) plugins disabled")
+ break;
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
@@ -273,9 +280,31 @@ done:
*
* Purpose: Opens a plugin.
*
- * The success parameter will be set to TRUE and the plugin_info
- * parameter will be filled in on success. Otherwise, they
- * will be FALSE and NULL, respectively.
+ * `path` specifies the path to the plugin library file.
+ *
+ * `type` specifies the type of plugin being searched for and
+ * will be used to verify that a loaded plugin matches the
+ * type requested. H5PL_TYPE_NONE may be passed, in which case
+ * no plugin type verification is performed. This is most
+ * useful when iterating over available plugins without regard
+ * to their types.
+ *
+ * `key` specifies the information that will be used to find a
+ * specific plugin. For filter plugins, this is typically an
+ * integer identifier. For VOL connector and VFD plugins, this
+ * is typically either an integer identifier or a name string.
+ * After a plugin has been opened, this information will be
+ * compared against the relevant information provided by the
+ * plugin to ensure that the plugin is a match. If
+ * H5PL_TYPE_NONE is provided for `type`, then `key` should be
+ * NULL.
+ *
+ * On successful open of a plugin, the `success` parameter
+ * will be set to TRUE and the `plugin_type` and `plugin_info`
+ * parameters will be filled appropriately. On failure, the
+ * `success` parameter will be set to FALSE, the `plugin_type`
+ * parameter will be set to H5PL_TYPE_ERROR and the
+ * `plugin_info` parameter will be set to NULL.
*
* Return: SUCCEED/FAIL
*
@@ -290,7 +319,7 @@ done:
* get_plugin_info function pointer, but early (4.4.7, at least) gcc
* only allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("pedantic")
+H5_GCC_CLANG_DIAG_OFF("pedantic")
herr_t
H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *success,
H5PL_type_t *plugin_type, const void **plugin_info)
@@ -306,6 +335,8 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
/* Check args - Just assert on package functions */
HDassert(path);
+ if (type == H5PL_TYPE_NONE)
+ HDassert(!key);
HDassert(success);
HDassert(plugin_info);
@@ -394,6 +425,34 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s
break;
}
+ case H5PL_TYPE_VFD: {
+ const void *cls;
+
+ /* Get the plugin info */
+ if (NULL == (cls = (const void *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VFD info from plugin")
+
+ /* Setup temporary plugin key if one wasn't supplied */
+ if (!key) {
+ tmp_key.vfd.kind = H5FD_GET_DRIVER_BY_NAME;
+ tmp_key.vfd.u.name = ((const H5FD_class_t *)cls)->name;
+ key = &tmp_key;
+ }
+
+ /* Ask VFD interface if this class is the one we are looking for and is compatible, etc */
+ if (H5FD_check_plugin_load(cls, key, success) < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VFD compatibility check failed")
+
+ /* Check for finding the correct plugin */
+ if (*success) {
+ if (plugin_type)
+ *plugin_type = H5PL_TYPE_VFD;
+ *plugin_info = cls;
+ }
+
+ break;
+ }
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
@@ -412,7 +471,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__open() */
-H5_GCC_DIAG_ON("pedantic")
+H5_GCC_CLANG_DIAG_ON("pedantic")
/*-------------------------------------------------------------------------
* Function: H5PL__close
diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h
index ab9f1d5..a093096 100644
--- a/src/H5PLmodule.h
+++ b/src/H5PLmodule.h
@@ -28,8 +28,34 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5PL H5PL
- * \brief Plugins
- * \todo Describe what programmatically controlling dynamically loaded plugins (H5PL) is all about
+ *
+ * Use the functions in this module to manage the loading behavior of HDF5
+ * plugins.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5PL_examples.c create
+ * </td>
+ * <td>
+ * \snippet H5PL_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5PL_examples.c update
+ * </td>
+ * <td>
+ * \snippet H5PL_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \attention The loading behavior of HDF5 plugins can be controlled via the
+ * functions described below and certain environment variables, such
+ * as \c HDF5_PLUGIN_PRELOAD and \c HDF5_PLUGIN_PATH.
+ *
*/
#endif /* H5PLmodule_H */
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 39a7d0d..9aecad1 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -248,7 +248,7 @@ H5PL__create_path_table(void)
/* Retrieve paths from HDF5_PLUGIN_PATH if the user sets it
* or from the default paths if it isn't set.
*/
- env_var = HDgetenv("HDF5_PLUGIN_PATH");
+ env_var = HDgetenv(HDF5_PLUGIN_PATH);
if (NULL == env_var)
paths = H5MM_strdup(H5PL_DEFAULT_PATH);
else
@@ -571,12 +571,12 @@ H5PL__path_table_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op,
FUNC_ENTER_PACKAGE
- for (u = 0; (u < H5PL_num_paths_g) && (ret_value == H5_ITER_CONT); u++)
- ret_value = H5PL__path_table_iterate_process_path(H5PL_paths_g[u], iter_type, iter_op, op_data);
-
- if (ret_value < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_BADITER, H5_ITER_ERROR, "can't iterate over plugins in plugin path '%s'",
- H5PL_paths_g[u]);
+ for (u = 0; (u < H5PL_num_paths_g) && (ret_value == H5_ITER_CONT); u++) {
+ if ((ret_value =
+ H5PL__path_table_iterate_process_path(H5PL_paths_g[u], iter_type, iter_op, op_data)) < 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_BADITER, H5_ITER_ERROR,
+ "can't iterate over plugins in plugin path '%s'", H5PL_paths_g[u]);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -615,9 +615,9 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
HDassert(plugin_path);
HDassert(iter_op);
- /* Open the directory */
+ /* Open the directory - skip the path if the directory can't be opened */
if (!(dirp = HDopendir(plugin_path)))
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory: %s", plugin_path)
+ HGOTO_DONE(H5_ITER_CONT)
/* Iterate through all entries in the directory */
while (NULL != (dp = HDreaddir(dirp))) {
@@ -663,7 +663,8 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
/* Determine if we should process this plugin */
plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) ||
((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) ||
- ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL));
+ ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)) ||
+ ((iter_type == H5PL_ITER_TYPE_VFD) && (plugin_type == H5PL_TYPE_VFD));
/* If the plugin was successfully loaded, call supplied callback function on plugin */
if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data)))
@@ -706,10 +707,11 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
HDassert(plugin_path);
HDassert(iter_op);
- /* Specify a file mask. *.* = We want everything! */
+ /* Specify a file mask. *.* = We want everything! -
+ * skip the path if the directory can't be opened */
HDsprintf(service, "%s\\*.dll", plugin_path);
if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
- HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, H5_ITER_ERROR, "can't open directory")
+ HGOTO_DONE(H5_ITER_CONT)
/* Loop over all the files */
do {
@@ -740,7 +742,8 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
/* Determine if we should process this plugin */
plugin_matches = (iter_type == H5PL_ITER_TYPE_ALL) ||
((iter_type == H5PL_ITER_TYPE_FILTER) && (plugin_type == H5PL_TYPE_FILTER)) ||
- ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL));
+ ((iter_type == H5PL_ITER_TYPE_VOL) && (plugin_type == H5PL_TYPE_VOL)) ||
+ ((iter_type == H5PL_ITER_TYPE_VFD) && (plugin_type == H5PL_TYPE_VFD));
/* If the plugin was successfully loaded, call supplied callback function on plugin */
if (plugin_loaded && plugin_matches && (ret_value = iter_op(plugin_type, plugin_info, op_data)))
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index 2ec0845..25e373f 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -242,7 +242,7 @@ done:
/* See the other use of H5PL_GET_LIB_FUNC() for an explanation
* for why we disable -Wpedantic here.
*/
-H5_GCC_DIAG_OFF("pedantic")
+H5_GCC_CLANG_DIAG_OFF("pedantic")
herr_t
H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found,
const void **plugin_info)
@@ -263,17 +263,85 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* Loop over all the plugins, looking for one that matches */
for (u = 0; u < H5PL_num_plugins_g; u++) {
-
- /* If the plugin type (filter, VOL connector, etc.) and ID match, query the plugin for its info */
- if ((search_params->type == (H5PL_cache_g[u]).type) &&
- (search_params->key->id == (H5PL_cache_g[u]).key.id)) {
-
+ hbool_t matched = FALSE; /* Whether cached plugin info matches */
+
+ /* Determine if the plugin types match */
+ if (search_params->type != H5PL_cache_g[u].type)
+ continue;
+
+ /* Determine if cache entry matches based on type-specific information */
+ switch (search_params->type) {
+ case H5PL_TYPE_FILTER:
+ /* Check if specified filter plugin ID matches cache entry's ID */
+ if (search_params->key->id == H5PL_cache_g[u].key.id)
+ matched = TRUE;
+
+ break;
+
+ case H5PL_TYPE_VOL:
+ if (search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ /* Make sure the plugin cache entry key type matches our search key type */
+ if (H5PL_cache_g[u].key.vol.kind != H5VL_GET_CONNECTOR_BY_NAME)
+ continue;
+
+ /* Check if specified VOL connector name matches cache entry's name */
+ if (!HDstrcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name))
+ matched = TRUE;
+ }
+ else {
+ HDassert(search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
+
+ /* Make sure the plugin cache entry key type matches our search key type */
+ if (H5PL_cache_g[u].key.vol.kind != H5VL_GET_CONNECTOR_BY_VALUE)
+ continue;
+
+ /* Check if specified VOL connector ID matches cache entry's ID */
+ if (search_params->key->vol.u.value == H5PL_cache_g[u].key.vol.u.value)
+ matched = TRUE;
+ }
+
+ break;
+
+ case H5PL_TYPE_VFD:
+ if (search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) {
+ /* Make sure the plugin cache entry key type matches our search key type */
+ if (H5PL_cache_g[u].key.vfd.kind != H5FD_GET_DRIVER_BY_NAME)
+ continue;
+
+ /* Check if specified VFD name matches cache entry's name */
+ if (!HDstrcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name))
+ matched = TRUE;
+ }
+ else {
+ HDassert(search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE);
+
+ /* Make sure the plugin cache entry key type matches our search key type */
+ if (H5PL_cache_g[u].key.vfd.kind != H5FD_GET_DRIVER_BY_VALUE)
+ continue;
+
+ /* Check if specified VFD ID matches cache entry's ID */
+ if (search_params->key->vfd.u.value == H5PL_cache_g[u].key.vfd.u.value)
+ matched = TRUE;
+ }
+
+ break;
+
+ case H5PL_TYPE_ERROR:
+ case H5PL_TYPE_NONE:
+ default:
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified")
+ }
+
+ /* If the plugin type (filter, VOL connector, VFD plugin, etc.) and key match,
+ * query the plugin for its info.
+ */
+ if (matched) {
H5PL_get_plugin_info_t get_plugin_info_function;
const void * info;
/* Get the "get plugin info" function from the plugin. */
if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(
- (H5PL_cache_g[u]).handle, "H5PLget_plugin_info")))
+ H5PL_cache_g[u].handle, "H5PLget_plugin_info")))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
/* Call the "get plugin info" function */
@@ -286,12 +354,10 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* No need to continue processing */
break;
-
- } /* end if */
-
+ }
} /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__find_plugin_in_cache() */
-H5_GCC_DIAG_ON("pedantic")
+H5_GCC_CLANG_DIAG_ON("pedantic")
diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h
index 7eae513..7ff5c1a 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -22,6 +22,7 @@
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
+#include "H5FDprivate.h" /* File Drivers */
#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -32,16 +33,29 @@
/* Library Private Typedefs */
/****************************/
+/* Key used to find VOL connector plugins */
+typedef struct H5PL_vol_key_t {
+ H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */
+ union {
+ H5VL_class_value_t value; /* VOL connector value */
+ const char * name; /* VOL connector name */
+ } u;
+} H5PL_vol_key_t;
+
+/* Key used to find VFD plugins */
+typedef struct H5PL_vfd_key_t {
+ H5FD_get_driver_kind_t kind; /* Kind of VFD lookup to do */
+ union {
+ H5FD_class_value_t value; /* VFD value */
+ const char * name; /* VFD name */
+ } u;
+} H5PL_vfd_key_t;
+
/* The key that will be used to find the plugin */
typedef union H5PL_key_t {
- int id; /* I/O filters */
- struct {
- H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */
- union {
- H5VL_class_value_t value; /* VOL connector value */
- const char * name; /* VOL connector name */
- } u;
- } vol;
+ int id; /* I/O filters */
+ H5PL_vol_key_t vol;
+ H5PL_vfd_key_t vfd;
} H5PL_key_t;
/* Enum dictating the type of plugins to process
@@ -50,6 +64,7 @@ typedef union H5PL_key_t {
typedef enum {
H5PL_ITER_TYPE_FILTER,
H5PL_ITER_TYPE_VOL,
+ H5PL_ITER_TYPE_VFD,
H5PL_ITER_TYPE_ALL,
} H5PL_iterate_type_t;
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
index 9ab2b17..ab24bd5 100644
--- a/src/H5PLpublic.h
+++ b/src/H5PLpublic.h
@@ -28,23 +28,23 @@
*/
#define H5PL_NO_PLUGIN "::"
-//! [H5PL_type_t_snip]
-
+//! <!-- [H5PL_type_t_snip] -->
/**
* Plugin type (bit-position) used by the plugin library
*/
typedef enum H5PL_type_t {
H5PL_TYPE_ERROR = -1, /**< Error */
H5PL_TYPE_FILTER = 0, /**< Filter */
- H5PL_TYPE_VOL = 1, /**< VOL driver */
- H5PL_TYPE_NONE = 2 /**< Sentinel: This must be last! */
+ H5PL_TYPE_VOL = 1, /**< VOL connector */
+ H5PL_TYPE_VFD = 2, /**< VFD */
+ H5PL_TYPE_NONE = 3 /**< Sentinel: This must be last! */
} H5PL_type_t;
-
-//! [H5PL_type_t_snip]
+//! <!-- [H5PL_type_t_snip] -->
/* Common dynamic plugin type flags used by the set/get_loading_state functions */
#define H5PL_FILTER_PLUGIN 0x0001
#define H5PL_VOL_PLUGIN 0x0002
+#define H5PL_VFD_PLUGIN 0x0004
#define H5PL_ALL_PLUGIN 0xFFFF
#ifdef __cplusplus
@@ -100,7 +100,9 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask);
* A plugin bit set to 1 (one) indicates that that the dynamic plugin type is
* enabled.\n
* If the value of \p plugin_control_mask is negative, all dynamic plugin
- * types are enabled.\n If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins are disabled.
+ * types are enabled.\n
+ * If the value of \p plugin_control_mask is 0 (zero), all dynamic plugins
+ * are disabled.
* \return \herr_t
*
* \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index c8a97c2..d374b25 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -768,7 +768,7 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
- if (rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 > 1.0)
HGOTO_ERROR(
H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
@@ -1453,7 +1453,7 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
@@ -1543,7 +1543,7 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 0768d11..d08d892 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -96,19 +96,31 @@
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
#define H5D_DEF_STORAGE_COMPACT \
{ \
- H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT } \
+ H5D_COMPACT, \
+ { \
+ .compact = H5D_DEF_STORAGE_COMPACT_INIT \
+ } \
}
#define H5D_DEF_STORAGE_CONTIG \
{ \
- H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT } \
+ H5D_CONTIGUOUS, \
+ { \
+ .contig = H5D_DEF_STORAGE_CONTIG_INIT \
+ } \
}
#define H5D_DEF_STORAGE_CHUNK \
{ \
- H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT } \
+ H5D_CHUNKED, \
+ { \
+ .chunk = H5D_DEF_STORAGE_CHUNK_INIT \
+ } \
}
#define H5D_DEF_STORAGE_VIRTUAL \
{ \
- H5D_VIRTUAL, { .virt = H5D_DEF_STORAGE_VIRTUAL_INIT } \
+ H5D_VIRTUAL, \
+ { \
+ .virt = H5D_DEF_STORAGE_VIRTUAL_INIT \
+ } \
}
#define H5D_DEF_LAYOUT_COMPACT \
{ \
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 70fc982..46dc94c 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -68,7 +68,7 @@
#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
#define H5D_XFER_BTREE_SPLIT_RATIO_DEF \
{ \
- 0.1f, 0.5f, 0.9f \
+ 0.1, 0.5, 0.9 \
}
#define H5D_XFER_BTREE_SPLIT_RATIO_ENC H5P__dxfr_btree_split_ratio_enc
#define H5D_XFER_BTREE_SPLIT_RATIO_DEC H5P__dxfr_btree_split_ratio_dec
@@ -159,6 +159,16 @@
#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp
#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
+/* Definitions for dataset I/O selection property */
+#define H5D_XFER_DSET_IO_SEL_SIZE sizeof(H5S_t *)
+#define H5D_XFER_DSET_IO_SEL_DEF NULL
+#define H5D_XFER_DSET_IO_SEL_COPY H5P__dxfr_dset_io_hyp_sel_copy
+#define H5D_XFER_DSET_IO_SEL_CMP H5P__dxfr_dset_io_hyp_sel_cmp
+#define H5D_XFER_DSET_IO_SEL_CLOSE H5P__dxfr_dset_io_hyp_sel_close
+#ifdef QAK
+#define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc
+#define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec
+#endif /* QAK */
/******************/
/* Local Typedefs */
@@ -196,6 +206,9 @@ static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char *name, size_t size,
static herr_t H5P__dxfr_xform_copy(const char *name, size_t size, void *value);
static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P__dxfr_xform_close(const char *name, size_t size, void *value);
+static herr_t H5P__dxfr_dset_io_hyp_sel_copy(const char *name, size_t size, void *value);
+static int H5P__dxfr_dset_io_hyp_sel_cmp(const void *value1, const void *value2, size_t size);
+static herr_t H5P__dxfr_dset_io_hyp_sel_close(const char *name, size_t size, void *value);
/*********************/
/* Package Variables */
@@ -262,7 +275,9 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default
static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
static const H5T_conv_cb_t H5D_def_conv_cb_g =
H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
-static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
+static const void * H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
+static const H5S_t *H5D_def_dset_io_sel_g =
+ H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_reg_prop
@@ -420,6 +435,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
H5D_XFER_XFORM_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the dataset I/O selection property */
+ if (H5P__register_real(pclass, H5D_XFER_DSET_IO_SEL_NAME, H5D_XFER_DSET_IO_SEL_SIZE,
+ &H5D_def_dset_io_sel_g, NULL, NULL, NULL, NULL, NULL, NULL,
+ H5D_XFER_DSET_IO_SEL_COPY, H5D_XFER_DSET_IO_SEL_CMP,
+ H5D_XFER_DSET_IO_SEL_CLOSE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dxfr_reg_prop() */
@@ -894,7 +916,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__dxfr_xform_copy() */
+} /* end H5P__dxfr_xform_cmp() */
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_xform_close
@@ -965,7 +987,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
/* Create data transform info from expression */
if (NULL == (data_xform_prop = H5Z_xform_create(expression)))
- HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info")
+ HGOTO_ERROR(H5E_PLIST, H5E_NOSPACE, FAIL, "unable to create data transform info")
/* Update property list (takes ownership of transform) */
if (H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
@@ -974,7 +996,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
done:
if (ret_value < 0)
if (data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_data_transform() */
@@ -1030,7 +1052,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
/* Copy into application buffer */
len = HDstrlen(pexp);
if (expression) {
- HDstrncpy(expression, pexp, MIN(len + 1, size));
+ HDstrncpy(expression, pexp, size);
if (len >= size)
expression[size - 1] = '\0';
} /* end if */
@@ -1486,9 +1508,8 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right)
H5TRACE4("e", "iddd", plist_id, left, middle, right);
/* Check arguments */
- if (left < (double)0.0f || left > (double)1.0f || middle < (double)0.0f || middle > (double)1.0f ||
- right < (double)0.0f || right > (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
+ if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0")
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
@@ -2110,3 +2131,251 @@ H5P__dxfr_edc_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__dxfr_edc_dec() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_copy
+ *
+ * Purpose: Creates a copy of the dataset I/O selection.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value)
+{
+ H5S_t *orig_space = *(H5S_t **)value; /* Original dataspace for property */
+ H5S_t *new_space = NULL; /* New dataspace for property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* If there's a dataspace I/O selection set, copy it */
+ if (orig_space) {
+ /* Make copy of dataspace */
+ if (NULL == (new_space = H5S_copy(orig_space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the dataset I/O selection")
+
+ /* Set new value for property */
+ *(void **)value = new_space;
+ } /* end if */
+
+done:
+ /* Cleanup on error */
+ if (ret_value < 0)
+ if (new_space && H5S_close(new_space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_copy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_cmp
+ *
+ * Purpose: Compare two dataset I/O selections.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is
+ * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H5_ATTR_UNUSED size)
+{
+ const H5S_t *const *space1 = (const H5S_t *const *)_space1; /* Create local aliases for values */
+ const H5S_t *const *space2 = (const H5S_t *const *)_space2; /* Create local aliases for values */
+ herr_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(space1);
+ HDassert(space1);
+ HDassert(size == sizeof(H5S_t *));
+
+ /* Check for a property being set */
+ if (*space1 == NULL && *space2 != NULL)
+ HGOTO_DONE(-1);
+ if (*space1 != NULL && *space2 == NULL)
+ HGOTO_DONE(1);
+
+ if (*space1) {
+ HDassert(*space2);
+
+ /* Compare the extents of the dataspaces */
+ /* (Error & not-equal count the same) */
+ if (TRUE != H5S_extent_equal(*space1, *space2))
+ HGOTO_DONE(-1);
+
+ /* Compare the selection "shape" of the dataspaces */
+ /* (Error & not-equal count the same) */
+ if (TRUE != H5S_select_shape_same(*space1, *space2))
+ HGOTO_DONE(-1);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_cmp() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__dxfr_dset_io_hyp_sel_close
+ *
+ * Purpose: Frees resources for dataset I/O selection
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, January 31, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__dxfr_dset_io_hyp_sel_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *_value)
+{
+ H5S_t *space = *(H5S_t **)_value; /* Dataspace for property */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Release any dataspace */
+ if (space && H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__dxfr_dset_io_hyp_sel_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dataset_io_hyperslab_selection
+ *
+ * Purpose: H5Pset_dataset_io_hyperslab_selection() is designed to be used
+ * in conjunction with using H5S_PLIST for the file dataspace
+ * ID when making a call to H5Dread() or H5Dwrite(). When used
+ * with H5S_PLIST, the selection created by one or more calls to
+ * this routine is used for determining which dataset elements to
+ * access.
+ *
+ * 'rank' is the dimensionality of the selection and determines
+ * the size of the 'start', 'stride', 'count', and 'block' arrays.
+ * 'rank' must be between 1 and H5S_MAX_RANK, inclusive.
+ *
+ * The 'op', 'start', 'stride', 'count', and 'block' parameters
+ * behave identically to their behavior for H5Sselect_hyperslab(),
+ * please see the documentation for that routine for details about
+ * their use.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 30, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
+{
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ H5S_t * space; /* Dataspace to hold selection */
+ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */
+ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "iIuSs*h*h*h*h", plist_id, rank, op, start, stride, count, block);
+
+ /* Check arguments */
+ if (rank < 1 || rank > H5S_MAX_RANK)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank value: %u", rank)
+ if (!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID))
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ if (start == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'count' pointer is NULL")
+ if (stride != NULL) {
+ unsigned u; /* Local index variable */
+
+ /* Check for 0-sized strides */
+ for (u = 0; u < rank; u++)
+ if (stride[u] == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value - stride[%u]==0", u)
+ } /* end if */
+ if (count == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'start' pointer is NULL")
+ /* block is allowed to be NULL, and will be assumed to be all '1's when NULL */
+
+ /* Get the plist structure */
+ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID")
+
+ /* See if a dataset I/O selection is already set, and free it if it is */
+ if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting dataset I/O selection")
+
+ /* Check for operation on existing dataspace selection */
+ if (NULL != space) {
+ int sndims; /* Rank of existing dataspace */
+
+ /* Get dimensions from current dataspace for selection */
+ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection's dataspace rank")
+
+ /* Check for different # of dimensions */
+ if ((unsigned)sndims != rank) {
+ /* Set up new dataspace for 'set' operation, otherwise fail */
+ if (op == H5S_SELECT_SET) {
+ /* Close previous dataspace */
+ if (H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+
+ /* Reset 'space' pointer, so it's re-created */
+ space = NULL;
+
+ /* Set flag to reset property list on error */
+ reset_prop_on_error = TRUE;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "different rank for previous and new selections")
+ } /* end if */
+ } /* end if */
+
+ /* Check for first time called */
+ if (NULL == space) {
+ hsize_t dims[H5S_MAX_RANK]; /* Dimensions for new dataspace */
+ unsigned u; /* Local index variable */
+
+ /* Initialize dimensions to largest possible actual size */
+ for (u = 0; u < rank; u++)
+ dims[u] = (H5S_UNLIMITED - 1);
+
+ /* Create dataspace of the correct dimensionality, with maximum dimensions */
+ if (NULL == (space = H5S_create_simple(rank, dims, NULL)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create dataspace for selection")
+ space_created = TRUE;
+ } /* end if */
+
+ /* Set selection for dataspace */
+ if (H5S_select_hyperslab(space, op, start, stride, count, block) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSELECT, FAIL, "can't create selection")
+
+ /* Update property list (takes ownership of dataspace, if new) */
+ if (H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection")
+ space_created = FALSE; /* Reset now that property owns the dataspace */
+
+done:
+ /* Cleanup on failure */
+ if (ret_value < 0) {
+ if (reset_prop_on_error && plist && H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection")
+ if (space_created && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_dataset_io_hyperslab_selection() */
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index 5b0ecb6..e2a97f8 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -333,7 +333,7 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata)
/* Encode (or not, if the 'encode' flag is off) the property's name */
prop_name_len = HDstrlen(prop->name) + 1;
if (udata->encode) {
- HDstrncpy((char *)*(udata->pp), prop->name, prop_name_len);
+ HDstrcpy((char *)*(udata->pp), prop->name);
*(uint8_t **)(udata->pp) += prop_name_len;
} /* end if */
*(udata->enc_size_ptr) += prop_name_len;
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index c085b71..f37cb74 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -41,8 +41,28 @@
#include "H5VMprivate.h" /* Vector Functions */
/* Includes needed to set default file driver */
-#include "H5FDsec2.h" /* POSIX unbuffered I/O */
+#include "H5FDsec2.h" /* POSIX unbuffered I/O */
+#include "H5FDcore.h"
+#include "H5FDlog.h"
+#include "H5FDfamily.h"
+#include "H5FDmulti.h"
#include "H5FDstdio.h" /* Standard C buffered I/O */
+#include "H5FDsplitter.h"
+#ifdef H5_HAVE_PARALLEL
+#include "H5FDmpio.h"
+#endif
+#ifdef H5_HAVE_DIRECT
+#include "H5FDdirect.h"
+#endif
+#ifdef H5_HAVE_MIRROR_VFD
+#include "H5FDmirror.h"
+#endif
+#ifdef H5_HAVE_LIBHDFS
+#include "H5FDhdfs.h"
+#endif
+#ifdef H5_HAVE_ROS3_VFD
+#include "H5FDros3.h"
+#endif
#ifdef H5_HAVE_WINDOWS
#include "H5FDwindows.h" /* Win32 I/O */
#endif
@@ -113,7 +133,7 @@
#define H5F_ACS_FILE_DRV_SIZE sizeof(H5FD_driver_prop_t)
#define H5F_ACS_FILE_DRV_DEF \
{ \
- H5_DEFAULT_VFD, NULL \
+ H5_DEFAULT_VFD, NULL, NULL \
}
#define H5F_ACS_FILE_DRV_CRT H5P__facc_file_driver_create
#define H5F_ACS_FILE_DRV_SET H5P__facc_file_driver_set
@@ -398,6 +418,9 @@ static int H5P__facc_mpi_info_cmp(const void *value1, const void *value2, siz
static herr_t H5P__facc_mpi_info_close(const char *name, size_t size, void *value);
#endif /* H5_HAVE_PARALLEL */
+/* Internal routines */
+static herr_t H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver_id);
+
/*********************/
/* Package Variables */
/*********************/
@@ -809,6 +832,208 @@ done:
} /* end H5P__facc_reg_prop() */
/*-------------------------------------------------------------------------
+ * Function: H5P__facc_set_def_driver
+ *
+ * Purpose: Parses a string that contains the name of the default VFL
+ * driver for the default FAPL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P__facc_set_def_driver(void)
+{
+ const char *driver_env_var;
+ hbool_t driver_ref_inc = FALSE;
+ hid_t driver_id = H5I_INVALID_HID; /* VFL driver ID */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check if VFL driver environment variable is set */
+ driver_env_var = HDgetenv(HDF5_DRIVER);
+
+ /* Only parse VFL driver string if it's set */
+ if (driver_env_var && *driver_env_var) {
+ H5FD_driver_prop_t driver_prop;
+ H5P_genplist_t * def_fapl; /* Default file access property list */
+ H5P_genclass_t * def_fapclass; /* Default file access property class */
+ const char * driver_config_env_var;
+ htri_t driver_is_registered;
+
+ /* Check to see if the driver is already registered */
+ if ((driver_is_registered = H5FD_is_driver_registered_by_name(driver_env_var, &driver_id)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFL driver is already registered")
+ if (driver_is_registered) {
+ HDassert(driver_id >= 0);
+
+ if (H5I_inc_ref(driver_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFD")
+ driver_ref_inc = TRUE;
+ } /* end else-if */
+ else {
+ /* Check for VFL drivers that ship with the library */
+ if (H5P__facc_set_def_driver_check_predefined(driver_env_var, &driver_id) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check for predefined VFL driver name")
+ else if (driver_id > 0) {
+ if (H5I_inc_ref(driver_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "can't increment VFL driver refcount")
+ driver_ref_inc = TRUE;
+ }
+ else {
+ /* Register the VFL driver */
+ if ((driver_id = H5FD_register_driver_by_name(driver_env_var, TRUE)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "can't register VFL driver")
+ driver_ref_inc = TRUE;
+ } /* end else */
+ } /* end else */
+
+ /* Retrieve driver configuration string from environment variable, if set. */
+ driver_config_env_var = HDgetenv(HDF5_DRIVER_CONFIG);
+
+ driver_prop.driver_id = driver_id;
+ driver_prop.driver_info = NULL;
+ driver_prop.driver_config_str = driver_config_env_var;
+
+ /* Get default file access pclass */
+ if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL,
+ "can't find object for default file access property class ID")
+
+ /* Set new default VFL driver for default file access pclass */
+ if (H5P__class_set(def_fapclass, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL,
+ "can't set default VFL driver for default file access property list class")
+
+ /* Get default file access plist */
+ if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, "can't find object for default fapl ID")
+
+ /* Set new default VFL driver for default FAPL */
+ if (H5P_set_driver(def_fapl, driver_prop.driver_id, driver_prop.driver_info,
+ driver_prop.driver_config_str) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default VFL driver for default FAPL")
+ }
+
+done:
+ /* Clean up on error */
+ if (ret_value < 0) {
+ if (driver_id >= 0 && driver_ref_inc && H5I_dec_app_ref(driver_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "unable to unregister VFL driver")
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_set_def_driver() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_set_def_driver_check_predefined
+ *
+ * Purpose: Checks a given driver name against a list of predefined
+ * names for VFL drivers that are internal to HDF5. If a name
+ * is matched, the ID for that driver is returned through
+ * `driver_id`. Otherwise, `driver_id` is set to
+ * H5I_INVALID_HID.
+ *
+ * Return: Non-negative on sucess/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver_id)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(driver_name);
+ HDassert(driver_id);
+
+ if (!HDstrcmp(driver_name, "sec2")) {
+ if ((*driver_id = H5FD_SEC2) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize sec2 VFD")
+ }
+ else if (!HDstrcmp(driver_name, "core") || !HDstrcmp(driver_name, "core_paged")) {
+ if ((*driver_id = H5FD_CORE) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize core VFD")
+ }
+ else if (!HDstrcmp(driver_name, "log")) {
+ if ((*driver_id = H5FD_LOG) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize log VFD")
+ }
+ else if (!HDstrcmp(driver_name, "family")) {
+ if ((*driver_id = H5FD_FAMILY) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize family VFD")
+ }
+ else if (!HDstrcmp(driver_name, "multi") || !HDstrcmp(driver_name, "split")) {
+ if ((*driver_id = H5FD_MULTI) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize multi VFD")
+ }
+ else if (!HDstrcmp(driver_name, "stdio")) {
+ if ((*driver_id = H5FD_STDIO) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize stdio VFD")
+ }
+ else if (!HDstrcmp(driver_name, "splitter")) {
+ if ((*driver_id = H5FD_SPLITTER) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize splitter VFD")
+ }
+ else if (!HDstrcmp(driver_name, "mpio")) {
+#ifdef H5_HAVE_PARALLEL
+ if ((*driver_id = H5FD_MPIO) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize MPI I/O VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "MPI-I/O VFD is not enabled")
+#endif
+ }
+ else if (!HDstrcmp(driver_name, "direct")) {
+#ifdef H5_HAVE_DIRECT
+ if ((*driver_id = H5FD_DIRECT) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Direct I/O VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Direct I/O VFD is not enabled")
+#endif
+ }
+ else if (!HDstrcmp(driver_name, "mirror")) {
+#ifdef H5_HAVE_MIRROR_VFD
+ if ((*driver_id = H5FD_MIRROR) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize mirror VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Mirror VFD is not enabled")
+#endif
+ }
+ else if (!HDstrcmp(driver_name, "hdfs")) {
+#ifdef H5_HAVE_LIBHDFS
+ if ((*driver_id = H5FD_HDFS) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize HDFS VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "HDFS VFD is not enabled")
+#endif
+ }
+ else if (!HDstrcmp(driver_name, "ros3")) {
+#ifdef H5_HAVE_ROS3_VFD
+ if ((*driver_id = H5FD_ROS3) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize ROS3 VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "ROS3 VFD is not enabled")
+#endif
+ }
+ else if (!HDstrcmp(driver_name, "windows")) {
+#ifdef H5_HAVE_WINDOWS
+ if ((*driver_id = H5FD_WINDOWS) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Windows VFD")
+#else
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Windows VFD is not enabled")
+#endif
+ }
+ else {
+ *driver_id = H5I_INVALID_HID;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__facc_set_def_driver_check_predefined() */
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_alignment
*
* Purpose: Sets the alignment properties of a file access property list
@@ -899,42 +1124,52 @@ done:
} /* end H5Pget_alignment() */
/*-------------------------------------------------------------------------
- * Function: H5P_set_driver
+ * Function: H5P_set_driver
*
- * Purpose: Set the file driver (DRIVER_ID) for a file access
- * property list (PLIST_ID) and supply an optional
- * struct containing the driver-specific properites
- * (DRIVER_INFO). The driver properties will be copied into the
- * property list and the reference count on the driver will be
- * incremented, allowing the caller to close the driver ID but
- * still use the property list.
+ * Purpose: Set the file driver (NEW_DRIVER_ID) for a file access
+ * property list (PLIST). A struct (NEW_DRIVER_INFO) or string
+ * (NEW_DRIVER_CONFIG_STR) containing the driver-specific
+ * properties can optionally be supplied. The driver properties
+ * (struct or string) will be copied into the property list and
+ * the reference count on the driver will be incremented,
+ * allowing the caller to close the driver ID but still use the
+ * property list.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Note: Only one of either NEW_DRIVER_INFO or NEW_DRIVER_CONFIG_STR
+ * should be specified, but not both.
+ *
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
- * Tuesday, August 3, 1999
+ * Tuesday, August 3, 1999
*
*-------------------------------------------------------------------------
*/
herr_t
-H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info)
+H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info,
+ const char *new_driver_config_str)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ /* If VFD configuration information is supplied, ensure that either binary
+ * configuration data or a configuration string is supplied, but not both.
+ */
+ HDassert(!new_driver_info || !new_driver_config_str);
+
if (NULL == H5I_object_verify(new_driver_id, H5I_VFL))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID")
if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & config. string */
/* Prepare the driver property */
- driver_prop.driver_id = new_driver_id;
- driver_prop.driver_info = new_driver_info;
+ driver_prop.driver_id = new_driver_id;
+ driver_prop.driver_info = new_driver_info;
+ driver_prop.driver_config_str = new_driver_config_str;
- /* Set the driver ID & info property */
+ /* Set the driver ID, info & config. string property */
if (H5P_set(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info")
} /* end if */
@@ -980,7 +1215,7 @@ H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID")
/* Set the driver */
- if (H5P_set_driver(plist, new_driver_id, new_driver_info) < 0)
+ if (H5P_set_driver(plist, new_driver_id, new_driver_info, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
done:
@@ -988,6 +1223,180 @@ done:
} /* end H5Pset_driver() */
/*-------------------------------------------------------------------------
+ * Function: H5P_set_driver_by_name
+ *
+ * Purpose: Set the file driver name (DRIVER_NAME) for a file access
+ * property list (PLIST) and supply an optional string
+ * containing the driver-specific properties (DRIVER_CONFIG).
+ * The driver properties string will be copied into the
+ * property list.
+ *
+ * If the file driver specified by DRIVER_NAME is not
+ * currently registered, an attempt will be made to load the
+ * driver as a plugin.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name, const char *driver_config,
+ hbool_t app_ref)
+{
+ hid_t new_driver_id = H5I_INVALID_HID;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ assert(plist);
+ assert(driver_name);
+
+ /* Register the driver */
+ if ((new_driver_id = H5FD_register_driver_by_name(driver_name, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD")
+
+ /* Set the driver */
+ if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+
+done:
+ if (ret_value < 0) {
+ if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_set_driver_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_driver_by_name
+ *
+ * Purpose: Set the file driver name (DRIVER_NAME) for a file access
+ * property list (PLIST_ID) and supply an optional string
+ * containing the driver-specific properties (DRIVER_CONFIG).
+ * The driver properties string will be copied into the
+ * property list.
+ *
+ * If the file driver specified by DRIVER_NAME is not
+ * currently registered, an attempt will be made to load the
+ * driver as a plugin.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *driver_config)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*s*s", plist_id, driver_name, driver_config);
+
+ /* Check arguments */
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if (!driver_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be NULL")
+ if (!*driver_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be an empty string")
+
+ /* Set the driver */
+ if (H5P_set_driver_by_name(plist, driver_name, driver_config, TRUE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_driver_by_name() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_set_driver_by_value
+ *
+ * Purpose: Set the file driver value (DRIVER_VALUE) for a file access
+ * property list (PLIST) and supply an optional string
+ * containing the driver-specific properties (DRIVER_CONFIG).
+ * The driver properties string will be copied into the
+ * property list.
+ *
+ * If the file driver specified by DRIVER_VALUE is not
+ * currently registered, an attempt will be made to load the
+ * driver as a plugin.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value, const char *driver_config,
+ hbool_t app_ref)
+{
+ hid_t new_driver_id = H5I_INVALID_HID;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ assert(plist);
+ assert(driver_value >= 0);
+
+ /* Register the driver */
+ if ((new_driver_id = H5FD_register_driver_by_value(driver_value, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD")
+
+ /* Set the driver */
+ if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+
+done:
+ if (ret_value < 0) {
+ if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_set_driver_by_value() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_driver_by_value
+ *
+ * Purpose: Set the file driver value (DRIVER_VALUE) for a file access
+ * property list (PLIST_ID) and supply an optional string
+ * containing the driver-specific properties (DRIVER_CONFIG).
+ * The driver properties string will be copied into the
+ * property list.
+ *
+ * If the file driver specified by DRIVER_VALUE is not
+ * currently registered, an attempt will be made to load the
+ * driver as a plugin.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, const char *driver_config)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iDV*s", plist_id, driver_value, driver_config);
+
+ /* Check arguments */
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if (driver_value < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative VFD value is disallowed")
+
+ /* Set the driver */
+ if (H5P_set_driver_by_value(plist, driver_value, driver_config, TRUE) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_driver_by_value() */
+
+/*-------------------------------------------------------------------------
* Function: H5P_peek_driver
*
* Purpose: Return the ID of the low-level file driver. PLIST_ID should
@@ -1014,7 +1423,7 @@ H5P_peek_driver(H5P_genplist_t *plist)
/* Get the current driver ID */
if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */
if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID")
@@ -1098,7 +1507,7 @@ H5P_peek_driver_info(H5P_genplist_t *plist)
/* Get the current driver info */
if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
- H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */
if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info")
@@ -1151,13 +1560,104 @@ done:
} /* end H5Pget_driver_info() */
/*-------------------------------------------------------------------------
+ * Function: H5P_peek_driver_config_str
+ *
+ * Purpose: Returns a pointer directly to the file driver configuration
+ * string of a file access property list.
+ *
+ * Return: Success: Ptr to *uncopied* driver configuration string, if
+ * any.
+ *
+ * Failure: NULL. NULL is also returned if the driver has not
+ * been configured with a driver configuration string.
+ *
+ *-------------------------------------------------------------------------
+ */
+const char *
+H5P_peek_driver_config_str(H5P_genplist_t *plist)
+{
+ const char *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Get the current driver configuration string */
+ if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
+ H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */
+
+ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver configuration string")
+ ret_value = driver_prop.driver_config_str;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_peek_driver_config_str() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_driver_config_str
+ *
+ * Purpose: Retrieves a string representation of the configuration for
+ * the driver set on the given FAPL. The returned string can
+ * be used to configure the same driver in an identical way.
+ *
+ * `config_buf` may be NULL, in which case the length of the
+ * driver configuration string is simply returned. The caller
+ * can then allocate a buffer of the appropriate size and call
+ * this routine again.
+ *
+ * Return: Length of the driver configuration string on success (not
+ * including the NUL terminator)
+ * Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ const char * config_str = NULL;
+ ssize_t ret_value = -1;
+
+ FUNC_ENTER_API((-1))
+ H5TRACE3("Zs", "i*sz", fapl_id, config_buf, buf_size);
+
+ /* Check arguments */
+ if (!config_buf && buf_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "config_buf cannot be NULL if buf_size is non-zero")
+
+ /* Get the plist structure */
+ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't find object for ID")
+
+ /* Retrieve configuration string property */
+ if ((config_str = H5P_peek_driver_config_str(plist))) {
+ size_t config_str_len = HDstrlen(config_str);
+
+ if (config_buf) {
+ HDstrncpy(config_buf, config_str, MIN(config_str_len + 1, buf_size));
+ if (config_str_len >= buf_size)
+ config_buf[buf_size - 1] = '\0';
+ }
+
+ ret_value = (ssize_t)config_str_len;
+ }
+ else
+ ret_value = 0;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_driver_config_str() */
+
+/*-------------------------------------------------------------------------
* Function: H5P__file_driver_copy
*
* Purpose: Copy file driver ID & info.
*
* Note: This is an "in-place" copy, since this routine gets called
* after the top-level copy has been performed and this routine
- * finishes the "deep" part of the copy.
+ * finishes the "deep" part of the copy.
*
* Return: Success: Non-negative
* Failure: Negative
@@ -1208,6 +1708,15 @@ H5P__file_driver_copy(void *value)
/* Set the driver info for the copy */
info->driver_info = new_pl;
} /* end if */
+
+ /* Copy driver configuration string, if it exists */
+ if (info->driver_config_str) {
+ char *new_config_str = NULL;
+
+ if (NULL == (new_config_str = H5MM_strdup(info->driver_config_str)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver configuration string copy failed")
+ info->driver_config_str = new_config_str;
+ } /* end if */
} /* end if */
} /* end if */
@@ -1238,7 +1747,6 @@ H5P__file_driver_free(void *value)
if (value) {
H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */
- /* Copy the driver & info, if there is one */
if (info->driver_id > 0) {
/* Free the driver info, if it exists */
@@ -1246,6 +1754,9 @@ H5P__file_driver_free(void *value)
if (H5FD_free_driver_info(info->driver_id, info->driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
+ /* Free the driver configuration string, if it exists */
+ H5MM_xfree_const(info->driver_config_str);
+
/* Decrement reference count for driver */
if (H5I_dec_ref(info->driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID")
@@ -1465,6 +1976,16 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR
HGOTO_DONE(cmp_value);
} /* end if */
+ /* Compare driver configuration strings */
+ if (info1->driver_config_str == NULL && info2->driver_config_str != NULL)
+ HGOTO_DONE(-1);
+ if (info1->driver_config_str != NULL && info2->driver_config_str == NULL)
+ HGOTO_DONE(1);
+ if (info1->driver_config_str) {
+ if (0 != (cmp_value = HDstrcmp(info1->driver_config_str, info2->driver_config_str)))
+ HGOTO_DONE(cmp_value);
+ }
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_cmp() */
@@ -1686,7 +2207,7 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots,
H5TRACE5("e", "iIszzd", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0);
/* Check arguments */
- if (rdcc_w0 < (double)0.0f || rdcc_w0 > (double)1.0f)
+ if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"raw data cache w0 value must be between 0.0 and 1.0 inclusive")
@@ -4221,7 +4742,7 @@ herr_t
H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access)
{
H5P_genplist_t *plist; /* Property list pointer */
- char * tmp_location; /* Working location pointer */
+ char * new_location; /* Working location pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -4237,19 +4758,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list")
- /* Get the current location string and free it */
- if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location")
- H5MM_xfree(tmp_location);
-
/* Make a copy of the passed-in location */
- if (NULL == (tmp_location = H5MM_xstrdup(location)))
+ if (NULL == (new_location = H5MM_xstrdup(location)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location")
/* Set values */
if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag")
- if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
+ if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location")
if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag")
@@ -5708,6 +6224,64 @@ done:
} /* end H5Pget_vol_info() */
/*-------------------------------------------------------------------------
+ * Function: H5Pget_vol_cap_flags
+ *
+ * Purpose: Queries the current VOL connector information for a FAPL to
+ * retrieve the capability flags for the VOL connector stack, as will
+ * be used by a file open or create operation that uses this FAPL.
+ *
+ * Current capability flags are:
+ * H5VL_CAP_FLAG_THREADSAFE - Connector is threadsafe
+ * H5VL_CAP_FLAG_ASYNC - Connector performs operations asynchronously
+ * H5VL_CAP_FLAG_NATIVE_FILES - Connector produces native file format
+ *
+ * Note: This routine supports the use of the HDF5_VOL_CONNECTOR environment
+ * environment variable to override the VOL connector set programmatically
+ * for the FAPL (with H5Pset_vol).
+ *
+ * Note: The H5VL_CAP_FLAG_ASYNC flag can be checked to see if asynchronous
+ * operations are supported by the VOL connector stack.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Iu", plist_id, cap_flags);
+
+ /* Get the 'cap_flags' from the connector */
+ if (cap_flags) {
+ if (TRUE == H5P_isa_class(plist_id, H5P_FILE_ACCESS)) {
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+
+ /* Get property list for ID */
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the connector property */
+ if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property")
+
+ /* Query the capability flags */
+ if (H5VL_get_cap_flags(&connector_prop, cap_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector capability flags")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_create
*
connectorose: Create callback for the VOL connector ID & info property.
diff --git a/src/H5Pint.c b/src/H5Pint.c
index dd1ad9b..9206d4c 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -412,20 +412,22 @@ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{
}};
/*-------------------------------------------------------------------------
- * Function: H5P_init
+ * Function: H5P_init_phase1
*
- * Purpose: Initialize the interface from some other layer.
+ * Purpose: Initialize the interface from some other layer. This should
+ * be followed with a call to H5P_init_phase2 after the H5P
+ * interface is completely setup.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, March 4, 2000
*
*-------------------------------------------------------------------------
*/
herr_t
-H5P_init(void)
+H5P_init_phase1(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -434,7 +436,36 @@ H5P_init(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_init() */
+} /* end H5P_init_phase1() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_init_phase2
+ *
+ * Purpose: Finish initializing the interface from some other package.
+ *
+ * Note: This is broken out as a separate routine so that the
+ * library's default VFL driver can be chosen and initialized
+ * after the entire H5P interface has been initialized.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_init_phase2(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Set up the default VFL driver */
+ if (H5P__facc_set_def_driver() < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "unable to set default VFL driver")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_init_phase2() */
/*--------------------------------------------------------------------------
NAME
@@ -449,8 +480,9 @@ DESCRIPTION
herr_t
H5P__init_package(void)
{
- size_t tot_init; /* Total # of classes initialized */
- size_t pass_init; /* # of classes initialized in each pass */
+ size_t tot_init = 0; /* Total # of classes initialized */
+ size_t pass_init; /* # of classes initialized in each pass */
+ size_t u;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -472,8 +504,6 @@ H5P__init_package(void)
*/
tot_init = 0;
do {
- size_t u; /* Local index variable */
-
/* Reset pass initialization counter */
pass_init = 0;
@@ -523,6 +553,28 @@ H5P__init_package(void)
HDassert(tot_init == NELMTS(init_class));
done:
+ if (ret_value < 0 && tot_init > 0) {
+ /* First uninitialize all default property lists */
+ H5I_clear_type(H5I_GENPROP_LST, FALSE, FALSE);
+
+ /* Then uninitialize any initialized libclass */
+ for (u = 0; u < NELMTS(init_class); u++) {
+ H5P_libclass_t const *lib_class = init_class[u]; /* Current class to operate on */
+
+ HDassert(lib_class->class_id);
+ if (*lib_class->class_id >= 0) {
+ /* Close the class ID */
+ if (H5I_dec_ref(*lib_class->class_id) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class ID")
+ }
+ else if (lib_class->pclass && *lib_class->pclass) {
+ /* Close a half-initialized pclass */
+ if (H5P__close_class(*lib_class->pclass) < 0)
+ HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class")
+ }
+ }
+ }
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__init_package() */
@@ -4878,7 +4930,8 @@ H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
- prop = H5P__find_prop_plist(src_plist, name);
+ if (NULL == (prop = H5P__find_prop_plist(src_plist, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Create property object from parameters */
if (NULL ==
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 879e6ed..d00efaf 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -1044,7 +1044,7 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h
index 130cb90..6e92e66 100644
--- a/src/H5Pmodule.h
+++ b/src/H5Pmodule.h
@@ -30,46 +30,165 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5P H5P
- * \brief Property List Interface
*
- * \details The HDF5 Property List Interface provides a mechanism to take
- * advantage of more powerful or unusual features in HDF5.
+ * Use the functions in this module to manage HDF5 property lists and property
+ * list classes. HDF5 property lists are the main vehicle to configure the
+ * behavior of HDF5 API functions.
*
- * HDF5 objects have properties or characteristics associated with
- * them, and there are default properties that handle the most
- * common needs. These default properties can be modified using the
- * HDF5 Property List Interface. For example, the data storage
- * layout property of a dataset is contiguous by default. For better
- * performance, the layout can be modified to be chunked or chunked
- * and compressed.
+ * Typically, property lists are created by instantiating one of the built-in
+ * or user-defined property list classes. After adding suitable properties,
+ * property lists are used when opening or creating HDF5 items, or when reading
+ * or writing data. Property lists can be modified by adding or changing
+ * properties. Property lists are deleted by closing the associated handles.
*
- * \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
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
- * \defgroup GPLO General Property List Operations
+ * \defgroup ALCAPL Attribute and Link Creation Properties
* \ingroup H5P
- * \defgroup GPLOA General Property List Operations (Advanced)
+ * Currently, there are only two creation properties that you can use to control
+ * the creation of HDF5 attributes and links. The first creation property, the
+ * choice of a character encoding, applies to both attributes and links.
+ * The second creation property applies to links only, and advises the library
+ * to automatically create missing intermediate groups when creating new objects.
+ *
+ * \defgroup DAPL Dataset Access Properties
* \ingroup H5P
- * \defgroup FCPL File Creation Properties
+ * Use dataset access properties to modify the default behavior of the HDF5
+ * library when accessing datasets. The properties include adjusting the size
+ * of the chunk cache, providing prefixes for external content and virtual
+ * dataset file paths, and controlling flush behavior, etc. These properties
+ * are \Emph{not} persisted with datasets, and can be adjusted at runtime before
+ * a dataset is created or opened.
+ *
+ * \defgroup DCPL Dataset Creation Properties
+ * \ingroup H5P
+ * Use dataset creation properties to control aspects of dataset creation such
+ * as fill time, storage layout, compression methods, etc.
+ * Unlike dataset access and transfer properties, creation properties \Emph{are}
+ * stored with the dataset, and cannot be changed once a dataset has been
+ * created.
+ *
+ * \defgroup DXPL Dataset Transfer Properties
* \ingroup H5P
+ * Use dataset transfer properties to customize certain aspects of reading
+ * and writing datasets such as transformations, MPI-IO I/O mode, error
+ * detection, etc. These properties are \Emph{not} persisted with datasets,
+ * and can be adjusted at runtime before a dataset is read or written.
+ *
* \defgroup FAPL File Access Properties
* \ingroup H5P
- * \defgroup GCPL Group Creation Properties
+ * Use file access properties to modify the default behavior of the HDF5
+ * library when accessing files. The properties include selecting a virtual
+ * file driver (VFD), configuring the metadata cache (MDC), control
+ * file locking, etc. These properties are \Emph{not} persisted with files, and
+ * can be adjusted at runtime before a file is created or opened.
+ *
+ * \defgroup FCPL File Creation Properties
* \ingroup H5P
- * \defgroup ALCAPL Attribute and Link Creation Properties
+ * Use file creation properties to control aspects of file creation such
+ * as setting a file space management strategy or creating a user block.
+ * Unlike file access properties, creation properties \Emph{are}
+ * stored with the file, and cannot be changed once a file has been
+ * created.
+ *
+ * \defgroup GAPL General Access Properties
* \ingroup H5P
- * \defgroup LAPL Link Access Properties
+ * \todo Should this be as standalone page?
+ *
+ * \defgroup GCPL Group Creation Properties
* \ingroup H5P
- * \defgroup DCPL Dataset Creation Properties
+ * Use group creation properties to control aspects of group creation such
+ * as storage layout, compression, and link creation order tracking.
+ * Unlike file access properties, creation properties \Emph{are}
+ * stored with the group, and cannot be changed once a group has been
+ * created.
+ *
+ * \defgroup GPLO General Property List Operations
* \ingroup H5P
- * \defgroup DAPL Dataset Access Properties
+ *
+ * Use the functions in this module to manage HDF5 property lists.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup GPLOA General Property List Operations (Advanced)
* \ingroup H5P
- * \defgroup DXPL Dataset Transfer Properties
+ *
+ * You can create and customize user-defined property list classes using the
+ * functions described below. Arbitrary user-defined properties can also
+ * be inserted into existing property lists as so-called temporary properties.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ *
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create_class
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read_class
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update_class
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete_class
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup LAPL Link Access Properties
+ * \ingroup H5P
+ *
+ *
+ * \defgroup MAPL Map Access Properties
* \ingroup H5P
+
* \defgroup OCPL Object Creation Properties
* \ingroup H5P
+ *
+ *
* \defgroup OCPPL Object Copy Properties
* \ingroup H5P
+ *
+ *
*/
#endif /* H5Pmodule_H */
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index dd43f76..2946931 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -188,6 +188,9 @@ H5_DLL herr_t H5P__decode_double(const void **_pp, void *value);
H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size);
H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value);
+/* Private FAPL routines */
+H5_DLL herr_t H5P__facc_set_def_driver(void);
+
/* Private OCPL routines */
H5_DLL herr_t H5P__get_filter(const struct H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts,
unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config);
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 6ebe5d3..7cbb397 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -156,8 +156,9 @@ struct H5O_fill_t;
struct H5T_t;
struct H5VL_connector_prop_t;
-/* Package initialization routine */
-H5_DLL herr_t H5P_init(void);
+/* Package initialization routines */
+H5_DLL herr_t H5P_init_phase1(void);
+H5_DLL herr_t H5P_init_phase2(void);
/* Internal versions of API routines */
H5_DLL herr_t H5P_close(H5P_genplist_t *plist);
@@ -181,7 +182,13 @@ H5_DLL char * H5P_get_class_name(H5P_genclass_t *pclass);
H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse);
H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist);
H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist);
-H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info);
+H5_DLL const char *H5P_peek_driver_config_str(H5P_genplist_t *plist);
+H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info,
+ const char *new_driver_config_str);
+H5_DLL herr_t H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name,
+ const char *driver_config, hbool_t app_ref);
+H5_DLL herr_t H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value,
+ const char *driver_config, hbool_t app_ref);
H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info);
H5_DLL herr_t H5P_reset_vol_class(const H5P_genclass_t *pclass, const struct H5VL_connector_prop_t *vol_prop);
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info,
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 801c561..3fa7118 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -22,16 +22,17 @@
/* Public headers needed by this file */
#include "H5public.h"
-#include "H5ACpublic.h"
-#include "H5Dpublic.h"
-#include "H5Fpublic.h"
-#include "H5FDpublic.h"
-#include "H5Ipublic.h"
-#include "H5Lpublic.h"
-#include "H5Opublic.h"
-#include "H5MMpublic.h"
-#include "H5Tpublic.h"
-#include "H5Zpublic.h"
+#include "H5ACpublic.h" /* Metadata cache */
+#include "H5Dpublic.h" /* Datasets */
+#include "H5Fpublic.h" /* Files */
+#include "H5FDpublic.h" /* File drivers */
+#include "H5Ipublic.h" /* ID management */
+#include "H5Lpublic.h" /* Links */
+#include "H5MMpublic.h" /* Memory management */
+#include "H5Opublic.h" /* Object headers */
+#include "H5Spublic.h" /* Dataspaces */
+#include "H5Tpublic.h" /* Datatypes */
+#include "H5Zpublic.h" /* Data filters */
/*****************/
/* Public Macros */
@@ -99,8 +100,10 @@
#define H5P_CRT_ORDER_TRACKED 0x0001
#define H5P_CRT_ORDER_INDEXED 0x0002
-/* Default value for all property list classes */
-#define H5P_DEFAULT (hid_t)0
+/**
+ * Default value of type \ref hid_t for all property list classes
+ */
+#define H5P_DEFAULT 0 /* (hid_t) */
#ifdef __cplusplus
extern "C" {
@@ -111,84 +114,169 @@ extern "C" {
/*******************/
/* Define property list class callback function pointer types */
-//! [H5P_cls_create_func_t_snip]
+//! <!-- [H5P_cls_create_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
-//! [H5P_cls_create_func_t_snip]
-//! [H5P_cls_copy_func_t_snip]
+//! <!-- [H5P_cls_create_func_t_snip] -->
+
+//! <!-- [H5P_cls_copy_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
-//! [H5P_cls_copy_func_t_snip]
-//! [H5P_cls_close_func_t_snip]
+//! <!-- [H5P_cls_copy_func_t_snip] -->
+
+//! <!-- [H5P_cls_close_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
-//! [H5P_cls_close_func_t_snip]
+//! <!-- [H5P_cls_close_func_t_snip] -->
/* Define property list callback function pointer types */
-//! [H5P_prp_cb1_t_snip]
+//! <!-- [H5P_prp_cb1_t_snip] -->
+/**
+ * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1()
+ *
+ * \param[in] name The name of the property
+ * \param[in] size The size of the property in bytes
+ * \param[in,out] value The value for the property
+ * \return \herr_t
+ *
+ * \details The H5P_prp_cb1_t() describes the parameters used by the
+ * property create,copy and close callback functions.
+ */
typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value);
-//! [H5P_prp_cb1_t_snip]
-//! [H5P_prp_cb2_t_snip]
+//! <!-- [H5P_prp_cb1_t_snip] -->
+
+//! <!-- [H5P_prp_cb2_t_snip] -->
+/**
+ * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1()
+ *
+ * \plist_id{prop_id}
+ * \param[in] name The name of the property
+ * \param[in] size The size of the property in bytes
+ * \param[in] value The value for the property
+ * \return \herr_t
+ *
+ * \details The H5P_prp_cb2_t() describes the parameters used by the
+ * property set ,copy and delete callback functions.
+ */
typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value);
-//! [H5P_prp_cb2_t_snip]
+//! <!-- [H5P_prp_cb2_t_snip] -->
+
typedef H5P_prp_cb1_t H5P_prp_create_func_t;
typedef H5P_prp_cb2_t H5P_prp_set_func_t;
typedef H5P_prp_cb2_t H5P_prp_get_func_t;
+//! <!-- [H5P_prp_encode_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size);
+//! <!-- [H5P_prp_encode_func_t_snip] -->
+//! <!-- [H5P_prp_decode_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
+//! <!-- [H5P_prp_decode_func_t_snip] -->
typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
-//! [H5P_prp_compare_func_t_snip]
+
+//! <!-- [H5P_prp_compare_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
-//! [H5P_prp_compare_func_t_snip]
+//! <!-- [H5P_prp_compare_func_t_snip] -->
+
typedef H5P_prp_cb1_t H5P_prp_close_func_t;
/* Define property list iteration function type */
-//! [H5P_iterate_t_snip]
+//! <!-- [H5P_iterate_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
-//! [H5P_iterate_t_snip]
+//! <!-- [H5P_iterate_t_snip] -->
-/* Actual IO mode property */
+//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] -->
+/**
+ * Actual IO mode property
+ *
+ * \details The default value, #H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all
+ * I/O operations that do not use chunk optimizations, including
+ * non-collective I/O and contiguous collective I/O.
+ */
typedef enum H5D_mpio_actual_chunk_opt_mode_t {
- /* The default value, H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all I/O
- * operations that do not use chunk optimizations, including non-collective
- * I/O and contiguous collective I/O.
- */
H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0,
+ /**< No chunk optimization was performed. Either no collective I/O was
+ attempted or the dataset wasn't chunked. */
H5D_MPIO_LINK_CHUNK,
+ /**< Collective I/O is performed on all chunks simultaneously. */
H5D_MPIO_MULTI_CHUNK
+ /**< Each chunk was individually assigned collective or independent I/O based
+ on what fraction of processes access the chunk. If the fraction is greater
+ than the multi chunk ratio threshold, collective I/O is performed on that
+ chunk. The multi chunk ratio threshold can be set using
+ H5Pset_dxpl_mpio_chunk_opt_ratio(). The default value is 60%. */
} H5D_mpio_actual_chunk_opt_mode_t;
+//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] -->
+//! <!-- [H5D_mpio_actual_io_mode_t_snip] -->
+/**
+ * The following values are conveniently defined as a bit field so that
+ * we can switch from the default to independent or collective and then to
+ * mixed without having to check the original value.
+ */
typedef enum H5D_mpio_actual_io_mode_t {
- /* The following four values are conveniently defined as a bit field so that
- * we can switch from the default to independent or collective and then to
- * mixed without having to check the original value.
- *
- * NO_COLLECTIVE means that either collective I/O wasn't requested or that
- * no I/O took place.
- *
- * CHUNK_INDEPENDENT means that collective I/O was requested, but the
- * chunk optimization scheme chose independent I/O for each chunk.
- */
- H5D_MPIO_NO_COLLECTIVE = 0x0,
+ H5D_MPIO_NO_COLLECTIVE = 0x0,
+ /**< No collective I/O was performed. Collective I/O was not requested or
+ collective I/O isn't possible on this dataset */
H5D_MPIO_CHUNK_INDEPENDENT = 0x1,
- H5D_MPIO_CHUNK_COLLECTIVE = 0x2,
- H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2,
-
- /* The contiguous case is separate from the bit field. */
+ /**< HDF5 performed one the chunk collective optimization schemes and each
+ chunk was accessed independently */
+ H5D_MPIO_CHUNK_COLLECTIVE = 0x2,
+ /**< HDF5 performed one the chunk collective optimization schemes and each
+ chunk was accessed collectively */
+ H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2,
+ /**< HDF5 performed one the chunk collective optimization schemes and some
+ chunks were accessed independently, some collectively. */
+ /** \internal The contiguous case is separate from the bit field. */
H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4
+ /**< Collective I/O was performed on a contiguous dataset */
} H5D_mpio_actual_io_mode_t;
+//! <!-- [H5D_mpio_actual_io_mode_t_snip] -->
-/* Broken collective IO property */
+//! <!-- [H5D_mpio_no_collective_cause_t_snip] -->
+/**
+ * Broken collective IO property
+ */
typedef enum H5D_mpio_no_collective_cause_t {
- H5D_MPIO_COLLECTIVE = 0x00,
- H5D_MPIO_SET_INDEPENDENT = 0x01,
- H5D_MPIO_DATATYPE_CONVERSION = 0x02,
- H5D_MPIO_DATA_TRANSFORMS = 0x04,
- H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08,
- H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
- H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
- H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
+ H5D_MPIO_COLLECTIVE = 0x00,
+ /**< Collective I/O was performed successfully */
+ H5D_MPIO_SET_INDEPENDENT = 0x01,
+ /**< Collective I/O was not performed because independent I/O was requested */
+ H5D_MPIO_DATATYPE_CONVERSION = 0x02,
+ /**< Collective I/O was not performed because datatype conversions were required */
+ H5D_MPIO_DATA_TRANSFORMS = 0x04,
+ /**< Collective I/O was not performed because data transforms needed to be applied */
+ H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08,
+ /**< \todo FIXME! */
+ H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
+ /**< Collective I/O was not performed because one of the dataspaces was neither simple nor scalar */
+ H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
+ /**< Collective I/O was not performed because the dataset was neither contiguous nor chunked */
+ H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
+ /**< \todo FIXME! */
H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80,
- H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
+ /**< \todo FIXME! */
+ H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
+ /**< Sentinel */
} H5D_mpio_no_collective_cause_t;
+//! <!-- [H5D_mpio_no_collective_cause_t_snip] -->
/********************/
/* Public Variables */
@@ -493,8 +581,6 @@ H5_DLL hid_t H5Pcreate(hid_t cls_id);
* list of this class is being created. The #H5P_cls_create_func_t
* callback function is defined as follows:
*
- * \todo fix snippets to work, when you click on them.
- *
* \snippet this H5P_cls_create_func_t_snip
*
* The parameters to this callback function are defined as follows:
@@ -1233,8 +1319,6 @@ H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
* property list objects; the initial value is assumed to
* have any necessary setup already performed on it.
*
- * \todo "cpp_note" goes here
- *
* \since 1.8.0
*
*/
@@ -1326,9 +1410,6 @@ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id);
* If the membership changes during the iteration, the function's
* behavior is undefined.
*
- *
- * \todo "cpp_note" goes here
- *
* \since 1.4.0
*
*/
@@ -1582,16 +1663,12 @@ H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_da
* property is being closed. The #H5P_prp_close_func_t callback
* function is defined as follows:
*
- * \snippet this H5P_prp_cb2_t_snip
+ * \snippet this H5P_prp_cb1_t_snip
*
* The parameters to the callback function are defined as follows:
*
* <table>
* <tr>
- * <td>\ref hid_t \c prop_id</td>
- * <td>IN: The identifier of the property list being closed</td>
- * </tr>
- * <tr>
* <td>\Code{const char * name}</td>
* <td>IN: The name of the property in the list</td>
* </tr>
@@ -1611,8 +1688,6 @@ H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_da
* list close routine returns an error value but the property list is
* still closed.
*
- * \todo "cpp_note" goes here
- *
* \since 1.8.0
*
*/
@@ -1701,7 +1776,7 @@ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name);
/* Object creation property list (OCPL) routines */
/**
- * \ingroup OCPL
+ * \ingroup DCPL
*
* \brief Verifies that all required filters are available
*
@@ -1805,7 +1880,7 @@ H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, un
* \todo Signature for H5Pget_filter2 is different in H5Pocpl.c than in
* H5Ppublic.h
*
- * \plist_id{plist_id}
+ * \ocpl_id{plist_id}
* \param[in] idx Sequence number within the filter pipeline of the filter
* for which information is sought
* \param[out] flags Bit vector specifying certain general properties of the
@@ -1869,7 +1944,7 @@ H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *f
*
* \brief Returns information about the specified filter
*
- * \plist_id
+ * \ocpl_id{plist_id}
* \param[in] filter_id Filter identifier
* \param[out] flags Bit vector specifying certain general
* properties of the filter
@@ -1927,10 +2002,7 @@ H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsig
*
* \brief Returns the number of filters in the pipeline
*
- * \todo Signature for H5Pget_nfilters() is different in H5Pocpl.c than in
- * H5Ppublic.h.
- *
- * \plist_id
+ * \ocpl_id{plist_id}
*
* \return Returns the number of filters in the pipeline if successful;
* otherwise returns a negative value.
@@ -1938,8 +2010,8 @@ H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsig
* \details H5Pget_nfilters() returns the number of filters defined in the
* filter pipeline associated with the property list \p plist_id.
*
- * In each pipeline, the filters are numbered from 0 through N-1,
- * where N is the value returned by this function. During output to
+ * In each pipeline, the filters are numbered from 0 through \Code{N-1},
+ * where \c N is the value returned by this function. During output to
* the file, the filters are applied in increasing order; during
* input from the file, they are applied in decreasing order.
*
@@ -1987,7 +2059,7 @@ H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times);
*
* \brief Modifies a filter in the filter pipeline
*
- * \plist_id
+ * \ocpl_id{plist_id}
* \param[in] filter Filter to be modified
* \param[in] flags Bit vector specifying certain general properties
* of the filter
@@ -2016,7 +2088,7 @@ H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int
*
* \brief Delete one or more filters in the filter pipeline
*
- * \plist_id
+ * \ocpl_id{plist_id}
* \param[in] filter Filter to be deleted
*
* \return \herr_t
@@ -2166,15 +2238,17 @@ H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flag
*/
H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
/**
- * \ingroup OCPL
+ * \ingroup DCPL
*
* \brief Sets deflate (GNU gzip) compression method and compression level
*
- * \plist_id
+ * \ocpl_id{plist_id}
* \param[in] level Compression level
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_deflate() sets the deflate compression method and the
* compression level, \p level, for a dataset or group creation
* property list, \p plist_id.
@@ -2226,7 +2300,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level);
*
* \brief Adds a filter to the filter pipeline
*
- * \param[in] plist_id Dataset or group creation property list identifier
+ * \ocpl_id{plist_id}
* \param[in] filter Filter identifier for the filter to be added to the
* pipeline
* \param[in] flags Bit vector specifying certain general properties of
@@ -2478,7 +2552,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level);
* (The SZIP filter is an exception to this rule; see H5Pset_szip()
* for details.)
*
- * \todo Removed several references to links to documentation
+ * \see \ref_filter_pipe, \ref_group_impls
*
* \version 1.8.5 Function applied to group creation property lists.
* \since 1.6.0
@@ -2491,7 +2565,7 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int fl
*
* \brief Sets up use of the Fletcher32 checksum filter
*
- * \param[in] plist_id Dataset or group creation property list identifier
+ * \ocpl_id{plist_id}
*
* \return \herr_t
*
@@ -2672,7 +2746,7 @@ H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsig
/**
* \ingroup FCPL
*
- * \brief Retrieves number of shared object header message indexes in file
+ * \brief Retrieves the number of shared object header message indexes in file
* creation property list
*
* \fcpl_id{plist_id}
@@ -3237,8 +3311,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz
* <td>#H5FD_SEC2</td>
* <td>This driver uses POSIX file-system functions like read and
* write to perform I/O to a single, permanent file on local disk
- * with no system buffering. This driver is POSIX-compliant and is
- * the default file driver for all systems.</td>
+ * with no system buffering. This driver is POSIX-compliant and
+ * is the default file driver for all systems.</td>
* <td>H5Pset_fapl_sec2()</td>
* </tr>
* <tr>
@@ -3276,8 +3350,9 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz
* <td>#H5FD_CORE</td>
* <td>With this driver, an application can work with a file in
* memory for faster reads and writes. File contents are kept in
- * memory until the file is closed. At closing, the memory version
- * of the file can be written back to disk or abandoned.</td>
+ * memory until the file is closed. At closing, the memory
+ * version of the file can be written back to disk or abandoned.
+ * </td>
* <td>H5Pset_fapl_core()</td>
* </tr>
* <tr>
@@ -3286,7 +3361,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz
* <td>With this driver, the HDF5 file’s address space is partitioned
* into pieces and sent to separate storage files using an
* underlying driver of the user’s choice. This driver is for
- * systems that do not support files larger than 2 gigabytes.</td>
+ * systems that do not support files larger than 2 gigabytes.
+ * </td>
* <td>H5Pset_fapl_family()</td>
* </tr>
* <tr>
@@ -3352,7 +3428,7 @@ H5_DLL hid_t H5Pget_driver(hid_t plist_id);
* struct. Driver-specific versions of that struct are defined
* for each low-level driver in the relevant source code file
* H5FD*.c. For example, the struct used for the MULTI driver is
- * #H5FD_multi_fapl_t defined in H5FDmulti.c.
+ * \c H5FD_multi_fapl_t defined in H5FDmulti.c.
*
* If no driver-specific properties have been registered,
* H5Pget_driver_info() returns NULL.
@@ -3369,8 +3445,78 @@ H5_DLL hid_t H5Pget_driver(hid_t plist_id);
*
*/
H5_DLL const void *H5Pget_driver_info(hid_t plist_id);
-H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size);
-H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves a string representation of the configuration for
+ * the driver set on the given FAPL. The returned string can
+ * be used to configure the same driver in an identical way.
+ *
+ * \fapl_id
+ * \param[out] config_buf Driver configuration string output buffer
+ * \param[in] buf_size Size of driver configuration string output buffer
+ *
+ * \return Returns the length of the driver configuration string on
+ * success (not including the NUL terminator). Returns negative
+ * on failure.
+ *
+ * \details H5Pget_driver_config_str() retrieves a string representation
+ * of the configuration for the driver set on the given FAPL. The
+ * returned string can be used to configure the same driver in
+ * an identical way.
+ *
+ * If \p config_buf is NULL, the length of the driver configuration
+ * string is simply returned. The caller can then allocate a buffer
+ * of the appropriate size and call this routine again.
+ *
+ * \version 1.12.1 Function publicized in this release.
+ *
+ */
+H5_DLL ssize_t H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the size of the external link open file cache
+ *
+ * \fapl_id{plist_id}
+ * \param[out] efc_size External link open file cache size in number of files
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_elink_file_cache_size() retrieves the number of files that
+ * can be held open in an external link open file cache.
+ *
+ * \since 1.8.7
+ *
+ */
+H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the file access property list setting that determines
+ * whether an HDF5 object will be evicted from the library's metadata
+ * cache when it is closed
+ *
+ * \fapl_id
+ * \param[out] evict_on_close Pointer to a variable that will indicate if
+ * the object will be evicted on close
+ *
+ * \return \herr_t
+ *
+ * \details The library's metadata cache is fairly conservative about holding on
+ * to HDF5 object metadata (object headers, chunk index structures,
+ * etc.), which can cause the cache size to grow, resulting in memory
+ * pressure on an application or system. When enabled, the "evict on
+ * close" property will cause all metadata for an object to be
+ * immediately evicted from the cache as long as it is not referenced
+ * by any other open object.
+ *
+ * See H5Pset_evict_on_close() for additional notes on behavior.
+ *
+ * \since 1.10.1
+ *
+ */
+H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close);
/**
* \ingroup FAPL
*
@@ -3386,9 +3532,7 @@ H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close)
* application can retrieve a file handle for low-level access to
* a particular member of a family of files. The file handle is
* retrieved with a separate call to H5Fget_vfd_handle() (or,
- * in special circumstances, to H5FDget_vfd_handle()).
- *
- * \todo References the VFL documentation.
+ * in special circumstances, to H5FDget_vfd_handle(), see \ref VFL).
*
* \since 1.6.0
*
@@ -3415,8 +3559,113 @@ H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset);
*
*/
H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves a copy of the file image designated as the initial content
+ * and structure of a file
+ *
+ * \fapl_id
+ * \param[in,out] buf_ptr_ptr On input, \c NULL or a pointer to a
+ * pointer to a buffer that contains the
+ * file image.\n On successful return, if \p buf_ptr_ptr is not
+ * \c NULL, \Code{*buf_ptr_ptr} will contain a pointer to a copy
+ * of the initial image provided in the last call to
+ * H5Pset_file_image() for the supplied \p fapl_id. If no initial
+ * image has been set, \Code{*buf_ptr_ptr} will be \c NULL.
+ * \param[in,out] buf_len_ptr On input, \c NULL or a pointer to a buffer
+ * specifying the required size of the buffer to hold the file
+ * image.\n On successful return, if \p buf_len_ptr was not
+ * passed in as \c NULL, \p buf_len_ptr will return the required
+ * size in bytes of the buffer to hold the initial file image in
+ * the supplied file access property list, \p fapl_id. If no
+ * initial image is set, the value of \Code{*buf_len_ptr} will be
+ * set to 0 (zero)
+ * \return \herr_t
+ *
+ * \details H5Pget_file_image() allows an application to retrieve a copy of the
+ * file image designated for a VFD to use as the initial contents of a file.
+ *
+ * If file image callbacks are defined, H5Pget_file_image() will use
+ * them when allocating and loading the buffer to return to the
+ * application (see H5Pset_file_image_callbacks()). If file image
+ * callbacks are not defined, the function will use \c malloc and \c
+ * memcpy. When \c malloc and \c memcpy are used, it is the caller’s
+ * responsibility to discard the returned buffer with a call to \c
+ * free.
+ *
+ * It is the responsibility of the calling application to free the
+ * buffer whose address is returned in \p buf_ptr_ptr. This can be
+ * accomplished with \c free if file image callbacks have not been set
+ * (see H5Pset_file_image_callbacks()) or with the appropriate method
+ * if file image callbacks have been set.
+ *
+ * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(),
+ * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(),
+ * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t,
+ * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations">
+ * HDF5 File Image Operations</a>.
+ *
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves callback routines for working with file images
+ *
+ * \fapl_id
+ * \param[in,out] callbacks_ptr Pointer to the instance of the
+ * #H5FD_file_image_callbacks_t struct in which the callback
+ * routines are to be returned\n
+ * Struct fields must be initialized to NULL before the call
+ * is made.\n
+ * Struct field contents upon return will match those passed in
+ * in the last H5Pset_file_image_callbacks() call for the file
+ * access property list \p fapl_id.
+ * \return \herr_t
+ *
+ * \details H5Pget_file_image_callbacks() retrieves the callback routines set for
+ * working with file images opened with the file access property list
+ * \p fapl_id.
+ *
+ * The callbacks must have been previously set with
+ * H5Pset_file_image_callbacks() in the file access property list.
+ *
+ * Upon the successful return of H5Pset_file_image_callbacks(), the
+ * fields in the instance of the #H5FD_file_image_callbacks_t struct
+ * pointed to by \p callbacks_ptr will contain the same values as were
+ * passed in the most recent H5Pset_file_image_callbacks() call for the
+ * file access property list \p fapl_id.
+ *
+ * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(),
+ * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(),
+ * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t,
+ * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations">
+ * HDF5 File Image Operations</a>.
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the file locking property values
+ *
+ * \fapl_id
+ * \param[out] use_file_locking File locking flag
+ * \param[out] ignore_when_disabled Ignore when disabled flag
+ * \return \herr_t
+ *
+ * \details H5Pget_file_locking() retrieves the file locking property values for
+ * the file access property list specified by \p fapl_id.
+ *
+ * \since 1.10.7
+ *
+ */
H5_DLL herr_t H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled);
/**
* \ingroup FAPL
@@ -3471,11 +3720,212 @@ H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/);
*
*/
H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Get the current initial metadata cache configuration from the
+ * provided file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in,out] config_ptr Pointer to the instance of #H5AC_cache_config_t
+ * in which the current metadata cache configuration is to be
+ * reported
+ * \return \herr_t
+ *
+ * \note The \c in direction applies only to the \ref H5AC_cache_config_t.version
+ * field. All other fields are \c out parameters.
+ *
+ * \details The fields of the #H5AC_cache_config_t structure are shown
+ * below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * H5Pget_mdc_config() gets the initial metadata cache configuration
+ * contained in a file access property list and loads it into the
+ * instance of #H5AC_cache_config_t pointed to by the \p config_ptr
+ * parameter. This configuration is used when the file is opened.
+ *
+ * Note that the version field of \Code{*config_ptr} must be
+ * initialized; this allows the library to support earlier versions of
+ * the #H5AC_cache_config_t structure.
+ *
+ * See the overview of the metadata cache in the special topics section
+ * of the user guide for details on the configuration data returned. If
+ * you haven't read and understood that documentation, the results of
+ * this call will not make much sense.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the metadata cache image configuration values for a file
+ * access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] config_ptr Pointer to metadata cache image configuration values
+ * \return \herr_t
+ *
+ * \details H5Pget_mdc_image_config() retrieves the metadata cache image values
+ * into \p config_ptr for the file access property list specified in \p
+ * plist_id.
+ *
+ * #H5AC_cache_image_config_t is defined as follows:
+ * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip
+ * \click4more
+ *
+ * \since 1.10.1
+ */
H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Gets metadata cache logging options
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_enabled Flag whether logging is enabled
+ * \param[out] location Location of log in UTF-8/ASCII (file path/name) (On
+ * Windows, this must be ASCII)
+ * \param[out] location_size Size in bytes of the location string
+ * \param[out] start_on_access Whether the logging begins as soon as the file is
+ * opened or created
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all file metadata reads and writes take place. File metadata
+ * is normally invisible to the user and is used by the library for
+ * purposes such as locating and indexing data. File metadata should
+ * not be confused with user metadata, which consists of attributes
+ * created by users and attached to HDF5 objects such as datasets via
+ * \ref H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has been
+ * created that can be used by HDF5 developers for debugging and
+ * performance analysis. The functions that control this functionality
+ * will normally be of use to a very limited number of developers
+ * outside of The HDF Group. The functions have been documented to help
+ * users create logs that can be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is
+ * enabled via the H5Pset_mdc_log_options() function, which will modify
+ * the file access property list used to open or create a file. This
+ * function has a flag that determines whether logging begins at file
+ * open or starts in a paused state. Log messages can then be
+ * controlled via the H5Fstart_mdc_logging() / H5Fstop_mdc_logging()
+ * functions. H5Pget_mdc_log_options() can be used to examine a file
+ * access property list, and H5Fget_mdc_logging_status() will return
+ * the current state of the logging flags.
+ *
+ * The log format is described in the
+ * <a href="https://bit.ly/2PG6fNv">Metadata Cache Logging</a> document.
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location,
size_t *location_size, hbool_t *start_on_access);
-H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns the current metadata block size setting
+ *
+ * \fapl_id{fapl_id}
+ * \param[out] size Minimum size, in bytes, of metadata block allocations
+ *
+ * \return \herr_t
+ *
+ * \details Returns the current minimum size, in bytes, of new
+ * metadata block allocations. This setting is retrieved from the
+ * file access property list \p fapl_id.
+ *
+ * This value is set by H5Pset_meta_block_size() and is
+ * retrieved from the file access property list \p fapl_id.
+ *
+ * \since 1.4.0
+ */
+H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the number of read attempts from a file access
+ * property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] attempts The number of read attempts
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_metadata_read_attempts() retrieves the number of read
+ * attempts that is set in the file access property list \p plist_id.
+ *
+ * For a default file access property list, the value retrieved
+ * will depend on whether the user sets the number of attempts via
+ * H5Pset_metadata_read_attempts():
+ *
+ * <ul>
+ *
+ * <li>If the number of attempts is set to N, the value
+ * returned will be N.
+ * <li>If the number of attempts is not set, the value returned
+ * will be the default for non-SWMR access (1). SWMR is short
+ * for single-writer/multiple-reader.
+ * </ul>
+ *
+ * For the file access property list of a specified HDF5 file,
+ * the value retrieved will depend on how the file is opened
+ * and whether the user sets the number of read attempts via
+ * H5Pset_metadata_read_attempts():
+ *
+ * <ul>
+ * <li>For a file opened with SWMR access:
+ *
+ * <ul>
+ * <li> If the number of attempts is set to N, the value
+ * returned will be N.
+ * <li> If the number of attempts is not set, the value
+ * returned will be the default for SWMR access (100).
+ * </ul>
+ * <li>For a file opened without SWMR access, the value
+ * retrieved will always be the default for non-SWMR access
+ * (1). The value set via H5Pset_metadata_read_attempts() does
+ * not have any effect on non-SWMR access.
+ * </ul>
+ *
+ * \par Failure Modes
+ * \parblock
+ *
+ * When the input property list is not a file access property list.
+ *
+ * When the library is unable to retrieve the number of read attempts from
+ * the file access property list.
+ *
+ * \endparblock
+ *
+ * \par Examples
+ * \parblock
+ *
+ * The first example illustrates the two cases for retrieving the number
+ * of read attempts from a default file access property list.
+ *
+ * \include H5Pget_metadata_read_attempts.1.c
+ *
+ * The second example illustrates the two cases for retrieving the
+ * number of read attempts from the file access property list of a file
+ * opened with SWMR acccess.
+ *
+ * \include H5Pget_metadata_read_attempts.2.c
+ *
+ * The third example illustrates the two cases for retrieving the number
+ * of read attempts from the file access property list of a file opened
+ * with non-SWMR acccess.
+ *
+ * \include H5Pget_metadata_read_attempts.3.c
+ *
+ * \endparblock
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts);
/**
* \ingroup FAPL
@@ -3510,10 +3960,102 @@ H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts);
*
*/
H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the object flush property values from the file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in] func The user-defined callback function
+ * \param[in] udata The user-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_object_flush_cb() gets the user-defined callback
+ * function that is set in the file access property list
+ * \p fapl_id and stored in the parameter \p func. The callback is
+ * invoked whenever an object flush occurs in the file. This
+ * routine also obtains the user-defined input data that is
+ * passed along to the callback function in the parameter
+ * \p udata.
+ *
+ * \par Example
+ * \parblock
+ * The example below illustrates the usage of this routine to obtain the
+ * object flush property values.
+ *
+ * \include H5Pget_object_flush_cb.c
+ * \endparblock
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata);
-H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_per,
- unsigned *min_raw_per);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the maximum size for the page buffer and the minimum
+ percentage for metadata and raw data pages
+ *
+ * \fapl_id{plist_id}
+ * \param[out] buf_size Maximum size, in bytes, of the page buffer
+ * \param[out] min_meta_perc Minimum metadata percentage to keep in the
+ * page buffer before allowing pages containing metadata to
+ * be evicted
+ *
+ * \param[out] min_raw_perc Minimum raw data percentage to keep in the
+ * page buffer before allowing pages containing raw data to
+ * be evicted
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_page_buffer_size() retrieves \p buf_size, the maximum
+ * size in bytes of the page buffer, \p min_meta_perc, the
+ * minimum metadata percentage, and \p min_raw_perc, the
+ * minimum raw data percentage.
+ *
+ * \since 1.10.1
+ */
+H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc,
+ unsigned *min_raw_perc);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Returns maximum data sieve buffer size
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of data sieve buffer
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_sieve_buf_size() retrieves, size, the current maximum
+ * size of the data sieve buffer.
+ *
+ * This value is set by H5Pset_sieve_buf_size() and is retrieved
+ * from the file access property list fapl_id.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type \c hsize_t
+ * to \c size_t
+ * \since 1.4.0
+ */
H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves the current small data block size setting
+ *
+ * \fapl_id{fapl_id}
+ * \param[out] size Maximum size, in bytes, of the small data block
+ *
+ * \result \herr_t
+ *
+ * \details H5Pget_small_data_block_size() retrieves the current setting
+ * for the size of the small data block.
+ *
+ * If the returned value is zero (0), the small data block
+ * mechanism has been disabled for the file.
+ *
+ * \since 1.4.4
+ */
H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/);
/**
* \ingroup FAPL
@@ -3684,6 +4226,64 @@ H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignme
*/
H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes,
double rdcc_w0);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets write tracking information for core driver, #H5FD_CORE
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] is_enabled Boolean value specifying whether feature is
+ enabled
+ * \param[in] page_size Positive integer specifying size, in bytes, of
+ * write aggregation pages Value of 1 (one) enables
+ * tracking with no paging.
+ *
+ * \return \herr_t
+ *
+ * \details When a file is created or opened for writing using the core
+ * virtual file driver (VFD) with the backing store option
+ * turned on, the core driver can be configured to track
+ * changes to the file and write out only the modified bytes.
+ *
+ * This write tracking feature is enabled and disabled with \p
+ * is_enabled. The default setting is that write tracking is
+ * disabled, or off.
+ *
+ * To avoid a large number of small writes, changes can
+ * be aggregated into pages of a user-specified size, \p
+ * page_size.
+ *
+ * Setting \p page_size to 1 enables tracking with no page
+ * aggregation.
+ *
+ * The backing store option is set via the function
+ * H5Pset_fapl_core.
+ *
+ * \attention
+ * \parblock
+ * This function is only for use with the core VFD and must
+ * be used after the call to H5Pset_fapl_core(). It is an error
+ * to use this function with any other VFD.
+ *
+ * It is an error to use this function when the backing store
+ * flag has not been set using H5Pset_fapl_core().
+ *
+ * This function only applies to the backing store write
+ * operation which typically occurs when the file is flushed
+ * or closed. This function has no relationship to the
+ * increment parameter passed to H5Pset_fapl_core().
+ *
+ * For optimum performance, the \p page_size parameter should be
+ * a power of two.
+ *
+ * It is an error to set the page size to 0.
+ * \endparblock
+ *
+ * \version 1.8.14 C function modified in this release to return error
+ * if \p page_size is set to 0 (zero).
+ * \since 1.8.13
+ *
+ */
H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
/**
* \ingroup FAPL
@@ -3712,8 +4312,192 @@ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size
*
*/
H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets a file driver according to a given driver name
+ *
+ * \plist_id
+ * \param[in] driver_name The new driver name
+ * \param[in] driver_config Optional string containing driver properties
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_driver_by_name() sets the file driver, by the name
+ * driver_name, for a file access or data transfer property list,
+ * \p plist_id, and supplies an optional string containing the
+ * driver-specific properties, \p driver_config. The driver
+ * properties string will be copied into the property list.
+ *
+ * If the driver specified by \p driver_name is not currently
+ * registered, an attempt will be made to load the driver as a
+ * plugin.
+ *
+ * \version 1.12.1 Function publicized in this release.
+ *
+ */
+H5_DLL herr_t H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *driver_config);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets a file driver according to a given driver value (ID).
+ *
+ * \plist_id
+ * \param[in] driver_value The new driver value (ID)
+ * \param[in] driver_config Optional string containing driver properties
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_driver_by_value() sets the file driver, by the value
+ * driver_value, for a file access or data transfer property list,
+ * \p plist_id, and supplies an optional string containing the
+ * driver-specific properties, \p driver_config. The driver
+ * properties string will be copied into the property list.
+ *
+ * If the driver specified by \p driver_value is not currently
+ * registered, an attempt will be made to load the driver as a
+ * plugin.
+ *
+ * \version 1.12.1 Function publicized in this release.
+ *
+ */
+H5_DLL herr_t H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value,
+ const char *driver_config);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the number of files that can be held open in an external
+ * link open file cache
+ *
+ * \par Motivation
+ * \parblock
+ * The <em>external link open file cache</em> holds files open after
+ * they have been accessed via an external link. This cache reduces
+ * the number of times such files are opened when external links are
+ * accessed repeatedly and can siginificantly improves performance in
+ * certain heavy-use situations and when low-level file opens or closes
+ * are expensive.
+ *
+ * H5Pset_elink_file_cache_size() sets the number of files
+ * that will be held open in an external link open file
+ * cache. H5Pget_elink_file_cache_size() retrieves the size of an existing
+ * cache; and H5Fclear_elink_file_cache() clears an existing cache without
+ * closing it.
+ * \endparblock
+ *
+ * \fapl_id{plist_id}
+ * \param[in] efc_size External link open file cache size in number of files
+ * <em>Default setting is 0 (zero).</em>
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_elink_file_cache_size() specifies the number of files
+ * that will be held open in an external link open file cache.
+ *
+ * The default external link open file cache size is 0 (zero),
+ * meaning that files accessed via an external link are not
+ * held open. Setting the cache size to a positive integer
+ * turns on the cache; setting the size back to zero turns it
+ * off.
+ *
+ * With this property set, files are placed in the external
+ * link open file cache cache when they are opened via an
+ * external link. Files are then held open until either
+ * they are evicted from the cache or the parent file is
+ * closed. This property setting can improve performance when
+ * external links are repeatedly accessed.
+ *
+ * When the cache is full, files will be evicted using a least
+ * recently used (LRU) scheme; the file which has gone the
+ * longest time without being accessed through the parent file
+ * will be evicted and closed if nothing else is holding that
+ * file open.
+ *
+ * Files opened through external links inherit the parent
+ * file’s file access property list by default, and therefore
+ * inherit the parent file’s external link open file cache
+ * setting.
+ *
+ * When child files contain external links of their own, the
+ * caches can form a graph of cached external files. Closing
+ * the last external reference to such a graph will recursively
+ * close all files in the graph, even if cycles are present.
+ * \par Example
+ * \parblock
+ * The following code sets up an external link open file cache that will
+ * hold open up to 8 files reached through external links:
+ *
+ * \code
+ * status = H5Pset_elink_file_cache_size(fapl_id, 8);
+ * \endcode
+ * \endparblock
+ *
+ * \since 1.8.7
+ */
H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Controls the library's behavior of evicting metadata associated with
+ * a closed object
+ *
+ * \fapl_id
+ * \param[in] evict_on_close Whether the HDF5 object should be evicted on close
+ *
+ * \return \herr_t
+ *
+ * \details The library's metadata cache is fairly conservative about holding
+ * on to HDF5 object metadata(object headers, chunk index structures,
+ * etc.), which can cause the cache size to grow, resulting in memory
+ * pressure on an application or system. When enabled, the "evict on
+ * close" property will cause all metadata for an object to be evicted
+ * from the cache as long as metadata is not referenced by any other
+ * open object.
+ *
+ * This function only applies to file access property lists.
+ *
+ * The default library behavior is to not evict on object or file
+ * close.
+ *
+ * When applied to a file access property list, any subsequently opened
+ * object will inherit the "evict on close" property and will have
+ * its metadata evicted when the object is closed.
+ *
+ * \since 1.10.1
+ *
+ */
H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets offset property for low-level access to a file in a family of
+ * files
+ *
+ * \fapl_id
+ * \param[in] offset Offset in bytes within the HDF5 file
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_family_offset() sets the offset property in the file access
+ * property list \p fapl_id so that the user application can
+ * retrieve a file handle for low-level access to a particular member
+ * of a family of files. The file handle is retrieved with a separate
+ * call to H5Fget_vfd_handle() (or, in special circumstances, to
+ * H5FDget_vfd_handle(); see \ref VFL).
+ *
+ * The value of \p offset is an offset in bytes from the beginning of
+ * the HDF5 file, identifying a user-determined location within the
+ * HDF5 file.
+ * The file handle the user application is seeking is for the specific
+ * member-file in the associated family of files to which this offset
+ * is mapped.
+ *
+ * Use of this function is only appropriate for an HDF5 file written as
+ * a family of files with the \c FAMILY file driver.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
/**
* \ingroup FAPL
@@ -3776,9 +4560,279 @@ H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset);
*
*/
H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets an initial file image in a memory buffer
+ *
+ * \fapl_id
+ * \param[in] buf_ptr Pointer to the initial file image, or
+ * NULL if no initial file image is desired
+ * \param[in] buf_len Size of the supplied buffer, or
+ * 0 (zero) if no initial image is desired
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_image() allows an application to provide a file image
+ * to be used as the initial contents of a file.
+ * Calling H5Pset_file_image()makes a copy of the buffer specified in
+ * \p buf_ptr of size \p buf_len.
+ *
+ * \par Motivation:
+ * H5Pset_file_image() and other elements of HDF5 are
+ * used to load an image of an HDF5 file into system memory and open
+ * that image as a regular HDF5 file. An application can then use the
+ * file without the overhead of disk I/O.
+ *
+ * \par Recommended Reading:
+ * This function is part of the file image
+ * operations feature set. It is highly recommended to study the guide
+ * [<em>HDF5 File Image Operations</em>]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations
+ * ) before using this feature set. See the “See Also” section below
+ * for links to other elements of HDF5 file image operations.
+ *
+ * \see
+ * \li H5LTopen_file_image()
+ * \li H5Fget_file_image()
+ * \li H5Pget_file_image()
+ * \li H5Pset_file_image_callbacks()
+ * \li H5Pget_file_image_callbacks()
+ *
+ * \li [HDF5 File Image Operations]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations)
+ * in [Advanced Topics in HDF5]
+ * (https://portal.hdfgroup.org/display/HDF5/Advanced+Topics+in+HDF5)
+ *
+ * \li Within H5Pset_file_image_callbacks():
+ * \li Callback #H5FD_file_image_callbacks_t
+ * \li Callback #H5FD_file_image_op_t
+ *
+ * \version 1.8.13 Fortran subroutine added in this release.
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the callbacks for working with file images
+ *
+ * \note **Motivation:** H5Pset_file_image_callbacks() and other elements
+ * of HDF5 are used to load an image of an HDF5 file into system
+ * memory and open that image as a regular HDF5 file. An application
+ * can then use the file without the overhead of disk I/O.\n
+ * **Recommended Reading:** This function is part of the file
+ * image operations feature set. It is highly recommended to study
+ * the guide [HDF5 File Image Operations]
+ * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations
+ * ) before using this feature set. See the “See Also” section below
+ * for links to other elements of HDF5 file image operations.
+ *
+ * \fapl_id
+ * \param[in,out] callbacks_ptr Pointer to the instance of the
+ * #H5FD_file_image_callbacks_t structure
+ *
+ * \return \herr_t \n
+ * **Failure Modes**: Due to interactions between this function and
+ * H5Pset_file_image() and H5Pget_file_image(),
+ * H5Pset_file_image_callbacks() will fail if a file image has
+ * already been set in the target file access property list, \p fapl_id.
+ *
+ * \details H5Pset_file_image_callbacks() sets callback functions for working
+ * with file images in memory.
+ *
+ * H5Pset_file_image_callbacks() allows an application to control the
+ * management of file image buffers through user defined callbacks.
+ * These callbacks can be used in the management of file image buffers
+ * in property lists and with certain file drivers.
+ *
+ * H5Pset_file_image_callbacks() must be used before any file image has
+ * been set in the file access property list. Once a file image has
+ * been set, the function will fail.
+ *
+ * The callback routines set up by H5Pset_file_image_callbacks() are
+ * invoked when a new file image buffer is allocated, when an existing
+ * file image buffer is copied or resized, or when a file image buffer
+ * is released from use.
+ *
+ * Some file drivers allow the use of user-defined callback functions
+ * for allocating, freeing, and copying the driver’s internal buffer,
+ * potentially allowing optimizations such as avoiding large \c malloc
+ * and \c memcpy operations, or to perform detailed logging.
+ *
+ * From the perspective of the HDF5 library, the operations of the
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc",
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy",
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks
+ * must be identical to those of the
+ * corresponding C standard library calls (\c malloc, \c memcpy,
+ * \c realloc, and \c free). While the operations must be identical,
+ * the file image callbacks have more parameters. The return values
+ * of \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" are identical to
+ * the return values of \c malloc and \c realloc. The return values of
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" differ from the return
+ * values of \c memcpy and \c free in that the return values of
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" can also indicate failure.
+ *
+ * The callbacks and their parameters, along with a struct and
+ * an \c ENUM required for their use, are described below.
+ *
+ * <b>Callback struct and \c ENUM:</b>
+ *
+ * The callback functions set up by H5Pset_file_image_callbacks() use
+ * a struct and an \c ENUM that are defined as follows
+ *
+ * The struct #H5FD_file_image_callbacks_t serves as a container
+ * for the callback functions and a pointer to user-supplied data.
+ * The struct is defined as follows:
+ * \snippet H5FDpublic.h H5FD_file_image_callbacks_t_snip
+ *
+ * Elements of the #H5FD_file_image_op_t are used by the
+ * callbacks to invoke certain operations on file images. The ENUM is
+ * defined as follows:
+ * \snippet H5FDpublic.h H5FD_file_image_op_t_snip
+ *
+ * The elements of the #H5FD_file_image_op_t are used in the following
+ * callbacks:
+ *
+ * - The \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" callback
+ * contains a pointer to a function that must appear to HDF5 to have
+ * functionality identical to that of the standard C library \c malloc() call.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_malloc_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy"
+ * callback contains a pointer to a function
+ * that must appear to HDF5 to have functionality identical to that
+ * of the standard C library \c memcopy() call, except that it returns
+ * a \p NULL on failure. (The \c memcpy C Library routine is defined
+ * to return the \p dest parameter in all cases.)
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy"
+ * to \c NULL indicates that HDF5 should invoke
+ * the standard C library \c memcpy() routine when copying buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_memcpy_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" callback
+ * contains a pointer to a function that must appear to HDF5 to have
+ * functionality identical to that of the standard C library \c realloc() call.
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc"
+ * to \p NULL indicates that HDF5 should
+ * invoke the standard C library \c realloc() routine when resizing
+ * file image buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_realloc_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.image_free "image_free" callback contains
+ * a pointer to a function that must appear to HDF5 to have functionality
+ * identical to that of the standard C library \c free() call, except
+ * that it will return \c 0 (\c SUCCEED) on success and \c -1 (\c FAIL) on failure.
+ *
+ * - Setting \ref H5FD_file_image_callbacks_t.image_free "image_free"
+ * to \c NULL indicates that HDF5 should invoke
+ * the standard C library \c free() routine when releasing file image
+ * buffers.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h image_free_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.udata_copy "udata_copy"
+ * callback contains a pointer to a function
+ * that, from the perspective of HDF5, allocates a buffer of suitable
+ * size, copies the contents of the supplied \p udata into the new
+ * buffer, and returns the address of the new buffer. The function
+ * returns NULL on failure. This function is necessary if a non-NULL
+ * \p udata parameter is supplied, so that property lists containing
+ * the image callbacks can be copied. If the \p udata parameter below
+ * is \c NULL, then this parameter should be \c NULL as well.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h udata_copy_snip
+ * \n
+ * - The \ref H5FD_file_image_callbacks_t.udata_free "udata_free"
+ * callback contains a pointer to a function
+ * that, from the perspective of HDF5, frees a user data block. This
+ * function is necessary if a non-NULL udata parameter is supplied so
+ * that property lists containing image callbacks can be discarded
+ * without a memory leak. If the udata parameter below is \c NULL,
+ * this parameter should be \c NULL as well.
+ *
+ * - Signature in #H5FD_file_image_callbacks_t:
+ * \snippet H5FDpublic.h udata_free_snip
+ *
+ * - \p **udata**, the final field in the #H5FD_file_image_callbacks_t
+ * struct, provides a pointer to user-defined data. This pointer will
+ * be passed to the
+ * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc",
+ * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy",
+ * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and
+ * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks.
+ * Define udata as \c NULL if no user-defined data is provided.
+ *
+ * \since 1.8.9
+ *
+ */
H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the file locking property values
+ *
+ * \fapl_id
+ * \param[in] use_file_locking Toggle to specify file locking (or not)
+ * \param[in] ignore_when_disabled Toggle to ignore when disabled (or not)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_file_locking() overrides the default file locking flag
+ * setting that was set when the library was configured.
+ *
+ * This setting can be overridden by the \c HDF5_USE_FILE_LOCKING
+ * environment variable.
+ *
+ * File locking is used when creating/opening a file to prevent
+ * problematic file accesses.
+ *
+ * \since 1.10.7
+ *
+ */
H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets garbage collecting references flag
+ *
+ * \fapl_id
+ * \param[in] gc_ref Flag setting reference garbage collection to on (1) or off (0)
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_gc_references() sets the flag for garbage collecting
+ * references for the file.
+ *
+ * Dataset region references and other reference types use space in an
+ * HDF5 file's global heap. If garbage collection is on and the user
+ * passes in an uninitialized value in a reference structure, the heap
+ * might get corrupted. When garbage collection is off, however, and
+ * the user re-uses a reference, the previous heap block will be
+ * orphaned and not returned to the free heap space.
+ *
+ * When garbage collection is on, the user must initialize the
+ * reference structures to 0 or risk heap corruption.
+ *
+ * The default value for garbage collecting references is off.
+ *
+ */
H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
/**
* \ingroup FAPL
@@ -3861,10 +4915,11 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
* <td>\p low=#H5F_LIBVER_V18<br />
* \p high=#H5F_LIBVER_V18</td>
* <td>
- * \li The library will create objects with the latest format versions
- * available to library release 1.8.x.
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.8.x.
* \li API calls that create objects or features that are available
- * to versions of the library greater than 1.8.x release will fail.
+ * to versions of the library greater than 1.8.x release will
+ * fail.
* \li Earlier versions of the library may not be able to access
* objects created with this setting.</td>
* </tr>
@@ -3872,14 +4927,15 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
* <td>\p low=#H5F_LIBVER_V18<br />
* \p high=#H5F_LIBVER_V110</td>
* <td>
- * \li The library will create objects with the latest format versions
- * available to library release 1.8.x.
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.8.x.
* \li The library will allow objects to be created with the latest
* format versions available to library release 1.10.x.
- * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper limit
- * on the format versions to use. For example, if a newer format
- * version is required to support a feature e.g. virtual dataset,
- * this setting will allow the object to be created.
+ * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper
+ * limit on the format versions to use. For example, if a
+ * newer format version is required to support a feature e.g.
+ * virtual dataset, this setting will allow the object to be
+ * created.
* \li Earlier versions of the library may not be able to access
* objects created with this setting.</td>
* </tr>
@@ -3888,39 +4944,356 @@ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
* \p high=#H5F_LIBVER_V110
* </td>
* <td>
- * \li The library will create objects with the latest format versions
- * available to library release 1.10.x.
+ * \li The library will create objects with the latest format
+ * versions available to library release 1.10.x.
* \li The library will allow objects to be created with the latest
* format versions available to library release 1.10.x.
- * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper limit
- * on the format versions to use. For example, if a newer format
- * version is required to support a feature e.g. virtual dataset,
- * this setting will allow the object to be created.
+ * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper
+ * limit on the format versions to use. For example, if a
+ * newer format version is required to support a feature e.g.
+ * virtual dataset, this setting will allow the object to be
+ * created.
* \li This setting allows users to take advantage of the latest
- * features and performance enhancements in the library. However,
- * objects written with this setting may be accessible to a smaller
- * range of library versions than would be the case if low is set
- * to #H5F_LIBVER_EARLIEST.
- * \li Earlier versions of the library may not be able to access objects created with this
+ * features and performance enhancements in the library.
+ * However, objects written with this setting may be
+ * accessible to a smaller range of library versions than
+ * would be the case if low is set to #H5F_LIBVER_EARLIEST.
+ * \li Earlier versions of the library may not be able to access
+ * objects created with this
* setting.
* </td>
* </tr>
* </table>
*
- * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in #H5F_libver_t.
+ * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in
+ * #H5F_libver_t.
*
* \since 1.8.0
*
*/
H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Set the initial metadata cache configuration in the indicated File
+ * Access Property List to the supplied value
+ *
+ * \fapl_id{plist_id}
+ * \param[in] config_ptr Pointer to the instance of \p H5AC_cache_config_t
+ * containing the desired configuration
+ * \return \herr_t
+ *
+ * \details The fields of the #H5AC_cache_config_t structure are shown
+ * below:
+ * \snippet H5ACpublic.h H5AC_cache_config_t_snip
+ * \click4more
+ *
+ * \details H5Pset_mdc_config() attempts to set the initial metadata cache
+ * configuration to the supplied value. It will fail if an invalid
+ * configuration is detected. This configuration is used when the file
+ * is opened.
+ *
+ * See the overview of the metadata cache in the special topics section
+ * of the user manual for details on what is being configured. If you
+ * have not read and understood that documentation, you really should
+ * not be using this API call.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets metadata cache logging options
+ *
+ * \fapl_id{plist_id}
+ * \param[in] is_enabled Whether logging is enabled
+ * \param[in] location Location of log in UTF-8/ASCII (file path/name)
+ * (On Windows, this must be ASCII)
+ * \param[in] start_on_access Whether the logging will begin as soon as the
+ * file is opened or created
+ *
+ * \return \herr_t
+ *
+ * \details The metadata cache is a central part of the HDF5 library through
+ * which all file metadata reads and writes take place. File metadata
+ * is normally invisible to the user and is used by the library for
+ * purposes such as locating and indexing data. File metadata should
+ * not be confused with user metadata, which consists of attributes
+ * created by users and attached to HDF5 objects such as datasets via
+ * H5A API calls.
+ *
+ * Due to the complexity of the cache, a trace/logging feature has
+ * been created that can be used by HDF5 developers for debugging and
+ * performance analysis. The functions that control this functionality
+ * will normally be of use to a very limited number of developers
+ * outside of The HDF Group. The functions have been documented to
+ * help users create logs that can be sent with bug reports.
+ *
+ * Control of the log functionality is straightforward. Logging is
+ * enabled via the H5Pset_mdc_log_options() function,
+ * which will modify the file access property list used to open or
+ * create a file. This function has a flag that determines whether
+ * logging begins at file open or starts in a paused state. Log
+ * messages can then be controlled via the H5Fstart_mdc_logging()
+ * and H5Fstop_mdc_logging() function.
+ *
+ * H5Pget_mdc_log_options() can be used to examine a file access
+ * property list, and H5Fget_mdc_logging_status() will return the
+ * current state of the logging flags.
+ *
+ * The log format is described in [<em>Metadata Cache Logging</em>]
+ * (https://portal.hdfgroup.org/display/HDF5/Fine-tuning+the+Metadata+Cache).
+ *
+ * \since 1.10.0
+ *
+ */
H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
hbool_t start_on_access);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the minimum metadata block size
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Minimum size, in bytes, of metadata block allocations
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_meta_block_size() sets the minimum size, in bytes, of
+ * metadata block allocations when #H5FD_FEAT_AGGREGATE_METADATA is set by a VFL
+ * driver.
+
+ * Each raw metadata block is initially allocated to be of the given size.
+ * Specific metadata objects (e.g., object headers, local heaps, B-trees) are then
+ * sub-allocated from this block.
+ *
+ * The default setting is 2048 bytes, meaning that the library will
+ * attempt to aggregate metadata in at least 2K blocks in the file.
+ * Setting the value to zero (\Code{0}) with this function will turn
+ * off metadata aggregation, even if the VFL driver attempts to use the
+ * metadata aggregation strategy.
+ *
+ * Metadata aggregation reduces the number of small data objects in the file that
+ * would otherwise be required for metadata. The aggregated block of metadata is
+ * usually written in a single write action and always in a contiguous block,
+ * potentially significantly improving library and application performance.
+ *
+ * \since 1.4.0
+ */
H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the number of read attempts in a file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[in] attempts The number of read attempts. Must be a value greater than \Code{0}
+ *
+ * \return \herr_t
+ *
+ * \return Failure Modes:
+ * - When the user sets the number of read attempts to \Code{0}.
+ * - When the input property list is not a file access property list.
+ * - When the library is unable to set the number of read attempts in the file access property list.
+ *
+ * \details H5Pset_metadata_read_attempts() sets the number of reads that the
+ * library will try when reading checksummed metadata in an HDF5 file opened
+ * with SWMR access. When reading such metadata, the library will compare the
+ * checksum computed for the metadata just read with the checksum stored within
+ * the piece of checksum. When performing SWMR operations on a file, the
+ * checksum check might fail when the library reads data on a system that is not
+ * atomic. To remedy such situations, the library will repeatedly read the piece
+ * of metadata until the check passes or finally fails the read when the allowed
+ * number of attempts is reached.
+ *
+ * The number of read attempts used by the library will depend on how the file is
+ * opened and whether the user sets the number of read attempts via this routine:
+
+ * - For a file opened with SWMR access:
+ * - If the user sets the number of attempts to \Code{N}, the library will use \Code{N}.
+ * - If the user does not set the number of attempts, the library will use the
+ * default for SWMR access (\Code{100}).
+ * - For a file opened with non-SWMR access, the library will always use the default
+ * for non-SWMR access (\Code{1}). The value set via this routine does not have any effect
+ * during non-SWMR access.
+ *
+ * \b Example: The first example illustrates the case in setting the number of read attempts for a file
+ * opened with SWMR access.
+ *
+ * \snippet H5Pset_metadata_read_attempts.c SWMR Access
+ *
+ * \b Example: The second example illustrates the case in setting the number of
+ * read attempts for a file opened with non-SWMR access. The value
+ * set in the file access property list does not have any effect.
+ *
+ * \snippet H5Pset_metadata_read_attempts.c non-SWMR Access
+ *
+ * \note \b Motivation: On a system that is not atomic, the library might
+ * possibly read inconsistent metadata with checksum when performing
+ * single-writer/multiple-reader (SWMR) operations for an HDF5 file. Upon
+ * encountering such situations, the library will try reading the metadata
+ * again to obtain consistent data. This routine provides the means to set
+ * the number of read attempts other than the library default.
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Specifies type of data to be accessed via the \Code{MULTI} driver,
+ * enabling more direct access
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] type Type of data to be accessed
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_multi_type() sets the \Emph{type of data} property in the file
+ * access property list \p fapl_id. This setting enables a user
+ * application to specify the type of data the application wishes to
+ * access so that the application can retrieve a file handle for
+ * low-level access to the particular member of a set of \Code{MULTI}
+ * files in which that type of data is stored. The file handle is
+ * retrieved with a separate call to H5Fget_vfd_handle() (or, in special
+ * circumstances, to H5FDget_vfd_handle(); see \ref VFL.
+ *
+ * The type of data specified in \p type may be one of the following:
+ *
+ * <table>
+ * <tr>
+ * <td>#H5FD_MEM_SUPER</td> <td>Super block data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_BTREE</td> <td>B-tree data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_DRAW</td> <td>Dataset raw data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_GHEAP</td> <td>Global heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_LHEAP</td> <td>Local Heap data</td>
+ * </tr>
+ * <tr>
+ * <td>#H5FD_MEM_OHDR</td> <td>Object header data</td>
+ * </tr>
+ * </table>
+ *
+ * This function is for use only when accessing an HDF5 file written as a set of
+ * files with the \Code{MULTI} file driver.
+ *
+ * \since 1.6.0
+ */
H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets a callback function to invoke when an object flush occurs in the file
+ *
+ * \fapl_id{plist_id}
+ * \op{func}
+ * \op_data_in{udata}
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_object_flush_cb() sets the callback function to invoke in the
+ * file access property list \p plist_id whenever an object flush occurs in
+ * the file. Library objects are group, dataset, and committed
+ * datatype.
+ *
+ * The callback function \p func must conform to the prototype defined below:
+ * \code
+ * typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *user_data)
+ * \endcode
+ *
+ * The parameters of the callback function, per the above prototypes, are defined as follows:
+ * - \Code{object_id} is the identifier of the object which has just been flushed.
+ * - \Code{user_data} is the user-defined input data for the callback function.
+ *
+ * \b Example: The example below illustrates the usage of this routine to set
+ * the callback function to invoke when an object flush occurs.
+ *
+ * \include H5Pset_object_flush_cb.c
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the maximum size of the data sieve buffer
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of data sieve buffer
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_sieve_buf_size() sets \p size, the maximum size in bytes of the
+ * data sieve buffer, which is used by file drivers that are capable of
+ * using data sieving.
+ *
+ * The data sieve buffer is used when performing I/O on datasets in the
+ * file. Using a buffer which is large enough to hold several pieces of
+ * the dataset being read in for hyperslab selections boosts
+ * performance by quite a bit.
+ *
+ * The default value is set to 64KB, indicating that file I/O for raw
+ * data reads and writes will occur in at least 64KB blocks. Setting
+ * the value to zero (\Code{0}) with this API function will turn off
+ * the data sieving, even if the VFL driver attempts to use that
+ * strategy.
+ *
+ * Internally, the library checks the storage sizes of the datasets in
+ * the file. It picks the smaller one between the size from the file
+ * access property and the size of the dataset to allocate the sieve
+ * buffer for the dataset in order to save memory usage.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type \Code{hsize_t} to \Code{size_t}.
+ *
+ * \since 1.4.0
+ */
H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the size of a contiguous block reserved for small data
+ *
+ * \fapl_id{fapl_id}
+ * \param[in] size Maximum size, in bytes, of the small data block.
+ The default size is \Code{2048}.
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_small_data_block_size() reserves blocks of \p size bytes for the
+ * contiguous storage of the raw data portion of \Emph{small} datasets. The
+ * HDF5 library then writes the raw data from small datasets to this
+ * reserved space, thus reducing unnecessary discontinuities within
+ * blocks of meta data and improving I/O performance.
+ *
+ * A small data block is actually allocated the first time a qualifying
+ * small dataset is written to the file. Space for the raw data portion
+ * of this small dataset is suballocated within the small data block.
+ * The raw data from each subsequent small dataset is also written to
+ * the small data block until it is filled; additional small data
+ * blocks are allocated as required.
+ *
+ * The HDF5 library employs an algorithm that determines whether I/O
+ * performance is likely to benefit from the use of this mechanism with
+ * each dataset as storage space is allocated in the file. A larger
+ * \p size will result in this mechanism being employed with larger
+ * datasets.
+ *
+ * The small data block size is set as an allocation property in the
+ * file access property list identified by \p fapl_id.
+ *
+ * Setting \p size to zero (\Code{0}) disables the small data block mechanism.
+ *
+ * \since 1.4.4
+ */
H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size);
/**
* \ingroup FAPL
@@ -3942,15 +5315,271 @@ H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size);
*/
H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Query the capability flags for the VOL connector that will be used
+ * with this file access property list (FAPL).
+ *
+ * \fapl_id{plist_id}
+ * \param[out] cap_flags Flags that indicate the VOL connector capabilities
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vol_cap_flags() queries the current VOL connector information
+ * for a FAPL to retrieve the capability flags for the VOL
+ * connector stack, as will be used by a file open or create
+ * operation that uses this FAPL.
+ *
+ * \note This routine supports the use of the HDF5_VOL_CONNECTOR environment
+ * variable to override the VOL connector set programmatically for the
+ * FAPL (with H5Pset_vol).
+ *
+ * \note The H5VL_CAP_FLAG_ASYNC flag can be checked to see if asynchronous
+ * operations are supported by the VOL connector stack.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags);
+
#ifdef H5_HAVE_PARALLEL
+/**
+ * \ingroup GAPL
+ *
+ * \brief Sets metadata I/O mode for read operations to collective or independent (default)
+ *
+ * \gacpl_id
+ * \param[in] is_collective Boolean value indicating whether metadata reads are collective
+ * (\Code{1}) or independent (\Code{0}).
+ * Default mode: Independent (\Code{0})
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_all_coll_metadata_ops() sets the metadata I/O mode for read
+ * operations in the access property list \p plist_id.
+ *
+ * When engaging in parallel I/O, all metadata write operations must be
+ * collective. If \p is_collective is \Code{1}, this property specifies
+ * that the HDF5 library will perform all metadata read operations
+ * collectively; if \p is_collective is \Code{0}, such operations may
+ * be performed independently.
+ *
+ * Users must be aware that several HDF5 operations can potentially
+ * issue metadata reads. These include opening a dataset, datatype, or
+ * group; reading an attribute; or issuing a \Emph{get info} call such
+ * as getting information for a group with H5Fget_info(). Collective
+ * I/O requirements must be kept in mind when issuing such calls in the
+ * context of parallel I/O.
+ *
+ * If this property is collective on a file access property list that
+ * is used in creating or opening a file, then the HDF5 library will
+ * assume that all metadata read operations issued on that file
+ * identifier will be issued collectively from all ranks irrespective
+ * of the individual setting of a particular operation. If this
+ * assumption is not adhered to, corruption will be introduced in the
+ * metadata cache and HDF5’s behavior will be undefined.
+ *
+ * Alternatively, a user may wish to avoid setting this property
+ * globally on the file access property list, and individually set it
+ * on particular object access property lists (dataset, group, link,
+ * datatype, attribute access property lists) for certain operations.
+ * This will indicate that only the operations issued with such an
+ * access property list will be called collectively and other
+ * operations may potentially be called independently. There are,
+ * however, several HDF5 operations that can issue metadata reads but
+ * have no property list in their function signatures to allow passing
+ * the collective requirement property. For those operations, the only
+ * option is to set the global collective requirement property on the
+ * file access property list; otherwise the metadata reads that can be
+ * triggered from those operations will be done independently by each
+ * process.
+ *
+ * Functions that do not accommodate an access property list but that
+ * might issue metadata reads are listed in \ref maybe_metadata_reads.
+ *
+ * \attention As noted above, corruption will be introduced into the metadata
+ * cache and HDF5 library behavior will be undefined when both of the following
+ * conditions exist:
+ * - A file is created or opened with a file access property list in which the
+ * collective metadata I/O property is set to \Code{1}.
+ * - Any function is called that triggers an independent metadata read while the
+ * file remains open with that file access property list.
+ *
+ * \attention An approach that avoids this corruption risk is described above.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective);
+/**
+ * \ingroup GAPL
+ *
+ * \brief Retrieves metadata read mode setting
+ *
+ * \gacpl_id
+ * \param[out] is_collective Pointer to a buffer containing the Boolean value indicating whether metadata
+ * reads are collective (\Code{>0}) or independent (\Code{0}).
+ * Default mode: Independent (\Code{0})
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_all_coll_metadata_ops() retrieves the collective metadata read setting from the access
+ * property list \p plist_id into \p is_collective.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets metadata write mode to collective or independent (default)
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_collective Boolean value indicating whether metadata
+ * writes are collective (\Code{>0}) or independent (\Code{0}).
+ * \Emph{Default mode:} Independent (\Code{0})
+ * \return \herr_t
+ *
+ * \details H5Pset_coll_metadata_write() tells the HDF5 library whether to
+ * perform metadata writes collectively (1) or independently (0).
+ *
+ * If collective access is selected, then on a flush of the metadata
+ * cache, all processes will divide the metadata cache entries to be
+ * flushed evenly among themselves and issue a single MPI-IO collective
+ * write operation. This is the preferred method when the size of the
+ * metadata created by the application is large.
+ *
+ * If independent access is selected, the library uses the default
+ * method for doing metadata I/O either from process zero or
+ * independently from each process.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Retrieves metadata write mode setting
+ *
+ * \fapl_id{plist_id}
+ * \param[out] is_collective Pointer to a boolean value indicating whether
+ * metadata writes are collective (\Code{>0}) or independent (\Code{0}).
+ * \Emph{Default mode:} Independent (\Code{0})
+ * \return \herr_t
+ *
+ * \details H5Pget_coll_metadata_write() retrieves the collective metadata write
+ * setting from the file access property into \p is_collective.
+ *
+ * \sa_metadata_ops
+ *
+ * \since 1.10.0
+ */
H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective);
+
+/**
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pget_mpi_params(hid_t fapl_id, MPI_Comm *comm, MPI_Info *info);
+
+/**
+ * \todo Add missing documentation
+ */
H5_DLL herr_t H5Pset_mpi_params(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
#endif /* H5_HAVE_PARALLEL */
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the metadata cache image option for a file access property list
+ *
+ * \fapl_id{plist_id}
+ * \param[out] config_ptr Pointer to metadata cache image configuration values
+ * \return \herr_t
+ *
+ * \details H5Pset_mdc_image_config() sets the metadata cache image option with
+ * configuration values specified by \p config_ptr for the file access
+ * property list specified in \p plist_id.
+ *
+ * #H5AC_cache_image_config_t is defined as follows:
+ * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip
+ * \click4more
+ *
+ * \par Limitations: While it is an obvious error to request a cache image when
+ * opening the file read only, it is not in general possible to test for
+ * this error in the H5Pset_mdc_image_config() call. Rather than fail the
+ * subsequent file open, the library silently ignores the file image
+ * request in this case.\n It is also an error to request a cache image on
+ * a file that does not support superblock extension messages (i.e. a
+ * superblock version less than 2). As above, it is not always possible to
+ * detect this error in the H5Pset_mdc_image_config() call, and thus the
+ * request for a cache image will fail silently in this case as well.\n
+ * Creation of cache images is currently disabled in parallel -- as above,
+ * any request for a cache image in this context will fail silently.\n
+ * Files with cache images may be read in parallel applications, but note
+ * that the load of the cache image is a collective operation triggered by
+ * the first operation that accesses metadata after file open (or, if
+ * persistent free space managers are enabled, on the first allocation or
+ * deallocation of file space, or read of file space manager status,
+ * whichever comes first). Thus the parallel process may deadlock if any
+ * process does not participate in this access.\n
+ * In long sequences of file closes and opens, infrequently accessed
+ * metadata can accumulate in the cache image to the point where the cost
+ * of storing and restoring this metadata exceeds the benefit of retaining
+ * frequently used metadata in the cache image. When implemented, the
+ * #H5AC_cache_image_config_t::entry_ageout should address this problem. In
+ * the interim, not requesting a cache image every n file close/open cycles
+ * may be an acceptable work around. The choice of \c n will be driven by
+ * application behavior, but \Code{n = 10} seems a good starting point.
+ *
+ * \since 1.10.1
+ */
H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Sets the maximum size for the page buffer and the minimum percentage
+ * for metadata and raw data pages
+ *
+ * \fapl_id{plist_id}
+ * \param[in] buf_size Maximum size, in bytes, of the page buffer
+ * \param[in] min_meta_per Minimum metadata percentage to keep in the page buffer
+ * before allowing pages containing metadata to be evicted (Default is 0)
+ * \param[in] min_raw_per Minimum raw data percentage to keep in the page buffer
+ * before allowing pages containing raw data to be evicted (Default is 0)
+ * \return \herr_t
+ *
+ * \details H5Pset_page_buffer_size() sets buf_size, the maximum size in bytes
+ * of the page buffer. The default value is zero, meaning that page
+ * buffering is disabled. When a non-zero page buffer size is set, the
+ * library will enable page buffering if that size is larger or equal
+ * than a single page size if a paged file space strategy is enabled
+ * using the functions H5Pset_file_space_strategy() and
+ * H5Pset_file_space_page_size().
+ *
+ * The page buffer layer captures all I/O requests before they are
+ * issued to the VFD and "caches" them in fixed sized pages. Once the
+ * total number of pages exceeds the page buffer size, the library
+ * evicts pages from the page buffer by writing them to the VFD. At
+ * file close, the page buffer is flushed writing all the pages to the
+ * file.
+ *
+ * If a non-zero page buffer size is set, and the file space strategy
+ * is not set to paged or the page size for the file space strategy is
+ * larger than the page buffer size, the subsequent call to H5Fcreate()
+ * or H5Fopen() using the \p plist_id will fail.
+ *
+ * The function also allows setting the minimum percentage of pages for
+ * metadata and raw data to prevent a certain type of data to evict hot
+ * data of the other type.
+ *
+ * \since 1.10.1
+ *
+ */
H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per,
unsigned min_raw_per);
@@ -4288,7 +5917,7 @@ H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id);
* virtual dataset that has the creation property list specified
* by \p dcpl_id.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -4331,7 +5960,7 @@ H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/);
* assigned to \p size for a second H5Pget_virtual_dsetname()
* call, which will retrieve the actual dataset name.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -4375,7 +6004,7 @@ H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name /
* \p size for a second H5Pget_virtual_filename() call, which
* will retrieve the actual filename.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -4400,7 +6029,7 @@ H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name /
* index, \p index, and returns a dataspace identifier for the
* selection within the source dataset used in the mapping.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -4425,7 +6054,7 @@ H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index);
* index, \p index, and returns a dataspace identifier for the
* selection within the virtual dataset used in the mapping.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -4745,6 +6374,8 @@ H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_shuffle() sets the shuffle filter, #H5Z_FILTER_SHUFFLE,
* in the dataset creation property list \p plist_id. The shuffle
* filter de-interlaces a block of data by reordering the bytes.
@@ -4816,6 +6447,8 @@ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_nbit() sets the N-Bit filter, #H5Z_FILTER_NBIT, in the
* dataset creation property list \p plist_id.
*
@@ -4909,6 +6542,8 @@ H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_scaleoffset() sets the scale-offset filter,
* #H5Z_FILTER_SCALEOFFSET, for a dataset.
*
@@ -5018,6 +6653,8 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type,
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_szip() sets an SZIP compression filter, #H5Z_FILTER_SZIP,
* for a dataset. SZIP is a compression method designed for use with
* scientific data.
@@ -5159,6 +6796,133 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type,
*
*/
H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block);
+
+/**
+ * \ingroup DCPL
+ *
+ * \brief Sets the mapping between virtual and source datasets
+ *
+ * \dcpl_id
+ * \param[in] vspace_id The dataspace identifier with the selection within the
+ * virtual dataset applied, possibly an unlimited selection
+ * \param[in] src_file_name The name of the HDF5 file where the source dataset is
+ * located or a \Code{"."} (period) for a source dataset in the same
+ * file. The file might not exist yet. The name can be specified using
+ * a C-style \c printf statement as described below.
+ * \param[in] src_dset_name The path to the HDF5 dataset in the file specified by
+ * \p src_file_name. The dataset might not exist yet. The dataset name
+ * can be specified using a C-style \c printf statement as described below.
+ * \param[in] src_space_id The source dataset’s dataspace identifier with a
+ * selection applied, possibly an unlimited selection
+ * \return \herr_t
+ *
+ * \details H5Pset_virtual() maps elements of the virtual dataset (VDS)
+ * described by the virtual dataspace identifier \p vspace_id to the
+ * elements of the source dataset described by the source dataset
+ * dataspace identifier \p src_space_id. The source dataset is
+ * identified by the name of the file where it is located,
+ * \p src_file_name, and the name of the dataset, \p src_dset_name.
+ *
+ * \par C-style \c printf Formatting Statements:
+ * C-style \c printf formatting allows a pattern to be specified in the name
+ * of a source file or dataset. Strings for the file and dataset names are
+ * treated as literals except for the following substitutions:
+ * <table>
+ * <tr>
+ * <td>\Code{"%%"}</td>
+ * <td>Replaced with a single \Code{"%"} (percent) character.</td>
+ * </tr>
+ * <tr>
+ * <td><code>"%<d>b"</code></td>
+ * <td>Where <code>"<d>"</code> is the virtual dataset dimension axis (0-based)
+ * and \Code{"b"} indicates that the block count of the selection in that
+ * dimension should be used. The full expression (for example, \Code{"%0b"})
+ * is replaced with a single numeric value when the mapping is evaluated at
+ * VDS access time. Example code for many source and virtual dataset mappings
+ * is available in the "Examples of Source to Virtual Dataset Mapping"
+ * chapter in the
+ * <a href="https://portal.hdfgroup.org/display/HDF5/RFC+HDF5+Virtual+Dataset">
+ * RFC: HDF5 Virtual Dataset</a>.
+ * </td>
+ * </tr>
+ * </table>
+ * If the printf form is used for the source file or dataset names, the
+ * selection in the source dataset’s dataspace must be fixed-size.
+ *
+ * \par Source File Resolutions:
+ * When a source dataset residing in a different file is accessed, the
+ * library will search for the source file \p src_file_name as described
+ * below:
+ * \li If \p src_file_name is a \Code{"."} (period) then it refers to the
+ * file containing the virtual dataset.
+ * \li If \p src_file_name is a relative pathname, the following steps are
+ * performed:
+ * - The library will get the prefix(es) set in the environment
+ * variable \c HDF5_VDS_PREFIX and will try to prepend each prefix
+ * to \p src_file_name to form a new \p src_file_name. If the new
+ * \p src_file_name does not exist or if \c HDF5_VDS_PREFIX is not
+ * set, the library will get the prefix set via H5Pset_virtual_prefix()
+ * and prepend it to \p src_file_name to form a new \p src_file_name.
+ * If the new \p src_file_name does not exist or no prefix is being
+ * set by H5Pset_virtual_prefix() then the path of the file containing
+ * the virtual dataset is obtained. This path can be the absolute path
+ * or the current working directory plus the relative path of that
+ * file when it is created/opened. The library will prepend this path
+ * to \p src_file_name to form a new \p src_file_name.
+ * - If the new \p src_file_name does not exist, then the library will
+ * look for \p src_file_name and will return failure/success accordingly.
+ * \li If \p src_file_name is an absolute pathname, the library will first
+ * try to find \p src_file_name. If \p src_file_name does not exist,
+ * \p src_file_name is stripped of directory paths to form a new
+ * \p src_file_name. The search for the new \p src_file_name then follows
+ * the same steps as described above for a relative pathname. See
+ * examples below illustrating how \p src_file_name is stripped to form
+ * a new \p src_file_name.
+ * \par
+ * Note that \p src_file_name is considered to be an absolute pathname when
+ * the following condition is true:
+ * \li For Unix, the first character of \p src_file_name is a slash
+ * (\Code{/}).\n For example, consider a \p src_file_name of
+ * \Code{/tmp/A.h5}. If that source file does not exist, the new
+ * \p src_file_name after stripping will be \Code{A.h5}.
+ * \li For Windows, there are 6 cases:
+ * 1. \p src_file_name is an absolute drive with absolute pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 2. \p src_file_name is an absolute pathname without specifying
+ * drive name.\n For example, consider a \p src_file_name of
+ * \Code{/tmp/A.h5}. If that source file does not exist, the new
+ * \p src_file_name after stripping will be \Code{A.h5}.
+ * 3. \p src_file_name is an absolute drive with relative pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{tmp/A.h5}.
+ * 4. \p src_file_name is in UNC (Uniform Naming Convention) format
+ * with server name, share name, and pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 5. \p src_file_name is in Long UNC (Uniform Naming Convention)
+ * format with server name, share name, and pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}.
+ * 6. \p src_file_name is in Long UNC (Uniform Naming Convention)
+ * format with an absolute drive and an absolute pathname.\n
+ * For example, consider a \p src_file_name of \Code{/tmp/A.h5}.
+ * If that source file does not exist, the new \p src_file_name
+ * after stripping will be \Code{A.h5}
+ *
+ * \see <a href="https://portal.hdfgroup.org/display/HDF5/Virtual+Dataset++-+VDS">
+ * Virtual Dataset Overview</a>
+ *
+ * \see_virtual
+ *
+ * \version 1.10.2 A change was made to the method of searching for VDS source files.
+ * \since 1.10.0
+ *
+ */
H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
const char *src_dset_name, hid_t src_space_id);
@@ -5191,8 +6955,6 @@ H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_fil
* \p udata is the user-defined input data for the callback
* function.
*
- * \todo Example Usage was removed and needs to be re-added
- *
* \since 1.10.0
*
*/
@@ -5298,7 +7060,7 @@ H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char *prefix /*out*/, size_t s
* NULL will return the size of the prefix without the NULL
* terminator.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.2
*
@@ -5348,7 +7110,7 @@ H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t dapl_id, hsize_t *gap_size);
* list, \p dapl_id, and retrieves the flag, \p view, set by the
* H5Pset_virtual_view() call.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -5389,7 +7151,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view);
* \p boundary. It is a 1-dimensional array with \p ndims
* elements, which should be the same as the rank of the
* dataset’s dataspace. While appending to a dataset along a
- * particular dimension index via H5DOappend(), the library
+ * particular dimension index via H5Dappend(), the library
* determines a boundary is reached when the resulting dimension
* size is divisible by \p boundary[index]. A zero value for
* \p boundary[index] indicates no boundary is set for that
@@ -5415,8 +7177,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view);
*
* The callback function \p func must conform to the following
* prototype:
- * \Code{typedef herr_t (#H5D_append_cb_t)(hid_t dataset_id,
- * hsize_t *cur_dims, void *user_data)}
+ * \snippet H5Dpublic.h H5D_append_cb_t_snip
*
* The parameters of the callback function, per the above
* prototype, are defined as follows:
@@ -5426,10 +7187,6 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view);
* a boundary is hit.
* \li \p user_data is the user-defined input data.
*
- * \todo Example Usage was removed and should be added back.
- * \todo Adding snippet for H5D_append_cb_t_snip did not work.
- * \todo H5DOappend() not found
- *
* \since 1.10.0
*
*/
@@ -5643,7 +7400,7 @@ H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix);
* buffer should not be freed until the property list has been
* closed.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.2
*
@@ -5685,7 +7442,7 @@ H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix);
* d-2 and d-3 will be filled according to the virtual
* dataset’s fill value setting.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -5723,7 +7480,7 @@ H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size);
* Missing mapped data is filled with the fill value set in the
* VDS creation property list.
*
- * \virtual
+ * \see_virtual
*
* \since 1.10.0
*
@@ -5731,8 +7488,48 @@ H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size);
H5_DLL herr_t H5Pset_virtual_view(hid_t dapl_id, H5D_vds_view_t view);
/* Dataset xfer property list (DXPL) routines */
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets B-tree split ratios for a dataset transfer property list
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] left The B-tree split ratio for left-most nodes
+ * \param[out] middle The B-tree split ratio for right-most nodes and lone nodes
+ * \param[out] right The B-tree split ratio for all other nodes
+ * \return \herr_t
+ *
+ * \details H5Pget_btree_ratios() returns the B-tree split ratios for a dataset
+ * transfer property list.
+ *
+ * The B-tree split ratios are returned through the non-NULL arguments
+ * \p left, \p middle, and \p right, as set by the H5Pset_btree_ratios()
+ * function.
+ *
+ */
H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/,
double *right /*out*/);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Reads buffer settings
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ * \param[out] tconv Address of the pointer to application-allocated type
+ * conversion buffer
+ * \param[out] bkg Address of the pointer to application-allocated
+ * background buffer
+ *
+ * \return Returns buffer size, in bytes, if successful; otherwise 0 on failure.
+ *
+ * \details H5Pget_buffer() reads values previously set with H5Pset_buffer().
+ *
+ * \version 1.6.0 The return type changed from \p hsize_t to \p size_t.
+ * \version 1.4.0 The return type changed to \p hsize_t.
+ *
+ */
H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/);
/**
*
@@ -5740,54 +7537,233 @@ H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*o
*
* \brief Retrieves a data transform expression
*
- * \param[in] plist_id Identifier of the property list or class
- * \param[out] expression Pointer to memory where the transform expression
- * will be copied
- * \param[in] size Number of bytes of the transform expression to copy to
+ * \param[in] plist_id Identifier of the property list or class
+ * \param[out] expression Pointer to memory where the transform expression will
+ * be copied
+ * \param[in] size Number of bytes of the transform expression to copy
+ * to
*
- * \return Returns the size of the transform expression if successful;
- * otherwise returns a negative value.
+ * \return Success: the size of the transform expression. Failure: a negative
+ * value.
*
- * \details H5Pget_data_transform() retrieves the data transform
- * expression previously set in the dataset transfer property
- * list \p plist_id by H5Pset_data_transform().
+ * \details H5Pget_data_transform() retrieves the data transform expression
+ * previously set in the dataset transfer property list \p plist_id
+ * by H5Pset_data_transform().
*
- * H5Pget_data_transform() can be used to both retrieve the
- * transform expression and to query its size.
+ * H5Pget_data_transform() can be used to both retrieve the transform
+ * expression and query its size.
*
* If \p expression is non-NULL, up to \p size bytes of the data
- * transform expression are written to the buffer. If
- * \p expression is NULL, \p size is ignored and the function
- * does not write anything to the buffer. The function always
- * returns the size of the data transform expression.
+ * transform expression are written to the buffer. If \p expression
+ * is NULL, \p size is ignored, and the function does not write
+ * anything to the buffer. The function always returns the size of
+ * the data transform expression.
*
- * If 0 is returned for the size of the expression, no data
- * transform expression exists for the property list.
+ * If 0 is returned for the size of the expression, no data transform
+ * expression exists for the property list.
*
* If an error occurs, the buffer pointed to by \p expression is
- * unchanged and the function returns a negative value.
+ * unchanged, and the function returns a negative value.
*
* \since 1.8.0
*
*/
-H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size);
+H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Determines whether error-detection is enabled for dataset reads
+ *
+ * \param[in] plist_id Dataset transfer property list identifier
+ *
+ * \return Returns \p H5Z_ENABLE_EDC or \p H5Z_DISABLE_EDC if successful;
+ * otherwise returns a negative value.
+ *
+ * \details H5Pget_edc_check() queries the dataset transfer property
+ * list \p plist to determine whether error detection is enabled for
+ * data read operations.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id);
-H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/);
-H5_DLL int H5Pget_preserve(hid_t plist_id);
-H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data);
-H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info,
- H5MM_free_t *free_func, void **free_info);
-H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right);
-H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Retrieves number of I/O vectors to be read/written in hyperslab I/O
+ *
+ * \param[in] fapl_id Dataset transfer property list identifier
+ * \param[out] size Number of I/O vectors to accumulate in memory for I/O operations
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_hyper_vector_size() retrieves the number of I/O vectors to be accumulated in
+ * memory before being issued to the lower levels of the HDF5 library for reading or
+ * writing the actual data.
+ *
+ * The number of I/O vectors set in the dataset transfer property list \p fapl_id is
+ * returned in \p size. Unless the default value is in use, \p size was
+ * previously set with a call to H5Pset_hyper_vector_size().
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Checks status of the dataset transfer property list (\b DEPRECATED)
+ *
+ * \deprecated{H5Pget_preserve() is deprecated as it is no longer useful;
+ * compound datatype field preservation is now core functionality
+ * in the HDF5 library.}
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ *
+ * \return Returns 1 or 0 if successful; otherwise returns a negative value.
+ *
+ * \details H5Pget_preserve() checks the status of the dataset transfer
+ * property list.
+ *
+ * \version 1.6.0 The flag parameter was changed from INTEGER to LOGICAL to
+ * better match the C API. (Fortran 90)
+ *
+ */
+H5_DLL int H5Pget_preserve(hid_t plist_id);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets user-defined datatype conversion callback function
+ *
+ * \param[in] dxpl_id Dataset transfer property list identifier
+ * \param[out] op User-defined type conversion callback function
+ * \param[out] operate_data User-defined input data for the callback function
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_type_conv_cb() gets the user-defined datatype conversion
+ * callback function \p op in the dataset transfer property list
+ * \p dxpl_id.
+ *
+ * The parameter \p operate_data is a pointer to user-defined input
+ * data for the callback function.
+ *
+ * The callback function \p op defines the actions an application is
+ * to take when there is an exception during datatype conversion.
+ *
+ * Please refer to the function H5Pset_type_conv_cb() for more details.
+ *
+ */
+H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Gets the memory manager for variable-length datatype allocation in H5Dread() and H5Dvlen_reclaim()
+ *
+ * \param[in] plist_id Identifier for the dataset transfer property list
+ * \param[out] alloc_func User's allocate routine, or NULL for system malloc
+ * \param[out] alloc_info Extra parameter for user’s allocation routine.
+ * Contents are ignored if preceding
+ * parameter is NULL \param[out] free_func User's free routine, or NULL for
+ * system free \param[out] free_info
+ * Extra parameter for user’s free routine. Contents are ignored if preceding
+ * parameter is NULL
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vlen_mem_manager() is the companion function to
+ * H5Pset_vlen_mem_manager(), returning the parameters set by
+ * that function.
+ *
+ */
+H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info,
+ H5MM_free_t *free_func, void **free_info);
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets B-tree split ratios for a dataset transfer property list
+ *
+ * \param[in] plist_id The dataset transfer property list identifier
+ * \param[in] left The B-tree split ratio for left-most nodes
+ * \param[in] middle The B-tree split ratio for all other nodes
+ * \param[in] right The B-tree split ratio for right-most nodes and lone
+ * nodes
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_btree_ratios() sets the B-tree split ratios for a dataset
+ * transfer property list. The split ratios determine what percent of
+ * children go in the first node when a node splits.
+ *
+ * The ratio \p left is used when the splitting node is the left-most
+ * node at its level in the tree;
+ * the ratio \p right is used when the splitting node is the right-most
+ * node at its level; and
+ * the ratio \p middle is used for all other cases.
+ *
+ * A node that is the only node at its level in the tree uses the
+ * ratio \p right when it splits.
+ *
+ * All ratios are real numbers between 0 and 1, inclusive.
+ *
+ */
+H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right);
+
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets type conversion and background buffers
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] size Size, in bytes, of the type conversion and background buffers
+ * \param[in] tconv Pointer to application-allocated type conversion buffer
+ * \param[in] bkg Pointer to application-allocated background buffer
+ * \return \herr_t
+ *
+ * \details Given a dataset transfer property list, H5Pset_buffer() sets the
+ * maximum size for the type conversion buffer and background buffer
+ * and optionally supplies pointers to application-allocated
+ * buffers. If the buffer size is smaller than the entire amount of
+ * data being transferred between the application and the file, and a
+ * type conversion buffer or background buffer is required, then strip
+ * mining will be used.
+ *
+ * Note that there are minimum size requirements for the buffer. Strip
+ * mining can only break the data up along the first dimension, so the
+ * buffer must be large enough to accommodate a complete slice that
+ * encompasses all of the remaining dimensions. For example, when strip
+ * mining a \Code{100x200x300} hyperslab of a simple data space, the
+ * buffer must be large enough to hold \Code{1x200x300} data
+ * elements. When strip mining a \Code{100x200x300x150} hyperslab of a
+ * simple data space, the buffer must be large enough to hold
+ * \Code{1x200x300x150} data elements.
+ *
+ * If \p tconv and/or \p bkg are null pointers, then buffers will be
+ * allocated and freed during the data transfer.
+ *
+ * The default value for the maximum buffer is 1 MiB.
+ *
+ * \version 1.6.0 The \p size parameter has changed from type hsize_t to \c size_t.
+ * \version 1.4.0 The \p size parameter has changed to type hsize_t.
+ *
+ */
+H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
+
/**
* \ingroup DXPL
*
* \brief Sets a data transform expression
*
- * \param[in] plist_id Identifier of the property list or class
+ * \dxpl_id{plist_id}
* \param[in] expression Pointer to the null-terminated data transform
* expression
- *
* \return \herr_t
*
* \details H5Pset_data_transform() sets the data transform to be used for
@@ -5795,11 +7771,11 @@ H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *b
* transfer property list \p plist_id.
*
* The \p expression parameter is a string containing an algebraic
- * expression, such as (5/9.0)*(x-32) or x*(x-5). When a dataset
- * is read or written with this property list, the transform
- * expression is applied with the x being replaced by the values
- * in the dataset. When reading data, the values in the file are
- * not changed and the transformed data is returned to the user.
+ * expression, such as \Code{(5/9.0)*(x-32)} or \Code{x*(x-5)}. When a
+ * dataset is read or written with this property list, the transform
+ * expression is applied with the \c x being replaced by the values in
+ * the dataset. When reading data, the values in the file are not
+ * changed and the transformed data is returned to the user.
*
* Data transforms can only be applied to integer or
* floating-point datasets. Order of operations is obeyed and
@@ -5813,20 +7789,395 @@ H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *b
*
*/
H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the dataset transfer property list to enable or disable error
+ * detection when reading data
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] check Specifies whether error checking is enabled or disabled
+ * for dataset read operations
+ * \return \herr_t
+ *
+ * \details H5Pset_edc_check() sets the dataset transfer property list \p plist
+ * to enable or disable error detection when reading data.
+ *
+ * Whether error detection is enabled or disabled is specified in the
+ * \p check parameter. Valid values are #H5Z_ENABLE_EDC (default) and
+ * #H5Z_DISABLE_EDC.
+ *
+ * \note The initial error detection implementation, Fletcher32 checksum,
+ * supports error detection for chunked datasets only.
+ *
+ * \attention The Fletcher32 EDC checksum filter, set with H5Pset_fletcher32(),
+ * was added in HDF5 Release 1.6.0. In the original implementation,
+ * however, the checksum value was calculated incorrectly on
+ * little-endian systems. The error was fixed in HDF5 Release 1.6.3.\n
+ * As a result of this fix, an HDF5 library of Release 1.6.0 through
+ * Release 1.6.2 cannot read a dataset created or written with
+ * Release 1.6.3 or later if the dataset was created with the
+ * checksum filter and the filter is enabled in the reading
+ * library. (Libraries of Release 1.6.3 and later understand the
+ * earlier error and compensate appropriately.)\n
+ * \Bold{Work-around:} An HDF5 library of Release 1.6.2 or earlier
+ * will be able to read a dataset created or written with the
+ * checksum filter by an HDF5 library of Release 1.6.3 or later if
+ * the checksum filter is disabled for the read operation. This can
+ * be accomplished via an H5Pset_edc_check() call with the value
+ * #H5Z_DISABLE_EDC in the second parameter. This has the obvious
+ * drawback that the application will be unable to verify the
+ * checksum, but the data does remain accessible.
+ *
+ * \version 1.6.3 Error in checksum calculation on little-endian systems
+ * corrected in this release.
+ * \since 1.6.0
+ *
+ */
H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets user-defined filter callback function
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] func User-defined filter callback function
+ * \param[in] op_data User-defined input data for the callback function
+ * \return \herr_t
+ *
+ * \details H5Pset_filter_callback() sets the user-defined filter callback
+ * function \p func in the dataset transfer property list \p plist_id.
+ *
+ * The parameter \p op_data is a pointer to user-defined input data for
+ * the callback function and will be passed through to the callback
+ * function.
+ *
+ * The callback function \p func defines the actions an application is
+ * to take when a filter fails. The function prototype is as follows:
+ * \snippet H5Zpublic.h H5Z_filter_func_t_snip
+ * where \c filter indicates which filter has failed, \c buf and \c buf_size
+ * are used to pass in the failed data, and op_data is the required
+ * input data for this callback function.
+ *
+ * Valid callback function return values are #H5Z_CB_FAIL and #H5Z_CB_CONT.
+ *
+ * \since 1.6.0
+ *
+ */
H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data);
-H5_DLL herr_t H5Pset_hyper_vector_size(hid_t fapl_id, size_t size);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets number of I/O vectors to be read/written in hyperslab I/O
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] size Number of I/O vectors to accumulate in memory for I/O
+ * operations\n
+ * Must be greater than 1 (one)\n
+ * Default value: 1024
+ * \return \herr_t
+ *
+ * \details H5Pset_hyper_vector_size() sets the number of I/O vectors to be
+ * accumulated in memory before being issued to the lower levels of
+ * the HDF5 library for reading or writing the actual data.
+ *
+ * The I/O vectors are hyperslab offset and length pairs and are
+ * generated during hyperslab I/O.
+ *
+ * The number of I/O vectors is passed in \p size to be set in the
+ * dataset transfer property list \p plist_id. \p size must be
+ * greater than 1 (one).
+ *
+ * H5Pset_hyper_vector_size() is an I/O optimization function;
+ * increasing vector_size should provide better performance, but the
+ * library will use more memory during hyperslab I/O. The default value
+ * of \p size is 1024.
+ *
+ * \since 1.6.0
+ *
+ */
+H5_DLL herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t size);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the dataset transfer property list \p status
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] status Status toggle of the dataset transfer property list
+ * \return \herr_t
+ *
+ * \deprecated This function is deprecated as it no longer has any effect;
+ * compound datatype field preservation is now core functionality in
+ * the HDF5 library.
+ *
+ * \details H5Pset_preserve() sets the dataset transfer property list status to
+ * \c 1 or \c 0.
+ *
+ * When reading or writing compound datatypes and the destination is
+ * partially initialized and the read/write is intended to initialize
+ * the other members, one must set this property to \c 1. Otherwise the
+ * I/O pipeline treats the destination datapoints as completely
+ * uninitialized.
+ *
+ * \todo Add missing version information: introduction, deprecation, etc.
+ * Why is the declaration not in the deprecated section?
+ *
+ */
H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets user-defined datatype conversion callback function
+ *
+ * \dxpl_id
+ * \param[in] op User-defined type conversion callback function
+ * \param[in] operate_data User-defined input data for the callback function
+ * \return \herr_t
+ *
+ * \details H5Pset_type_conv_cb() sets the user-defined datatype conversion
+ * callback function \p op in the dataset transfer property list \p
+ * dxpl_id
+ *
+ * The parameter operate_data is a pointer to user-defined input data
+ * for the callback function and will be passed through to the callback
+ * function.
+ *
+ * The callback function \p op defines the actions an application is to
+ * take when there is an exception during datatype conversion. The
+ * function prototype is as follows:
+ * \snippet H5Tpublic.h H5T_conv_except_func_t_snip
+ *
+ * \todo Add version information.
+ *
+ */
H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data);
+
+/**
+ * \ingroup DXPL
+ *
+ * \brief Sets the memory manager for variable-length datatype allocation in
+ * H5Dread() and H5Dvlen_reclaim()
+ *
+ * \dxpl_id{plist_id}
+ * \param[in] alloc_func User's allocate routine, or \c NULL for system \c malloc
+ * \param[in] alloc_info Extra parameter for user's allocation routine.
+ * Contents are ignored if preceding parameter is \c NULL.
+ * \param[in] free_func User's free routine, or \c NULL for system \c free
+ * \param[in] free_info Extra parameter for user's free routine. Contents are
+ * ignored if preceding parameter is \c NULL
+ * \return \herr_t
+ *
+ * \details H5Pset_vlen_mem_manager() sets the memory manager for
+ * variable-length datatype allocation in H5Dread() and free in
+ * H5Dvlen_reclaim().
+ *
+ * The \p alloc_func and \p free_func parameters identify the memory
+ * management routines to be used. If the user has defined custom
+ * memory management routines, \p alloc_func and/or free_func should be
+ * set to make those routine calls (i.e., the name of the routine is
+ * used as the value of the parameter); if the user prefers to use the
+ * system's \c malloc and/or \c free, the \p alloc_func and \p
+ * free_func parameters, respectively, should be set to \c NULL
+ *
+ * The prototypes for these user-defined functions are as follows:
+ * \snippet H5MMpublic.h H5MM_allocate_t_snip
+ *
+ * \snippet H5MMpublic.h H5MM_free_t_snip
+ *
+ * The \p alloc_info and \p free_info parameters can be used to pass
+ * along any required information to the user's memory management
+ * routines.
+ *
+ * In summary, if the user has defined custom memory management
+ * routines, the name(s) of the routines are passed in the \p
+ * alloc_func and \p free_func parameters and the custom routines'
+ * parameters are passed in the \p alloc_info and \p free_info
+ * parameters. If the user wishes to use the system \c malloc and \c
+ * free functions, the \p alloc_func and/or \p free_func parameters are
+ * set to \c NULL and the \p alloc_info and \p free_info parameters are
+ * ignored.
+ *
+ * \todo Add version information.
+ */
H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info,
H5MM_free_t free_func, void *free_info);
+
#ifdef H5_HAVE_PARALLEL
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves the type of chunk optimization that HDF5 actually performed
+ * on the last parallel I/O call (not necessarily the type requested)
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] actual_chunk_opt_mode The type of chunk optimization performed by HDF5
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list
+ * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio().
+ * However, HDF5 will sometimes ignore this request and perform independent
+ * I/O instead. This property allows the user to see what kind of I/O HDF5
+ * actually performed. Used in conjunction with H5Pget_mpio_actual_io_mode(),
+ * this property allows the user to determine exactly what HDF5 did when
+ * attempting collective I/O.
+ *
+ * \details H5Pget_mpio_actual_chunk_opt_mode() retrieves the type of chunk
+ * optimization performed when collective I/O was requested. This
+ * property is set before I/O takes place, and will be set even if I/O
+ * fails.
+ *
+ * Valid values returned in \p actual_chunk_opt_mode:
+ * \snippet this H5D_mpio_actual_chunk_opt_mode_t_snip
+ * \click4more
+ *
+ * \since 1.8.8
+ *
+ */
H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id,
H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves the type of I/O that HDF5 actually performed on the last
+ * parallel I/O call (not necessarily the type requested)
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] actual_io_mode The type of I/O performed by this process
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list
+ * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio().
+ * However, HDF5 will sometimes ignore this request and perform independent
+ * I/O instead. This property allows the user to see what kind of I/O HDF5
+ * actually performed. Used in conjunction with H5Pget_mpio_actual_chunk_opt_mode(),
+ * this property allows the user to determine exactly HDF5 did when
+ * attempting collective I/O.
+ *
+ * \details H5Pget_mpio_actual_io_mode() retrieves the type of I/O performed on
+ * the selection of the current process. This property is set after all
+ * I/O is completed; if I/O fails, it will not be set.
+ *
+ * Valid values returned in \p actual_io_mode:
+ * \snippet this H5D_mpio_actual_io_mode_t_snip
+ * \click4more
+ *
+ * \attention All processes do not need to have the same value. For example, if
+ * I/O is being performed using the multi chunk optimization scheme,
+ * one process's selection may include only chunks accessed
+ * collectively, while another may include chunks accessed
+ * independently. In this case, the first process will report
+ * #H5D_MPIO_CHUNK_COLLECTIVE while the second will report
+ * #H5D_MPIO_CHUNK_INDEPENDENT.
+ *
+ * \see H5Pget_mpio_no_collective_cause(), H5Pget_mpio_actual_chunk_opt_mode()
+ *
+ * \since 1.8.8
+ *
+ */
H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
+/**
+ * \ingroup DXPL
+ *
+ * \brief Retrieves local and global causes that broke collective I/O on the last
+ * parallel I/O call
+ *
+ * \dxpl_id{plist_id}
+ * \param[out] local_no_collective_cause An enumerated set value indicating the
+ * causes that prevented collective I/O in the local process
+ * \param[out] global_no_collective_cause An enumerated set value indicating
+ * the causes across all processes that prevented collective I/O
+ * \return \herr_t
+ *
+ * \par Motivation:
+ * A user can request collective I/O via a data transfer property list (DXPL)
+ * that has been suitably modified with H5P_SET_DXPL_MPIO. However, there are
+ * conditions that can cause HDF5 to forgo collective I/O and perform
+ * independent I/O. Such causes can be different across the processes of a
+ * parallel application. This function allows the user to determine what
+ * caused the HDF5 library to skip collective I/O locally, that is in the
+ * local process, and globally, across all processes.
+ *
+ * \details H5Pget_mpio_no_collective_cause() serves two purposes. It can be
+ * used to determine whether collective I/O was used for the last
+ * preceding parallel I/O call. If collective I/O was not used, the
+ * function retrieves the local and global causes that broke collective
+ * I/O on that parallel I/O call. The properties retrieved by this
+ * function are set before I/O takes place and are retained even when
+ * I/O fails.
+ *
+ * Valid values returned in \p local_no_collective_cause and \p
+ * global_no_collective_cause are as follows or, if there are multiple
+ * causes, a bitwise OR of the relevant causes; the numbers in the
+ * center column are the bitmask values:
+ * \snippet this H5D_mpio_no_collective_cause_t_snip
+ * \click4more
+ *
+ * \attention Each process determines whether it can perform collective I/O and
+ * broadcasts the result. Those results are combined to make a
+ * collective decision; collective I/O will be performed only if all
+ * processes can perform collective I/O.\n
+ * If collective I/O was not used, the causes that prevented it are
+ * reported by individual process by means of an enumerated set. The
+ * causes may differ among processes, so H5Pget_mpio_no_collective_cause()
+ * returns two property values. The first value is the one produced
+ * by the local process to report local causes. This local information
+ * is encoded in an enumeration, the \ref H5D_mpio_no_collective_cause_t
+ * described above, with all individual causes combined into a single
+ * enumeration value by means of a bitwise OR operation. The second
+ * value reports global causes; this global value is the result of a
+ * bitwise-OR operation across the values returned by all the processes.
+ *
+ * \since 1.8.10
+ *
+ */
H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause,
uint32_t *global_no_collective_cause);
#endif /* H5_HAVE_PARALLEL */
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets a hyperslab file selection for a dataset I/O operation
+ *
+ * \param[in] plist_id Property list identifier
+ * \param[in] rank Number of dimensions of selection
+ * \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 H5Pset_dataset_io_hyperslab_selection() is designed to be used
+ * in conjunction with using #H5S_PLIST for the file dataspace
+ * ID when making a call to H5Dread() or H5Dwrite(). When used
+ * with #H5S_PLIST, the selection created by one or more calls to
+ * this routine is used for determining which dataset elements to
+ * access.
+ *
+ * \p rank is the dimensionality of the selection and determines
+ * the size of the \p start, \p stride, \p count, and \p block arrays.
+ * \p rank must be between 1 and #H5S_MAX_RANK, inclusive.
+ *
+ * The \p op, \p start, \p stride, \p count, and \p block parameters
+ * behave identically to their behavior for H5Sselect_hyperslab(),
+ * please see the documentation for that routine for details about
+ * their use.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op,
+ const hsize_t start[], const hsize_t stride[],
+ const hsize_t count[], const hsize_t block[]);
/* Link creation property list (LCPL) routines */
/**
@@ -5880,6 +8231,36 @@ H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_int
H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
/* Group creation property list (GCPL) routines */
+
+/**
+ * \ingroup GCPL
+ *
+ * \brief Returns the estimated link count and average link name length in a group
+ *
+ * \gcpl_id{plist_id}
+ * \param[out] est_num_entries The estimated number of links in the group
+ * referenced by \p plist_id
+ * \param[out] est_name_len The estimated average length of line names in the group
+ * referenced by \p plist_id
+ * \return \herr_t
+ *
+ * \details H5Pget_est_link_info() retrieves two settings from the group creation
+ * property list \p plist_id: the estimated number of links that are
+ * expected to be inserted into a group created with the property list
+ * and the estimated average length of those link names.
+ *
+ * The estimated number of links is returned in \p est_num_entries. The
+ * limit for \p est_num_entries is 64 K.
+ *
+ * The estimated average length of the anticipated link names is returned
+ * in \p est_name_len. The limit for \p est_name_len is 64 K.
+ *
+ * See \ref_group_impls for a discussion of the available types of HDF5
+ * group structures.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */,
unsigned *est_name_len /* out */);
/**
@@ -5949,7 +8330,64 @@ H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_fla
*/
H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/,
unsigned *min_dense /*out*/);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Retrieves the anticipated size of the local heap for original-style
+ * groups
+ *
+ * \gcpl_id{plist_id}
+ * \param[out] size_hint Anticipated size of local heap
+ * \return \herr_t
+ *
+ * \details H5Pget_local_heap_size_hint() queries the group creation property
+ * list, \p plist_id, for the anticipated size of the local heap, \p
+ * size_hint, for original-style groups, i.e., for groups of the style
+ * used prior to HDF5 Release 1.8.0. See H5Pset_local_heap_size_hint()
+ * for further discussion.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Sets estimated number of links and length of link names in a group
+ *
+ * \gcpl_id{plist_id}
+ * \param[in] est_num_entries Estimated number of links to be inserted into group
+ * \param[in] est_name_len Estimated average length of link names
+ * \return \herr_t
+ *
+ * \details H5Pset_est_link_info() inserts two settings into the group creation
+ * property list plist_id: the estimated number of links that are
+ * expected to be inserted into a group created with the property list
+ * and the estimated average length of those link names.
+ *
+ * The estimated number of links is passed in \p est_num_entries. The
+ * limit for \p est_num_entries is 64 K.
+ *
+ * The estimated average length of the anticipated link names is passed
+ * in \p est_name_len. The limit for \p est_name_len is 64 K.
+ *
+ * The values for these two settings are multiplied to compute the
+ * initial local heap size (for old-style groups, if the local heap
+ * size hint is not set) or the initial object header size for
+ * (new-style compact groups; see \ref_group_impls). Accurately setting
+ * these parameters will help reduce wasted file space.
+ *
+ * If a group is expected to have many links and to be stored in dense
+ * format, set \p est_num_entries to 0 (zero) for maximum
+ * efficiency. This will prevent the group from being created in the
+ * compact format.
+ *
+ * See \ref_group_impls for a discussion of the available types of HDF5
+ * group structures.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len);
/**
* \ingroup GCPL
@@ -6043,11 +8481,115 @@ H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flag
*
*/
H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
+/**
+ * \ingroup GCPL
+ *
+ * \brief Specifies the anticipated maximum size of a local heap
+ *
+ * \gcpl_id{plist_id}
+ * \param[in] size_hint Anticipated maximum size in bytes of local heap
+ * \return \herr_t
+ *
+ * \details H5Pset_local_heap_size_hint() is used with original-style HDF5
+ * groups (see “Motivation” below) to specify the anticipated maximum
+ * local heap size, size_hint, for groups created with the group
+ * creation property list \p plist_id. The HDF5 library then uses \p
+ * size_hint to allocate contiguous local heap space in the file for
+ * each group created with \p plist_id.
+ *
+ * For groups with many members or very few members, an appropriate
+ * initial value of \p size_hint would be the anticipated number of
+ * group members times the average length of group member names, plus a
+ * small margin:
+ * \code
+ * size_hint = max_number_of_group_members *
+ * (average_length_of_group_member_link_names + 2)
+ * \endcode
+ * If it is known that there will be groups with zero members, the use
+ * of a group creation property list with \p size_hint set to to 1 (one)
+ * will guarantee the smallest possible local heap for each of those groups.
+ *
+ * Setting \p size_hint to zero (0) causes the library to make a
+ * reasonable estimate for the default local heap size.
+ *
+ * \par Motivation:
+ * In situations where backward-compatibility is required, specifically, when
+ * libraries prior to HDF5 Release 1.8.0 may be used to read the file, groups
+ * must be created and maintained in the original style. This is HDF5’s default
+ * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern,
+ * greater efficiencies can be obtained with the new-format compact and indexed
+ * groups. See <a href="https://portal.hdfgroup.org/display/HDF5/Groups">Group
+ * implementations in HDF5</a> in the \ref H5G API introduction (at the bottom).\n
+ * H5Pset_local_heap_size_hint() is useful for tuning file size when files
+ * contain original-style groups with either zero members or very large
+ * numbers of members.\n
+ * The original style of HDF5 groups, the only style available prior to HDF5
+ * Release 1.8.0, was well-suited for moderate-sized groups but was not optimized
+ * for either very small or very large groups. This original style remains the
+ * default, but two new group implementations were introduced in HDF5 Release 1.8.0:
+ * compact groups to accommodate zero to small numbers of members and indexed groups
+ * for thousands or tens of thousands of members ... or millions, if that's what
+ * your application requires.\n
+ * The local heap size hint, \p size_hint, is a performance tuning parameter for
+ * original-style groups. As indicated above, an HDF5 group may have zero, a handful,
+ * or tens of thousands of members. Since the original style of HDF5 groups stores the
+ * metadata for all of these group members in a uniform format in a local heap, the size
+ * of that metadata (and hence, the size of the local heap) can vary wildly from group
+ * to group. To intelligently allocate space and to avoid unnecessary fragmentation of
+ * the local heap, it can be valuable to provide the library with a hint as to the local
+ * heap’s likely eventual size. This can be particularly valuable when it is known that
+ * a group will eventually have a great many members. It can also be useful in conserving
+ * space in a file when it is known that certain groups will never have any members.
+ *
+ * \since 1.8.0
+ *
+ */
H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint);
/* Map access property list (MAPL) routines */
#ifdef H5_HAVE_MAP_API
+/**
+ * \ingroup MAPL
+ *
+ * \brief Set map iteration hints
+ *
+ * \mapl_id
+ * \param[in] key_prefetch_size Number of keys to prefetch at a time during
+ * iteration
+ * \param[in] key_alloc_size The initial size of the buffer allocated to hold
+ * prefetched keys
+ * \return \herr_t
+ *
+ * \details H5Pset_map_iterate_hints() adjusts the behavior of H5Miterate() when
+ * prefetching keys for iteration. The \p key_prefetch_size parameter
+ * specifies the number of keys to prefetch at a time during
+ * iteration. The \p key_alloc_size parameter specifies the initial
+ * size of the buffer allocated to hold these prefetched keys. If this
+ * buffer is too small it will be reallocated to a larger size, though
+ * this may result in an additional I/O.
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size);
+/**
+ * \ingroup MAPL
+ *
+ * \brief Set map iteration hints
+ *
+ * \mapl_id
+ * \param[out] key_prefetch_size Pointer to number of keys to prefetch at a time
+ * during iteration
+ * \param[out] key_alloc_size Pointer to the initial size of the buffer allocated
+ * to hold prefetched keys
+ * \return \herr_t
+ *
+ * \details H5Pget_map_iterate() returns the map iterate hints, \p key_prefetch_size
+ * and \p key_alloc_size, as set by H5Pset_map_iterate_hints().
+ *
+ * \since 1.12.0
+ *
+ */
H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/,
size_t *key_alloc_size /*out*/);
#endif /* H5_HAVE_MAP_API */
@@ -6409,9 +8951,6 @@ H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags);
* </pre>
*
*
- * \todo Add Programming Note for C++ Developers Using C Functions
- *
- *
* \since 1.8.3
*
*/
@@ -6594,10 +9133,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
* \li H5Pget_mcdt_search_cb()
* \li H5Pset_copy_object()
* \li H5Pset_mcdt_search_cb()
- *
- * \todo missing link to "Copying Committed Datatypes with H5Ocopy - A
- * comprehensive discussion of copying committed datatypes (PDF)
- * in Advanced Topics in HDF5
+ * \li \ref_h5ocopy
*
* \since 1.8.9
*
@@ -6711,8 +9247,7 @@ H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/)
* \li H5Pget_mcdt_search_cb()
* \li H5Pset_copy_object()
* \li H5Pset_mcdt_search_cb()
- *
- * \todo Link to Copying Committed Datatypes with H5Ocopy was removed.
+ * \li \ref_h5ocopy
*
* \since 1.8.9
*
@@ -6803,8 +9338,8 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func,
* \li H5Pget_mcdt_search_cb()
* \li H5Pset_copy_object()
* \li H5Pset_mcdt_search_cb()
+ * \li \ref_h5ocopy
*
- * \todo Link to Copying Committed Datatypes with H5Ocopy was removed.
* \version 1.8.9 #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG added in this release.
*
* \since 1.8.0
@@ -6890,9 +9425,7 @@ H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned copy_options);
* \li H5Pget_mcdt_search_cb()
* \li H5Pset_copy_object()
* \li H5Pset_mcdt_search_cb()
- *
- * \todo Link removed to "Copying Committed Datatypes with H5Ocopy" in Advanced Topics in HDF5
- * \todo Programming Note for C++ Developers Using C Functions:
+ * \li \ref_h5ocopy
*
* \since 1.8.9
*
@@ -6911,38 +9444,312 @@ H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, v
#define H5P_NO_CLASS H5P_ROOT
/* Typedefs */
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a permanent property with a property list class
+ *
+ * \plistcls_id{cls_id}
+ * \param[in] name Name of property to register
+ * \param[in] size Size of property in bytes
+ * \param[in] def_value Default value for property in newly created
+ * property lists
+ * \param[in] prp_create Callback routine called when a property list is
+ * being created and the property value will be
+ * initialized
+ * \param[in] prp_set Callback routine called before a new value is
+ * copied into the property's value
+ * \param[in] prp_get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_del Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] prp_copy Callback routine called when a property is copied
+ * from a property list
+ * \param[in] prp_close Callback routine called when a property list is
+ * being closed and the property value will be
+ * disposed of
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pregister2() or the macro H5Pregister().
+ *
+ * \details H5Pregister1() registers a new property with a property list
+ * class. The property will exist in all property list objects
+ * of that class after this routine is finished. The name of
+ * the property must not already exist. The default property
+ * value must be provided and all new property lists created
+ * with this property will have the property value set to the
+ * default provided. Any of the callback routines may be set
+ * to NULL if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data in
+ * the property list. These may be used as flags to indicate the
+ * presence or absence of a particular piece of information. The
+ * default pointer for a zero-sized property may be set to NULL.
+ * The property \p prp_create and \p prp_close callbacks are called for
+ * zero-sized properties, but the \p prp_set and \p prp_get callbacks
+ * are never called.
+ *
+ * The \p prp_create routine is called when a new property list with
+ * this property is being created. The #H5P_prp_create_func_t
+ * callback function is defined as #H5P_prp_cb1_t.
+ *
+ * The \p prp_create routine may modify the value to be set and those
+ * changes will be stored as the initial value of the property.
+ * If the \p prp_create routine returns a negative value, the new
+ * property value is not copied into the property and the
+ * \p prp_create routine returns an error value.
+ *
+ * The \p prp_set routine is called before a new value is copied into
+ * the property. The #H5P_prp_set_func_t callback function is defined
+ * as #H5P_prp_cb2_t.
+ *
+ * The \p prp_set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p prp_set routine returns a negative value, the new property
+ * value is not copied into the property and the \p prp_set routine
+ * returns an error value. The \p prp_set routine will not be called
+ * for the initial value; only the \p prp_create routine will be
+ * called.
+ *
+ * \b Note: The \p prp_set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p prp_get
+ * callback would then reverse the transformation or translation.
+ * A single \p prp_get or \p prp_set callback could handle multiple
+ * properties by performing different actions based on the property
+ * name or other properties in the property list.
+ *
+ * The \p prp_get routine is called when a value is retrieved from a
+ * property value. The #H5P_prp_get_func_t callback function is
+ * defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_get routine may modify the value to be returned from the
+ * query and those changes will be returned to the calling routine.
+ * If the \p prp_set routine returns a negative value, the query
+ * routine returns an error value.
+ *
+ * The \p prp_del routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_del routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_del routine
+ * returns. If the \p prp_del routine returns a negative value,
+ * the property list deletion routine returns an error value but
+ * the property is still deleted.
+ *
+ * The \p prp_copy routine is called when a new property list with
+ * this property is being created through a \p prp_copy operation.
+ * The #H5P_prp_copy_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If
+ * the \p prp_copy routine returns a negative value, the new
+ * property value is not copied into the property and the \p prp_copy
+ * routine returns an error value.
+ *
+ * The \p prp_close routine is called when a property list with this
+ * property is being closed. The #H5P_prp_close_func_t callback
+ * function is defined as #H5P_prp_cb1_t.
+ *
+ * The \p prp_close routine may modify the value passed in, but the
+ * value is not used by the library when the \p prp_close routine
+ * returns. If the \p prp_close routine returns a negative value, the
+ * property list close routine returns an error value but the property
+ * list is still closed.
+ *
+ * The #H5P_prp_cb1_t is as follows:
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The #H5P_prp_cb2_t is as follows:
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ */
/* Function prototypes */
H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value,
H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del,
H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close);
+/**
+ * \ingroup GPLOA
+ *
+ * \brief Registers a temporary property with a property list
+ *
+ * \plist_id
+ * \param[in] name Name of property to create
+ * \param[in] size Size of property in bytes
+ * \param[in] value Initial value for the property
+ * \param[in] prp_set Callback routine called before a new value is copied
+ * into the property's value
+ * \param[in] prp_get Callback routine called when a property value is
+ * retrieved from the property
+ * \param[in] prp_delete Callback routine called when a property is deleted
+ * from a property list
+ * \param[in] prp_copy Callback routine called when a property is copied
+ * from an existing property list
+ * \param[in] prp_close Callback routine called when a property list is
+ * being closed and the property value will be disposed
+ * of
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pinsert2() or the macro H5Pinsert().
+ *
+ * \details H5Pinsert1() creates a new property in a property
+ * list. The property will exist only in this property list and
+ * copies made from it.
+ *
+ * The initial property value must be provided in \p value and
+ * the property value will be set accordingly.
+ *
+ * The name of the property must not already exist in this list,
+ * or this routine will fail.
+ *
+ * The \p prp_set and \p prp_get callback routines may be set to NULL
+ * if they are not needed.
+ *
+ * Zero-sized properties are allowed and do not store any data
+ * in the property list. The default value of a zero-size
+ * property may be set to NULL. They may be used to indicate the
+ * presence or absence of a particular piece of information.
+ *
+ * The \p prp_set routine is called before a new value is copied
+ * into the property. The #H5P_prp_set_func_t callback function
+ * is defined as #H5P_prp_cb2_t.
+ * The \p prp_set routine may modify the value pointer to be set and
+ * those changes will be used when setting the property's value.
+ * If the \p prp_set routine returns a negative value, the new property
+ * value is not copied into the property and the \p set routine
+ * returns an error value. The \p prp_set routine will be called for
+ * the initial value.
+ *
+ * \b Note: The \p prp_set callback function may be useful to range
+ * check the value being set for the property or may perform some
+ * transformation or translation of the value set. The \p prp_get
+ * callback would then reverse the transformation or translation.
+ * A single \p prp_get or \p prp_set callback could handle multiple
+ * properties by performing different actions based on the
+ * property name or other properties in the property list.
+ *
+ * The \p prp_get routine is called when a value is retrieved from
+ * a property value. The #H5P_prp_get_func_t callback function
+ * is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_get routine may modify the value to be returned from
+ * the query and those changes will be preserved. If the \p prp_get
+ * routine returns a negative value, the query routine returns
+ * an error value.
+ *
+ * The \p prp_delete routine is called when a property is being
+ * deleted from a property list. The #H5P_prp_delete_func_t
+ * callback function is defined as #H5P_prp_cb2_t.
+ *
+ * The \p prp_copy routine is called when a new property list with
+ * this property is being created through a \p prp_copy operation.
+ * The #H5P_prp_copy_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_copy routine may modify the value to be set and those
+ * changes will be stored as the new value of the property. If the
+ * \p prp_copy routine returns a negative value, the new property value
+ * is not copied into the property and the prp_copy routine returns an
+ * error value.
+ *
+ * The \p prp_close routine is called when a property list with this
+ * property is being closed.
+ * The #H5P_prp_close_func_t callback function is defined as
+ * #H5P_prp_cb1_t.
+ *
+ * The \p prp_close routine may modify the value passed in, the
+ * value is not used by the library when the close routine
+ * returns. If the \p prp_close routine returns a negative value,
+ * the property list \p prp_close routine returns an error value
+ * but the property list is still closed.
+ *
+ * \b Note: There is no \p prp_create callback routine for temporary
+ * property list objects; the initial value is assumed to
+ * have any necessary setup already performed on it.
+ *
+ * The #H5P_prp_cb1_t is as follows:
+ * \snippet this H5P_prp_cb1_t_snip
+ *
+ * The #H5P_prp_cb2_t is as follows:
+ * \snippet this H5P_prp_cb2_t_snip
+ *
+ */
H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy,
H5P_prp_close_func_t prp_close);
+/**
+ * \ingroup GPLO
+ *
+ * \brief Encodes the property values in a property list into a binary
+ * buffer
+ *
+ * \plist_id
+ * \param[out] buf Buffer into which the property list will be encoded.
+ * If the provided buffer is NULL, the size of the
+ * buffer required is returned through \p nalloc; the
+ * function does nothing more.
+ * \param[out] nalloc The size of the required buffer
+ *
+ * \return \herr_t
+ *
+ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
+ * H5Pencode2() or the macro H5Pencode().
+ *
+ * \details H5Pencode1() encodes the property list \p plist_id into the
+ * binary buffer \p buf.
+ *
+ * If the required buffer size is unknown, \p buf can be passed
+ * in as NULL and the function will set the required buffer size
+ * in \p nalloc. The buffer can then be created and the property
+ * list encoded with a subsequent H5Pencode1() call.
+ *
+ * If the buffer passed in is not big enough to hold the encoded
+ * properties, the H5Pencode1() call can be expected to fail with
+ * a segmentation fault.
+ *
+ * Properties that do not have encode callbacks will be skipped.
+ * There is currently no mechanism to register an encode callback for
+ * a user-defined property, so user-defined properties cannot currently
+ * be encoded.
+ *
+ * Some properties cannot be encoded, particularly properties that are
+ * reliant on local context.
+ *
+ * \since 1.10.0
+ *
+ */
H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
/**
- * \ingroup OCPL
+ * \ingroup DCPL
*
* \brief Returns information about a filter in a pipeline (DEPRECATED)
*
- * \todo H5Pget_filter1() prototype does not match source in H5Pocpl.c.
- * Also, it is not in a deprecated file. Is that okay?
+ *
*
* \plist_id{plist_id}
- * \param[in] filter Sequence number within the filter pipeline of the filter
- * for which information is sought
- * \param[out] flags Bit vector specifying certain general properties of
- * the filter
+ * \param[in] filter Sequence number within the filter pipeline of
+ * the filter for which information is sought
+ * \param[out] flags Bit vector specifying certain general properties
+ * of the filter
* \param[in,out] cd_nelmts Number of elements in \p cd_values
- * \param[out] cd_values Auxiliary data for the filter
- * \param[in] namelen Anticipated number of characters in \p name
- * \param[out] name Name of the filter
+ * \param[out] cd_values Auxiliary data for the filter
+ * \param[in] namelen Anticipated number of characters in \p name
+ * \param[out] name Name of the filter
*
* \return Returns the filter identifier if successful; Otherwise returns
* a negative value. See: #H5Z_filter_t
*
+ * \deprecated When was this function deprecated?
+ *
* \details H5Pget_filter1() returns information about a filter, specified
* by its filter number, in a filter pipeline, specified by the
* property list with which it is associated.
@@ -6977,13 +9784,127 @@ H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc);
H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter, unsigned int *flags /*out*/,
size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
char name[]);
-H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
- size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
- char name[] /*out*/);
-H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/,
- unsigned *stab /*out*/, unsigned *shhdr /*out*/);
-H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
-H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
+/**
+ * \ingroup DCPL
+ *
+ * \brief Returns information about the specified filter
+ *
+ * \plist_id{plist_id}
+ * \param[in] id Filter identifier
+ * \param[out] flags Bit vector specifying certain general properties
+ * of the filter
+ * \param[in,out] cd_nelmts Number of elements in \p cd_values
+ * \param[out] cd_values Auxiliary data for the filter
+ * \param[in] namelen Anticipated number of characters in \p name
+ * \param[out] name Name of the filter
+ *
+ *
+ * \return Returns a non-negative value if successful; Otherwise returns
+ * a negative value.
+ *
+ * \deprecated As of HDF5-1.8 this function was deprecated in favor of
+ * H5Pget_filter_by_id2() or the macro H5Pget_filter_by_id().
+ *
+ * \details H5Pget_filter_by_id1() returns information about a filter, specified
+ * in \p id, a filter identifier.
+ *
+ * \p plist_id must be a dataset or group creation property list and
+ * \p id must be in the associated filter pipeline.
+ *
+ * The \p id and \p flags parameters are used in the same
+ * manner as described in the discussion of H5Pset_filter().
+ *
+ * Aside from the fact that they are used for output, the parameters
+ * \p cd_nelmts and \p cd_values[] are used in the same manner as
+ * described in the discussion of H5Pset_filter().
+ * On input, the \p cd_nelmts parameter indicates the number of entries
+ * in the \p cd_values[] array allocated by the calling program;
+ * on exit it contains the number of values defined by the filter.
+ *
+ * On input, the \p namelen parameter indicates the number of
+ * characters allocated for the filter name by the calling program
+ * in the array \p name[]. On exit \p name[] contains the name of the
+ * filter with one character of the name in each element of the array.
+ *
+ * If the filter specified in \p id is not set for the property
+ * list, an error will be returned and this function will fail.
+ *
+ *
+ * \version 1.8.5 Function extended to work with group creation property
+ * lists.
+ * \version 1.8.0 Function H5Pget_filter_by_id() renamed to
+ * H5Pget_filter_by_id1() and deprecated in this release.
+ * \version 1.6.0 Function introduced in this release.
+ */
+H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/,
+ size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen,
+ char name[] /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the version information of various objects
+ * for a file creation property list(deprecated)
+ *
+ * \plist_id
+ * \param[out] boot Pointer to location to return super block version number
+ * \param[out] freelist Pointer to location to return global freelist version number
+ * \param[out] stab Pointer to location to return symbol table version number
+ * \param[out] shhdr Pointer to location to return shared object header version
+ * number
+ *
+ * \return \herr_t
+ *
+ * \deprecated Deprecated in favor of the function H5Fget_info()
+ *
+ * \details H5Pget_version() retrieves the version information of various objects
+ * for a file creation property list. Any pointer parameters which are
+ * passed as NULL are not queried.
+ *
+ * \version 1.6.4 \p boot, \p freelist, \p stab, \p shhdr parameter types
+ * changed to unsigned.
+ *
+ */
+H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/,
+ unsigned *stab /*out*/, unsigned *shhdr /*out*/);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Sets the file space handling strategy and the free-space section
+ * size threshold.
+ *
+ * \fcpl_id{plist_id}
+ * \param[in] strategy The file space handling strategy to be used. See:
+ * #H5F_fspace_strategy_t
+ * \param[in] threshold The smallest free-space section size that the free
+ * space manager will track
+ *
+ * \return \herr_t
+ *
+ * \deprecated When was this function deprecated?
+ *
+ * \details Maps to the function H5Pset_file_space_strategy().
+ *
+ */
+H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
+/**
+ * \ingroup FCPL
+ *
+ * \brief Retrieves the file space handling strategy, and threshold value for
+ * a file creation property list
+ *
+ * \fcpl_id{plist_id}
+ * \param[out] strategy Pointer to the file space handling strategy
+ * \param[out] threshold Pointer to the free-space section size threshold value
+ *
+ * \return \herr_t
+ *
+ * \deprecated When was this function deprecated?
+ *
+ * \details Maps to the function H5Pget_file_space_strategy()
+ *
+ *
+ */
+H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
diff --git a/src/H5R.c b/src/H5R.c
index 5301743..102af7f 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -79,14 +79,16 @@ static hid_t H5R__open_attr_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t
herr_t
H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr);
@@ -121,9 +123,12 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -132,15 +137,18 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
- if (H5R__create_object((const H5O_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) <
- 0)
+ if (H5R__create_object(&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference")
/* Attach loc_id to reference and hold reference to it */
@@ -167,15 +175,17 @@ done:
herr_t
H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- struct H5S_t * space = NULL; /* Pointer to dataspace containing region */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ struct H5S_t * space = NULL; /* Pointer to dataspace containing region */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr);
@@ -185,7 +195,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if ((space_id == H5I_BADID) || (space_id == H5S_ALL))
+ if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL) || (space_id == H5S_BLOCK))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
@@ -214,9 +224,12 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -225,9 +238,13 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
@@ -259,14 +276,16 @@ done:
herr_t
H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr);
@@ -303,9 +322,12 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -314,9 +336,13 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
@@ -584,7 +610,7 @@ H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_li
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID")
@@ -611,15 +637,16 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo
hid_t loc_id; /* Reference location ID */
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
- (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5I_type_t opened_type; /* Opened object type */
- void * opened_obj = NULL; /* Opened object */
- hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
- H5S_t * space = NULL; /* Dataspace pointer (copy) */
- hid_t space_id = H5I_INVALID_HID; /* Dataspace ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void * opened_obj = NULL; /* Opened object */
+ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
+ H5S_t * space = NULL; /* Dataspace pointer (copy) */
+ hid_t space_id = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -662,10 +689,14 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo
if (NULL == (opened_obj = H5VL_vol_object(opened_obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get dataspace from object */
- if (H5VL_dataset_get(opened_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &space_id) < 0)
+ if (H5VL_dataset_get(opened_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace from dataset")
+ space_id = vol_cb_args.args.get_space.space_id;
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
@@ -746,7 +777,7 @@ H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_li
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on region ID")
@@ -915,7 +946,7 @@ H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID,
@@ -940,11 +971,12 @@ done:
herr_t
H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/)
{
- hid_t loc_id; /* Reference location ID */
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*Rrix", ref_ptr, rapl_id, obj_type);
@@ -959,11 +991,10 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Retrieve loc_id from reference */
- if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr)))
/* Attempt to re-open file and pass rapl_id as a fapl_id */
if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, FAIL, "cannot re-open referenced file")
- }
/* Get object token */
if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
@@ -978,9 +1009,12 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
done:
@@ -1021,15 +1055,27 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name")
}
else {
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t file_name_len = 0; /* Length of file name */
/* Retrieve VOL file object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5I_FILE,
- size, buf, &ret_value) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
+ /* Get file name */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get file name")
+
+ /* Set return value */
+ ret_value = (ssize_t)file_name_len;
}
done:
@@ -1049,11 +1095,13 @@ done:
ssize_t
H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t size)
{
- hid_t loc_id; /* Reference location ID */
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- ssize_t ret_value = 0; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = 0; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE4("Zs", "*Rrixz", ref_ptr, rapl_id, buf, size);
@@ -1068,11 +1116,10 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list")
/* Retrieve loc_id from reference */
- if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr)))
/* Attempt to re-open file and pass rapl_id as a fapl_id */
if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, (-1), "cannot re-open referenced file")
- }
/* Get object token */
if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
@@ -1087,11 +1134,19 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* 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, buf, size) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_obj_name() */
diff --git a/src/H5RS.c b/src/H5RS.c
index 96d55e7..d9915f2 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -349,7 +349,7 @@ done:
* format_templ in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
H5_ATTR_FORMAT(printf, 2, 3)
herr_t
H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...)
@@ -392,7 +392,7 @@ H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_asprintf_cat() */
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5RS_acat
@@ -698,7 +698,7 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
const H5RS_str_t *rs; IN: Ref-counted string to compute length of
RETURNS
- Returns non-negative value on success, negative value on failure
+ Returns non-negative value on success, can't fail
DESCRIPTION
Compute the length of a ref-counted string. [same as strlen()]
GLOBAL VARIABLES
@@ -706,7 +706,7 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-ssize_t
+size_t
H5RS_len(const H5RS_str_t *rs)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -715,7 +715,7 @@ H5RS_len(const H5RS_str_t *rs)
HDassert(rs);
HDassert(rs->s);
- FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s))
+ FUNC_LEAVE_NOAPI(HDstrlen(rs->s))
} /* end H5RS_len() */
/*--------------------------------------------------------------------------
diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h
index 7d2b728..ebca1a3 100644
--- a/src/H5RSprivate.h
+++ b/src/H5RSprivate.h
@@ -53,7 +53,7 @@ H5_DLL herr_t H5RS_acat(H5RS_str_t *rs, const char *s);
H5_DLL herr_t H5RS_ancat(H5RS_str_t *rs, const char *s, size_t len);
H5_DLL herr_t H5RS_aputc(H5RS_str_t *rs, int c);
H5_DLL int H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2);
-H5_DLL ssize_t H5RS_len(const H5RS_str_t *rs);
+H5_DLL size_t H5RS_len(const H5RS_str_t *rs);
H5_DLL char * H5RS_get_str(const H5RS_str_t *rs);
H5_DLL unsigned H5RS_get_count(const H5RS_str_t *rs);
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index b5d0d44..3f1d70f 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -94,7 +94,8 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
H5VL_object_t * vol_obj_file = NULL;
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED;
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -119,9 +120,12 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
if (ref_type == H5R_OBJECT1) {
@@ -240,13 +244,14 @@ done:
H5G_obj_t
H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5O_type_t obj_type; /* Object type */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
- H5G_obj_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference buffer */
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN; /* Type of the referenced object */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
@@ -274,9 +279,12 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = &obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type")
/* Set return value */
@@ -365,15 +373,17 @@ done:
herr_t
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- void * vol_obj_file = NULL;
- unsigned char * buf = (unsigned char *)ref; /* Return reference pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ void * vol_obj_file = NULL;
+ unsigned char * buf = (unsigned char *)ref; /* Return reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
@@ -417,9 +427,13 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Get the file for the object */
@@ -430,9 +444,12 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Create reference */
@@ -449,7 +466,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
/* Retrieve space */
- if (space_id == H5I_BADID)
+ if (space_id == H5I_INVALID_HID)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
@@ -483,12 +500,13 @@ done:
herr_t
H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iRt*xx", id, ref_type, ref, obj_type);
@@ -516,9 +534,12 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
done:
@@ -612,12 +633,13 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
void * vol_obj_file = NULL; /* VOL file */
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- H5F_t * f = NULL; /* Native file */
- size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Reference buffer size */
- H5S_t * space = NULL; /* Dataspace object */
- hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
- hid_t ret_value; /* Return value */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5F_t * f = NULL; /* Native file */
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Reference buffer size */
+ H5S_t * space = NULL; /* Dataspace object */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
@@ -658,9 +680,12 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info")
/* Retrieve file from VOL object */
@@ -695,12 +720,14 @@ done:
ssize_t
H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "iRt*xxz", id, ref_type, ref, name, size);
@@ -728,11 +755,19 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/,
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* 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)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_name() */
diff --git a/src/H5Rint.c b/src/H5Rint.c
index b714f09..e1a5dcd 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -588,11 +588,18 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
supported = 0;
if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
- if (supported & H5VL_OPT_QUERY_SUPPORTED)
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN;
+ vol_cb_args.args = NULL;
+
+ /* Make the 'post open' callback */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID,
"unable to make file 'post open' callback")
+ } /* end if */
/* Attach loc_id to reference */
if (H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0)
diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h
index 2a34d56..fe28bb2 100644
--- a/src/H5Rmodule.h
+++ b/src/H5Rmodule.h
@@ -27,9 +27,32 @@
/**
* \defgroup H5R H5R
- * \brief Reference Interface
- * \details The HDF5 Reference Interface, H5R, provides a mechanism for managing
- * HDF5 referenced objects.
+ *
+ * Use the functions in this module to manage HDF5 references. Referents can
+ * be HDF5 objects, attributes, and selections on datasets a.k.a. dataset
+ * regions.
+ *
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5R_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5R_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5R_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5R_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5Rmodule_H */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 5d356e9..ef798ea 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -30,9 +30,11 @@
#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
-/* Default reference buffer size.
- * Note! Be careful with the sizes of the references because they should really
- * depend on the run-time values in the file.
+/**
+ * Default reference buffer size.
+ *
+ * \internal Note! Be careful with the sizes of the references because they
+ * should really depend on the run-time values in the file.
*/
#define H5R_REF_BUF_SIZE (64)
@@ -40,40 +42,54 @@
/* Public Typedefs */
/*******************/
-/*
+//! <!-- [H5R_type_t_snip] -->
+/**
* Reference types allowed.
- * DO NOT CHANGE THE ORDER or VALUES as reference type values are encoded into
- * the datatype message header.
+ *
+ * \internal DO NOT CHANGE THE ORDER or VALUES as reference type values are
+ * encoded into the datatype message header.
*/
typedef enum {
- H5R_BADTYPE = (-1), /* Invalid reference type */
- H5R_OBJECT1 = 0, /* Backward compatibility (object) */
- H5R_DATASET_REGION1 = 1, /* Backward compatibility (region) */
- H5R_OBJECT2 = 2, /* Object reference */
- H5R_DATASET_REGION2 = 3, /* Region reference */
- H5R_ATTR = 4, /* Attribute Reference */
- H5R_MAXTYPE = 5 /* Highest type (invalid) */
+ H5R_BADTYPE = (-1), /**< Invalid reference type */
+ H5R_OBJECT1 = 0, /**< Backward compatibility (object) */
+ H5R_DATASET_REGION1 = 1, /**< Backward compatibility (region) */
+ H5R_OBJECT2 = 2, /**< Object reference */
+ H5R_DATASET_REGION2 = 3, /**< Region reference */
+ H5R_ATTR = 4, /**< Attribute Reference */
+ H5R_MAXTYPE = 5 /**< Highest type (invalid) */
} H5R_type_t;
+//! <!-- [H5R_type_t_snip] -->
/* Deprecated types are kept for backward compatibility with previous versions */
+//! <!-- [hobj_ref_t_snip] -->
/**
- * Deprecated object reference type that is used with deprecated reference APIs.
- * Note! This type can only be used with the "native" HDF5 VOL connector.
+ * \deprecated Deprecated object reference type that is used with deprecated
+ * reference APIs.
+ *
+ * \note This type can only be used with the "native" HDF5 VOL connector.
*/
typedef haddr_t hobj_ref_t;
+//! <!-- [hobj_ref_t_snip] -->
+//! <!-- [hdset_reg_ref_t_snip] -->
/**
- * Dataset region reference type that is used with deprecated reference APIs.
- * (Buffer to store heap ID and index)
- * This needs to be large enough to store largest haddr_t in a worst case
+ * Buffer to store heap ID and index
+ *
+ * This needs to be large enough to store largest #haddr_t in a worst case
* machine (8 bytes currently) plus an int.
- * Note! This type can only be used with the "native" HDF5 VOL connector.
+ *
+ * \deprecated Dataset region reference type that is used with deprecated
+ * reference APIs.
+ *
+ * \note This type can only be used with the "native" HDF5 VOL connector.
*/
typedef struct {
uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE];
} hdset_reg_ref_t;
+//! <!-- [hdset_reg_ref_t_snip] -->
+//! <!-- [H5R_ref_t_snip] -->
/**
* Opaque reference type. The same reference type is used for object,
* dataset region and attribute references. This is the type that
@@ -81,10 +97,11 @@ typedef struct {
*/
typedef struct {
union {
- uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */
- int64_t align; /* ensures alignment */
+ uint8_t __data[H5R_REF_BUF_SIZE]; /**< opaque data */
+ int64_t align; /**< ensures alignment */
} u;
} H5R_ref_t;
+//! <!-- [H5R_ref_t_snip] -->
/********************/
/* Public Variables */
@@ -121,8 +138,8 @@ extern "C" {
* must be of the same type as the object being referenced, that is
* a group, dataset or committed datatype property list.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
* H5Rdestroy() should be used to release the resource from the
* reference.
@@ -157,14 +174,12 @@ H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5
* must be of the same type as the object being referenced, that is
* a dataset property list in this case.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
* H5Rdestroy() should be used to release the resource from the
* reference.
*
- * \see function_name()
- *
*/
H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
H5R_ref_t *ref_ptr);
@@ -196,8 +211,8 @@ H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, h
* as that object, that is a group, dataset or committed datatype
* property list.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
* H5Rdestroy() should be used to release the resource from the
* reference.
@@ -216,12 +231,12 @@ H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_na
*
* \return \herr_t
*
- * \details Given a reference, ref_ptr, to an object, region or attribute
- * attached to an object, H5R_DESTROY releases allocated resources
+ * \details Given a reference, \p ref_ptr, to an object, region or attribute
+ * attached to an object, H5Rdestroy() releases allocated resources
* from a previous create call.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
*/
H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
@@ -236,23 +251,20 @@ H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
*
* \param[in] ref_ptr Pointer to reference
*
- * \return Returns a valid reference type if successful; otherwise returns #H5R_UNKNOWN.
+ * \return Returns a valid reference type if successful; otherwise returns #H5R_BADTYPE .
*
* \details Given a reference, \p ref_ptr, H5Rget_type() returns the
* type of the reference.
*
* Valid returned reference types are:
+ * \snippet this H5R_type_t_snip
*
- * #H5R_OBJECT2 Object reference version 2
- * #H5R_DATASET_REGION2 Region reference version 2
- * #H5R_ATTRIBUTE Attribute reference
- *
- * Note that #H5R_OBJECT1 and #H5R_DATASET REGION1 can never be
- * associated to an H5R_ref_t reference and can therefore never be
+ * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be
+ * associated to an \ref H5R_ref_t reference and can therefore never be
* returned through that function.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
*/
H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
@@ -273,8 +285,8 @@ H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
* \details H5Requal() determines whether two references point to the
* same object, region or attribute.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
*/
H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
@@ -320,8 +332,8 @@ H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
* must be of the same type as the object being referenced, that is
* a group or dataset property list.
*
- * H5R_ref_t is defined in H5Rpublic.h as: typedef unsigned char
- * H5R_ref_t[#H5R_REF_BUF_SIZE];
+ * \ref H5R_ref_t is defined in H5Rpublic.h as:
+ * \snippet this H5R_ref_t_snip
*
* The object opened with this function should be closed when it
* is no longer needed so that resource leaks will not develop. Use
@@ -333,22 +345,8 @@ H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5R
- *
- * \brief Asynchronous version of H5Ropen_object()
- *
- * \app_file
- * \app_func
- * \app_line
- * \param[out] ref_ptr Pointer to reference to open
- * \rapl_id
- * \oapl_id
- * \es_id
- *
- * \return \hid_t{object}
- *
- * \see H5Ropen_object()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ropen}
*/
H5_DLL hid_t H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_line,
H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id);
@@ -388,22 +386,8 @@ H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5R
- *
- * \brief Asynchronous version of H5Ropen_region()
- *
- * \app_file
- * \app_func
- * \app_line
- * \param[in] ref_ptr Pointer to reference to open
- * \rapl_id
- * \oapl_id
- * \es_id
- *
- * \return \hid_t{dataspace}
- *
- * \see H5Ropen_region()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ropen_region}
*/
H5_DLL hid_t H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_line,
H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id);
@@ -440,22 +424,8 @@ H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id);
/**
* --------------------------------------------------------------------------
- * \ingroup H5R
- *
- * \brief Asynchronous version of H5Ropen_attr()
- *
- * \app_file
- * \app_func
- * \app_line
- * \param[in] ref_ptr Pointer to reference to open
- * \rapl_id
- * \aapl_id
- * \es_id
- *
- * \return \hid_t{attribute}
- *
- * \see H5Ropen_attr()
- *
+ * \ingroup ASYNC
+ * \async_variant_of{H5Ropen_attr}
*/
H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line,
H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, hid_t es_id);
@@ -485,10 +455,7 @@ H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsi
* Upon success, the function returns in \p obj_type the type of
* the object that the reference points to. Valid values for this
* referenced object type are as followed (defined in H5Opublic.h):
- *
- * H5O_TYPE_GROUP Object is a group
- * H5O_TYPE_DATASET Object is a dataset
- * H5O_TYPE_NAMED_DATATYPE Object is a named datatype
+ * \snippet H5Opublic.h H5O_type_t_snip
*
*/
H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type);
@@ -540,12 +507,12 @@ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t siz
* \details H5Rget_obj_name() retrieves the object name for the object,
* region or attribute reference pointed to by \p ref_ptr.
*
- * The parameter \p rapl id is a reference access property list
+ * The parameter \p rapl_id is a reference access property list
* identifier for the reference. The access property list can
* be used to access external files that the reference points to
* (through a file access property list).
*
- * Up to size characters of the name are returned in name; additional
+ * Up to size characters of the name are returned in \p name; additional
* characters, if any, are not returned to the user application. If
* the length of the name, which determines the required value of
* \p size, is unknown, a preliminary call to H5Rget_obj_name() call
@@ -553,8 +520,8 @@ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t siz
* object name. That value can then be passed in for \p size in the
* second call to H5Rget_obj_name(), which will retrieve the actual
* name. If there is no name associated with the object identifier
- * or if the name is #NULL, H5Rget_obj_name() returns the size of
- * the name buffer (the size does not include the #NULL terminator).
+ * or if the name is NULL, H5Rget_obj_name() returns the size of
+ * the name buffer (the size does not include the \c \0 terminator).
*
* If \p ref_ptr is an object reference, \p name will be returned with
* a name for the referenced object. If \p ref_ptr is a dataset region
@@ -595,6 +562,7 @@ H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, si
*/
H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -609,6 +577,7 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz
#define H5Ropen_region_async_wrap H5_NO_EXPAND(H5Ropen_region_async)
#define H5Ropen_attr_async_wrap H5_NO_EXPAND(H5Ropen_attr_async)
#endif /* H5R_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -624,15 +593,334 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz
/* Function prototypes */
#ifndef H5_NO_DEPRECATED_SYMBOLS
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of object that an object reference points to
+ *
+ * \param[in] id The dataset containing the reference object or the group
+ * containing that dataset
+ * \param[in] ref_type Type of reference to query
+ * \param[in] ref Reference to query
+ *
+ * \return Returns a valid object type if successful; otherwise returns a
+ * negative value (#H5G_UNKNOWN).
+ *
+ * \deprecated This function has been renamed from H5Rget_obj_type() and is
+ * deprecated in favor of the macro H5Rget_obj_type() or the
+ * function H5Rget_obj_type2().
+ *
+ * \details Given an object reference, \p ref, H5Rget_obj_type1() returns the
+ * type of the referenced object.
+ *
+ * A \Emph{reference type} is the type of reference, either an object
+ * reference or a dataset region reference. An \Emph{object reference}
+ * points to an HDF5 object while a \Emph{dataset region reference}
+ * points to a defined region within a dataset.
+ *
+ * The \Emph{referenced object} is the object the reference points
+ * to. The \Emph{referenced object type}, or the type of the referenced
+ * object, is the type of the object that the reference points to.
+ *
+ * The location identifier, \p id, is the identifier for either the
+ * dataset containing the object reference or the group containing that
+ * dataset.
+ *
+ * Valid reference types, to pass in as \p ref_type, include the
+ * following:
+ * \snippet this H5R_type_t_snip
+ *
+ * If the application does not already know the object reference type,
+ * that can be determined with three preliminary calls:
+ *
+ * \li Call H5Dget_type() on the dataset containing the reference to
+ * get a datatype identifier for the dataset’s datatype.
+ * \li Using that datatype identifier, H5Tget_class() returns a datatype
+ * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
+ * then be used to determine whether the reference’s datatype is
+ * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
+ * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
+ * is #H5R_OBJECT.
+ * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
+ * type is #H5R_DATASET_REGION.
+ *
+ * When the function completes successfully, it returns one of the
+ * following valid object type values (defined in H5Gpublic.h):
+ * \snippet H5Gpublic.h H5G_obj_t_snip
+ *
+ * \version 1.8.0 Function H5Rget_obj_type() renamed to H5Rget_obj_type1() and
+ * deprecated in this release.
+ * \since 1.6.0
+ *
+ */
H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref);
-H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 object referenced
+ *
+ * \obj_id
+ * \param[in] ref_type The reference type of \p ref
+ * \param[in] ref Reference to open
+ *
+ * \return Returns identifier of referenced object if successful; otherwise
+ * returns a negative value.
+ *
+ * \deprecated This function has been renamed from H5Rdereference() and is
+ * deprecated in favor of the macro H5Rdereference() or the function
+ * H5Rdereference2().
+ *
+ * \details Given a reference, \p ref, to an object or a region in an object,
+ * H5Rdereference1() opens that object and returns an identifier.
+ *
+ * The parameter \p obj_id must be a valid identifier for an object in
+ * the HDF5 file containing the referenced object, including the file
+ * identifier.
+ *
+ * The parameter \p ref_type specifies the reference type of the
+ * reference \p ref. \p ref_type may contain either of the following
+ * values:
+ * - #H5R_OBJECT
+ * - #H5R_DATASET_REGION
+ *
+ * The object opened with this function should be closed when it is no
+ * longer needed so that resource leaks will not develop. Use the
+ * appropriate close function such as H5Oclose() or H5Dclose() for
+ * datasets.
+ *
+ * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and
+ * deprecated in this release.
+ * \since 1.8.0
+ *
+ */
+H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
-H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
-H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
-H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Creates a reference
+ *
+ * \param[out] ref Reference created by the function call
+ * \param[in] loc_id Location identifier used to locate the object being pointed to
+ * \param[in] name Name of object at location \p loc_id
+ * \param[in] ref_type Type of reference
+ * \param[in] space_id Dataspace identifier with selection. Used only for
+ * dataset region references; pass as -1 if reference is
+ * an object reference, i.e., of type #H5R_OBJECT
+ *
+ * \return \herr_t
+ *
+ * \details H5Rcreate() creates the reference, \p ref, of the type specified in
+ * \p ref_type, pointing to the object \p name located at \p loc_id.
+ *
+ * The HDF5 library maps the void type specified above for \p ref to
+ * the type specified in \p ref_type, which will be one of the following:
+ * \snippet this H5R_type_t_snip
+ *
+ * The parameters \p loc_id and \p name are used to locate the object.
+ *
+ * The parameter \p space_id identifies the dataset region that a
+ * dataset region reference points to. This parameter is used only with
+ * dataset region references and should be set to -1 if the reference
+ * is an object reference, #H5R_OBJECT.
+ *
+ * \since 1.8.0
+ */
+H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves the type of object that an object reference points to
+ *
+ * \param[in] id The dataset containing the reference object or the group
+ * containing that dataset
+ * \param[in] ref_type Type of reference to query
+ * \param[in] ref Reference to query
+ * \param[out] obj_type Type of referenced object
+ *
+ * \return \herr_t
+ *
+ * \details Given an object reference, \p ref, H5Rget_obj_type2() returns the
+ * type of the referenced object in \p obj_type.
+ *
+ * A \Emph{reference type} is the type of reference, either an object
+ * reference or a dataset region reference. An \Emph{object reference}
+ * points to an HDF5 object while a \Emph{dataset region reference}
+ * points to a defined region within a dataset.
+ *
+ * The \Emph{referenced object} is the object the reference points
+ * to. The \Emph{referenced object type}, or the type of the referenced
+ * object, is the type of the object that the reference points to.
+ *
+ * The location identifier, \p id, is the identifier for either the
+ * dataset containing the object reference or the group containing that
+ * dataset.
+ *
+ * Valid reference types, to pass in as \p ref_type, include the
+ * following:
+ * \snippet this H5R_type_t_snip
+ *
+ * If the application does not already know the object reference type,
+ * that can be determined with three preliminary calls:
+ *
+ * \li Call H5Dget_type() on the dataset containing the reference to
+ * get a datatype identifier for the dataset’s datatype.
+ * \li Using that datatype identifier, H5Tget_class() returns a datatype
+ * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
+ * then be used to determine whether the reference’s datatype is
+ * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
+ * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
+ * is #H5R_OBJECT.
+ * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
+ * type is #H5R_DATASET_REGION.
+ *
+ * When the function completes successfully, it returns one of the
+ * following valid object type values (defined in H5Opublic.h):
+ * \snippet H5Opublic.h H5O_type_t_snip
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Opens the HDF5 object referenced
+ *
+ * \obj_id
+ * \oapl_id
+ * \param[in] ref_type The reference type of \p ref
+ * \param[in] ref Reference to open
+ *
+ * \return Returns identifier of referenced object if successful; otherwise
+ * returns a negative value.
+ *
+ * \details Given a reference, \p ref, to an object or a region in an object,
+ * H5Rdereference2() opens that object and returns an identifier.
+ *
+ * The parameter \p obj_id must be a valid identifier for the HDF5 file
+ * containing the referenced object or for any object in that HDF5
+ * file.
+ *
+ * The parameter \p oapl_id is an object access property list
+ * identifier for the referenced object. The access property list must
+ * be of the same type as the object being referenced, that is a group,
+ * dataset, or datatype property list.
+ *
+ * The parameter \p ref_type specifies the reference type of the
+ * reference \p ref. \p ref_type may contain either of the following
+ * values:
+ * - #H5R_OBJECT
+ * - #H5R_DATASET_REGION
+ *
+ * The object opened with this function should be closed when it is no
+ * longer needed so that resource leaks will not develop. Use the
+ * appropriate close function such as H5Oclose() or H5Dclose() for
+ * datasets.
+ *
+ * \since 1.10.0
+ *
+ */
+H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Sets up a dataspace and selection as specified by a region reference
+ *
+ * \param[in] dataset File identifier or identifier for any object in the file
+ * containing the referenced region
+ * \param[in] ref_type Reference type of \p ref, which must be #H5R_DATASET_REGION
+ * \param[in] ref Region reference to open
+ *
+ * \return Returns a valid dataspace identifier if successful; otherwise returns
+ * a negative value.
+ *
+ * \details H5Rget_region() creates a copy of the dataspace of the dataset
+ * pointed to by a region reference, \p ref, and defines a selection
+ * matching the selection pointed to by ref within the dataspace copy.
+ *
+ * \p dataset is used to identify the file containing the referenced
+ * region; it can be a file identifier or an identifier for any object
+ * in the file.
+ *
+ * The parameter \p ref_type specifies the reference type of \p ref and
+ * must contain the value #H5R_DATASET_REGION.
+ *
+ * Use H5Sclose() to release the dataspace identifier returned by this
+ * function when the identifier is no longer needed.
+ *
+ */
+H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+
+/**
+ * --------------------------------------------------------------------------
+ * \ingroup H5R
+ *
+ * \brief Retrieves a name for a referenced object
+ *
+ * \param[in] loc_id Identifier for the file containing the reference or for
+ * any object in that file
+ * \param[in] ref_type Type of reference
+ * \param[in] ref An object or dataset region reference
+ * \param[out] name A buffer to place the name of the referenced object or
+ * dataset region. If \c NULL, then this call will return the
+ * size in bytes of the name.
+ * \param[in] size The size of the \p name buffer. When the size is passed in,
+ * the \c NULL terminator needs to be included.
+ *
+ * \return Returns the length of the name if successful, returning 0 (zero) if
+ * no name is associated with the identifier. Otherwise returns a
+ * negative value.
+ *
+ * \details H5Rget_name() retrieves a name for the object identified by \p ref.\n
+ * \p loc_id is used to identify the file containing the reference. It
+ * can be the file identifier for the file containing the reference or
+ * an identifier for any object in that file.
+ *
+ * \ref H5R_type_t is the reference type of \p ref. Valid values
+ * include the following:
+ * \snippet this H5R_type_t_snip
+ *
+ * \p ref is the reference for which the target object’s name is
+ * sought.
+ *
+ * If \p ref is an object reference, \p name will be returned with a
+ * name for the referenced object. If \p ref is a dataset region
+ * reference, \p name will contain a name for the object containing the
+ * referenced region.
+ *
+ * Up to \p size characters of the name are returned in \p name;
+ * additional characters, if any, are not returned to the user
+ * application.
+ *
+ * If the length of the name, which determines the required value of \p
+ * size, is unknown, a preliminary H5Rget_name() call can be made. The
+ * return value of this call will be the size of the object name. That
+ * value can then be assigned to \p size for a second H5Rget_name()
+ * call, which will retrieve the actual name.
+ *
+ * If there is no name associated with the object identifier or if the
+ * \p name is \c NULL, H5Rget_name() returns the size of the \p name
+ * buffer (the size does not include the \p NULL terminator).
+ *
+ * Note that an object in an HDF5 file may have multiple paths if there
+ * are multiple links pointing to it. This function may return any one
+ * of these paths.
+ *
+ * \since 1.8.0
+ */
H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size);
#ifdef __cplusplus
diff --git a/src/H5S.c b/src/H5S.c
index 747d297..c0c940a 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -84,7 +84,7 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
H5I_DATASPACE, /* ID class value */
0, /* Class flags */
- 2, /* # of reserved IDs for class */
+ 3, /* # of reserved IDs for class */
(H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */
}};
@@ -275,6 +275,8 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__close_cb() */
+#if 1 /* JRM */ /* restore this function for now */
+
/*--------------------------------------------------------------------------
NAME
H5S_get_validiated_dataspace
@@ -324,6 +326,8 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_get_validated_dataspace() */
+#endif /* JRM */ /* restore this function for now */
+
/*--------------------------------------------------------------------------
NAME
H5S_create
diff --git a/src/H5SL.c b/src/H5SL.c
index 166019b..ba9721c 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -209,7 +209,7 @@
/* Check if we need to increase allocation of forward pointers */ \
if (LVL + 1 >= 1u << X->log_nalloc) { \
H5SL_node_t **_tmp; \
- HDassert(LVL + 1 == 1u << X->log_nalloc); \
+ HDassert(LVL + 1 == 1U << X->log_nalloc); \
/* Double the amount of allocated space */ \
X->log_nalloc++; \
\
@@ -251,7 +251,7 @@
/* Check if we can reduce the allocation of forward pointers */ \
if (LVL <= 1u << (X->log_nalloc - 1)) { \
H5SL_node_t **_tmp; \
- HDassert(LVL == 1u << (X->log_nalloc - 1)); \
+ HDassert(LVL == 1U << (X->log_nalloc - 1)); \
X->log_nalloc--; \
\
/* Allocate space for new forward pointers */ \
diff --git a/src/H5SM.c b/src/H5SM.c
index ad7ae4f..b09cb45 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -1079,7 +1079,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id,
ssize_t index_num;
htri_t tri_ret;
#ifndef NDEBUG
- unsigned deferred_type = -1u;
+ unsigned deferred_type = -1U;
#endif
htri_t ret_value = TRUE;
@@ -1262,16 +1262,16 @@ static herr_t
H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t defer, unsigned type_id,
void *mesg, unsigned *cache_flags_ptr)
{
- H5SM_list_t * list = NULL; /* List index */
- H5SM_mesg_key_t key; /* Key used to search the index */
- H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- H5O_shared_t shared; /* Shared H5O message */
- hbool_t found = FALSE; /* Was the message in the index? */
- H5HF_t * fheap = NULL; /* Fractal heap handle */
- H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
- size_t buf_size; /* Size of the encoded message */
- void * encoding_buf = NULL; /* Buffer for encoded message */
- size_t empty_pos = UFAIL; /* Empty entry in list */
+ H5SM_list_t * list = NULL; /* List index */
+ H5SM_mesg_key_t key; /* Key used to search the index */
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5O_shared_t shared; /* Shared H5O message */
+ hbool_t found = FALSE; /* Was the message in the index? */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ size_t buf_size; /* Size of the encoded message */
+ void * encoding_buf = NULL; /* Buffer for encoded message */
+ size_t empty_pos = SIZE_MAX; /* Empty entry in list */
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1325,11 +1325,11 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
if (defer) {
- if (list_pos != UFAIL)
+ if (list_pos != SIZE_MAX)
found = TRUE;
} /* end if */
else {
- if (list_pos != UFAIL) {
+ if (list_pos != SIZE_MAX) {
/* If the message was previously shared in an object header, share
* it in the heap now.
*/
@@ -1481,13 +1481,13 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t
/* Insert the new message into the SOHM index */
if (header->index_type == H5SM_LIST) {
/* Index is a list. Find an empty spot if we haven't already */
- if (empty_pos == UFAIL) {
+ if (empty_pos == SIZE_MAX) {
size_t pos;
if (H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list")
- if (pos == UFAIL || empty_pos == UFAIL)
+ if (pos == SIZE_MAX || empty_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list")
}
/* Insert message into list */
@@ -1647,9 +1647,14 @@ done:
*
* If EMPTY_POS is NULL, don't store anything in it.
*
- * Return: Message's position in the list on success
- * UFAIL if message couldn't be found
- * empty_pos set to position of empty message or UFAIL.
+ * Return: Success: SUCCEED
+ * pos = position (if found)
+ * pos = SIZE_MAX (if not found)
+ * empty_pos = indeterminate (if found)
+ * empty_pos = 1st empty position (if not found)
+ *
+ * Failure: FAIL
+ * pos & empty_pos indeterminate
*
* Programmer: James Laird
* Tuesday, May 2, 2006
@@ -1670,7 +1675,7 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Initialize empty_pos to an invalid value */
if (empty_pos)
- *empty_pos = UFAIL;
+ *empty_pos = SIZE_MAX;
/* Find the first (only) message equal to the key passed in.
* Also record the first empty position we find.
@@ -1693,11 +1698,11 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *
/* Found earlier position possible, don't check any more */
empty_pos = NULL;
- } /* end if */
- } /* end for */
+ }
+ }
/* If we reached this point, we didn't find the message */
- *pos = UFAIL;
+ *pos = SIZE_MAX;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1839,7 +1844,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
if (list->messages[list_pos].location == H5SM_IN_HEAP)
@@ -2221,7 +2226,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize
/* Find the message in the list */
if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list")
- if (list_pos == UFAIL)
+ if (list_pos == SIZE_MAX)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Copy the message */
@@ -2519,7 +2524,7 @@ H5SM__list_free(H5SM_list_t *list)
*
* Purpose: Print debugging information for the master table.
*
- * If table_vers and num_indexes are not UFAIL, they are used
+ * If table_vers and num_indexes are not UINT_MAX, they are used
* instead of the values in the superblock.
*
* Return: Non-negative on success/Negative on failure
@@ -2546,14 +2551,14 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- /* If table_vers and num_indexes are UFAIL, replace them with values from
+ /* If table_vers and num_indexes are UINT_MAX, replace them with values from
* userblock
*/
- if (table_vers == UFAIL)
+ if (table_vers == UINT_MAX)
table_vers = H5F_SOHM_VERS(f);
else if (table_vers != H5F_SOHM_VERS(f))
HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n");
- if (num_indexes == UFAIL)
+ if (num_indexes == UINT_MAX)
num_indexes = H5F_SOHM_NINDEXES(f);
else if (num_indexes != H5F_SOHM_NINDEXES(f))
HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n");
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 8a4c155..2ad467f 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -238,7 +238,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l
HDassert(table->table_size == len);
/* Check magic number */
- if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature")
image += H5_SIZEOF_MAGIC;
@@ -580,7 +580,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le
list->header = udata->header;
/* Check magic number */
- if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature")
image += H5_SIZEOF_MAGIC;
diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h
index f425074..efe9355 100644
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -66,4 +66,4 @@ H5_DLL herr_t H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int i
H5_DLL herr_t H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidth,
haddr_t table_addr);
-#endif /*_H5SMprivate_H*/
+#endif /*H5SMprivate_H*/
diff --git a/src/H5ST.c b/src/H5ST.c
deleted file mode 100644
index 0b7b858..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_STATIC_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_STATIC_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_STATIC_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_STATIC_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_STATIC_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 2d009fa..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/H5Shyper.c b/src/H5Shyper.c
index e12ff93..a5b9b6c 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -296,11 +296,11 @@ H5S__hyper_print_spans_helper(FILE *f, const H5S_hyper_span_t *span, unsigned de
FUNC_ENTER_STATIC_NOERR
while (span) {
- HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", FUNC, depth * 2, "", depth, span,
+ HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", __func__, depth * 2, "", depth, span,
span->low, span->high, span->next);
if (span->down) {
- HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, (depth + 1) * 2,
- "", span->down, span->down->count, span->down->low_bounds[0],
+ HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__,
+ (depth + 1) * 2, "", span->down, span->down->count, span->down->low_bounds[0],
span->down->high_bounds[0], span->down->head);
H5S__hyper_print_spans_helper(f, span->down->head, depth + 1);
} /* end if */
@@ -316,7 +316,7 @@ H5S__hyper_print_spans(FILE *f, const H5S_hyper_span_info_t *span_lst)
FUNC_ENTER_STATIC_NOERR
if (span_lst != NULL) {
- HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, span_lst,
+ HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__, span_lst,
span_lst->count, span_lst->low_bounds[0], span_lst->high_bounds[0], span_lst->head);
H5S__hyper_print_spans_helper(f, span_lst->head, 0);
} /* end if */
@@ -342,21 +342,21 @@ H5S__hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, cons
FUNC_ENTER_STATIC_NOERR
if (dinfo != NULL) {
- HDfprintf(f, "%s: %s: start=[", FUNC, field);
+ HDfprintf(f, "%s: %s: start=[", __func__, field);
for (u = 0; u < ndims; u++)
HDfprintf(f, "%Hd%s", dinfo[u].start, (u < (ndims - 1) ? ", " : "]\n"));
- HDfprintf(f, "%s: %s: stride=[", FUNC, field);
+ HDfprintf(f, "%s: %s: stride=[", __func__, field);
for (u = 0; u < ndims; u++)
HDfprintf(f, "%Hu%s", dinfo[u].stride, (u < (ndims - 1) ? ", " : "]\n"));
- HDfprintf(f, "%s: %s: count=[", FUNC, field);
+ HDfprintf(f, "%s: %s: count=[", __func__, field);
for (u = 0; u < ndims; u++)
HDfprintf(f, "%Hu%s", dinfo[u].count, (u < (ndims - 1) ? ", " : "]\n"));
- HDfprintf(f, "%s: %s: block=[", FUNC, field);
+ HDfprintf(f, "%s: %s: block=[", __func__, field);
for (u = 0; u < ndims; u++)
HDfprintf(f, "%Hu%s", dinfo[u].block, (u < (ndims - 1) ? ", " : "]\n"));
} /* end if */
else
- HDfprintf(f, "%s: %s==NULL\n", FUNC, field);
+ HDfprintf(f, "%s: %s==NULL\n", __func__, field);
FUNC_LEAVE_NOAPI(SUCCEED)
}
diff --git a/src/H5Smodule.h b/src/H5Smodule.h
index bb33eb8..010f4a6 100644
--- a/src/H5Smodule.h
+++ b/src/H5Smodule.h
@@ -30,29 +30,36 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5S H5S
- * \brief Dataspace Interface
*
- * \details The Dataspace Interface provides functions for creating and
- * working with dataspaces.
+ * Use the functions in this module to manage HDF5 dataspaces \Emph{and} selections.
*
- * A dataspace has two roles:
+ * HDF5 dataspaces describe the \Emph{shape} of datasets in memory or in HDF5
+ * files. Dataspaces can be empty (#H5S_NULL), a singleton (#H5S_SCALAR), or
+ * a multi-dimensional, regular grid (#H5S_SIMPLE). Dataspaces can be re-shaped.
*
- * \li It contains the spatial information (logical layout) of a
- * dataset stored in a file.
- * \li It describes an application’s data buffers and data elements
- * participating in I/O. In other words, it can be used to
- * select a portion or subset of a dataset.
+ * Subsets of dataspaces can be "book-marked" or used to restrict I/O operations
+ * using \Emph{selections}. Furthermore, certain set operations are supported
+ * for selections.
*
- * The spatial information of a dataset in a file includes the
- * rank and dimensions of the dataset, which are a permanent part
- * of the dataset definition. It can have dimensions that are fixed
- * (unchanging) or unlimited, which means they can grow in size
- * (or are extendible).
- *
- * A dataspace can consist of:
- * \li no elements (NULL)
- * \li a single element (scalar), or
- * \li a simple array.
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5S_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5S_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5S_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5S_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
*/
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 9a38aaa..b626b77 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -685,7 +685,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
rank = sel_iter.u.hyp.iter_rank;
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", FUNC);
+ HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", __func__);
#endif
for (u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -700,7 +700,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
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);
+ __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
@@ -719,7 +719,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
rank = space->extent.rank;
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", FUNC);
+ HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", __func__);
#endif
for (u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -734,7 +734,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
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);
+ __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
@@ -783,7 +783,7 @@ 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=%" PRIuHSIZE "\n", i, d[i].xtent);
}
@@ -817,12 +817,12 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
"%s: Dimension i=%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]);
+ __func__, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
#endif
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC, i);
+ HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", __func__, i);
#endif
/****************************************
* Build vector type of the selection.
@@ -957,7 +957,7 @@ done:
#ifdef H5S_DEBUG
if (H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", FUNC, *count,
+ 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)
@@ -1014,8 +1014,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
- if (H5VM_array_down(space->extent.rank, space->extent.size, down) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
+ H5VM_array_down(space->extent.rank, space->extent.size, down);
/* Acquire an operation generation value for creating MPI datatypes */
op_gen = H5S__hyper_get_op_gen();
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 33d1ede..c89b616 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol
- * Thursday, September 28, 2000
+ * Programmer: Quincey Koziol
+ * Thursday, September 28, 2000
*
- * Purpose: This file contains declarations which are visible only within
- * the H5S package. Source files outside the H5S package should
- * include H5Sprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5S package. Source files outside the H5S package should
+ * include H5Sprivate.h instead.
*/
#if !(defined H5S_FRIEND || defined H5S_MODULE)
#error "Do not include this file outside the H5S package!"
@@ -420,4 +420,4 @@ H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *
H5_DLL htri_t H5S__internal_consistency_test(hid_t space_id);
#endif /* H5S_TESTING */
-#endif /*_H5Spkg_H*/
+#endif /*H5Spkg_H*/
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 56c1646..e1a6409 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -217,7 +217,9 @@ H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max);
H5_DLL H5S_t *H5S_create(H5S_class_t type);
+#if 1 /* JRM */ /* restore this for now */
H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space /*out*/);
+#endif /* JRM */
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]);
H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 5037e0a..30ca813 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -21,99 +21,106 @@
#include "H5public.h"
#include "H5Ipublic.h"
-/* Define atomic datatypes */
-#define H5S_ALL (hid_t)0
-#define H5S_UNLIMITED HSIZE_UNDEF
+/* Define special dataspaces for dataset I/O operations */
+#define H5S_ALL 0 /* (hid_t) */
+#define H5S_BLOCK 1 /* (hid_t) */
+#define H5S_PLIST 2 /* (hid_t) */
-/* Define user-level maximum number of dimensions */
+#define H5S_UNLIMITED HSIZE_UNDEF /**< Value for 'unlimited' dimensions */
+
+/**
+ * The maximum dataspace rank or number of dimensions
+ */
#define H5S_MAX_RANK 32
/* Flags for selection iterators */
#define H5S_SEL_ITER_GET_SEQ_LIST_SORTED \
- 0x0001 /* Retrieve elements from iterator \
- * in increasing offset order, for \
- * each call to retrieve sequences. \
- * Currently, this only applies to \
- * point selections, as hyperslab \
- * selections are always returned \
- * in increasing offset order. \
- * \
- * Note that the order is only \
- * increasing for each call to \
- * get_seq_list, the next set of \
- * sequences could start with an \
- * earlier offset than the previous \
- * one. \
+ 0x0001 /**< Retrieve elements from iterator in increasing offset order, for \
+ * each call to retrieve sequences. Currently, this only applies to \
+ * point selections, as hyperslab selections are always returned in \
+ * increasing offset order. Note that the order is only increasing \
+ * for each call to H5Sget_seq_list(), the next set of sequences \
+ * could start with an earlier offset than the previous one. \
*/
#define H5S_SEL_ITER_SHARE_WITH_DATASPACE \
- 0x0002 /* Don't copy the dataspace \
- * selection when creating the \
- * selection iterator. \
- * \
- * This can improve performance \
- * of creating the iterator, but \
- * the dataspace _MUST_NOT_ be \
- * modified or closed until the \
- * selection iterator is closed \
- * or the iterator's behavior \
- * will be undefined. \
+ 0x0002 /**< Don't copy the dataspace selection when creating the selection \
+ * iterator. This can improve performance of creating the iterator, \
+ * but the dataspace \Bold{MUST NOT} be modified or closed until the \
+ * selection iterator is closed or the iterator's behavior will be \
+ * undefined. \
*/
-/* Different types of dataspaces */
+/**
+ * Types of dataspaces
+ */
typedef enum H5S_class_t {
- H5S_NO_CLASS = -1, /*error */
- H5S_SCALAR = 0, /*scalar variable */
- H5S_SIMPLE = 1, /*simple dataspace */
- H5S_NULL = 2 /*null dataspace */
+ H5S_NO_CLASS = -1, /**< Error */
+ H5S_SCALAR = 0, /**< Singleton (scalar) */
+ H5S_SIMPLE = 1, /**< Regular grid */
+ H5S_NULL = 2 /**< Empty set */
} H5S_class_t;
-/* Different ways of combining selections */
+/**
+ * Different ways of combining selections
+ */
typedef enum H5S_seloper_t {
- H5S_SELECT_NOOP = -1, /* error */
- H5S_SELECT_SET = 0, /* Select "set" operation */
- H5S_SELECT_OR, /* Binary "or" operation for hyperslabs
+ H5S_SELECT_NOOP = -1, /**< Error */
+ H5S_SELECT_SET = 0, /**< Select "set" operation */
+ H5S_SELECT_OR, /**< Binary "or" operation for hyperslabs
* (add new selection to existing selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A or B: CCCCCCCCCCCCCCCC
+ * \endcode
*/
- H5S_SELECT_AND, /* Binary "and" operation for hyperslabs
+ H5S_SELECT_AND, /**< Binary "and" operation for hyperslabs
* (only leave overlapped regions in selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A and B: CCCC
+ * \endcode
*/
- H5S_SELECT_XOR, /* Binary "xor" operation for hyperslabs
+ H5S_SELECT_XOR, /**< Binary "xor" operation for hyperslabs
* (only leave non-overlapped regions in selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A xor B: CCCCCC CCCCCC
+ * \endcode
*/
- H5S_SELECT_NOTB, /* Binary "not" operation for hyperslabs
+ H5S_SELECT_NOTB, /**< Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in original selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A not B: CCCCCC
+ * \endcode
*/
- H5S_SELECT_NOTA, /* Binary "not" operation for hyperslabs
+ H5S_SELECT_NOTA, /**< Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in new selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* B not A: CCCCCC
+ * \endcode
*/
- H5S_SELECT_APPEND, /* Append elements to end of point selection */
- H5S_SELECT_PREPEND, /* Prepend elements to beginning of point selection */
- H5S_SELECT_INVALID /* Invalid upper bound on selection operations */
+ H5S_SELECT_APPEND, /**< Append elements to end of point selection */
+ H5S_SELECT_PREPEND, /**< Prepend elements to beginning of point selection */
+ H5S_SELECT_INVALID /**< Invalid upper bound on selection operations */
} H5S_seloper_t;
-/* Enumerated type for the type of selection */
+/**
+ * Selection type
+ */
typedef enum {
- H5S_SEL_ERROR = -1, /* Error */
- H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Points / elements selected */
- H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
- H5S_SEL_ALL = 3, /* Entire extent selected */
- H5S_SEL_N /*THIS MUST BE LAST */
+ H5S_SEL_ERROR = -1, /**< Error */
+ H5S_SEL_NONE = 0, /**< Empty selection */
+ H5S_SEL_POINTS = 1, /**< Set of points */
+ H5S_SEL_HYPERSLABS = 2, /**< Hyperslab */
+ H5S_SEL_ALL = 3, /**< Everything */
+ H5S_SEL_N /**< Sentinel \internal THIS MUST BE LAST */
} H5S_sel_type;
#ifdef __cplusplus
@@ -364,10 +371,8 @@ H5_DLL hid_t H5Sdecode(const void *buf);
*
* \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 New Features
- * in HDF5 Release 1.12 as well as the H5Sencode() / H5Sdecode() Format Change RFC.
- *
- * \todo Fix the references.
+ * 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
*
@@ -1069,7 +1074,7 @@ H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
* 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 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
*
@@ -1316,9 +1321,6 @@ H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
* \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
@@ -1327,10 +1329,6 @@ H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
* 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
*
diff --git a/src/H5T.c b/src/H5T.c
index d736d64..19a3d39 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -290,7 +290,7 @@
#define H5T_INIT_TYPE_SET_SIZE(SIZE) \
{ \
dt->shared->size = SIZE; \
- dt->shared->u.atomic.prec = 8 * SIZE; \
+ dt->shared->u.atomic.prec = 8 * (SIZE); \
}
#define H5T_INIT_TYPE_NOSET_SIZE(SIZE) \
@@ -327,7 +327,7 @@
H5_GLUE3(H5T_INIT_TYPE_, GUTS, _CORE) \
\
/* Register result */ \
- if ((GLOBAL = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \
+ if (((GLOBAL) = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \
}
@@ -560,10 +560,10 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* Useful floating-point values for conversion routines */
/* (+/- Inf for all floating-point types) */
-float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
-float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
-double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f;
-double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
+float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F;
+float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F;
+double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
+double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
/* Declare the free list for H5T_t's and H5T_shared_t's */
H5FL_DEFINE(H5T_t);
@@ -1512,7 +1512,8 @@ H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata)
FUNC_ENTER_STATIC_NOERR
- HDassert(dt && dt->shared);
+ HDassert(dt);
+ HDassert(dt->shared);
if (H5T_STATE_IMMUTABLE == dt->shared->state) {
dt->shared->state = H5T_STATE_RDONLY;
@@ -1891,19 +1892,24 @@ H5Tcopy(hid_t obj_id)
break;
case H5I_DATASET: {
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ H5VL_object_t * vol_obj; /* Object for obj_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* The argument is a dataset handle */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_TYPE;
+ vol_cb_args.args.get_type.type_id = H5I_INVALID_HID;
+
/* Get the datatype from the dataset
* NOTE: This will have to be closed after we're done with it.
*/
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &dset_tid) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID,
"unable to get datatype from the dataset")
+ dset_tid = vol_cb_args.args.get_type.type_id;
/* Unwrap the type ID */
if (NULL == (dt = (H5T_t *)H5I_object(dset_tid)))
@@ -2039,7 +2045,7 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
/* If a token was created, add the token to the event set */
if (NULL != token)
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0)
+ H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set")
done:
@@ -2834,7 +2840,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;
@@ -2856,7 +2862,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
diff --git a/src/H5TS.c b/src/H5TS.c
index 90b1244..258c9df 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -12,13 +12,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Purpose: This file contains the framework for ensuring that the global
- * library lock is held when an API routine is called. This
+ * Purpose: This file contains the framework for ensuring that the global
+ * library lock is held when an API routine is called. This
* framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API
- * macros defined in H5private.h.
+ * macros defined in H5private.h.
*
- * Note: Because this threadsafety framework operates outside the library,
- * it does not use the error stack and only uses the "namecheck only"
+ * Note: Because this threadsafety framework operates outside the library,
+ * it does not use the error stack and only uses the "namecheck only"
* FUNC_ENTER_* / FUNC_LEAVE_* macros.
*/
@@ -70,23 +70,45 @@ static herr_t H5TS__mutex_unlock(H5TS_mutex_t *mutex, unsigned int *lock_count);
/* Global variable definitions */
#ifdef H5_HAVE_WIN_THREADS
H5TS_once_t H5TS_first_init_g;
-#else /* H5_HAVE_WIN_THREADS */
-H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
-#endif /* H5_HAVE_WIN_THREADS */
+#else
+H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
+#endif
/* Thread-local keys, used by other interfaces */
-H5TS_key_t H5TS_errstk_key_g; /* Error stack */
+/* Error stack */
+#ifdef H5_HAVE_WIN_THREADS
+H5TS_key_t H5TS_errstk_key_g = TLS_OUT_OF_INDEXES;
+#else
+H5TS_key_t H5TS_errstk_key_g;
+#endif
+
#ifdef H5_HAVE_CODESTACK
-H5TS_key_t H5TS_funcstk_key_g; /* Function stack */
-#endif /* H5_HAVE_CODESTACK */
-H5TS_key_t H5TS_apictx_key_g; /* API context */
+/* Function stack */
+#ifdef H5_HAVE_WIN_THREADS
+H5TS_key_t H5TS_funcstk_key_g = TLS_OUT_OF_INDEXES;
+#else
+H5TS_key_t H5TS_funcstk_key_g;
+#endif
+#endif /* H5_HAVE_CODESTACK */
+
+/* API context */
+#ifdef H5_HAVE_WIN_THREADS
+H5TS_key_t H5TS_apictx_key_g = TLS_OUT_OF_INDEXES;
+#else
+H5TS_key_t H5TS_apictx_key_g;
+#endif
/*******************/
/* Local Variables */
/*******************/
/* Thread-local keys, used in this module */
-static H5TS_key_t H5TS_cancel_key_s; /* Thread cancellation state */
+/* Thread cancellation state */
+#ifdef H5_HAVE_WIN_THREADS
+static H5TS_key_t H5TS_cancel_key_s = TLS_OUT_OF_INDEXES;
+#else
+static H5TS_key_t H5TS_cancel_key_s;
+#endif
#ifndef H5_HAVE_WIN_THREADS
@@ -871,11 +893,14 @@ H5TS_win32_process_exit(void)
DeleteCriticalSection(&H5_g.init_lock.CriticalSection);
/* Clean up per-process thread local storage */
- TlsFree(H5TS_errstk_key_g);
+ if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES)
+ TlsFree(H5TS_errstk_key_g);
#ifdef H5_HAVE_CODESTACK
- TlsFree(H5TS_funcstk_key_g);
+ if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES)
+ TlsFree(H5TS_funcstk_key_g);
#endif /* H5_HAVE_CODESTACK */
- TlsFree(H5TS_apictx_key_g);
+ if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES)
+ TlsFree(H5TS_apictx_key_g);
FUNC_LEAVE_NOAPI_VOID_NAMECHECK_ONLY
} /* H5TS_win32_process_exit() */
@@ -909,19 +934,25 @@ H5TS_win32_thread_exit(void)
*/
/* Clean up per-thread thread local storage */
- lpvData = TlsGetValue(H5TS_errstk_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
+ if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES) {
+ lpvData = TlsGetValue(H5TS_errstk_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+ }
#ifdef H5_HAVE_CODESTACK
- lpvData = TlsGetValue(H5TS_funcstk_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
+ if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES) {
+ lpvData = TlsGetValue(H5TS_funcstk_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+ }
#endif /* H5_HAVE_CODESTACK */
- lpvData = TlsGetValue(H5TS_apictx_key_g);
- if (lpvData)
- LocalFree((HLOCAL)lpvData);
+ if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES) {
+ lpvData = TlsGetValue(H5TS_apictx_key_g);
+ if (lpvData)
+ LocalFree((HLOCAL)lpvData);
+ }
FUNC_LEAVE_NOAPI_NAMECHECK_ONLY(ret_value)
} /* H5TS_win32_thread_exit() */
diff --git a/src/H5TSpublic.h b/src/H5TSdevelop.h
index 41213f9..9e8f718 100644
--- a/src/H5TSpublic.h
+++ b/src/H5TSdevelop.h
@@ -2,7 +2,7 @@
* Copyright by The HDF Group. *
* All rights reserved. *
* *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, 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. *
@@ -11,14 +11,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * This file contains public declarations for the H5TS (threadsafety) module.
+ * This file contains public declarations for the H5TS (threadsafety) developer
+ * support routines.
*/
-#ifndef H5TSpublic_H
-#define H5TSpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h" /* Generic Functions */
+#ifndef H5TSdevelop_H
+#define H5TSdevelop_H
/*****************/
/* Public Macros */
@@ -49,4 +47,4 @@ H5_DLL herr_t H5TSmutex_get_attempt_count(unsigned int *count);
}
#endif
-#endif /* H5TSpublic_H */
+#endif /* H5TSdevelop_H */
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index 6f9f1c0..3150f59 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -25,8 +25,8 @@
#define H5TSprivate_H_
#ifdef H5_HAVE_THREADSAFE
-/* Public headers needed by this file */
-#include "H5TSpublic.h" /* Public API prototypes */
+/* Include package's public headers */
+#include "H5TSdevelop.h"
#ifdef H5_HAVE_WIN_THREADS
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index c35a530..04e2a97 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -228,10 +228,7 @@ done:
* Purpose: Return a small bit sequence as a number. Bit vector starts
* at OFFSET and is SIZE bits long.
*
- * Return: Success: The bit sequence interpretted as an unsigned
- * integer.
- *
- * Failure: 0
+ * Return: The bit sequence interpretted as an unsigned integer
*
*-------------------------------------------------------------------------
*/
@@ -264,14 +261,13 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size)
case H5T_ORDER_NONE:
case H5T_ORDER_MIXED:
default:
- /* Unknown endianness. Bail out. */
- HGOTO_DONE(UFAIL)
+ /* This function can't return errors */
+ HDassert(0 && "unknown byte order");
}
/* Set return value */
ret_value = val;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__bit_get_d() */
@@ -388,7 +384,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value)
*-------------------------------------------------------------------------
*/
ssize_t
-H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
+H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
{
ssize_t base = (ssize_t)offset;
ssize_t idx, i;
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index d214ca1..d079e71 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -218,7 +218,7 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0)
+ H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -726,7 +726,7 @@ H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) {
+ H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) {
/* clang-format on */
if (H5I_dec_app_ref_always_close(ret_value) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID,
@@ -790,12 +790,19 @@ H5Tget_create_plist(hid_t dtype_id)
} /* end if */
/* If the datatype is committed, retrieve further information */
else {
- H5VL_object_t *vol_obj = type->vol_obj;
+ H5VL_object_t * vol_obj = type->vol_obj;
+ H5VL_datatype_get_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_TCPL;
+ vol_cb_args.args.get_tcpl.tcpl_id = H5I_INVALID_HID;
/* Get the property list through the VOL */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info")
+
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_tcpl.tcpl_id;
} /* end else */
done:
@@ -829,15 +836,21 @@ H5Tflush(hid_t type_id)
if (!H5T_is_named(dt))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
-
/* Flush metadata for named datatype */
- if (dt->vol_obj)
- if (H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id) < 0)
+ if (dt->vol_obj) {
+ H5VL_datatype_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_FLUSH;
+ vol_cb_args.args.flush.type_id = type_id;
+
+ if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -870,15 +883,21 @@ H5Trefresh(hid_t type_id)
if (!H5T_is_named(dt))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
-
/* Refresh the datatype's metadata */
- if (dt->vol_obj)
- if (H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id) < 0)
+ if (dt->vol_obj) {
+ H5VL_datatype_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_REFRESH;
+ vol_cb_args.args.refresh.type_id = type_id;
+
+ if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -1222,32 +1241,41 @@ H5T_update_shared(H5T_t *dt)
H5T_t *
H5T_construct_datatype(H5VL_object_t *vol_obj)
{
- ssize_t nalloc;
- void * buf = NULL;
- H5T_t * dt = NULL; /* datatype object from VOL connector */
- H5T_t * ret_value = NULL;
+ H5T_t * dt = NULL; /* Datatype object from VOL connector */
+ H5VL_datatype_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t nalloc = 0; /* Size required to store serialized form of datatype */
+ void * buf = NULL; /* Buffer to store serialized datatype */
+ H5T_t * ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
- /* get required buf size for encoding the datatype */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &nalloc, NULL, 0) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_BINARY_SIZE;
+ vol_cb_args.args.get_binary_size.size = &nalloc;
+
+ /* Get required buf size for encoding the datatype */
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size")
- /* allocate buffer to store binary description of the datatype */
- if (NULL == (buf = (void *)H5MM_calloc((size_t)nalloc)))
+ /* Allocate buffer to store binary description of the datatype */
+ if (NULL == (buf = (void *)H5MM_calloc(nalloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_BINARY;
+ vol_cb_args.args.get_binary.buf = buf;
+ vol_cb_args.args.get_binary.buf_size = nalloc;
+
/* get binary description of the datatype */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &nalloc, buf, (size_t)nalloc) < 0)
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype")
- if (NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf)))
+ /* Construct datatype, from serialized form in buffer */
+ if (NULL == (dt = H5T_decode(nalloc, buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype")
-
dt->vol_obj = vol_obj;
+ /* Set return value */
ret_value = dt;
done:
@@ -1407,3 +1435,34 @@ H5T_already_vol_managed(const H5T_t *dt)
FUNC_LEAVE_NOAPI(dt->vol_obj != NULL)
} /* end H5T_already_vol_managed() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_invoke_vol_optional
+ *
+ * Purpose: Invokes an optional VOL connector-specific operation on a named datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_invoke_vol_optional(H5T_t *dt, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **vol_obj_ptr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check that datatype is committed */
+ if (!H5T_is_named(dt))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a committed datatype")
+
+ /* Only invoke callback if VOL object is set for the datatype */
+ if (dt->vol_obj)
+ if (H5VL_datatype_optional_op(dt->vol_obj, args, dxpl_id, req, vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_invoke_vol_optional() */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 60ad627..273bb23 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -1668,7 +1668,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t olap; /*num overlapping elements */
size_t half_size; /*1/2 of total size for swapping*/
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t dbuf[256]; /*temp destination buffer */
+ uint8_t dbuf[256] = {0}; /*temp destination buffer */
size_t msb_pad_offset; /*offset for dest MSB padding */
size_t i;
uint8_t * src_rev = NULL; /*order-reversed source buffer */
@@ -2699,7 +2699,7 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for (i = 0, j = 0; i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) {
while (j < dst->shared->u.enumer.nmembs &&
- HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]))
+ HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0)
j++;
if (j >= dst->shared->u.enumer.nmembs)
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
@@ -3205,14 +3205,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion")
/* References need to know about the src file */
if (tsrc_cpy->shared->type == H5T_REFERENCE)
- if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, H5T_LOC_MEMORY) < 0)
+ if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, src->shared->u.vlen.loc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location");
if (NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion")
/* References need to know about the dst file */
if (tdst_cpy->shared->type == H5T_REFERENCE)
- if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, H5T_LOC_MEMORY) < 0)
+ if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, dst->shared->u.vlen.loc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location");
if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) ||
@@ -3843,8 +3843,8 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t half_size; /*half the type size */
size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
size_t first;
ssize_t sfirst; /*a signed version of `first' */
size_t i; /*Local index variables */
@@ -4286,8 +4286,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t olap; /*num overlapping elements */
ssize_t bitno = 0; /*bit number */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
@@ -4947,7 +4947,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size);
/* Allocate the overlap buffer */
- if (NULL == (dbuf = (uint8_t *)H5MM_malloc(dst->shared->size)))
+ if (NULL == (dbuf = (uint8_t *)H5MM_calloc(dst->shared->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion")
/* The conversion loop. */
@@ -7725,9 +7725,9 @@ herr_t
H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7747,9 +7747,9 @@ herr_t
H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7769,9 +7769,9 @@ herr_t
H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7791,9 +7791,9 @@ herr_t
H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7813,9 +7813,9 @@ herr_t
H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7835,9 +7835,9 @@ herr_t
H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7857,9 +7857,9 @@ herr_t
H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7879,9 +7879,9 @@ herr_t
H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7901,9 +7901,9 @@ herr_t
H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7923,9 +7923,9 @@ herr_t
H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7945,9 +7945,9 @@ herr_t
H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7967,9 +7967,9 @@ herr_t
H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7989,9 +7989,9 @@ herr_t
H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8011,9 +8011,9 @@ herr_t
H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8033,9 +8033,9 @@ herr_t
H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8055,9 +8055,9 @@ herr_t
H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8077,9 +8077,9 @@ herr_t
H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8099,9 +8099,9 @@ herr_t
H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8121,9 +8121,9 @@ herr_t
H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8143,9 +8143,9 @@ herr_t
H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8165,9 +8165,9 @@ herr_t
H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8187,9 +8187,9 @@ herr_t
H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8209,9 +8209,9 @@ herr_t
H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8231,9 +8231,9 @@ herr_t
H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8253,9 +8253,9 @@ herr_t
H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8275,9 +8275,9 @@ herr_t
H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8297,9 +8297,9 @@ herr_t
H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8319,9 +8319,9 @@ herr_t
H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8342,9 +8342,9 @@ herr_t
H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
@@ -8366,9 +8366,9 @@ herr_t
H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/
@@ -8401,8 +8401,8 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t tsize; /*type size for swapping bytes */
size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
@@ -8477,7 +8477,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
/* Allocate enough space for the buffer holding temporary
* converted value
*/
- buf_size = (size_t)(HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1);
+ buf_size = (size_t)(HDpow(2.0, (double)src.u.f.esize) / 8 + 1);
int_buf = (uint8_t *)H5MM_calloc(buf_size);
/* Get conversion exception callback property */
@@ -9027,8 +9027,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz
size_t tsize; /*type size for swapping bytes */
size_t olap; /*num overlapping elements */
uint8_t * s, *sp, *d, *dp; /*source and dest traversal ptrs*/
- uint8_t * src_rev = NULL; /*order-reversed source buffer */
- uint8_t dbuf[64]; /*temp destination buffer */
+ uint8_t * src_rev = NULL; /*order-reversed source buffer */
+ uint8_t dbuf[64] = {0}; /*temp destination buffer */
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
@@ -9315,7 +9315,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*/
diff --git a/src/H5Tdevelop.h b/src/H5Tdevelop.h
new file mode 100644
index 0000000..e642d7c
--- /dev/null
+++ b/src/H5Tdevelop.h
@@ -0,0 +1,227 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5T (datatype) developer
+ * support routines.
+ */
+
+#ifndef _H5Tdevelop_H
+#define _H5Tdevelop_H
+
+/* Include package's public header */
+#include "H5Tpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/**
+ * Commands sent to conversion functions
+ */
+typedef enum H5T_cmd_t {
+ H5T_CONV_INIT = 0, /**< query and/or initialize private data */
+ H5T_CONV_CONV = 1, /**< convert data from source to dest datatype */
+ H5T_CONV_FREE = 2 /**< function is being removed from path */
+} H5T_cmd_t;
+
+/**
+ * How is the `bkg' buffer used by the conversion function?
+ */
+typedef enum H5T_bkg_t {
+ H5T_BKG_NO = 0, /**< background buffer is not needed, send NULL */
+ H5T_BKG_TEMP = 1, /**< bkg buffer used as temp storage only */
+ H5T_BKG_YES = 2 /**< init bkg buf with data before conversion */
+} H5T_bkg_t;
+
+/**
+ * Type conversion client data
+ */
+//! <!-- [H5T_cdata_t_snip] -->
+typedef struct H5T_cdata_t {
+ H5T_cmd_t command; /**< what should the conversion function do? */
+ H5T_bkg_t need_bkg; /**< is the background buffer needed? */
+ hbool_t recalc; /**< recalculate private data */
+ void * priv; /**< private data */
+} H5T_cdata_t;
+//! <!-- [H5T_cdata_t_snip] -->
+
+/**
+ * Conversion function persistence
+ */
+typedef enum H5T_pers_t {
+ H5T_PERS_DONTCARE = -1, /**< wild card */
+ H5T_PERS_HARD = 0, /**< hard conversion function */
+ H5T_PERS_SOFT = 1 /**< soft conversion function */
+} H5T_pers_t;
+
+/**
+ * All datatype conversion functions are...
+ */
+//! <!-- [H5T_conv_t_snip] -->
+typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist);
+//! <!-- [H5T_conv_t_snip] -->
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \ingroup CONV
+ *
+ * \brief Registers a datatype conversion function
+ *
+ * \param[in] pers Conversion function type
+ * \param[in] name Name displayed in diagnostic output
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[in] func Function to convert between source and destination datatypes
+ *
+ * \return \herr_t
+ *
+ * \details H5Tregister() registers a hard or soft conversion function for a
+ * datatype conversion path. The parameter \p pers indicates whether a
+ * conversion function is hard (#H5T_PERS_HARD) or soft
+ * (#H5T_PERS_SOFT). User-defined functions employing compiler casting
+ * are designated as \Emph{hard}; other user-defined conversion
+ * functions registered with the HDF5 library (with H5Tregister() )
+ * are designated as \Emph{soft}. The HDF5 library also has its own
+ * hard and soft conversion functions.
+ *
+ * A conversion path can have only one hard function. When type is
+ * #H5T_PERS_HARD, \p func replaces any previous hard function.
+ *
+ * When type is #H5T_PERS_SOFT, H5Tregister() adds the function to the
+ * end of the master soft list and replaces the soft function in all
+ * applicable existing conversion paths. Soft functions are used when
+ * determining which conversion function is appropriate for this path.
+ *
+ * The \p name is used only for debugging and should be a short
+ * identifier for the function.
+ *
+ * The path is specified by the source and destination datatypes \p
+ * src_id and \p dst_id. For soft conversion functions, only the class
+ * of these types is important.
+ *
+ * The type of the conversion function pointer is declared as:
+ * \snippet this H5T_conv_t_snip
+ *
+ * The \ref H5T_cdata_t \c struct is declared as:
+ * \snippet this H5T_cdata_t_snip
+ *
+ * \since 1.6.3 The following change occurred in the \ref H5T_conv_t function:
+ * the \c nelmts parameter type changed to size_t.
+ *
+ */
+H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
+/**
+ * \ingroup CONV
+ *
+ * \brief Removes a conversion function
+ *
+ * \param[in] pers Conversion function type
+ * \param[in] name Name displayed in diagnostic output
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[in] func Function to convert between source and destination datatypes
+ *
+ * \return \herr_t
+ *
+ * \details H5Tunregister() removes a conversion function matching criteria
+ * such as soft or hard conversion, source and destination types, and
+ * the conversion function.
+ *
+ * If a user is trying to remove a conversion function he registered,
+ * all parameters can be used. If he is trying to remove a library’s
+ * default conversion function, there is no guarantee the \p name and
+ * \p func parameters will match the user’s chosen values. Passing in
+ * some values may cause this function to fail. A good practice is to
+ * pass in NULL as their values.
+ *
+ * All parameters are optional. The missing parameters will be used to
+ * generalize the search criteria.
+ *
+ * The conversion function pointer type declaration is described in
+ * H5Tregister().
+ *
+ * \version 1.6.3 The following change occurred in the \ref H5T_conv_t function:
+ * the \c nelmts parameter type changed to size_t.
+ *
+ */
+H5_DLL herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
+/**
+ * \ingroup CONV
+ *
+ * \brief Finds a conversion function
+ *
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ * \param[out] pcdata Pointer to type conversion data
+ *
+ * \return Returns a pointer to a suitable conversion function if successful.
+ * Otherwise returns NULL.
+ *
+ * \details H5Tfind() finds a conversion function that can handle a conversion
+ * from type \p src_id to type \p dst_id. The \p pcdata argument is a
+ * pointer to a pointer to type conversion data which was created and
+ * initialized by the soft type conversion function of this path when
+ * the conversion function was installed on the path.
+ *
+ */
+H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
+/**
+ * \ingroup CONV
+ *
+ * \brief Check whether the library’s default conversion is hard conversion
+ *
+ * \type_id{src_id} of source datatype
+ * \type_id{dst_id} of destination datatype
+ *
+ * \return \htri_t
+ *
+ * \details H5Tcompiler_conv() determines whether the library’s conversion
+ * function from type \p src_id to type \p dst_id is a compiler (hard)
+ * conversion or not. A compiler conversion uses compiler’s casting; a
+ * library (soft) conversion uses the library’s own conversion
+ * function.
+ *
+ * \since 1.8.0
+ *
+ */
+H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#endif /* _H5Tdevelop_H */
diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h
index 4f9edde..73424fb 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -29,10 +29,38 @@
#define H5_MY_PKG_ERR H5E_DATATYPE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5T H5T
- * \brief Datatype Interface
- * \todo Describe concisely what the functions in this module are about.
+/**\defgroup H5T H5T
+ *
+ * Use the functions in this module to manage HDF5 datatypes.
+ *
+ * HDF5 datatypes describe the element type of HDF5 datasets and attributes.
+ * There's a large set of predefined datatypes, but users may find it useful
+ * to define new datatypes through a process called \Emph{derivation}.
+ *
+ * The element type is automatically persisted as part of the HDF5 metadata of
+ * attributes and datasets. Additionally, datatype definitions can be persisted
+ * to HDF5 files and linked to groups as HDF5 datatype objects or so-called
+ * \Emph{committed datatypes}.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5T_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5T_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5T_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5T_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
* \defgroup ARRAY Array Datatypes
* \ingroup H5T
@@ -44,12 +72,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/H5Tpkg.h b/src/H5Tpkg.h
index 0fe4f50..51ecaca 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -852,7 +852,8 @@ H5_DLL herr_t H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset,
H5_DLL void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value);
H5_DLL uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size);
H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val);
-H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value);
+H5_DLL ssize_t H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
+ hbool_t value);
H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 9ee0d04..9731379 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -20,8 +20,9 @@
/* Early typedefs to avoid circular dependencies */
typedef struct H5T_t H5T_t;
-/* Get package's public header */
+/* Include package's public headers */
#include "H5Tpublic.h"
+#include "H5Tdevelop.h"
/* Other public headers needed by this file */
#include "H5MMpublic.h" /* Memory management */
@@ -100,6 +101,8 @@ typedef struct H5T_subset_info_t {
} H5T_subset_info_t;
/* Forward declarations for prototype arguments */
+struct H5G_loc_t;
+struct H5G_name_t;
struct H5O_shared_t;
/* The native endianness of the platform */
@@ -119,14 +122,14 @@ H5_DLL size_t H5T_get_size(const H5T_t *dt);
H5_DLL hbool_t H5T_get_force_conv(const H5T_t *dt);
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
-H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf);
-H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE *stream);
-H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
-H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt);
-H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
-H5_DLL htri_t H5T_is_named(const H5T_t *dt);
-H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f);
-H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt);
+H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf);
+H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE *stream);
+H5_DLL struct H5O_loc_t * H5T_oloc(H5T_t *dt);
+H5_DLL struct H5G_name_t *H5T_nameof(const H5T_t *dt);
+H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
+H5_DLL htri_t H5T_is_named(const H5T_t *dt);
+H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f);
+H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt);
H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst);
H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p);
H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p);
@@ -151,12 +154,14 @@ H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O
H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared);
H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt);
H5_DLL htri_t H5T_is_vl_storage(const H5T_t *dt);
+H5_DLL herr_t H5T_invoke_vol_optional(H5T_t *dt, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **vol_obj_ptr);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
/* Operations on named datatypes */
-H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc);
+H5_DLL H5T_t *H5T_open(const struct H5G_loc_t *loc);
H5_DLL int H5T_link(const H5T_t *type, int adjust);
H5_DLL herr_t H5T_update_shared(H5T_t *type);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 1457053..bb5b0ef 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -28,7 +28,7 @@
* internal If this goes over 16 types (0-15), the file format will need to
* change.
*/
-//! [H5T_class_t_snip]
+//! <!-- [H5T_class_t_snip] -->
typedef enum H5T_class_t {
H5T_NO_CLASS = -1, /**< error */
H5T_INTEGER = 0, /**< integer types */
@@ -45,12 +45,12 @@ typedef enum H5T_class_t {
H5T_NCLASSES /**< sentinel: this must be last */
} H5T_class_t;
-//! [H5T_class_t_snip]
+//! <!-- [H5T_class_t_snip] -->
/**
* Byte orders
*/
-//! [H5T_order_t_snip]
+//! <!-- [H5T_order_t_snip] -->
typedef enum H5T_order_t {
H5T_ORDER_ERROR = -1, /**< error */
H5T_ORDER_LE = 0, /**< little endian */
@@ -60,12 +60,12 @@ typedef enum H5T_order_t {
H5T_ORDER_NONE = 4 /**< no particular order (strings, bits,..) */
/*H5T_ORDER_NONE must be last */
} H5T_order_t;
-//! [H5T_order_t_snip]
+//! <!-- [H5T_order_t_snip] -->
/**
* Types of integer sign schemes
*/
-//! [H5T_sign_t_snip]
+//! <!-- [H5T_sign_t_snip] -->
typedef enum H5T_sign_t {
H5T_SGN_ERROR = -1, /**< error */
H5T_SGN_NONE = 0, /**< this is an unsigned type */
@@ -73,12 +73,12 @@ typedef enum H5T_sign_t {
H5T_NSGN = 2 /** sentinel: this must be last! */
} H5T_sign_t;
-//! [H5T_sign_t_snip]
+//! <!-- [H5T_sign_t_snip] -->
/**
* Floating-point normalization schemes
*/
-//! [H5T_norm_t_snip]
+//! <!-- [H5T_norm_t_snip] -->
typedef enum H5T_norm_t {
H5T_NORM_ERROR = -1, /**< error */
H5T_NORM_IMPLIED = 0, /**< msb of mantissa isn't stored, always 1 */
@@ -86,7 +86,7 @@ typedef enum H5T_norm_t {
H5T_NORM_NONE = 2 /**< not normalized */
/*H5T_NORM_NONE must be last */
} H5T_norm_t;
-//! [H5T_norm_t_snip]
+//! <!-- [H5T_norm_t_snip] -->
/**
* Character set to use for text strings.
@@ -141,7 +141,7 @@ typedef enum H5T_str_t {
/**
* Type of padding to use in other atomic types
*/
-//! [H5T_pad_t_snip]
+//! <!-- [H5T_pad_t_snip] -->
typedef enum H5T_pad_t {
H5T_PAD_ERROR = -1, /**< error */
H5T_PAD_ZERO = 0, /**< always set to zero */
@@ -150,69 +150,37 @@ typedef enum H5T_pad_t {
H5T_NPAD = 3 /**< sentinal: THIS MUST BE LAST */
} H5T_pad_t;
-//! [H5T_pad_t_snip]
-
-/**
- * Commands sent to conversion functions
- */
-typedef enum H5T_cmd_t {
- H5T_CONV_INIT = 0, /**< query and/or initialize private data */
- H5T_CONV_CONV = 1, /**< convert data from source to dest datatype */
- H5T_CONV_FREE = 2 /**< function is being removed from path */
-} H5T_cmd_t;
-
-/**
- * How is the `bkg' buffer used by the conversion function?
- */
-typedef enum H5T_bkg_t {
- H5T_BKG_NO = 0, /**< background buffer is not needed, send NULL */
- H5T_BKG_TEMP = 1, /**< bkg buffer used as temp storage only */
- H5T_BKG_YES = 2 /**< init bkg buf with data before conversion */
-} H5T_bkg_t;
-
-/**
- * Type conversion client data
- */
-//! [H5T_cdata_t_snip]
-typedef struct H5T_cdata_t {
- H5T_cmd_t command; /**< what should the conversion function do? */
- H5T_bkg_t need_bkg; /**< is the background buffer needed? */
- hbool_t recalc; /**< recalculate private data */
- void * priv; /**< private data */
-} H5T_cdata_t;
-//! [H5T_cdata_t_snip]
-
-/**
- * Conversion function persistence
- */
-typedef enum H5T_pers_t {
- H5T_PERS_DONTCARE = -1, /**< wild card */
- H5T_PERS_HARD = 0, /**< hard conversion function */
- H5T_PERS_SOFT = 1 /**< soft conversion function */
-} H5T_pers_t;
+//! <!-- [H5T_pad_t_snip] -->
/**
* The order to retrieve atomic native datatype
*/
-//! [H5T_direction_t_snip]
+//! <!-- [H5T_direction_t_snip] -->
typedef enum H5T_direction_t {
- H5T_DIR_DEFAULT = 0, /**< default direction is inscendent */
- H5T_DIR_ASCEND = 1, /**< in inscendent order */
- H5T_DIR_DESCEND = 2 /**< in descendent order */
+ H5T_DIR_DEFAULT = 0, /**< default direction is ascending */
+ H5T_DIR_ASCEND = 1, /**< in ascending order */
+ H5T_DIR_DESCEND = 2 /**< in descending order */
} H5T_direction_t;
-//! [H5T_direction_t_snip]
+//! <!-- [H5T_direction_t_snip] -->
/**
* The exception type passed into the conversion callback function
*/
typedef enum H5T_conv_except_t {
- H5T_CONV_EXCEPT_RANGE_HI = 0, /**< source value is greater than destination's range */
- H5T_CONV_EXCEPT_RANGE_LOW = 1, /**< source value is less than destination's range */
- H5T_CONV_EXCEPT_PRECISION = 2, /**< source value loses precision in destination */
- H5T_CONV_EXCEPT_TRUNCATE = 3, /**< source value is truncated in destination */
- H5T_CONV_EXCEPT_PINF = 4, /**< source value is positive infinity(floating number) */
- H5T_CONV_EXCEPT_NINF = 5, /**< source value is negative infinity(floating number) */
- H5T_CONV_EXCEPT_NAN = 6 /**< source value is NaN(floating number) */
+ H5T_CONV_EXCEPT_RANGE_HI = 0,
+ /**< Source value is greater than destination's range */
+ H5T_CONV_EXCEPT_RANGE_LOW = 1,
+ /**< Source value is less than destination's range */
+ H5T_CONV_EXCEPT_PRECISION = 2,
+ /**< Source value loses precision in destination */
+ H5T_CONV_EXCEPT_TRUNCATE = 3,
+ /**< Source value is truncated in destination */
+ H5T_CONV_EXCEPT_PINF = 4,
+ /**< Source value is positive infinity */
+ H5T_CONV_EXCEPT_NINF = 5,
+ /**< Source value is negative infinity */
+ H5T_CONV_EXCEPT_NAN = 6
+ /**< Source value is \c NaN (not a number, including \c QNaN and \c SNaN) */
} H5T_conv_except_t;
/**
@@ -238,7 +206,7 @@ typedef struct {
* Indicate that a string is variable length (null-terminated in C, instead of
* fixed length)
*/
-#define H5T_VARIABLE ((size_t)(-1))
+#define H5T_VARIABLE SIZE_MAX
/* Opaque information */
/**
@@ -251,20 +219,26 @@ typedef struct {
extern "C" {
#endif
+//! <!-- [H5T_conv_except_func_t_snip] -->
/**
- * All datatype conversion functions are...
- */
-//! [H5T_conv_t_snip]
-typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
- size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist);
-//! [H5T_conv_t_snip]
-
-/**
- * Exception handler. If an exception like overflow happenes during conversion,
- * this function is called if it's registered through H5Pset_type_conv_cb().
+ * \brief Exception handler.
+ *
+ * \param[in] except_type The kind of exception that occurred
+ * \param[in] src_id Source datatype identifier
+ * \param[in] dst_id Destination datatype identifier
+ * \param[in] src_buf Source data buffer
+ * \param[in,out] dst_buf Destination data buffer
+ * \param[in,out] user_data Callback context
+ * \returns Valid callback function return values are #H5T_CONV_ABORT,
+ * #H5T_CONV_UNHANDLED and #H5T_CONV_HANDLED.
+ *
+ * \details If an exception like overflow happens during conversion, this
+ * function is called if it's registered through H5Pset_type_conv_cb().
+ *
*/
typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type, hid_t src_id, hid_t dst_id,
void *src_buf, void *dst_buf, void *user_data);
+//! <!-- [H5T_conv_except_func_t_snip] -->
/* When this header is included from a private header, don't make calls to H5open() */
#undef H5OPEN
@@ -1061,7 +1035,7 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g;
* predefined datatype.
*
* When creating a variable-length string datatype, \p size must
- * be #H5T_VARIABLE.
+ * be #H5T_VARIABLE; see \ref_vlen_strings.
*
* When creating a fixed-length string datatype, \p size will
* be the length of the string in bytes. The length of the
@@ -1075,13 +1049,9 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g;
* The datatype identifier returned from this function should be
* released with H5Tclose or resource leaks will result.
*
- * \since 1.2.0
- *
* \see H5Tclose()
*
- * \todo Original has a reference to “Creating variable-length string
- * datatypes”.
- * \todo Create an example for H5Tcreate.
+ * \since 1.2.0
*
*/
H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size);
@@ -1106,8 +1076,6 @@ H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size);
* The returned datatype identifier should be released with H5Tclose()
* to prevent resource leak.
*
- * \todo Create an example for H5Tcopy().
- *
*/
H5_DLL hid_t H5Tcopy(hid_t type_id);
/**
@@ -1130,8 +1098,6 @@ H5_DLL herr_t H5Tclose(hid_t type_id);
*
* \brief Asynchronous version of H5Tclose().
*
- * \todo Create an example for H5Tclose_async().
- *
*/
H5_DLL herr_t H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t type_id,
hid_t es_id);
@@ -1222,8 +1188,6 @@ H5_DLL herr_t H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lc
*
* \brief Asynchronous version of H5Tcommit2().
*
- * \todo Create an example for H5Tcommit_async().
- *
*/
H5_DLL herr_t H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id,
@@ -1257,8 +1221,6 @@ H5_DLL hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id);
*
* \brief Asynchronous version of H5Topen2().
*
- * \todo Create an example for H5Topen_async().
- *
*/
H5_DLL hid_t H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
const char *name, hid_t tapl_id, hid_t es_id);
@@ -1503,8 +1465,6 @@ H5_DLL herr_t H5Trefresh(hid_t type_id);
*
* \since 1.2.0
*
- * \todo Create example for H5Tinsert
- *
*/
H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id);
/**
@@ -1663,10 +1623,7 @@ H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/)
* character base type creates a variable-length sequence of strings
* (a variable-length, 1-dimensional array), with each element of
* the array being of the string or character base type.\n
- * To create a variable-length string datatype, see "Creating
- * variable-length string datatypes."
- *
- * \todo Fix the reference.
+ * To create a variable-length string datatype, see \ref_vlen_strings.
*
*/
H5_DLL hid_t H5Tvlen_create(hid_t base_id);
@@ -1870,13 +1827,9 @@ H5_DLL htri_t H5Tdetect_class(hid_t type_id, H5T_class_t cls);
* actual data and a size value. This function does not return the
* size of actual variable-length sequence data.
*
- * \since 1.2.0
- *
* \see H5Tset_size()
*
- * \todo Original has a reference to “Creating variable-length string datatypes”.
- * \todo Create an example for H5Tget_size().
- *
+ * \since 1.2.0
*/
H5_DLL size_t H5Tget_size(hid_t type_id);
/**
@@ -2090,7 +2043,7 @@ H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
*/
H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
/**
- * \ingroup COMPOUND
+ * \ingroup COMPOUND ENUM
*
* \brief Retrieves the number of elements in a compound or enumeration datatype
*
@@ -2107,7 +2060,7 @@ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
*/
H5_DLL int H5Tget_nmembers(hid_t type_id);
/**
- * \ingroup COMPOUND
+ * \ingroup COMPOUND ENUM
*
* \brief Retrieves the name of a compound or enumeration datatype member
*
@@ -2134,7 +2087,7 @@ H5_DLL int H5Tget_nmembers(hid_t type_id);
*/
H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
/**
- * \ingroup COMPOUND
+ * \ingroup COMPOUND ENUM
*
* \brief Retrieves the index of a compound or enumeration datatype member
*
@@ -2406,6 +2359,7 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
*
* \li Variable-length string datatypes: If \p dtype_id is a
* variable-length string, size must normally be set to #H5T_VARIABLE.
+ * See \ref_vlen_strings.
*
* \li Compound datatypes: This function may be used to increase or
* decrease the size of a compound datatype, but the function will
@@ -2416,12 +2370,9 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
* variable-length array datatypes (#H5T_VLEN), or reference datatypes
* (#H5T_REFERENCE).
*
- * \since 1.2.0
- *
* \see H5Tget_size()
*
- *\todo Create an example for H5Tset_size().
- *\todo Original has a reference to “Creating variable-length string datatypes”.
+ * \since 1.2.0
*
*/
H5_DLL herr_t H5Tset_size(hid_t type_id, size_t size);
@@ -2712,130 +2663,6 @@ H5_DLL herr_t H5Tset_cset(hid_t type_id, H5T_cset_t cset);
*/
H5_DLL herr_t H5Tset_strpad(hid_t type_id, H5T_str_t strpad);
-/* Type conversion database */
-/**
- * \ingroup CONV
- *
- * \brief Registers a datatype conversion function
- *
- * \param[in] pers Conversion function type
- * \param[in] name Name displayed in diagnostic output
- * \type_id{src_id} of source datatype
- * \type_id{dst_id} of destination datatype
- * \param[in] func Function to convert between source and destination datatypes
- *
- * \return \herr_t
- *
- * \details H5Tregister() registers a hard or soft conversion function for a
- * datatype conversion path. The parameter \p pers indicates whether a
- * conversion function is hard (#H5T_PERS_HARD) or soft
- * (#H5T_PERS_SOFT). User-defined functions employing compiler casting
- * are designated as \Emph{hard}; other user-defined conversion
- * functions registered with the HDF5 library (with H5Tregister() )
- * are designated as \Emph{soft}. The HDF5 library also has its own
- * hard and soft conversion functions.
- *
- * A conversion path can have only one hard function. When type is
- * #H5T_PERS_HARD, \p func replaces any previous hard function.
- *
- * When type is #H5T_PERS_SOFT, H5Tregister() adds the function to the
- * end of the master soft list and replaces the soft function in all
- * applicable existing conversion paths. Soft functions are used when
- * determining which conversion function is appropriate for this path.
- *
- * The \p name is used only for debugging and should be a short
- * identifier for the function.
- *
- * The path is specified by the source and destination datatypes \p
- * src_id and \p dst_id. For soft conversion functions, only the class
- * of these types is important.
- *
- * The type of the conversion function pointer is declared as:
- * \snippet this H5T_conv_t_snip
- *
- * The \ref H5T_cdata_t \c struct is declared as:
- * \snippet this H5T_cdata_t_snip
- *
- * \since 1.6.3 The following change occurred in the \ref H5T_conv_t function:
- * the \c nelmts parameter type changed to size_t.
- *
- */
-H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
-/**
- * \ingroup CONV
- *
- * \brief Removes a conversion function
- *
- * \param[in] pers Conversion function type
- * \param[in] name Name displayed in diagnostic output
- * \type_id{src_id} of source datatype
- * \type_id{dst_id} of destination datatype
- * \param[in] func Function to convert between source and destination datatypes
- *
- * \return \herr_t
- *
- * \details H5Tunregister() removes a conversion function matching criteria
- * such as soft or hard conversion, source and destination types, and
- * the conversion function.
- *
- * If a user is trying to remove a conversion function he registered,
- * all parameters can be used. If he is trying to remove a library’s
- * default conversion function, there is no guarantee the \p name and
- * \p func parameters will match the user’s chosen values. Passing in
- * some values may cause this function to fail. A good practice is to
- * pass in NULL as their values.
- *
- * All parameters are optional. The missing parameters will be used to
- * generalize the search criteria.
- *
- * The conversion function pointer type declaration is described in
- * H5Tregister().
- *
- * \version 1.6.3 The following change occurred in the \ref H5T_conv_t function:
- * the \c nelmts parameter type changed to size_t.
- *
- */
-H5_DLL herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func);
-/**
- * \ingroup CONV
- *
- * \brief Finds a conversion function
- *
- * \type_id{src_id} of source datatype
- * \type_id{dst_id} of destination datatype
- * \param[out] pcdata Pointer to type conversion data
- *
- * \return Returns a pointer to a suitable conversion function if successful.
- * Otherwise returns NULL.
- *
- * \details H5Tfind() finds a conversion function that can handle a conversion
- * from type \p src_id to type \p dst_id. The \p pcdata argument is a
- * pointer to a pointer to type conversion data which was created and
- * initialized by the soft type conversion function of this path when
- * the conversion function was installed on the path.
- *
- */
-H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
-/**
- * \ingroup CONV
- *
- * \brief Check whether the library’s default conversion is hard conversion
- *
- * \type_id{src_id} of source datatype
- * \type_id{dst_id} of destination datatype
- *
- * \return \htri_t
- *
- * \details H5Tcompiler_conv() determines whether the library’s conversion
- * function from type \p src_id to type \p dst_id is a compiler (hard)
- * conversion or not. A compiler conversion uses compiler’s casting; a
- * library (soft) conversion uses the library’s own conversion
- * function.
- *
- * \since 1.8.0
- *
- */
-H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
/**
* --------------------------------------------------------------------------
* \ingroup CONV
@@ -2873,7 +2700,7 @@ H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id);
* enough to hold the larger of the input and output data.
*
* \version 1.6.3 \p nelmts parameter type changed to size_t.
- * \version 1.4.0 \p nelmts parameter type changed to \ref hsize_t.
+ * \version 1.4.0 \p nelmts parameter type changed to hsize_t.
*
*/
H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background,
diff --git a/src/H5Tref.c b/src/H5Tref.c
index 1114c25..cac8cf6 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -289,12 +289,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
} /* end else-if */
else {
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
size_t ref_encode_size;
H5R_ref_priv_t fixed_ref;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
/* Retrieve min encode size (when references have no vlen part) */
@@ -434,8 +438,10 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
/* Force re-calculating encoding size if any flags are set */
if (flags || !src_ref->encode_size) {
- char file_name_buf_static[256]; /* File name */
- ssize_t file_name_len; /* Size of file name buffer */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ char * file_name = NULL; /* Actual file name */
+ char file_name_buf_static[256]; /* File name */
+ size_t file_name_len = 0; /* Length of file name */
/* Pass the correct encoding version for the selection depending on the
* file libver bounds, this is later retrieved in H5S hyper encode */
@@ -458,21 +464,38 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
H5CX_set_libver_bounds(NULL);
} /* end if */
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = sizeof(file_name_buf_static);
+ vol_cb_args.args.get_name.buf = file_name_buf_static;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
/* Get file name */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
- if (file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
- if (NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+
+ /* Check if we need to allocate a buffer for the file name */
+ if (file_name_len >= sizeof(file_name_buf_static)) {
+ /* Allocate file name buffer */
+ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+
+ /* Update VOL callback arguments */
+ vol_cb_args.args.get_name.buf_size = file_name_len + 1;
+ vol_cb_args.args.get_name.buf = file_name_buf_dyn;
+
+ /* Get file name again */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+
+ file_name = file_name_buf_dyn;
} /* end if */
+ else
+ file_name = file_name_buf_static;
/* Determine encoding size */
- if (H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL,
- &ret_value, flags) < 0)
+ if (H5R__encode(file_name, src_ref, NULL, &ret_value, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size")
} /* end if */
else {
@@ -506,10 +529,10 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
H5VL_object_t * vol_obj; /* VOL object for src ref's location */
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */
+ char * file_name = NULL; /* Actual file name */
char file_name_buf_static[256] = {'\0'}; /* File name */
char * file_name_buf_dyn =
NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */
- ssize_t file_name_len; /* Size of file name buffer */
unsigned flags = 0; /* References flags */
herr_t ret_value = SUCCEED; /* Return value */
@@ -560,21 +583,42 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
/* Get file name (if external reference) */
if (flags) {
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t file_name_len = 0; /* Length of file name */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = sizeof(file_name_buf_static);
+ vol_cb_args.args.get_name.buf = file_name_buf_static;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
+ /* Get file name */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
- if (file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
- if (NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+
+ /* Check if we need to allocate a buffer for the file name */
+ if (file_name_len >= sizeof(file_name_buf_static)) {
+ /* Allocate file name buffer */
+ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+
+ /* Update VOL callback arguments */
+ vol_cb_args.args.get_name.buf_size = file_name_len + 1;
+ vol_cb_args.args.get_name.buf = file_name_buf_dyn;
+
+ /* Get file name again */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+
+ file_name = file_name_buf_dyn;
} /* end if */
- } /* end if */
+ else
+ file_name = file_name_buf_static;
+ } /* end if */
/* Encode reference */
- if (H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref,
- (unsigned char *)dst_buf, &dst_size, flags) < 0)
+ if (H5R__encode(file_name, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference")
done:
@@ -731,11 +775,17 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t
*isnull = FALSE;
}
else {
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
/* Skip the size / header */
p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_ISNULL;
+ vol_cb_args.args.is_null.isnull = isnull;
+
/* Check if blob ID is "nil" */
- if (H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0)
+ if (H5VL_blob_specific(src_file, (void *)p, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
}
@@ -755,9 +805,10 @@ done:
static herr_t
H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
{
- uint8_t *q = (uint8_t *)dst_buf;
- uint8_t *p_bg = (uint8_t *)bg_buf;
- herr_t ret_value = SUCCEED;
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * q = (uint8_t *)dst_buf;
+ uint8_t * p_bg = (uint8_t *)bg_buf;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
H5T_REF_LOG_DEBUG("");
@@ -770,8 +821,11 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
/* Skip the size / header */
p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
+
/* Remove blob for old data */
- if (H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
@@ -782,8 +836,11 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
/* Set the size */
UINT32ENCODE(q, 0);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_SETNULL;
+
/* Set blob ID to "nil" */
- if (H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0)
+ if (H5VL_blob_specific(dst_file, q, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
done:
@@ -913,15 +970,19 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
/* TODO Should get rid of bg stuff */
if (p_bg) {
- size_t p_buf_size_left = dst_size;
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t p_buf_size_left = dst_size;
/* Skip the size / header */
p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE));
p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
+
/* Remove blob for old data */
- if (H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 39d14f3..080d725 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -247,8 +247,7 @@ done:
htri_t
H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- htri_t ret_value = FALSE; /* Indicate success, but no location change */
+ htri_t ret_value = FALSE; /* Indicate success, but no location change */
FUNC_ENTER_PACKAGE
@@ -293,15 +292,22 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
dt->shared->u.vlen.file = NULL;
break;
- case H5T_LOC_DISK: /* Disk based VL datatype */
+ /* Disk based VL datatype */
+ case H5T_LOC_DISK: {
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+
HDassert(file);
/* Mark this type as being stored on disk */
dt->shared->u.vlen.loc = H5T_LOC_DISK;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
/* The datatype size is equal to 4 bytes for the sequence length
@@ -319,6 +325,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
if (H5T_own_vol_obj(dt, file) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
break;
+ }
case H5T_LOC_BADLOC:
/* Allow undefined location. In H5Odtype.c, H5O_dtype_decode sets undefined
@@ -841,8 +848,9 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_
static herr_t
H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
{
- uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -854,8 +862,12 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
/* Skip the sequence's length */
vl += 4;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_ISNULL;
+ vol_cb_args.args.is_null.isnull = isnull;
+
/* Check if blob ID is "nil" */
- if (H5VL_blob_specific(file, vl, H5VL_BLOB_ISNULL, isnull) < 0)
+ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
done:
@@ -877,8 +889,9 @@ done:
static herr_t
H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
{
- uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -895,8 +908,11 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
/* Set the length of the sequence */
UINT32ENCODE(vl, 0);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_SETNULL;
+
/* Set blob ID to "nil" */
- if (H5VL_blob_specific(file, vl, H5VL_BLOB_SETNULL) < 0)
+ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
done:
@@ -1013,10 +1029,16 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
UINT32DECODE(vl, seq_len);
/* Delete object, if length > 0 */
- if (seq_len > 0)
- if (H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
+ if (seq_len > 0) {
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
+
+ if (H5VL_blob_specific(file, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VL.c b/src/H5VL.c
index a77a6f3..2cece6d 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -764,6 +764,39 @@ done:
} /* H5VLretrieve_lib_state() */
/*---------------------------------------------------------------------------
+ * Function: H5VLstart_lib_state
+ *
+ * Purpose: Opens a new internal state for the HDF5 library.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 5, 2021
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLstart_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE0("e", "");
+
+ /* Start a new library state */
+ if (H5VL_start_lib_state() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't start new library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLstart_lib_state() */
+
+/*---------------------------------------------------------------------------
* Function: H5VLrestore_lib_state
*
* Purpose: Restores the internal state of the HDF5 library.
@@ -801,16 +834,16 @@ done:
} /* H5VLrestore_lib_state() */
/*---------------------------------------------------------------------------
- * Function: H5VLreset_lib_state
+ * Function: H5VLfinish_lib_state
*
- * Purpose: Resets the internal state of the HDF5 library, undoing the
- * affects of H5VLrestore_lib_state.
+ * Purpose: Closes the internal state of the HDF5 library, undoing the
+ * affects of H5VLstart_lib_state.
*
* Note: This routine is _only_ for HDF5 VOL connector authors! It is
* _not_ part of the public API for HDF5 application developers.
*
* Note: This routine must be called as a "pair" with
- * H5VLrestore_lib_state. It can be called before / after /
+ * H5VLstart_lib_state. It can be called before / after /
* independently of H5VLfree_lib_state.
*
* Return: Success: Non-negative
@@ -822,7 +855,7 @@ done:
*---------------------------------------------------------------------------
*/
herr_t
-H5VLreset_lib_state(void)
+H5VLfinish_lib_state(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -831,12 +864,12 @@ H5VLreset_lib_state(void)
H5TRACE0("e", "");
/* Reset the library state */
- if (H5VL_reset_lib_state() < 0)
+ if (H5VL_finish_lib_state() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLreset_lib_state() */
+} /* H5VLfinish_lib_state() */
/*---------------------------------------------------------------------------
* Function: H5VLfree_lib_state
@@ -911,3 +944,136 @@ H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t
done:
FUNC_LEAVE_API(ret_value)
} /* H5VLquery_optional() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLregister_opt_operation
+ *
+ * Purpose: Allow a VOL connector to register a new optional operation
+ * for a VOL object subclass. The operation name must be runtime
+ * unique for each operation, preferably avoiding naming clashes
+ * by using a Uniform Type Identifier (UTI,
+ *https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)
+ * for each operation name. The value returned in the 'op_val'
+ * pointer will be unique for that VOL connector to use for its
+ * operation on that subclass.
+ *
+ * For example, registering a 'prefetch' operation for the
+ * caching VOL connector written at the ALCF at Argonne National
+ * Laboratory could have a UTI of: "gov.anl.alcf.cache.prefetch",
+ * and the "evict" operation for the same connector could have a
+ * UTI of: "gov.anl.alcf.cache.evict". Registering a "suspend
+ * background threads" operation for the asynchronous VOL connector
+ * written at NERSC at Lawrence Berkeley National Laboratory could
+ * have a UTI of: "gov.lbnl.nersc.async.suspend_bkg_threads".
+ *
+ * Note: The first 1024 values of each subclass's optional operations
+ * are reserved for the native VOL connector's use.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "VS*sx", subcls, op_name, op_val);
+
+ /* Check args */
+ if (NULL == op_val)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer")
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Register the operation */
+ if (H5VL__register_opt_operation(subcls, op_name, op_val) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register dynamic optional operation: '%s'",
+ op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLregister_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfind_opt_operation
+ *
+ * Purpose: Look up a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "VS*sx", subcls, op_name, op_val);
+
+ /* Check args */
+ if (NULL == op_val)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer")
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Find the operation */
+ if (H5VL__find_opt_operation(subcls, op_name, op_val) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "can't find dynamic optional operation: '%s'", op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLfind_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLunregister_opt_operation
+ *
+ * Purpose: Unregister a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "VS*s", subcls, op_name);
+
+ /* Check args */
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Unregister the operation */
+ if (H5VL__unregister_opt_operation(subcls, op_name) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "can't unregister dynamic optional operation: '%s'",
+ op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLunregister_opt_operation() */
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 02e0ee0..2369be5 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -29,11 +29,13 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
+#include "H5ESprivate.h" /* Event Sets */
+#include "H5Fprivate.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5PLprivate.h" /* Plugins */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLpkg.h" /* Virtual Object Layer */
/****************/
@@ -54,6 +56,10 @@ typedef struct H5VL_file_open_find_connector_t {
hid_t fapl_id;
} H5VL_file_open_find_connector_t;
+/* Typedef for common callback form of registered optional operations */
+typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
+
/********************/
/* Package Typedefs */
/********************/
@@ -70,13 +76,12 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type
void **req);
static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf,
hid_t dxpl_id, void **req);
-static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
@@ -87,26 +92,24 @@ static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_
hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
-static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls,
- H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
hid_t tapl_id, hid_t dxpl_id, void **req);
static void * H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls,
- H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id, void **req);
@@ -114,28 +117,28 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigne
hid_t dxpl_id, void **req);
static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info,
void *op_data);
-static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id,
void **req);
static void * H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
-static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
+ void **req);
static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -143,12 +146,11 @@ static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params
const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
static void * H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls,
H5I_type_t *opened_type, hid_t dxpl_id, void **req);
static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name,
@@ -156,12 +158,11 @@ static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_
const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
void **req);
static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls,
@@ -170,27 +171,25 @@ static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t ti
H5VL_request_status_t *status);
static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, void *ctx);
static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls, H5VL_request_status_t *status);
-static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls,
- H5VL_request_specific_t specific_type, va_list arguments);
-static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args);
+static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args);
static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id,
void *ctx);
static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *buf, size_t size,
void *ctx);
static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id,
- H5VL_blob_specific_t specific_type, va_list arguments);
+ H5VL_blob_specific_args_t *args);
static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id,
- H5VL_blob_optional_t opt_type, va_list arguments);
+ H5VL_optional_args_t *args);
static herr_t H5VL__token_cmp(void *obj, const H5VL_class_t *cls, const H5O_token_t *token1,
const H5O_token_t *token2, int *cmp_value);
static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
const H5O_token_t *token, char **token_str);
static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
const char *token_str, H5O_token_t *token);
-static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
/*********************/
/* Package Variables */
@@ -329,6 +328,50 @@ done:
} /* H5VLget_value */
/*-------------------------------------------------------------------------
+ * Function: H5VL__common_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_opt_op,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req, H5VL_object_t **_vol_obj_ptr)
+{
+ H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */
+ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check ID type & get VOL object */
+ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(id, id_type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid identifier")
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ (*reg_opt_op)((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__common_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_copy_connector_info
*
* Purpose: Copy the VOL info for a connector
@@ -1341,8 +1384,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1353,7 +1395,7 @@ H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method")
/* Call the corresponding VOL callback */
- if ((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->attr_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
done:
@@ -1371,10 +1413,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1386,16 +1426,10 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1414,23 +1448,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVaixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if (NULL == args)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct")
/* Call the corresponding internal VOL routine */
- if (H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__attr_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information")
done:
@@ -1449,7 +1484,7 @@ done:
*/
static herr_t
H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1460,8 +1495,9 @@ H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->attr_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1479,10 +1515,8 @@ done:
*/
herr_t
H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1494,17 +1528,12 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1524,13 +1553,13 @@ done:
*/
herr_t
H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVbixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -1539,8 +1568,9 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -1557,8 +1587,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1569,8 +1598,9 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->attr_cls.optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1587,11 +1617,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1603,17 +1630,11 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req,
- arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1632,14 +1653,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVsixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -1648,14 +1669,58 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLattr_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLattr_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Attribute VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the common VOL connector optional routine */
+ if ((ret_value = H5VL__common_optional_op(attr_id, H5I_ATTR, H5VL__attr_optional, args, dxpl_id,
+ token_ptr, &vol_obj)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLattr_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__attr_close
*
* Purpose: Closes an attribute through the VOL
@@ -2169,8 +2234,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2181,7 +2246,7 @@ H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
done:
@@ -2199,10 +2264,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2214,16 +2277,10 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2242,14 +2299,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVcixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2258,7 +2315,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback")
done:
@@ -2276,8 +2333,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2288,7 +2345,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
@@ -2306,11 +2363,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2322,17 +2377,10 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2351,14 +2399,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVdixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2367,7 +2415,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t spec
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
@@ -2385,8 +2433,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2397,7 +2445,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2415,11 +2463,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2431,16 +2476,10 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2459,14 +2498,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVtixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2475,7 +2514,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2483,6 +2522,49 @@ done:
} /* end H5VLdataset_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Dataset VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__common_optional_op(dset_id, H5I_DATASET, H5VL__dataset_optional, args, dxpl_id, token_ptr,
+ &vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLdataset_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__dataset_close
*
* Purpose: Closes a dataset through the VOL
@@ -2807,8 +2889,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2819,8 +2901,8 @@ H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_t
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
+ if ((cls->datatype_cls.get)(obj, args, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype 'get' failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2837,10 +2919,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2852,16 +2932,10 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hi
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2880,14 +2954,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVeixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2895,12 +2969,8 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hi
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->datatype_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method")
-
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback")
done:
@@ -2918,8 +2988,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2930,7 +3000,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
@@ -2948,11 +3018,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2964,17 +3032,10 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2993,14 +3054,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVfixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3009,7 +3070,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t sp
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
@@ -3027,8 +3088,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3039,7 +3100,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_option
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
@@ -3057,11 +3118,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3073,17 +3131,10 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t op
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) <
- 0)
+ if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3092,6 +3143,50 @@ done:
} /* end H5VL_datatype_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_optional_op
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **_vol_obj_ptr)
+{
+ H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */
+ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set up vol_obj_ptr */
+ *vol_obj_ptr = vol_obj;
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__datatype_optional((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VLdatatype_optional
*
* Purpose: Performs an optional connector-specific operation on a datatype
@@ -3102,14 +3197,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVuixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3118,7 +3213,7 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t op
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
@@ -3126,6 +3221,53 @@ done:
} /* end H5VLdatatype_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t type_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5T_t * dt; /* Datatype for this operation */
+ H5VL_object_t *vol_obj = NULL; /* Datatype VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id);
+
+ /* Check args */
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Only invoke callback if VOL object is set for the datatype */
+ if (H5T_invoke_vol_optional(dt, args, dxpl_id, token_ptr, &vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to invoke datatype optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLdatatype_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__datatype_close
*
* Purpose: Closes a datatype through the VOL
@@ -3380,14 +3522,16 @@ static herr_t
H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info, void *op_data)
{
H5VL_file_open_find_connector_t *udata = (H5VL_file_open_find_connector_t *)op_data;
- const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info;
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info;
H5P_genplist_t * fapl_plist;
H5P_genplist_t * fapl_plist_copy;
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ ssize_t num_errors = 0;
herr_t status;
- htri_t is_accessible = FALSE;
- hid_t connector_id = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- herr_t ret_value = H5_ITER_CONT;
+ hid_t connector_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ herr_t ret_value = H5_ITER_CONT;
FUNC_ENTER_STATIC
@@ -3416,19 +3560,40 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in
if (H5P_set_vol(fapl_plist_copy, connector_id, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = udata->filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
+ /* Store current error stack size */
+ if ((num_errors = H5Eget_num(H5E_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size")
+
/* Check if file is accessible with given VOL connector */
H5E_BEGIN_TRY
{
- status = H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- fapl_id, udata->filename, &is_accessible);
+ status = H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL);
}
H5E_END_TRY;
- /* If the file was accessible with the current VOL connector, return
- * the FAPL with that VOL connector set on it. Errors are ignored here
- * as some VOL connectors may not support H5Fis_accessible.
- */
- if (status == SUCCEED && is_accessible > 0) {
+ if (status < 0) {
+ ssize_t new_num_errors = 0;
+
+ /* Pop any errors generated by the above call */
+ if ((new_num_errors = H5Eget_num(H5E_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size")
+ if (new_num_errors > num_errors) {
+ new_num_errors -= num_errors;
+ if (H5Epop(H5E_DEFAULT, (size_t)new_num_errors) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't sanitize error stack")
+ }
+ }
+ else if (status == SUCCEED && is_accessible) {
+ /* If the file was accessible with the current VOL connector, return
+ * the FAPL with that VOL connector set on it.
+ */
+
/* Modify 'connector_prop' to point to the VOL connector that
* was actually used to open the file, rather than the original
* VOL connector that was requested.
@@ -3438,7 +3603,7 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in
udata->fapl_id = fapl_id;
ret_value = H5_ITER_STOP;
- } /* end if */
+ }
done:
if (ret_value != H5_ITER_STOP) {
@@ -3479,21 +3644,18 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned
/* Call the corresponding internal VOL routine */
if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) {
- H5VL_file_open_find_connector_t find_connector_ud;
- hbool_t find_connector;
- hbool_t connector_available = FALSE;
+ hbool_t is_default_conn = TRUE;
/* Opening the file failed - Determine whether we should search
* the plugin path to see if any other VOL connectors are available
- * to attempt to open the file with. This only occurs if no particular
- * VOL connector was specified (either via a FAPL or the
- * HDF5_VOL_CONNECTOR environment variable).
+ * to attempt to open the file with. This only occurs if the default
+ * VOL connector was used for the initial file open attempt.
*/
- find_connector = !getenv("HDF5_VOL_CONNECTOR") && ((H5P_FILE_ACCESS_DEFAULT == fapl_id) ||
- connector_prop->connector_id == H5_DEFAULT_VOL);
+ H5VL__is_default_conn(fapl_id, connector_prop->connector_id, &is_default_conn);
- if (find_connector) {
- herr_t iter_ret;
+ if (is_default_conn) {
+ H5VL_file_open_find_connector_t find_connector_ud;
+ herr_t iter_ret;
find_connector_ud.connector_prop = connector_prop;
find_connector_ud.filename = name;
@@ -3505,24 +3667,24 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned
if (iter_ret < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, NULL,
"failed to iterate over available VOL connector plugins")
- else if (iter_ret)
- connector_available = TRUE;
+ else if (iter_ret) {
+ /* If one of the available VOL connector plugins is
+ * able to open the file, clear the error stack from any
+ * previous file open failures and then open the file.
+ * Otherwise, if no VOL connectors are available, throw
+ * error from original file open failure.
+ */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags,
+ find_connector_ud.fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL,
+ "can't open file '%s' with VOL connector '%s'", name,
+ find_connector_ud.cls->name)
+ }
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
} /* end if */
-
- /* If one of the available VOL connector plugins is
- * able to open the file, clear the error stack from any
- * previous file open failures and then open the file.
- * Otherwise, if no VOL connectors are available, throw
- * error from original file open failure.
- */
- if (connector_available) {
- H5E_clear_stack(NULL);
-
- if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags,
- find_connector_ud.fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'",
- name, find_connector_ud.cls->name)
- }
else
HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
} /* end if */
@@ -3581,8 +3743,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3593,7 +3754,7 @@ H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
done:
@@ -3611,10 +3772,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3626,16 +3785,10 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3654,14 +3807,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVgixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3670,7 +3822,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback")
done:
@@ -3688,8 +3840,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3700,7 +3852,7 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
@@ -3718,33 +3870,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
{
const H5VL_class_t *cls; /* VOL connector's class struct */
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Start access to the varargs, so they are available in all situations below */
- HDva_start(arguments, req);
- arg_started = TRUE;
-
/* Special treatment of file access check & delete operations */
/* (Retrieve the VOL connector from the FAPL, since the file isn't open) */
- if (specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE || args->op_type == H5VL_FILE_DELETE) {
H5P_genplist_t * plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- va_list tmp_args; /* argument list passed from the API call */
hid_t fapl_id; /* File access property list for accessing the file */
/* Get the file access property list to access the file */
- HDva_copy(tmp_args, arguments);
- fapl_id = HDva_arg(tmp_args, hid_t);
- HDva_end(tmp_args);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE)
+ fapl_id = args->args.is_accessible.fapl_id;
+ else {
+ HDassert(args->op_type == H5VL_FILE_DELETE);
+ fapl_id = args->args.del.fapl_id;
+ }
/* Get the VOL info from the FAPL */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -3770,14 +3917,10 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
} /* end else */
/* Call the corresponding internal VOL routine */
- if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3798,21 +3941,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVhixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback")
done:
@@ -3830,8 +3973,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3842,7 +3984,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
@@ -3860,11 +4002,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3876,16 +4015,10 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3904,14 +4037,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVvixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3920,7 +4053,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
done:
@@ -3928,6 +4061,49 @@ done:
} /* end H5VLfile_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLfile_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* File VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__common_optional_op(file_id, H5I_FILE, H5VL__file_optional, args, dxpl_id, token_ptr, &vol_obj) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLfile_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__file_close
*
* Purpose: Closes a file through the VOL
@@ -4244,8 +4420,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4256,7 +4431,7 @@ H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, h
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method")
/* Call the corresponding VOL callback */
- if ((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->group_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
done:
@@ -4274,10 +4449,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4289,16 +4462,10 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dx
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4317,14 +4484,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiViixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4333,7 +4499,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dx
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback")
done:
@@ -4351,8 +4517,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4363,7 +4529,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t s
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method")
/* Call the corresponding VOL callback */
- if ((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
@@ -4381,11 +4547,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4397,17 +4560,10 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) <
- 0)
+ if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4426,14 +4582,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVjixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4442,7 +4598,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
@@ -4460,8 +4616,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4472,8 +4628,9 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t o
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->group_cls.optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4490,11 +4647,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4506,17 +4660,11 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req,
- arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4535,14 +4683,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVwixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4551,14 +4699,58 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__group_optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLgroup_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Group VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if ((ret_value = H5VL__common_optional_op(group_id, H5I_GROUP, H5VL__group_optional, args, dxpl_id,
+ token_ptr, &vol_obj)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLgroup_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__group_close
*
* Purpose: Closes a group through the VOL
@@ -4672,9 +4864,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4685,7 +4876,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.create)(args, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
@@ -4703,31 +4894,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- ...)
+H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
- H5VL_object_t tmp_vol_obj; /* Temporary object */
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ H5VL_object_t tmp_vol_obj; /* Temporary VOL object */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Start the varargs, so they can be copied */
- HDva_start(arguments, req);
- arg_started = TRUE;
-
/* Special case for hard links */
- if (H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
- va_list tmp_arguments; /* Copy of argument list passed in */
-
- /* Get the VOL data pointer from the varargs */
- HDva_copy(tmp_arguments, arguments);
- tmp_vol_obj.data = HDva_arg(tmp_arguments, void *);
- HDva_end(tmp_arguments);
- } /* end if */
+ if (H5VL_LINK_CREATE_HARD == args->op_type && NULL == vol_obj->data)
+ /* Get the VOL data pointer from the arguments */
+ tmp_vol_obj.data = args->args.hard.curr_obj;
else
/* Use the VOL object passed in */
tmp_vol_obj.data = vol_obj->data;
@@ -4739,15 +4918,11 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if (H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id,
- dxpl_id, req, arguments) < 0)
+ if (H5VL__link_create(args, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id,
+ req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4768,23 +4943,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE9("e", "Vk*x*#iiiixx", create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req,
- arguments);
+ H5TRACE8("e", "*!*x*#iiiix", args, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_create(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -5017,7 +5190,7 @@ done:
*/
static herr_t
H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5028,7 +5201,7 @@ H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.get)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
done:
@@ -5046,11 +5219,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5062,17 +5233,10 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5091,14 +5255,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVlixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5107,7 +5271,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_get(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback")
done:
@@ -5126,7 +5290,7 @@ done:
*/
static herr_t
H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5137,8 +5301,9 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->link_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5156,10 +5321,8 @@ done:
*/
herr_t
H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5171,17 +5334,12 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5201,13 +5359,13 @@ done:
*/
herr_t
H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVmixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5216,8 +5374,9 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__link_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -5234,8 +5393,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5246,7 +5405,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -5264,11 +5423,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5280,16 +5437,10 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5308,14 +5459,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVxixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5324,7 +5475,7 @@ H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_optional(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -5332,6 +5483,67 @@ done:
} /* end H5VLlink_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLlink_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id,
+ es_id);
+
+ /* Check arguments */
+ /* name is verified in H5VL_setup_name_args() */
+
+ /* Set up object access arguments */
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__link_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLlink_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__object_open
*
* Purpose: Opens a object through the VOL
@@ -5556,7 +5768,7 @@ done:
*/
static herr_t
H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5567,7 +5779,7 @@ H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_clas
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method")
/* Call the corresponding VOL callback */
- if ((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->object_cls.get)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
done:
@@ -5585,11 +5797,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5601,17 +5811,10 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5630,14 +5833,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVnixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5646,7 +5849,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_get(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback")
done:
@@ -5665,7 +5868,7 @@ done:
*/
static herr_t
H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5676,8 +5879,9 @@ H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5695,10 +5899,8 @@ done:
*/
herr_t
H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5710,17 +5912,12 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id,
+ req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5740,14 +5937,13 @@ done:
*/
herr_t
H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVoixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5755,13 +5951,10 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->object_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method")
-
/* Bypass the H5VLint layer, calling the VOL callback directly */
- if ((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute object specific callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -5778,8 +5971,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5790,7 +5983,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method")
/* Call the corresponding VOL callback */
- if ((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->object_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5808,11 +6001,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5824,16 +6015,10 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_ty
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5852,14 +6037,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVyixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5868,7 +6053,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_ty
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_optional(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5876,6 +6061,68 @@ done:
} /* end H5VLobject_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLobject_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ hid_t es_id)
+{
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id,
+ es_id);
+
+ /* Check arguments */
+ /* name is verified in H5VL_setup_name_args() */
+
+ /* Set up object access arguments */
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__object_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLobject_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__introspect_get_conn_cls
*
* Purpose: Calls the connector-specific callback to query the connector
@@ -5989,6 +6236,76 @@ done:
} /* end H5VLintrospect_get_conn_cls() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_introspect_get_cap_flags
+ *
+ * Purpose: Calls the connector-specific callback to query the connector's
+ * capability flags.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(cls);
+ HDassert(cap_flags);
+
+ /* Check if the corresponding VOL callback exists */
+ if (NULL == cls->introspect_cls.get_cap_flags)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_cap_flags' method")
+
+ /* Call the corresponding VOL callback */
+ if ((cls->introspect_cls.get_cap_flags)(info, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector capability flags")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_introspect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLintrospect_get_cap_flags
+ *
+ * Purpose: Calls the connector-specific callback to query the connector's
+ * capability flags.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags /*out*/)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xix", info, connector_id, cap_flags);
+
+ /* Check args */
+ if (NULL == cap_flags)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer")
+
+ /* Get class pointer */
+ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL_introspect_get_cap_flags(info, cls, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLintrospect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__introspect_opt_query
*
* Purpose: Calls the connector-specific callback to query if an optional
@@ -6135,28 +6452,18 @@ done:
herr_t
H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5VL_request_status_t *status)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_wait() */
@@ -6239,28 +6546,18 @@ done:
herr_t
H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_notify() */
@@ -6342,28 +6639,18 @@ done:
herr_t
H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_cancel() */
@@ -6378,13 +6665,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status)
+H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE3("e", "*xi*#", req, connector_id, status);
+ H5TRACE3("e", "*xix", req, connector_id, status);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
@@ -6409,8 +6696,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_t specific_type,
- va_list arguments)
+H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6425,7 +6711,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0)
+ if ((cls->request_cls.specific)(req, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
@@ -6444,40 +6730,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...)
+H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, specific_type);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0)
+ if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_specific() */
@@ -6492,20 +6759,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments)
+H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments);
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0)
+ if (H5VL__request_specific(req, cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
@@ -6524,8 +6791,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type,
- va_list arguments)
+H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6540,7 +6806,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->request_cls.optional)(req, opt_type, arguments)) < 0)
+ if ((cls->request_cls.optional)(req, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
@@ -6559,39 +6825,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...)
+H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, opt_type);
- arg_started = TRUE;
- if ((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0)
+ if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_optional() */
@@ -6606,20 +6854,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments)
+H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE4("e", "*xiVzx", req, connector_id, opt_type, arguments);
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__request_optional(req, cls, opt_type, arguments)) < 0)
+ if (H5VL__request_optional(req, cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
@@ -6628,6 +6876,43 @@ done:
} /* end H5VLrequest_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
+
+ /* Check arguments */
+ if (NULL == req)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request")
+ if (NULL == args)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments")
+
+ /* Get class pointer */
+ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__request_optional(req, cls, args) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLrequest_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__request_free
*
* Purpose: Frees an asynchronous request through the VOL
@@ -6673,28 +6958,18 @@ done:
herr_t
H5VL_request_free(const H5VL_object_t *vol_obj)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_free() */
@@ -6778,8 +7053,7 @@ done:
herr_t
H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -6788,19 +7062,11 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *
HDassert(size == 0 || buf);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__blob_put(vol_obj->data, vol_obj->connector->cls, buf, size, blob_id, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_put() */
@@ -6882,8 +7148,7 @@ done:
herr_t
H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -6892,19 +7157,11 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size
HDassert(blob_id);
HDassert(buf);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__blob_get(vol_obj->data, vol_obj->connector->cls, blob_id, buf, size, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_get() */
@@ -6953,8 +7210,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6970,7 +7226,7 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method")
/* Call the corresponding VOL callback */
- if ((cls->blob_cls.specific)(obj, blob_id, specific_type, arguments) < 0)
+ if ((cls->blob_cls.specific)(obj, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
@@ -6988,12 +7244,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...)
+H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7001,27 +7254,11 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif
HDassert(vol_obj);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, specific_type);
- arg_started = TRUE;
- if ((ret_value = H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, specific_type,
- arguments)) < 0)
+ if (H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_specific() */
@@ -7035,14 +7272,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE5("e", "*xi*xVBx", obj, connector_id, blob_id, specific_type, arguments);
+ H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args);
/* Get class pointer */
if (NULL == obj)
@@ -7051,7 +7287,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding VOL callback */
- if (H5VL__blob_specific(obj, cls, blob_id, specific_type, arguments) < 0)
+ if (H5VL__blob_specific(obj, cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed")
done:
@@ -7071,8 +7307,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments)
+H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_optional_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7088,7 +7323,7 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method")
/* Call the corresponding VOL callback */
- if ((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0)
+ if ((cls->blob_cls.optional)(obj, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
@@ -7106,12 +7341,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...)
+H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7119,27 +7351,11 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_option
HDassert(vol_obj);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, opt_type);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0)
+ if (H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_optional() */
@@ -7153,14 +7369,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments)
+H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments);
+ H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args);
/* Get class pointer */
if (NULL == obj)
@@ -7169,7 +7384,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_option
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding VOL callback */
- if (H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0)
+ if (H5VL__blob_optional(obj, cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed")
done:
@@ -7243,8 +7458,7 @@ herr_t
H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5O_token_t *token2,
int *cmp_value)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7252,20 +7466,11 @@ H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5
HDassert(vol_obj);
HDassert(cmp_value);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0)
+ if (H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_cmp() */
@@ -7362,8 +7567,7 @@ herr_t
H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_token_t *token,
char **token_str)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7372,21 +7576,11 @@ H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_t
HDassert(token);
HDassert(token_str);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) <
- 0)
+ if (H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_to_str() */
@@ -7480,8 +7674,7 @@ herr_t
H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const char *token_str,
H5O_token_t *token)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7490,21 +7683,11 @@ H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const cha
HDassert(token);
HDassert(token_str);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value =
- H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0)
+ if (H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_from_str() */
@@ -7557,7 +7740,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7568,8 +7751,8 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, v
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+ if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -7586,10 +7769,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...)
+H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -7601,20 +7782,13 @@ H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **r
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback")
+ if ((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, ret_value, "can't reset VOL wrapper info")
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_optional() */
@@ -7630,13 +7804,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiIsixx", obj, connector_id, op_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -7645,8 +7819,8 @@ H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **r
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+ if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index ac40e70..af3530c 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -20,6 +20,7 @@
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
#include "H5Apublic.h" /* Attributes */
+#include "H5Dpublic.h" /* Datasets */
#include "H5ESpublic.h" /* Event Stack */
#include "H5Fpublic.h" /* Files */
#include "H5Ipublic.h" /* IDs */
@@ -33,8 +34,10 @@
/*****************/
/* Capability flags for connector */
-#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
-#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
+#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+#define H5VL_CAP_FLAG_ASYNC 0x02 /* Connector performs operations asynchronously*/
+#define H5VL_CAP_FLAG_NATIVE_FILES 0x04 /* Connector produces native file format */
/* Container info version */
#define H5VL_CONTAINER_INFO_VERSION 0x01 /* Container info struct version */
@@ -42,11 +45,64 @@
/* The maximum size allowed for blobs */
#define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */
+/* # of optional operations reserved for the native VOL connector */
+#define H5VL_RESERVED_NATIVE_OPTIONAL 1024
+
/*******************/
/* Public Typedefs */
/*******************/
-/* types for attribute GET callback */
+/* Types for different ways that objects are located in an HDF5 container */
+typedef enum H5VL_loc_type_t {
+ H5VL_OBJECT_BY_SELF,
+ H5VL_OBJECT_BY_NAME,
+ H5VL_OBJECT_BY_IDX,
+ H5VL_OBJECT_BY_TOKEN
+} H5VL_loc_type_t;
+
+typedef struct H5VL_loc_by_name {
+ const char *name;
+ hid_t lapl_id;
+} H5VL_loc_by_name_t;
+
+typedef struct H5VL_loc_by_idx {
+ const char * name;
+ H5_index_t idx_type;
+ H5_iter_order_t order;
+ hsize_t n;
+ hid_t lapl_id;
+} H5VL_loc_by_idx_t;
+
+typedef struct H5VL_loc_by_token {
+ H5O_token_t *token;
+} H5VL_loc_by_token_t;
+
+/* Structure to hold parameters for object locations.
+ * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
+ *
+ * Note: Leave loc_by_token as the first union member so we
+ * can perform the simplest initialization of the struct
+ * without raising warnings.
+ *
+ * Note: BY_SELF requires no union members.
+ */
+typedef struct H5VL_loc_params_t {
+ H5I_type_t obj_type;
+ H5VL_loc_type_t type;
+ union {
+ H5VL_loc_by_token_t loc_by_token;
+ H5VL_loc_by_name_t loc_by_name;
+ H5VL_loc_by_idx_t loc_by_idx;
+ } loc_data;
+} H5VL_loc_params_t;
+
+/* Struct for all 'optional' callbacks */
+typedef struct H5VL_optional_args_t {
+ int op_type; /* Operation to perform */
+ void *args; /* Pointer to operation's argument struct */
+} H5VL_optional_args_t;
+
+/* Values for attribute 'get' operations */
typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_ACPL, /* creation property list */
H5VL_ATTR_GET_INFO, /* info */
@@ -56,18 +112,115 @@ typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_TYPE /* datatype */
} H5VL_attr_get_t;
-/* types for attribute SPECFIC callback */
+/* Parameters for attribute 'get_name' operation */
+typedef struct H5VL_attr_get_name_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ size_t buf_size; /* Size of attribute name buffer */
+ char * buf; /* Buffer for attribute name (OUT) */
+ size_t * attr_name_len; /* Actual length of attribute name (OUT) */
+} H5VL_attr_get_name_args_t;
+
+/* Parameters for attribute 'get_info' operation */
+typedef struct H5VL_attr_get_info_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ const char * attr_name; /* Attribute name (for get_info_by_name) */
+ H5A_info_t * ainfo; /* Attribute info (OUT) */
+} H5VL_attr_get_info_args_t;
+
+/* Parameters for attribute 'get' operations */
+typedef struct H5VL_attr_get_args_t {
+ H5VL_attr_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_ATTR_GET_ACPL */
+ struct {
+ hid_t acpl_id; /* Attribute creation property list ID (OUT) */
+ } get_acpl;
+
+ /* H5VL_ATTR_GET_INFO */
+ H5VL_attr_get_info_args_t get_info; /* Attribute info */
+
+ /* H5VL_ATTR_GET_NAME */
+ H5VL_attr_get_name_args_t get_name; /* Attribute name */
+
+ /* H5VL_ATTR_GET_SPACE */
+ struct {
+ hid_t space_id; /* Dataspace ID (OUT) */
+ } get_space;
+
+ /* H5VL_ATTR_GET_STORAGE_SIZE */
+ struct {
+ hsize_t *data_size; /* Size of attribute in file (OUT) */
+ } get_storage_size;
+
+ /* H5VL_ATTR_GET_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID (OUT) */
+ } get_type;
+ } args;
+} H5VL_attr_get_args_t;
+
+/* Values for attribute 'specific' operation */
typedef enum H5VL_attr_specific_t {
- H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */
- H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
- H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
- H5VL_ATTR_RENAME /* H5Arename(_by_name) */
+ H5VL_ATTR_DELETE, /* H5Adelete(_by_name) */
+ H5VL_ATTR_DELETE_BY_IDX, /* H5Adelete_by_idx */
+ H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
+ H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
+ H5VL_ATTR_RENAME /* H5Arename(_by_name) */
} H5VL_attr_specific_t;
+/* Parameters for attribute 'iterate' operation */
+typedef struct H5VL_attr_iterate_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t * idx; /* Start/stop iteration index (IN/OUT) */
+ H5A_operator2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_attr_iterate_args_t;
+
+/* Parameters for attribute 'delete_by_idx' operation */
+typedef struct H5VL_attr_delete_by_idx_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t n; /* Iteration index */
+} H5VL_attr_delete_by_idx_args_t;
+
+/* Parameters for attribute 'specific' operations */
+typedef struct H5VL_attr_specific_args_t {
+ H5VL_attr_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_ATTR_DELETE */
+ struct {
+ const char *name; /* Name of attribute to delete */
+ } del;
+
+ /* H5VL_ATTR_DELETE_BY_IDX */
+ H5VL_attr_delete_by_idx_args_t delete_by_idx;
+
+ /* H5VL_ATTR_EXISTS */
+ struct {
+ const char *name; /* Name of attribute to check */
+ hbool_t * exists; /* Whether attribute exists (OUT) */
+ } exists;
+
+ /* H5VL_ATTR_ITER */
+ H5VL_attr_iterate_args_t iterate;
+
+ /* H5VL_ATTR_RENAME */
+ struct {
+ const char *old_name; /* Name of attribute to rename */
+ const char *new_name; /* New attribute name */
+ } rename;
+ } args;
+} H5VL_attr_specific_args_t;
+
/* Typedef for VOL connector attribute optional VOL operations */
typedef int H5VL_attr_optional_t;
-/* types for dataset GET callback */
+/* Values for dataset 'get' operation */
typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_DAPL, /* access property list */
H5VL_DATASET_GET_DCPL, /* creation property list */
@@ -77,31 +230,146 @@ typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_TYPE /* datatype */
} H5VL_dataset_get_t;
-/* types for dataset SPECFIC callback */
+/* Parameters for dataset 'get' operations */
+typedef struct H5VL_dataset_get_args_t {
+ H5VL_dataset_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATASET_GET_DAPL */
+ struct {
+ hid_t dapl_id; /* Dataset access property list ID (OUT) */
+ } get_dapl;
+
+ /* H5VL_DATASET_GET_DCPL */
+ struct {
+ hid_t dcpl_id; /* Dataset creation property list ID (OUT) */
+ } get_dcpl;
+
+ /* H5VL_DATASET_GET_SPACE */
+ struct {
+ hid_t space_id; /* Dataspace ID (OUT) */
+ } get_space;
+
+ /* H5VL_DATASET_GET_SPACE_STATUS */
+ struct {
+ H5D_space_status_t *status; /* Storage space allocation status (OUT) */
+ } get_space_status;
+
+ /* H5VL_DATASET_GET_STORAGE_SIZE */
+ struct {
+ hsize_t *storage_size; /* Size of dataset's storage (OUT) */
+ } get_storage_size;
+
+ /* H5VL_DATASET_GET_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID (OUT) */
+ } get_type;
+ } args;
+} H5VL_dataset_get_args_t;
+
+/* Values for dataset 'specific' operation */
typedef enum H5VL_dataset_specific_t {
H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
H5VL_DATASET_FLUSH, /* H5Dflush */
- H5VL_DATASET_REFRESH, /* H5Drefresh */
- H5VL_DATASET_WAIT /* H5Dwait */
+ H5VL_DATASET_REFRESH /* H5Drefresh */
} H5VL_dataset_specific_t;
+/* Parameters for dataset 'specific' operations */
+typedef struct H5VL_dataset_specific_args_t {
+ H5VL_dataset_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATASET_SET_EXTENT */
+ struct {
+ const hsize_t *size; /* New dataspace extent */
+ } set_extent;
+
+ /* H5VL_DATASET_FLUSH */
+ struct {
+ hid_t dset_id; /* Dataset ID (IN) */
+ } flush;
+
+ /* H5VL_DATASET_REFRESH */
+ struct {
+ hid_t dset_id; /* Dataset ID (IN) */
+ } refresh;
+ } args;
+} H5VL_dataset_specific_args_t;
+
/* Typedef for VOL connector dataset optional VOL operations */
typedef int H5VL_dataset_optional_t;
-/* types for datatype GET callback */
+/* Values for datatype 'get' operation */
typedef enum H5VL_datatype_get_t {
- H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */
- H5VL_DATATYPE_GET_TCPL /* datatype creation property list */
+ H5VL_DATATYPE_GET_BINARY_SIZE, /* Get size of serialized form of transient type */
+ H5VL_DATATYPE_GET_BINARY, /* Get serialized form of transient type */
+ H5VL_DATATYPE_GET_TCPL /* Datatype creation property list */
} H5VL_datatype_get_t;
-/* types for datatype SPECFIC callback */
-typedef enum H5VL_datatype_specific_t { H5VL_DATATYPE_FLUSH, H5VL_DATATYPE_REFRESH } H5VL_datatype_specific_t;
+/* Parameters for datatype 'get' operations */
+typedef struct H5VL_datatype_get_args_t {
+ H5VL_datatype_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATATYPE_GET_BINARY_SIZE */
+ struct {
+ size_t *size; /* Size of serialized form of datatype (OUT) */
+ } get_binary_size;
+
+ /* H5VL_DATATYPE_GET_BINARY */
+ struct {
+ void * buf; /* Buffer to store serialized form of datatype (OUT) */
+ size_t buf_size; /* Size of serialized datatype buffer */
+ } get_binary;
+
+ /* H5VL_DATATYPE_GET_TCPL */
+ struct {
+ hid_t tcpl_id; /* Named datatype creation property list ID (OUT) */
+ } get_tcpl;
+ } args;
+} H5VL_datatype_get_args_t;
+
+/* Values for datatype 'specific' operation */
+typedef enum H5VL_datatype_specific_t {
+ H5VL_DATATYPE_FLUSH, /* H5Tflush */
+ H5VL_DATATYPE_REFRESH /* H5Trefresh */
+} H5VL_datatype_specific_t;
+
+/* Parameters for datatype 'specific' operations */
+typedef struct H5VL_datatype_specific_args_t {
+ H5VL_datatype_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATATYPE_FLUSH */
+ struct {
+ hid_t type_id; /* Named datatype ID (IN) */
+ } flush;
+
+ /* H5VL_DATATYPE_REFRESH */
+ struct {
+ hid_t type_id; /* Named datatype ID (IN) */
+ } refresh;
+ } args;
+} H5VL_datatype_specific_args_t;
/* Typedef and values for native VOL connector named datatype optional VOL operations */
typedef int H5VL_datatype_optional_t;
/* (No optional named datatype VOL operations currently) */
-/* types for file GET callback */
+/* Info for H5VL_FILE_GET_CONT_INFO */
+typedef struct H5VL_file_cont_info_t {
+ unsigned version; /* version information (keep first) */
+ uint64_t feature_flags; /* Container feature flags */
+ /* (none currently defined) */
+ size_t token_size; /* Size of tokens */
+ size_t blob_id_size; /* Size of blob IDs */
+} H5VL_file_cont_info_t;
+
+/* Values for file 'get' operation */
typedef enum H5VL_file_get_t {
H5VL_FILE_GET_CONT_INFO, /* file get container info */
H5VL_FILE_GET_FAPL, /* file access property list */
@@ -113,59 +381,296 @@ typedef enum H5VL_file_get_t {
H5VL_FILE_GET_OBJ_IDS /* object ids in file */
} H5VL_file_get_t;
-/* types for file SPECIFIC callback */
+/* Parameters for file 'get_name' operation */
+typedef struct H5VL_file_get_name_args_t {
+ H5I_type_t type; /* ID type of object pointer */
+ size_t buf_size; /* Size of file name buffer (IN) */
+ char * buf; /* Buffer for file name (OUT) */
+ size_t * file_name_len; /* Actual length of file name (OUT) */
+} H5VL_file_get_name_args_t;
+
+/* Parameters for file 'get_obj_ids' operation */
+typedef struct H5VL_file_get_obj_ids_args_t {
+ unsigned types; /* Type of objects to count */
+ size_t max_objs; /* Size of array of object IDs */
+ hid_t * oid_list; /* Array of object IDs (OUT) */
+ size_t * count; /* # of objects (OUT) */
+} H5VL_file_get_obj_ids_args_t;
+
+/* Parameters for file 'get' operations */
+typedef struct H5VL_file_get_args_t {
+ H5VL_file_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_FILE_GET_CONT_INFO */
+ struct {
+ H5VL_file_cont_info_t *info; /* Container info (OUT) */
+ } get_cont_info;
+
+ /* H5VL_FILE_GET_FAPL */
+ struct {
+ hid_t fapl_id; /* File access property list (OUT) */
+ } get_fapl;
+
+ /* H5VL_FILE_GET_FCPL */
+ struct {
+ hid_t fcpl_id; /* File creation property list (OUT) */
+ } get_fcpl;
+
+ /* H5VL_FILE_GET_FILENO */
+ struct {
+ unsigned long *fileno; /* File "number" (OUT) */
+ } get_fileno;
+
+ /* H5VL_FILE_GET_INTENT */
+ struct {
+ unsigned *flags; /* File open/create intent flags (OUT) */
+ } get_intent;
+
+ /* H5VL_FILE_GET_NAME */
+ H5VL_file_get_name_args_t get_name;
+
+ /* H5VL_FILE_GET_OBJ_COUNT */
+ struct {
+ unsigned types; /* Type of objects to count */
+ size_t * count; /* # of objects (OUT) */
+ } get_obj_count;
+
+ /* H5VL_FILE_GET_OBJ_IDS */
+ H5VL_file_get_obj_ids_args_t get_obj_ids;
+ } args;
+} H5VL_file_get_args_t;
+
+/* Values for file 'specific' operation */
typedef enum H5VL_file_specific_t {
H5VL_FILE_FLUSH, /* Flush file */
H5VL_FILE_REOPEN, /* Reopen the file */
- H5VL_FILE_MOUNT, /* Mount a file */
- 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_WAIT /* Wait for async operations to complete */
+ H5VL_FILE_IS_EQUAL /* Check if two files are the same */
} H5VL_file_specific_t;
+/* Parameters for file 'specific' operations */
+typedef struct H5VL_file_specific_args_t {
+ H5VL_file_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_FILE_FLUSH */
+ struct {
+ H5I_type_t obj_type; /* Type of object to use */
+ H5F_scope_t scope; /* Scope of flush operation */
+ } flush;
+
+ /* H5VL_FILE_REOPEN */
+ struct {
+ void **file; /* File object for new file (OUT) */
+ } reopen;
+
+ /* H5VL_FILE_IS_ACCESSIBLE */
+ struct {
+ const char *filename; /* Name of file to check */
+ hid_t fapl_id; /* File access property list to use */
+ hbool_t * accessible; /* Whether file is accessible with FAPL settings (OUT) */
+ } is_accessible;
+
+ /* H5VL_FILE_DELETE */
+ struct {
+ const char *filename; /* Name of file to delete */
+ hid_t fapl_id; /* File access property list to use */
+ } del;
+
+ /* H5VL_FILE_IS_EQUAL */
+ struct {
+ void * obj2; /* Second file object to compare against */
+ hbool_t *same_file; /* Whether files are the same (OUT) */
+ } is_equal;
+ } args;
+} H5VL_file_specific_args_t;
+
/* Typedef for VOL connector file optional VOL operations */
typedef int H5VL_file_optional_t;
-/* types for group GET callback */
+/* Values for group 'get' operation */
typedef enum H5VL_group_get_t {
H5VL_GROUP_GET_GCPL, /* group creation property list */
H5VL_GROUP_GET_INFO /* group info */
} H5VL_group_get_t;
-/* types for group SPECFIC callback */
-typedef enum H5VL_group_specific_t { H5VL_GROUP_FLUSH, H5VL_GROUP_REFRESH } H5VL_group_specific_t;
+/* Parameters for group 'get_info' operation */
+typedef struct H5VL_group_get_info_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5G_info_t * ginfo; /* Group info (OUT) */
+} H5VL_group_get_info_args_t;
+
+/* Parameters for group 'get' operations */
+typedef struct H5VL_group_get_args_t {
+ H5VL_group_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_GROUP_GET_GCPL */
+ struct {
+ hid_t gcpl_id; /* Group creation property list (OUT) */
+ } get_gcpl;
+
+ /* H5VL_GROUP_GET_INFO */
+ H5VL_group_get_info_args_t get_info; /* Group info */
+ } args;
+} H5VL_group_get_args_t;
+
+/* Values for group 'specific' operation */
+typedef enum H5VL_group_specific_t {
+ H5VL_GROUP_MOUNT, /* Mount a file on a group */
+ H5VL_GROUP_UNMOUNT, /* Unmount a file on a group */
+ H5VL_GROUP_FLUSH, /* H5Gflush */
+ H5VL_GROUP_REFRESH /* H5Grefresh */
+} H5VL_group_specific_t;
+
+/* Parameters for group 'mount' operation */
+typedef struct H5VL_group_spec_mount_args_t {
+ const char *name; /* Name of location to mount child file */
+ void * child_file; /* Pointer to child file object */
+ hid_t fmpl_id; /* File mount property list to use */
+} H5VL_group_spec_mount_args_t;
+
+/* Parameters for group 'specific' operations */
+typedef struct H5VL_group_specific_args_t {
+ H5VL_group_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_GROUP_MOUNT */
+ H5VL_group_spec_mount_args_t mount;
+
+ /* H5VL_GROUP_UNMOUNT */
+ struct {
+ const char *name; /* Name of location to unmount child file */
+ } unmount;
+
+ /* H5VL_GROUP_FLUSH */
+ struct {
+ hid_t grp_id; /* Group ID (IN) */
+ } flush;
+
+ /* H5VL_GROUP_REFRESH */
+ struct {
+ hid_t grp_id; /* Group ID (IN) */
+ } refresh;
+ } args;
+} H5VL_group_specific_args_t;
/* Typedef for VOL connector group optional VOL operations */
typedef int H5VL_group_optional_t;
-/* link create types for VOL */
-typedef enum H5VL_link_create_type_t {
+/* Link create types for VOL */
+typedef enum H5VL_link_create_t {
H5VL_LINK_CREATE_HARD,
H5VL_LINK_CREATE_SOFT,
H5VL_LINK_CREATE_UD
-} H5VL_link_create_type_t;
+} H5VL_link_create_t;
+
+/* Parameters for link 'create' operations */
+typedef struct H5VL_link_create_args_t {
+ H5VL_link_create_t op_type; /* Operation to perform */
-/* types for link GET callback */
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_CREATE_HARD */
+ struct {
+ void * curr_obj; /* Current object */
+ H5VL_loc_params_t curr_loc_params; /* Location parameters for current object */
+ } hard;
+
+ /* H5VL_LINK_CREATE_SOFT */
+ struct {
+ const char *target; /* Target of soft link */
+ } soft;
+
+ /* H5VL_LINK_CREATE_UD */
+ struct {
+ H5L_type_t type; /* Type of link to create */
+ const void *buf; /* Buffer that contains link info */
+ size_t buf_size; /* Size of link info buffer */
+ } ud;
+ } args;
+} H5VL_link_create_args_t;
+
+/* Values for link 'get' operation */
typedef enum H5VL_link_get_t {
H5VL_LINK_GET_INFO, /* link info */
H5VL_LINK_GET_NAME, /* link name */
H5VL_LINK_GET_VAL /* link value */
} H5VL_link_get_t;
-/* types for link SPECIFIC callback */
+/* Parameters for link 'get' operations */
+typedef struct H5VL_link_get_args_t {
+ H5VL_link_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_GET_INFO */
+ struct {
+ H5L_info2_t *linfo; /* Pointer to link's info (OUT) */
+ } get_info;
+
+ /* H5VL_LINK_GET_NAME */
+ struct {
+ size_t name_size; /* Size of link name buffer (IN) */
+ char * name; /* Buffer for link name (OUT) */
+ size_t *name_len; /* Actual length of link name (OUT) */
+ } get_name;
+
+ /* H5VL_LINK_GET_VAL */
+ struct {
+ size_t buf_size; /* Size of link value buffer (IN) */
+ void * buf; /* Buffer for link value (OUT) */
+ } get_val;
+ } args;
+} H5VL_link_get_args_t;
+
+/* Values for link 'specific' operation */
typedef enum H5VL_link_specific_t {
H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */
H5VL_LINK_EXISTS, /* link existence */
H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
} H5VL_link_specific_t;
+/* Parameters for link 'iterate' operation */
+typedef struct H5VL_link_iterate_args_t {
+ hbool_t recursive; /* Whether iteration is recursive */
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t * idx_p; /* Start/stop iteration index (OUT) */
+ H5L_iterate2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_link_iterate_args_t;
+
+/* Parameters for link 'specific' operations */
+typedef struct H5VL_link_specific_args_t {
+ H5VL_link_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_DELETE */
+ /* No args */
+
+ /* H5VL_LINK_EXISTS */
+ struct {
+ hbool_t *exists; /* Whether link exists (OUT) */
+ } exists;
+
+ /* H5VL_LINK_ITER */
+ H5VL_link_iterate_args_t iterate;
+ } args;
+} H5VL_link_specific_args_t;
+
/* Typedef and values for native VOL connector link optional VOL operations */
typedef int H5VL_link_optional_t;
/* (No optional link VOL operations currently) */
-/* types for object GET callback */
+/* Values for object 'get' operation */
typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_FILE, /* object file */
H5VL_OBJECT_GET_NAME, /* object name */
@@ -173,7 +678,38 @@ typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */
} H5VL_object_get_t;
-/* types for object SPECIFIC callback */
+/* Parameters for object 'get' operations */
+typedef struct H5VL_object_get_args_t {
+ H5VL_object_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_OBJECT_GET_FILE */
+ struct {
+ void **file; /* File object (OUT) */
+ } get_file;
+
+ /* H5VL_OBJECT_GET_NAME */
+ struct {
+ size_t buf_size; /* Size of name buffer (IN) */
+ char * buf; /* Buffer for name (OUT) */
+ size_t *name_len; /* Actual length of name (OUT) */
+ } get_name;
+
+ /* H5VL_OBJECT_GET_TYPE */
+ struct {
+ H5O_type_t *obj_type; /* Type of object (OUT) */
+ } get_type;
+
+ /* H5VL_OBJECT_GET_INFO */
+ struct {
+ unsigned fields; /* Flags for fields to retrieve */
+ H5O_info2_t *oinfo; /* Pointer to object info (OUT) */
+ } get_info;
+ } args;
+} H5VL_object_get_args_t;
+
+/* Values for object 'specific' operation */
typedef enum H5VL_object_specific_t {
H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
@@ -183,6 +719,51 @@ typedef enum H5VL_object_specific_t {
H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
} H5VL_object_specific_t;
+/* Parameters for object 'visit' operation */
+typedef struct H5VL_object_visit_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ unsigned fields; /* Flags for fields to provide in 'info' object for 'op' callback */
+ H5O_iterate2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_object_visit_args_t;
+
+/* Parameters for object 'specific' operations */
+typedef struct H5VL_object_specific_args_t {
+ H5VL_object_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_OBJECT_CHANGE_REF_COUNT */
+ struct {
+ int delta; /* Amount to modify object's refcount */
+ } change_rc;
+
+ /* H5VL_OBJECT_EXISTS */
+ struct {
+ hbool_t *exists; /* Whether object exists (OUT) */
+ } exists;
+
+ /* H5VL_OBJECT_LOOKUP */
+ struct {
+ H5O_token_t *token_ptr; /* Pointer to token for lookup (OUT) */
+ } lookup;
+
+ /* H5VL_OBJECT_VISIT */
+ H5VL_object_visit_args_t visit;
+
+ /* H5VL_OBJECT_FLUSH */
+ struct {
+ hid_t obj_id; /* Object ID (IN) */
+ } flush;
+
+ /* H5VL_OBJECT_REFRESH */
+ struct {
+ hid_t obj_id; /* Object ID (IN) */
+ } refresh;
+ } args;
+} H5VL_object_specific_args_t;
+
/* Typedef for VOL connector object optional VOL operations */
typedef int H5VL_object_optional_t;
@@ -199,82 +780,64 @@ typedef enum H5VL_request_status_t {
H5VL_REQUEST_STATUS_CANCELED /* Operation has not completed and was canceled */
} H5VL_request_status_t;
-/* types for async request SPECIFIC callback */
+/* Values for async request 'specific' operation */
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_GET_ERR_STACK /* Retrieve error stack for failed operation */
+ H5VL_REQUEST_GET_ERR_STACK, /* Retrieve error stack for failed operation */
+ H5VL_REQUEST_GET_EXEC_TIME /* Retrieve execution time for operation */
} H5VL_request_specific_t;
+/* Parameters for request 'specific' operations */
+typedef struct H5VL_request_specific_args_t {
+ H5VL_request_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_REQUEST_GET_ERR_STACK */
+ struct {
+ hid_t err_stack_id; /* Error stack ID for operation (OUT) */
+ } get_err_stack;
+
+ /* H5VL_REQUEST_GET_EXEC_TIME */
+ struct {
+ uint64_t *exec_ts; /* Timestamp for start of task execution (OUT) */
+ uint64_t *exec_time; /* Duration of task execution (in ns) (OUT) */
+ } get_exec_time;
+ } args;
+} H5VL_request_specific_args_t;
+
/* Typedef and values for native VOL connector request optional VOL operations */
typedef int H5VL_request_optional_t;
/* (No optional request VOL operations currently) */
-/* types for 'blob' SPECIFIC callback */
+/* Values for 'blob' 'specific' operation */
typedef enum H5VL_blob_specific_t {
- H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
- H5VL_BLOB_GETSIZE, /* Get size of blob */
- H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
- H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
+ H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
+ H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
+ H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
} H5VL_blob_specific_t;
-/* Typedef and values for native VOL connector blob optional VOL operations */
-typedef int H5VL_blob_optional_t;
-/* (No optional blob VOL operations currently) */
-
-/* Types for different ways that objects are located in an HDF5 container */
-typedef enum H5VL_loc_type_t {
- H5VL_OBJECT_BY_SELF,
- H5VL_OBJECT_BY_NAME,
- H5VL_OBJECT_BY_IDX,
- H5VL_OBJECT_BY_TOKEN
-} H5VL_loc_type_t;
-
-typedef struct H5VL_loc_by_name {
- const char *name;
- hid_t lapl_id;
-} H5VL_loc_by_name_t;
+/* Parameters for blob 'specific' operations */
+typedef struct H5VL_blob_specific_args_t {
+ H5VL_blob_specific_t op_type; /* Operation to perform */
-typedef struct H5VL_loc_by_idx {
- const char * name;
- H5_index_t idx_type;
- H5_iter_order_t order;
- hsize_t n;
- hid_t lapl_id;
-} H5VL_loc_by_idx_t;
+ /* Parameters for each operation */
+ union {
+ /* H5VL_BLOB_DELETE */
+ /* No args */
-typedef struct H5VL_loc_by_token {
- H5O_token_t *token;
-} H5VL_loc_by_token_t;
+ /* H5VL_BLOB_ISNULL */
+ struct {
+ hbool_t *isnull; /* Whether blob ID is "null" (OUT) */
+ } is_null;
-/* Structure to hold parameters for object locations.
- * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
- *
- * Note: Leave loc_by_token as the first union member so we
- * can perform the simplest initialization of the struct
- * without raising warnings.
- *
- * Note: BY_SELF requires no union members.
- */
-typedef struct H5VL_loc_params_t {
- H5I_type_t obj_type;
- H5VL_loc_type_t type;
- union {
- H5VL_loc_by_token_t loc_by_token;
- H5VL_loc_by_name_t loc_by_name;
- H5VL_loc_by_idx_t loc_by_idx;
- } loc_data;
-} H5VL_loc_params_t;
+ /* H5VL_BLOB_SETNULL */
+ /* No args */
+ } args;
+} H5VL_blob_specific_args_t;
-/* Info for H5VL_FILE_GET_CONT_INFO */
-typedef struct H5VL_file_cont_info_t {
- unsigned version; /* version information (keep first) */
- uint64_t feature_flags; /* Container feature flags */
- /* (none currently defined) */
- size_t token_size; /* Size of tokens */
- size_t blob_id_size; /* Size of blob IDs */
-} H5VL_file_cont_info_t;
+/* Typedef and values for native VOL connector blob optional VOL operations */
+typedef int H5VL_blob_optional_t;
+/* (No optional blob VOL operations currently) */
/* VOL connector info fields & callbacks */
typedef struct H5VL_info_class_t {
@@ -309,11 +872,10 @@ typedef struct H5VL_attr_class_t {
hid_t dxpl_id, void **req);
herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *attr, hid_t dxpl_id, void **req);
} H5VL_attr_class_t;
@@ -327,11 +889,9 @@ typedef struct H5VL_dataset_class_t {
void *buf, void **req);
herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
- herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *dset, hid_t dxpl_id, void **req);
} H5VL_dataset_class_t;
@@ -341,11 +901,9 @@ typedef struct H5VL_datatype_class_t {
hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *dt, hid_t dxpl_id, void **req);
} H5VL_datatype_class_t;
@@ -354,11 +912,9 @@ typedef struct H5VL_file_class_t {
void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
void **req);
void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *file, hid_t dxpl_id, void **req);
} H5VL_file_class_t;
@@ -368,30 +924,28 @@ typedef struct H5VL_group_class_t {
hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *grp, hid_t dxpl_id, void **req);
} H5VL_group_class_t;
/* H5L routines */
typedef struct H5VL_link_class_t {
- herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*create)(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
void **req);
herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args, hid_t dxpl_id,
+ void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
} H5VL_link_class_t;
/* H5O routines */
@@ -401,12 +955,12 @@ typedef struct H5VL_object_class_t {
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, void *dst_obj,
const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args, hid_t dxpl_id,
+ void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
} H5VL_object_class_t;
/* Asynchronous request 'notify' callback */
@@ -426,6 +980,7 @@ struct H5VL_class_t;
/* Container/connector introspection routines */
typedef struct H5VL_introspect_class_t {
herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls);
+ herr_t (*get_cap_flags)(const void *info, unsigned *cap_flags);
herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags);
} H5VL_introspect_class_t;
@@ -434,8 +989,8 @@ typedef struct H5VL_request_class_t {
herr_t (*wait)(void *req, uint64_t timeout, H5VL_request_status_t *status);
herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
herr_t (*cancel)(void *req, H5VL_request_status_t *status);
- herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
- herr_t (*optional)(void *req, H5VL_request_optional_t opt_type, va_list arguments);
+ herr_t (*specific)(void *req, H5VL_request_specific_args_t *args);
+ herr_t (*optional)(void *req, H5VL_optional_args_t *args);
herr_t (*free)(void *req);
} H5VL_request_class_t;
@@ -443,8 +998,8 @@ typedef struct H5VL_request_class_t {
typedef struct H5VL_blob_class_t {
herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
- herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
- herr_t (*optional)(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+ herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
+ herr_t (*optional)(void *obj, void *blob_id, H5VL_optional_args_t *args);
} H5VL_blob_class_t;
/* Object token routines */
@@ -458,7 +1013,7 @@ typedef struct H5VL_token_class_t {
* \ingroup H5VLDEV
* Class information for each VOL connector
*/
-//! [H5VL_class_t_snip]
+//! <!-- [H5VL_class_t_snip] -->
typedef struct H5VL_class_t {
/* Overall connector fields & callbacks */
unsigned version; /**< VOL connector class struct version # */
@@ -489,10 +1044,10 @@ typedef struct H5VL_class_t {
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 */
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req); /**< Optional callback */
} H5VL_class_t;
-//! [H5VL_class_t_snip]
+//! <!-- [H5VL_class_t_snip] -->
/********************/
/* Public Variables */
@@ -529,15 +1084,14 @@ extern "C" {
* 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 VOL documentation.
+ * 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
*
- * \todo Fix the reference to VOL documentation.
- *
* \since 1.12.0
+ *
*/
H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
/**
@@ -557,6 +1111,53 @@ H5_DLL hid_t H5VLpeek_connector_id_by_name(const char *name);
*/
H5_DLL hid_t H5VLpeek_connector_id_by_value(H5VL_class_value_t value);
+/* User-defined optional operations */
+H5_DLL herr_t H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name);
+H5_DLL herr_t H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t attr_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t dset_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t type_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t file_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t group_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *name, hid_t lapl_id, H5VL_optional_args_t *args,
+ hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *name, hid_t lapl_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args);
+
+/* API Wrappers for "optional_op" routines */
+/* (Must be defined _after_ the function prototype) */
+/* (And must only defined when included in application code, not the library) */
+#ifndef H5VL_MODULE
+/* Inject application compile-time macros into function calls */
+#define H5VLattr_optional_op(...) H5VLattr_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLdataset_optional_op(...) H5VLdataset_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLdatatype_optional_op(...) H5VLdatatype_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLfile_optional_op(...) H5VLfile_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLgroup_optional_op(...) H5VLgroup_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLlink_optional_op(...) H5VLlink_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLobject_optional_op(...) H5VLobject_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+
+/* Define "wrapper" versions of function calls, to allow compile-time values to
+ * be passed in by language wrapper or library layer on top of HDF5.
+ */
+#define H5VLattr_optional_op_wrap H5_NO_EXPAND(H5VLattr_optional_op)
+#define H5VLdataset_optional_op_wrap H5_NO_EXPAND(H5VLdataset_optional_op)
+#define H5VLdatatype_optional_op_wrap H5_NO_EXPAND(H5VLdatatype_optional_op)
+#define H5VLfile_optional_op_wrap H5_NO_EXPAND(H5VLfile_optional_op)
+#define H5VLgroup_optional_op_wrap H5_NO_EXPAND(H5VLgroup_optional_op)
+#define H5VLlink_optional_op_wrap H5_NO_EXPAND(H5VLlink_optional_op)
+#define H5VLobject_optional_op_wrap H5_NO_EXPAND(H5VLobject_optional_op)
+#endif /* H5VL_MODULE */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
index 720740f..17029f0 100644
--- a/src/H5VLconnector_passthru.h
+++ b/src/H5VLconnector_passthru.h
@@ -58,8 +58,9 @@ extern "C" {
H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
H5_DLL herr_t H5VLretrieve_lib_state(void **state);
+H5_DLL herr_t H5VLstart_lib_state(void);
H5_DLL herr_t H5VLrestore_lib_state(const void *state);
-H5_DLL herr_t H5VLreset_lib_state(void);
+H5_DLL herr_t H5VLfinish_lib_state(void);
H5_DLL herr_t H5VLfree_lib_state(void *state);
/* Pass-through callbacks */
@@ -92,13 +93,12 @@ H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void
void **req);
H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for dataset callbacks */
@@ -111,12 +111,12 @@ H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
-H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for named datatype callbacks */
@@ -125,24 +125,24 @@ H5_DLL void * H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params
hid_t dxpl_id, void **req);
H5_DLL void * H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for file callbacks */
H5_DLL void * H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
void **req);
H5_DLL void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for group callbacks */
@@ -151,18 +151,17 @@ H5_DLL void * H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, h
void **req);
H5_DLL void * H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for link callbacks */
-H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -170,12 +169,11 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Public wrappers for object callbacks */
H5_DLL void * H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
@@ -184,16 +182,16 @@ H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params
void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Public wrappers for connector/container introspection callbacks */
H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags);
H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, int opt_type,
uint64_t *flags);
@@ -202,10 +200,8 @@ H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout,
H5VL_request_status_t *status);
H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx);
H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status);
-H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type,
- va_list arguments);
-H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type,
- va_list arguments);
+H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t *args);
+H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args);
H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
/* Public wrappers for blob callbacks */
@@ -214,9 +210,8 @@ H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_
H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size,
void *ctx);
H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id,
- H5VL_blob_specific_t specific_type, va_list arguments);
-H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments);
+ H5VL_blob_specific_args_t *args);
+H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_args_t *args);
/* Public wrappers for token callbacks */
H5_DLL herr_t H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1,
@@ -227,8 +222,8 @@ H5_DLL herr_t H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector
H5O_token_t *token);
/* Public wrappers for generic 'optional' callback */
-H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
#ifdef __cplusplus
}
diff --git a/src/H5VLdyn_ops.c b/src/H5VLdyn_ops.c
new file mode 100644
index 0000000..0992452
--- /dev/null
+++ b/src/H5VLdyn_ops.c
@@ -0,0 +1,334 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: The Virtual Object Layer as described in documentation.
+ * The pupose is to provide an abstraction on how to access the
+ * underlying HDF5 container, whether in a local file with
+ * a specific file format, or remotely on other machines, etc...
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
+
+/***********/
+/* Headers */
+/***********/
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Dynamic operation info */
+typedef struct H5VL_dyn_op_t {
+ char *op_name; /* Name of operation */
+ int op_val; /* Value of operation */
+} H5VL_dyn_op_t;
+
+/********************/
+/* Local Prototypes */
+/********************/
+static void H5VL__release_dyn_op(H5VL_dyn_op_t *dyn_op);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* The current optional operation values */
+static int H5VL_opt_vals_g[H5VL_SUBCLS_TOKEN + 1] = {
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_NONE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_INFO */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_WRAP */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_ATTR */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_DATASET */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_DATATYPE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_FILE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_GROUP */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_LINK */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_OBJECT */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_REQUEST */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_BLOB */
+ H5VL_RESERVED_NATIVE_OPTIONAL /* H5VL_SUBCLS_TOKEN */
+};
+
+/* The current optional operations' info */
+static H5SL_t *H5VL_opt_ops_g[H5VL_SUBCLS_TOKEN + 1] = {
+ NULL, /* H5VL_SUBCLS_NONE */
+ NULL, /* H5VL_SUBCLS_INFO */
+ NULL, /* H5VL_SUBCLS_WRAP */
+ NULL, /* H5VL_SUBCLS_ATTR */
+ NULL, /* H5VL_SUBCLS_DATASET */
+ NULL, /* H5VL_SUBCLS_DATATYPE */
+ NULL, /* H5VL_SUBCLS_FILE */
+ NULL, /* H5VL_SUBCLS_GROUP */
+ NULL, /* H5VL_SUBCLS_LINK */
+ NULL, /* H5VL_SUBCLS_OBJECT */
+ NULL, /* H5VL_SUBCLS_REQUEST */
+ NULL, /* H5VL_SUBCLS_BLOB */
+ NULL /* H5VL_SUBCLS_TOKEN */
+};
+
+/* Declare a free list to manage the H5VL_class_t struct */
+H5FL_DEFINE_STATIC(H5VL_dyn_op_t);
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__release_dyn_op
+ *
+ * Purpose: Release a dynamic operation info node
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+H5VL__release_dyn_op(H5VL_dyn_op_t *dyn_op)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ H5MM_xfree(dyn_op->op_name);
+ H5FL_FREE(H5VL_dyn_op_t, dyn_op);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* H5VL__release_dyn_op() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__term_opt_operation_cb
+ *
+ * Purpose: Callback for releasing a dynamically registered operation info
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__term_opt_operation_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data)
+{
+ H5VL_dyn_op_t *item = (H5VL_dyn_op_t *)_item; /* Item to release */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Release the dynamically registered operation info */
+ H5VL__release_dyn_op(item);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5VL__term_opt_operation_cb() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__term_opt_operation
+ *
+ * Purpose: Terminate the dynamically registered optional operations,
+ * releasing all operations.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__term_opt_operation(void)
+{
+ size_t subcls; /* Index over the elements of operation array */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Iterate over the VOL subclasses */
+ for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++)
+ if (H5VL_opt_ops_g[subcls])
+ H5SL_destroy(H5VL_opt_ops_g[subcls], H5VL__term_opt_operation_cb, NULL);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5VL__term_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__register_opt_operation
+ *
+ * Purpose: Register a new optional operation for a VOL object subclass.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__register_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val)
+{
+ H5VL_dyn_op_t *new_op; /* Info about new operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_val);
+ HDassert(op_name && *op_name);
+
+ /* Check for duplicate operation */
+ if (H5VL_opt_ops_g[subcls]) {
+ if (NULL != H5SL_search(H5VL_opt_ops_g[subcls], op_name))
+ HGOTO_ERROR(H5E_VOL, H5E_EXISTS, FAIL, "operation name already exists")
+ } /* end if */
+ else {
+ /* Create skip list for operation of this subclass */
+ if (NULL == (H5VL_opt_ops_g[subcls] = H5SL_create(H5SL_TYPE_STR, NULL)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create skip list for operations")
+ } /* end else */
+
+ /* Register new operation */
+ if (NULL == (new_op = H5FL_CALLOC(H5VL_dyn_op_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for dynamic operation info")
+ if (NULL == (new_op->op_name = H5MM_strdup(op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate name for dynamic operation info")
+ new_op->op_val = H5VL_opt_vals_g[subcls]++;
+
+ /* Insert into subclass's skip list */
+ if (H5SL_insert(H5VL_opt_ops_g[subcls], new_op, new_op->op_name) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert operation info into skip list")
+
+ /* Return the next operation value to the caller */
+ *op_val = new_op->op_val;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__register_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__num_opt_operation
+ *
+ * Purpose: Returns the # of currently registered optional operations
+ *
+ * Return: # of registered optional operations / <can't fail>
+ *
+ *---------------------------------------------------------------------------
+ */
+size_t
+H5VL__num_opt_operation(void)
+{
+ size_t subcls; /* Index over the elements of operation array */
+ size_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Iterate over the VOL subclasses */
+ for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++)
+ if (H5VL_opt_ops_g[subcls])
+ ret_value += H5SL_count(H5VL_opt_ops_g[subcls]);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__num_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__find_opt_operation
+ *
+ * Purpose: Look up a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_val);
+ HDassert(op_name && *op_name);
+
+ /* Check for dynamic operations in the VOL subclass */
+ if (H5VL_opt_ops_g[subcls]) {
+ H5VL_dyn_op_t *dyn_op; /* Info about operation */
+
+ /* Search for dynamic operation with correct name */
+ if (NULL == (dyn_op = H5SL_search(H5VL_opt_ops_g[subcls], op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+ /* Set operation value for user */
+ *op_val = dyn_op->op_val;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__find_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__unregister_opt_operation
+ *
+ * Purpose: Unregister a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_name && *op_name);
+
+ /* Check for dynamic operations in the VOL subclass */
+ if (H5VL_opt_ops_g[subcls]) {
+ H5VL_dyn_op_t *dyn_op; /* Info about operation */
+
+ /* Search for dynamic operation with correct name */
+ if (NULL == (dyn_op = H5SL_remove(H5VL_opt_ops_g[subcls], op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+ /* Release the info for the operation */
+ H5VL__release_dyn_op(dyn_op);
+
+ /* Close the skip list, if no more operations in it */
+ if (0 == H5SL_count(H5VL_opt_ops_g[subcls])) {
+ if (H5SL_close(H5VL_opt_ops_g[subcls]) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "can't close dyn op skip list")
+ H5VL_opt_ops_g[subcls] = NULL;
+ } /* end if */
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__unregister_opt_operation() */
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 500e075..936614f 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -69,11 +69,7 @@ typedef struct H5VL_wrap_ctx_t {
*/
typedef struct {
/* IN */
- H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */
- union {
- const char * name; /* The name of the VOL connector to check */
- H5VL_class_value_t value; /* The value of the VOL connector to check */
- } u;
+ H5PL_vol_key_t key;
/* OUT */
hid_t found_id; /* The connector ID, if we found a match */
@@ -88,7 +84,6 @@ typedef struct {
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls, void **request);
static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
-static herr_t H5VL__set_def_conn(void);
static void * H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector,
hbool_t wrap_obj);
@@ -194,6 +189,10 @@ H5VL_init_phase2(void)
if (H5M_init() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface")
+ /* Sanity check default VOL connector */
+ HDassert(H5VL_def_conn_s.connector_id == (-1));
+ HDassert(H5VL_def_conn_s.connector_info == NULL);
+
/* Set up the default VOL connector in the default FAPL */
if (H5VL__set_def_conn() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
@@ -261,15 +260,22 @@ H5VL_term_package(void)
n++;
} /* end if */
else {
- /* Destroy the VOL connector ID group */
- n += (H5I_dec_type_ref(H5I_VOL) > 0);
-
- /* Mark interface as closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end else */
- } /* end else */
- } /* end if */
+ if (H5VL__num_opt_operation() > 0) {
+ /* Unregister all dynamically registered optional operations */
+ (void)H5VL__term_opt_operation();
+ n++;
+ } /* end if */
+ else {
+ /* Destroy the VOL connector ID group */
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if (0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end else */
+ } /* end else */
+ } /* end else */
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5VL_term_package() */
@@ -331,15 +337,15 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
FUNC_ENTER_STATIC_NOERR
- if (H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
- if (0 == HDstrcmp(cls->name, op_data->u.name)) {
+ if (H5VL_GET_CONNECTOR_BY_NAME == op_data->key.kind) {
+ if (0 == HDstrcmp(cls->name, op_data->key.u.name)) {
op_data->found_id = id;
ret_value = H5_ITER_STOP;
} /* end if */
} /* end if */
else {
- HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind);
- if (cls->value == op_data->u.value) {
+ HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->key.kind);
+ if (cls->value == op_data->key.u.value) {
op_data->found_id = id;
ret_value = H5_ITER_STOP;
} /* end if */
@@ -365,7 +371,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5VL__set_def_conn(void)
{
H5P_genplist_t *def_fapl; /* Default file access property list */
@@ -376,14 +382,19 @@ H5VL__set_def_conn(void)
void * vol_info = NULL; /* VOL connector info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
- /* Sanity check */
- HDassert(H5VL_def_conn_s.connector_id == (-1));
- HDassert(H5VL_def_conn_s.connector_info == NULL);
+ /* Reset default VOL connector, if it's set already */
+ /* (Can happen during testing -QAK) */
+ if (H5VL_def_conn_s.connector_id > 0) {
+ /* Release the default VOL connector */
+ (void)H5VL_conn_free(&H5VL_def_conn_s);
+ H5VL_def_conn_s.connector_id = -1;
+ H5VL_def_conn_s.connector_info = NULL;
+ } /* end if */
/* Check for environment variable set */
- env_var = HDgetenv("HDF5_VOL_CONNECTOR");
+ env_var = HDgetenv(HDF5_VOL_CONNECTOR);
/* Only parse the string if it's set */
if (env_var && *env_var) {
@@ -760,51 +771,47 @@ done:
} /* end H5VL_register_using_existing_id() */
/*-------------------------------------------------------------------------
- * Function: H5VL_register_using_vol_id
+ * Function: H5VL_new_connector
*
- * Purpose: Utility function to create a user ID for an object created
- * or opened through the VOL. Uses the VOL connector's ID to
- * get the connector information instead of it being passed in.
+ * Purpose: Utility function to create a connector for a connector ID.
*
- * Return: Success: A valid HDF5 ID
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to a new connector object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+H5VL_t *
+H5VL_new_connector(hid_t connector_id)
{
- H5VL_class_t *cls = NULL; /* VOL connector class */
- H5VL_t * connector = NULL; /* VOL connector struct */
- hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t * connector = NULL; /* New VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ H5VL_t * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(NULL)
/* Get the VOL class object from the connector's ID */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Setup VOL info struct */
if (NULL == (connector = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL connector struct")
connector->cls = cls;
connector->id = connector_id;
if (H5I_inc_ref(connector->id, FALSE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector")
conn_id_incr = TRUE;
- /* Get an ID for the VOL object */
- if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+ /* Set return value */
+ ret_value = connector;
done:
/* Clean up on error */
- if (ret_value < 0) {
+ if (NULL == ret_value) {
/* Decrement VOL connector ID ref count on error */
if (conn_id_incr && H5I_dec_ref(connector_id) < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
- "unable to decrement ref count on VOL connector")
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
/* Free VOL connector struct */
if (NULL != connector)
@@ -812,6 +819,45 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_new_connector() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_vol_id
+ *
+ * Purpose: Utility function to create a user ID for an object created
+ * or opened through the VOL. Uses the VOL connector's ID to
+ * get the connector information instead of it being passed in.
+ *
+ * Return: Success: A valid HDF5 ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+{
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Create new VOL connector object, using the connector ID */
+ if (NULL == (connector = H5VL_new_connector(connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't create VOL connector object")
+
+ /* Get an ID for the VOL object */
+ if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
+done:
+ /* Clean up on error */
+ if (H5I_INVALID_HID == ret_value)
+ /* Release newly created connector */
+ if (connector && H5VL_conn_dec_rc(connector) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
+ "unable to decrement ref count on VOL connector")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
@@ -1125,15 +1171,20 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
if (cmp_value)
*same_file = FALSE;
else {
- void *obj2; /* Terminal object for second file */
+ void * obj2; /* Terminal object for second file */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get unwrapped (terminal) object for vol_obj2 */
if (NULL == (obj2 = H5VL_object_data(vol_obj2)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object")
- /* Make callback */
- if (H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2,
- same_file) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_EQUAL;
+ vol_cb_args.args.is_equal.obj2 = obj2;
+ vol_cb_args.args.is_equal.same_file = same_file;
+
+ /* Make 'are files equal' callback */
+ if (H5VL_file_specific(vol_obj1, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
} /* end else */
@@ -1244,9 +1295,9 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_
"callback is provided")
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = cls->name;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.key.u.name = cls->name;
+ op_data.found_id = H5I_INVALID_HID;
/* Check if connector is already registered */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -1295,9 +1346,9 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.key.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
/* Check if connector is already registered */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0)
@@ -1355,12 +1406,12 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
- op_data.u.value = value;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.key.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
/* Check if connector is already registered */
- if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
/* If connector alread registered, increment ref count on ID and return ID */
@@ -1394,8 +1445,9 @@ done:
*
* Purpose: Checks if a connector with a particular name is registered.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: >0 if a VOL connector with that name has been registered
+ * 0 if a VOL connector with that name has NOT been registered
+ * <0 on errors
*
* Programmer: Dana Robinson
* June 17, 2017
@@ -1411,9 +1463,9 @@ H5VL__is_connector_registered_by_name(const char *name)
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.key.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
/* Find connector with name */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -1433,8 +1485,9 @@ done:
* Purpose: Checks if a connector with a particular value (ID) is
* registered.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: >0 if a VOL connector with that value has been registered
+ * 0 if a VOL connector with that value hasn't been registered
+ * <0 on errors
*
*-------------------------------------------------------------------------
*/
@@ -1447,9 +1500,9 @@ H5VL__is_connector_registered_by_value(H5VL_class_value_t value)
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
- op_data.u.value = value;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.key.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
/* Find connector with value */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -1580,9 +1633,9 @@ H5VL__peek_connector_id_by_name(const char *name)
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
- op_data.u.name = name;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.key.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
/* Find connector with name */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -1616,9 +1669,9 @@ H5VL__peek_connector_id_by_value(H5VL_class_value_t value)
FUNC_ENTER_PACKAGE
/* Set up op data for iteration */
- op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
- op_data.u.value = value;
- op_data.found_id = H5I_INVALID_HID;
+ op_data.key.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.key.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
/* Find connector with value */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -1702,7 +1755,7 @@ H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size)
len = HDstrlen(cls->name);
if (name) {
- HDstrncpy(name, cls->name, MIN(len + 1, size));
+ HDstrncpy(name, cls->name, size);
if (len >= size)
name[size - 1] = '\0';
} /* end if */
@@ -2047,6 +2100,36 @@ done:
} /* end H5VL_retrieve_lib_state() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_start_lib_state
+ *
+ * Purpose: Opens a new internal state for the HDF5 library.
+ *
+ * Note: Currently just pushes a new API context state, but could be
+ * expanded in the future.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 5, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_start_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Push a new API context on the stack */
+ if (H5CX_push() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_start_lib_state() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_restore_lib_state
*
* Purpose: Restore the state of the library.
@@ -2071,10 +2154,6 @@ H5VL_restore_lib_state(const void *state)
/* Sanity checks */
HDassert(state);
- /* Push a new API context on the stack */
- if (H5CX_push() < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
-
/* Restore the API context state */
if (H5CX_restore_state((const H5CX_state_t *)state) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state")
@@ -2084,16 +2163,16 @@ done:
} /* end H5VL_restore_lib_state() */
/*-------------------------------------------------------------------------
- * Function: H5VL_reset_lib_state
+ * Function: H5VL_finish_lib_state
*
- * Purpose: Reset the state of the library, undoing affects of
- * H5VL_restore_lib_state.
+ * Purpose: Closes the state of the library, undoing affects of
+ * H5VL_start_lib_state.
*
* Note: Currently just resets the API context state, but could be
* expanded in the future.
*
* Note: This routine must be called as a "pair" with
- * H5VL_restore_lib_state. It can be called before / after /
+ * H5VL_start_lib_state. It can be called before / after /
* independently of H5VL_free_lib_state.
*
* Return: SUCCEED / FAIL
@@ -2104,7 +2183,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_reset_lib_state(void)
+H5VL_finish_lib_state(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2116,7 +2195,7 @@ H5VL_reset_lib_state(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_reset_lib_state() */
+} /* end H5VL_finish_lib_state() */
/*-------------------------------------------------------------------------
* Function: H5VL_free_lib_state
@@ -2484,6 +2563,33 @@ done:
} /* end H5VL_check_plugin_load() */
/*-------------------------------------------------------------------------
+ * Function: H5VL__is_default_conn
+ *
+ * Purpose: Check if the default connector will be used for a container.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(is_default);
+
+ /* Determine if the default VOL connector will be used, based on non-default
+ * values in the FAPL, connector ID, or the HDF5_VOL_CONNECTOR environment
+ * variable being set.
+ */
+ *is_default = (H5VL_def_conn_s.connector_id == H5_DEFAULT_VOL) &&
+ ((H5P_FILE_ACCESS_DEFAULT == fapl_id) || connector_id == H5_DEFAULT_VOL);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL__is_default_conn() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_setup_args
*
* Purpose: Set up arguments to access an object
@@ -2506,7 +2612,7 @@ H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj)
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 */
+ /* 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")
@@ -2631,8 +2737,8 @@ done:
*-------------------------------------------------------------------------
*/
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)
+H5VL_setup_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_t lapl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2649,7 +2755,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
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)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2659,7 +2765,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
/* 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->loc_data.loc_by_name.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2677,8 +2783,8 @@ done:
*/
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)
+ hbool_t is_collective, hid_t lapl_id, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2699,7 +2805,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
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)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2712,7 +2818,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
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->loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2752,3 +2858,45 @@ H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_setup_token_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_cap_flags
+ *
+ * Purpose: Query capability flags for connector property.
+ *
+ * Note: VOL connector set with HDF5_VOL_CONNECTOR overrides the
+ * property passed in.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(connector_prop);
+
+ /* Copy the connector ID & info, if there is one */
+ if (connector_prop->connector_id > 0) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Query the connector's capability flags */
+ if (H5VL_introspect_get_cap_flags(connector_prop->connector_info, connector, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector ID not set?")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_cap_flags() */
diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h
index 78c5986..8fcb961 100644
--- a/src/H5VLmodule.h
+++ b/src/H5VLmodule.h
@@ -27,10 +27,12 @@
#define H5_MY_PKG_ERR H5E_VOL
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5VL H5VL
- * \brief Virtual Object Layer Interface
- * \todo Describe concisely what the functions in this module are about.
+/**\defgroup H5VL H5VL
+ *
+ * \todo Describe the VOL plugin life cycle.
+ *
+ * \defgroup ASYNC Asynchronous Functions
+ * \brief Asynchronous Functions
*
* \defgroup H5VLDEF Definitions
* \ingroup H5VL
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index b70d489..18b5b9c 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -47,13 +47,13 @@ static herr_t H5VL__native_term(void);
/* Native VOL connector class struct */
static const H5VL_class_t H5VL_native_cls_g = {
- 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 */
+ H5VL_VERSION, /* VOL class struct version */
+ H5VL_NATIVE_VALUE, /* value */
+ H5VL_NATIVE_NAME, /* name */
+ H5VL_NATIVE_VERSION, /* connector version */
+ H5VL_CAP_FLAG_NATIVE_FILES, /* capability flags */
+ NULL, /* initialize */
+ H5VL__native_term, /* terminate */
{
/* info_cls */
(size_t)0, /* info size */
@@ -139,8 +139,9 @@ static const H5VL_class_t H5VL_native_cls_g = {
},
{
/* introspect_cls */
- H5VL__native_introspect_get_conn_cls, /* get_conn_cls */
- H5VL__native_introspect_opt_query, /* opt_query */
+ H5VL__native_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL__native_introspect_get_cap_flags, /* get_cap_flags */
+ H5VL__native_introspect_opt_query, /* opt_query */
},
{
/* request_cls */
@@ -244,6 +245,32 @@ H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, H5VL_get_conn_lvl
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5VL__native_introspect_get_conn_cls() */
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_introspect_get_cap_flags
+ *
+ * Purpose: Query the capability flags for this connector.
+ *
+ * Note: This routine is in this file so that it can return the field
+ * from the staticly declared class struct.
+ *
+ * Returns: SUCCEED (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_introspect_get_cap_flags(const void H5_ATTR_UNUSED *info, unsigned *cap_flags)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDassert(cap_flags);
+
+ /* Set the flags from the connector's field */
+ *cap_flags = H5VL_native_cls_g.cap_flags;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5VL__native_introspect_get_cap_flags() */
+
/*-------------------------------------------------------------------------
* Function: H5VL_native_get_file_addr_len
*
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index 4a46e9e..fe8ede2 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -18,6 +18,7 @@
#define H5VLnative_H
/* Public headers needed by this file */
+#include "H5Apublic.h" /* Attributes */
#include "H5VLpublic.h" /* Virtual Object Layer */
/*****************/
@@ -39,21 +40,140 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
+ * must be updated.
+ */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Parameters for attribute 'iterate old' operation */
+typedef struct H5VL_native_attr_iterate_old_t {
+ hid_t loc_id;
+ unsigned * attr_num;
+ H5A_operator1_t op;
+ void * op_data;
+} H5VL_native_attr_iterate_old_t;
+
+/* Parameters for native connector's attribute 'optional' operations */
+typedef union H5VL_native_attr_optional_args_t {
+ /* H5VL_NATIVE_ATTR_ITERATE_OLD */
+ H5VL_native_attr_iterate_old_t iterate_old;
+} H5VL_native_attr_optional_args_t;
+#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 */
-#define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */
-#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
-#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
-#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
-#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
+#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 */
+#define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */
+#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
+#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
+#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
+#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
+#define H5VL_NATIVE_DATASET_CHUNK_ITER 10 /* H5Dget_offset */
+/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
+ * must be updated.
+ */
+
+/* Parameters for native connector's dataset 'chunk read' operation */
+typedef struct H5VL_native_dataset_chunk_read_t {
+ const hsize_t *offset;
+ uint32_t filters;
+ void * buf;
+} H5VL_native_dataset_chunk_read_t;
+
+/* Parameters for native connector's dataset 'chunk write' operation */
+typedef struct H5VL_native_dataset_chunk_write_t {
+ const hsize_t *offset;
+ uint32_t filters;
+ uint32_t size;
+ const void * buf;
+} H5VL_native_dataset_chunk_write_t;
+
+/* Parameters for native connector's dataset 'get vlen buf size' operation */
+typedef struct H5VL_native_dataset_get_vlen_buf_size_t {
+ hid_t type_id;
+ hid_t space_id;
+ hsize_t *size; /* Size of variable-length data buffer (OUT) */
+} H5VL_native_dataset_get_vlen_buf_size_t;
+
+/* Parameters for native connector's dataset 'get chunk storage size' operation */
+typedef struct H5VL_native_dataset_get_chunk_storage_size_t {
+ const hsize_t *offset; /* Offset of chunk */
+ hsize_t * size; /* Size of chunk (OUT) */
+} H5VL_native_dataset_get_chunk_storage_size_t;
+
+/* Parameters for native connector's dataset 'get num chunks' operation */
+typedef struct H5VL_native_dataset_get_num_chunks_t {
+ hid_t space_id; /* Space selection */
+ hsize_t *nchunks; /* # of chunk for space selection (OUT) */
+} H5VL_native_dataset_get_num_chunks_t;
+
+/* Parameters for native connector's dataset 'get chunk info by idx' operation */
+typedef struct H5VL_native_dataset_get_chunk_info_by_idx_t {
+ hid_t space_id; /* Space selection */
+ hsize_t chk_index; /* Chunk index within space */
+ hsize_t * offset; /* Chunk coordinates (OUT) */
+ unsigned *filter_mask; /* Filter mask for chunk (OUT) */
+ haddr_t * addr; /* Address of chunk in file (OUT) */
+ hsize_t * size; /* Size of chunk in file (OUT) */
+} H5VL_native_dataset_get_chunk_info_by_idx_t;
+
+/* Parameters for native connector's dataset 'get chunk info by coord' operation */
+typedef struct H5VL_native_dataset_get_chunk_info_by_coord_t {
+ const hsize_t *offset; /* Chunk coordinates */
+ unsigned * filter_mask; /* Filter mask for chunk (OUT) */
+ haddr_t * addr; /* Address of chunk in file (OUT) */
+ hsize_t * size; /* Size of chunk in file (OUT) */
+} H5VL_native_dataset_get_chunk_info_by_coord_t;
+
+/* Parameters for native connector's dataset 'optional' operations */
+typedef union H5VL_native_dataset_optional_args_t {
+ /* H5VL_NATIVE_DATASET_FORMAT_CONVERT */
+ /* No args */
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE */
+ struct {
+ H5D_chunk_index_t *idx_type; /* Type of chunk index (OUT) */
+ } get_chunk_idx_type;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE */
+ H5VL_native_dataset_get_chunk_storage_size_t get_chunk_storage_size;
+
+ /* H5VL_NATIVE_DATASET_GET_NUM_CHUNKS */
+ H5VL_native_dataset_get_num_chunks_t get_num_chunks;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX */
+ H5VL_native_dataset_get_chunk_info_by_idx_t get_chunk_info_by_idx;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD */
+ H5VL_native_dataset_get_chunk_info_by_coord_t get_chunk_info_by_coord;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_READ */
+ H5VL_native_dataset_chunk_read_t chunk_read;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_WRITE */
+ H5VL_native_dataset_chunk_write_t chunk_write;
+
+ /* H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE */
+ H5VL_native_dataset_get_vlen_buf_size_t get_vlen_buf_size;
+
+ /* H5VL_NATIVE_DATASET_GET_OFFSET */
+ struct {
+ haddr_t *offset; /* Contiguous dataset's offset in the file (OUT) */
+ } get_offset;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_ITER */
+ struct {
+ H5D_chunk_iter_op_t op; /* Chunk iteration callback */
+ void * op_data; /* Context to pass to iteration callback */
+ } chunk_iter;
+
+} H5VL_native_dataset_optional_args_t;
/* Values for native VOL connector file optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
@@ -85,9 +205,195 @@
#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */
#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */
#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */
-#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */
-#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */
-#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */
+#ifdef H5_HAVE_PARALLEL
+#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */
+#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */
+#endif /* H5_HAVE_PARALLEL */
+#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */
+/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
+ * must be updated.
+ */
+
+/* Parameters for native connector's file 'get file image' operation */
+typedef struct H5VL_native_file_get_file_image_t {
+ size_t buf_size; /* Size of file image buffer */
+ void * buf; /* Buffer for file image (OUT) */
+ size_t *image_len; /* Size of file image (OUT) */
+} H5VL_native_file_get_file_image_t;
+
+/* Parameters for native connector's file 'get free sections' operation */
+typedef struct H5VL_native_file_get_free_sections_t {
+ H5F_mem_t type; /* Type of file memory to query */
+ H5F_sect_info_t *sect_info; /* Array of sections (OUT) */
+ size_t nsects; /* Size of section array */
+ size_t * sect_count; /* Actual # of sections of type (OUT) */
+} H5VL_native_file_get_free_sections_t;
+
+/* Parameters for native connector's file 'get freespace' operation */
+typedef struct H5VL_native_file_get_freespace_t {
+ hsize_t *size; /* Size of free space (OUT) */
+} H5VL_native_file_get_freespace_t;
+
+/* Parameters for native connector's file 'get info' operation */
+typedef struct H5VL_native_file_get_info_t {
+ H5I_type_t type; /* Type of object */
+ H5F_info2_t *finfo; /* Pointer to file info (OUT) */
+} H5VL_native_file_get_info_t;
+
+/* Parameters for native connector's file 'get metadata cache size' operation */
+typedef struct H5VL_native_file_get_mdc_size_t {
+ size_t * max_size; /* Maximum amount of cached data (OUT) */
+ size_t * min_clean_size; /* Minimum amount of cached data to keep clean (OUT) */
+ size_t * cur_size; /* Current amount of cached data (OUT) */
+ uint32_t *cur_num_entries; /* Current # of cached entries (OUT) */
+} H5VL_native_file_get_mdc_size_t;
+
+/* Parameters for native connector's file 'get VFD handle' operation */
+typedef struct H5VL_native_file_get_vfd_handle_t {
+ hid_t fapl_id;
+ void **file_handle; /* File handle from VFD (OUT) */
+} H5VL_native_file_get_vfd_handle_t;
+
+/* Parameters for native connector's file 'get MDC logging status' operation */
+typedef struct H5VL_native_file_get_mdc_logging_status_t {
+ hbool_t *is_enabled; /* Whether logging is enabled (OUT) */
+ hbool_t *is_currently_logging; /* Whether currently logging (OUT) */
+} H5VL_native_file_get_mdc_logging_status_t;
+
+/* Parameters for native connector's file 'get page buffering stats' operation */
+typedef struct H5VL_native_file_get_page_buffering_stats_t {
+ unsigned *accesses; /* Metadata/raw data page access counts (OUT) */
+ unsigned *hits; /* Metadata/raw data page hit counts (OUT) */
+ unsigned *misses; /* Metadata/raw data page miss counts (OUT) */
+ unsigned *evictions; /* Metadata/raw data page eviction counts (OUT) */
+ unsigned *bypasses; /* Metadata/raw data page bypass counts (OUT) */
+} H5VL_native_file_get_page_buffering_stats_t;
+
+/* Parameters for native connector's file 'get MDC image info' operation */
+typedef struct H5VL_native_file_get_mdc_image_info_t {
+ haddr_t *addr; /* Address of image (OUT) */
+ hsize_t *len; /* Length of image (OUT) */
+} H5VL_native_file_get_mdc_image_info_t;
+
+/* Parameters for native connector's file 'set libver bounds' operation */
+typedef struct H5VL_native_file_set_libver_bounds_t {
+ H5F_libver_t low; /* Lowest version possible */
+ H5F_libver_t high; /* Highest version possible */
+} H5VL_native_file_set_libver_bounds_t;
+
+/* Parameters for native connector's file 'optional' operations */
+typedef union H5VL_native_file_optional_args_t {
+ /* H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_FILE_IMAGE */
+ H5VL_native_file_get_file_image_t get_file_image;
+
+ /* H5VL_NATIVE_FILE_GET_FREE_SECTIONS */
+ H5VL_native_file_get_free_sections_t get_free_sections;
+
+ /* H5VL_NATIVE_FILE_GET_FREE_SPACE */
+ H5VL_native_file_get_freespace_t get_freespace;
+
+ /* H5VL_NATIVE_FILE_GET_INFO */
+ H5VL_native_file_get_info_t get_info;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_CONF */
+ struct {
+ H5AC_cache_config_t *config; /* Pointer to MDC config (OUT) */
+ } get_mdc_config;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_HR */
+ struct {
+ double *hit_rate; /* Metadata cache hit rate (OUT) */
+ } get_mdc_hit_rate;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_SIZE */
+ H5VL_native_file_get_mdc_size_t get_mdc_size;
+
+ /* H5VL_NATIVE_FILE_GET_SIZE */
+ struct {
+ hsize_t *size; /* Size of file (OUT) */
+ } get_size;
+
+ /* H5VL_NATIVE_FILE_GET_VFD_HANDLE */
+ H5VL_native_file_get_vfd_handle_t get_vfd_handle;
+
+ /* H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_SET_MDC_CONFIG */
+ struct {
+ const H5AC_cache_config_t *config; /* Pointer to new MDC config */
+ } set_mdc_config;
+
+ /* H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO */
+ struct {
+ H5F_retry_info_t *info; /* Pointer to metadata read retry info (OUT) */
+ } get_metadata_read_retry_info;
+
+ /* H5VL_NATIVE_FILE_START_SWMR_WRITE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_START_MDC_LOGGING */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_STOP_MDC_LOGGING */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS */
+ H5VL_native_file_get_mdc_logging_status_t get_mdc_logging_status;
+
+ /* H5VL_NATIVE_FILE_FORMAT_CONVERT */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS */
+ H5VL_native_file_get_page_buffering_stats_t get_page_buffering_stats;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO */
+ H5VL_native_file_get_mdc_image_info_t get_mdc_image_info;
+
+ /* H5VL_NATIVE_FILE_GET_EOA */
+ struct {
+ haddr_t *eoa; /* End of allocated file address space (OUT) */
+ } get_eoa;
+
+ /* H5VL_NATIVE_FILE_INCR_FILESIZE */
+ struct {
+ hsize_t increment; /* Amount to increment file size */
+ } increment_filesize;
+
+ /* H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS */
+ H5VL_native_file_set_libver_bounds_t set_libver_bounds;
+
+ /* H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG */
+ struct {
+ hbool_t *minimize; /* Flag whether dataset object headers are minimal (OUT) */
+ } get_min_dset_ohdr_flag;
+
+ /* H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG */
+ struct {
+ hbool_t minimize; /* Flag whether dataset object headers should be minimal */
+ } set_min_dset_ohdr_flag;
+
+#ifdef H5_HAVE_PARALLEL
+ /* H5VL_NATIVE_FILE_GET_MPI_ATOMICITY */
+ struct {
+ hbool_t *flag; /* Flag whether MPI atomicity is set for files (OUT) */
+ } get_mpi_atomicity;
+
+ /* H5VL_NATIVE_FILE_SET_MPI_ATOMICITY */
+ struct {
+ hbool_t flag; /* Flag whether to set MPI atomicity for files */
+ } set_mpi_atomicity;
+#endif /* H5_HAVE_PARALLEL */
+
+ /* H5VL_NATIVE_FILE_POST_OPEN */
+ /* No args */
+} H5VL_native_file_optional_args_t;
/* Values for native VOL connector group optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
@@ -97,6 +403,36 @@
#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 */
+/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
+ * must be updated.
+ */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Parameters for group 'iterate old' operation */
+typedef struct H5VL_native_group_iterate_old_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for iteration */
+ hsize_t idx; /* Index of link to begin iteration at */
+ hsize_t * last_obj; /* Index of last link looked at (OUT) */
+ H5G_iterate_t op; /* Group (link) operator callback */
+ void * op_data; /* Context to pass to iterator callback */
+} H5VL_native_group_iterate_old_t;
+
+/* Parameters for group 'get objinfo' operation */
+typedef struct H5VL_native_group_get_objinfo_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for iteration */
+ hbool_t follow_link; /* Whether to follow links for query */
+ H5G_stat_t * statbuf; /* Pointer to object info struct (OUT) */
+} H5VL_native_group_get_objinfo_t;
+
+/* Parameters for native connector's group 'optional' operations */
+typedef union H5VL_native_group_optional_args_t {
+ /* H5VL_NATIVE_GROUP_ITERATE_OLD */
+ H5VL_native_group_iterate_old_t iterate_old;
+
+ /* H5VL_NATIVE_GROUP_GET_OBJINFO */
+ H5VL_native_group_get_objinfo_t get_objinfo;
+} H5VL_native_group_optional_args_t;
+#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
@@ -108,6 +444,47 @@
#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 3 /* H5Oenable_mdc_flushes */
#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 4 /* H5Oare_mdc_flushes_disabled */
#define H5VL_NATIVE_OBJECT_GET_NATIVE_INFO 5 /* H5Oget_native_info(_by_idx, _by_name) */
+/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
+ * must be updated.
+ */
+
+/* Parameters for native connector's object 'get comment' operation */
+typedef struct H5VL_native_object_get_comment_t {
+ size_t buf_size; /* Size of comment buffer */
+ void * buf; /* Buffer for comment (OUT) */
+ size_t *comment_len; /* Actual size of comment (OUT) */
+} H5VL_native_object_get_comment_t;
+
+/* Parameters for object 'get native info' operation */
+typedef struct H5VL_native_object_get_native_info_t {
+ unsigned fields; /* Fields to retrieve */
+ H5O_native_info_t *ninfo; /* Native info (OUT) */
+} H5VL_native_object_get_native_info_t;
+
+/* Parameters for native connector's object 'optional' operations */
+typedef union H5VL_native_object_optional_args_t {
+ /* H5VL_NATIVE_OBJECT_GET_COMMENT */
+ H5VL_native_object_get_comment_t get_comment;
+
+ /* H5VL_NATIVE_OBJECT_SET_COMMENT */
+ struct {
+ const char *comment; /* Comment string to set for the object (IN) */
+ } set_comment;
+
+ /* H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES */
+ /* No args */
+
+ /* H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES */
+ /* No args */
+
+ /* H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED */
+ struct {
+ hbool_t *flag; /* Flag whether metadata cache flushes are disabled for this object (OUT) */
+ } are_mdc_flushes_disabled;
+
+ /* H5VL_NATIVE_OBJECT_GET_NATIVE_INFO */
+ H5VL_native_object_get_native_info_t get_native_info;
+} H5VL_native_object_optional_args_t;
/*******************/
/* Public Typedefs */
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index 7beb98f..834ae40 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5A_FRIEND /* Suppress error about including H5Apkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
#include "H5Eprivate.h" /* Error handling */
@@ -30,6 +37,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_attr_create
*
@@ -214,40 +245,37 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* H5Aget_space */
case H5VL_ATTR_GET_SPACE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A_get_space(attr)) < 0)
+ if ((args->args.get_space.space_id = H5A_get_space(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
break;
}
/* H5Aget_type */
case H5VL_ATTR_GET_TYPE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A__get_type(attr)) < 0)
+ if ((args->args.get_type.type_id = H5A__get_type(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
break;
}
/* H5Aget_create_plist */
case H5VL_ATTR_GET_ACPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A__get_create_plist(attr)) < 0)
+ if ((args->args.get_acpl.acpl_id = H5A__get_create_plist(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
break;
@@ -255,40 +283,37 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Aget_name */
case H5VL_ATTR_GET_NAME: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- size_t buf_size = HDva_arg(arguments, size_t);
- char * buf = HDva_arg(arguments, char *);
- ssize_t * ret_val = HDva_arg(arguments, ssize_t *);
- H5A_t * attr = NULL;
+ H5VL_attr_get_name_args_t *get_name_args = &args->args.get_name;
- if (H5VL_OBJECT_BY_SELF == loc_params->type) {
- attr = (H5A_t *)obj;
- /* Call private function in turn */
- if (0 > (*ret_val = H5A__get_name(attr, buf_size, buf)))
+ if (H5VL_OBJECT_BY_SELF == get_name_args->loc_params.type) {
+ if (H5A__get_name((H5A_t *)obj, get_name_args->buf_size, get_name_args->buf,
+ get_name_args->attr_name_len) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
}
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
+ else if (H5VL_OBJECT_BY_IDX == get_name_args->loc_params.type) {
H5G_loc_t loc;
+ H5A_t * attr;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_name_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
- if (NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
+ if (NULL == (attr = H5A__open_by_idx(&loc, get_name_args->loc_params.loc_data.loc_by_idx.name,
+ get_name_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_name_args->loc_params.loc_data.loc_by_idx.order,
+ get_name_args->loc_params.loc_data.loc_by_idx.n)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the length of the name */
- *ret_val = (ssize_t)HDstrlen(attr->shared->name);
+ *get_name_args->attr_name_len = HDstrlen(attr->shared->name);
/* Copy the name into the user's buffer, if given */
- if (buf) {
- HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size));
- if ((size_t)(*ret_val) >= buf_size)
- buf[buf_size - 1] = '\0';
+ if (get_name_args->buf) {
+ HDstrncpy(get_name_args->buf, attr->shared->name,
+ MIN((*get_name_args->attr_name_len + 1), get_name_args->buf_size));
+ if (*get_name_args->attr_name_len >= get_name_args->buf_size)
+ get_name_args->buf[get_name_args->buf_size - 1] = '\0';
} /* end if */
/* Release resources */
@@ -303,52 +328,51 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Aget_info */
case H5VL_ATTR_GET_INFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- H5A_info_t * ainfo = HDva_arg(arguments, H5A_info_t *);
- H5A_t * attr = NULL;
+ H5VL_attr_get_info_args_t *get_info_args = &args->args.get_info;
+ H5A_t * attr = NULL;
- if (H5VL_OBJECT_BY_SELF == loc_params->type) {
+ if (H5VL_OBJECT_BY_SELF == get_info_args->loc_params.type) {
attr = (H5A_t *)obj;
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info")
}
- else if (H5VL_OBJECT_BY_NAME == loc_params->type) {
- char * attr_name = HDva_arg(arguments, char *);
+ else if (H5VL_OBJECT_BY_NAME == get_info_args->loc_params.type) {
H5G_loc_t loc;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
if (NULL ==
- (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
+ (attr = H5A__open_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name,
+ get_info_args->attr_name)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
/* Release resources */
if (attr && H5A__close(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
}
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
+ else if (H5VL_OBJECT_BY_IDX == get_info_args->loc_params.type) {
H5G_loc_t loc;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
- if (NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
+ if (NULL == (attr = H5A__open_by_idx(&loc, get_info_args->loc_params.loc_data.loc_by_idx.name,
+ get_info_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_info_args->loc_params.loc_data.loc_by_idx.order,
+ get_info_args->loc_params.loc_data.loc_by_idx.n)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
/* Release resources */
@@ -362,11 +386,10 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
}
case H5VL_ATTR_GET_STORAGE_SIZE: {
- hsize_t *ret = HDva_arg(arguments, hsize_t *);
- H5A_t * attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- /* Set return value */
- *ret = attr->shared->data_size;
+ /* Set storage size */
+ *args->args.get_storage_size.data_size = attr->shared->data_size;
break;
}
@@ -388,8 +411,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -400,48 +423,51 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (specific_type) {
+ switch (args->op_type) {
+ /* H5Adelete/delete_by_name */
case H5VL_ATTR_DELETE: {
- char *attr_name = HDva_arg(arguments, char *);
-
if (H5VL_OBJECT_BY_SELF == loc_params->type) {
- /* H5Adelete */
/* Delete the attribute from the location */
- if (H5O__attr_remove(loc.oloc, attr_name) < 0)
+ if (H5O__attr_remove(loc.oloc, args->args.del.name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end if */
else if (H5VL_OBJECT_BY_NAME == loc_params->type) {
- /* H5Adelete_by_name */
/* Delete the attribute */
- if (H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0)
+ if (H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, args->args.del.name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end else-if */
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
- /* H5Adelete_by_idx */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete location")
+ break;
+ }
+
+ /* H5Adelete_by_idx */
+ case H5VL_ATTR_DELETE_BY_IDX: {
+ H5VL_attr_delete_by_idx_args_t *del_by_idx_args =
+ &args->args.delete_by_idx; /* Arguments to delete_by_idx operation */
+
+ if (H5VL_OBJECT_BY_NAME == loc_params->type) {
/* Delete the attribute from the location */
- if (H5A__delete_by_idx(
- &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
+ if (H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_name.name, del_by_idx_args->idx_type,
+ del_by_idx_args->order, del_by_idx_args->n) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
- } /* end else-if */
+ } /* end if */
else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters")
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete_by_idx location")
break;
}
+ /* H5Aexists/exists_by_name */
case H5VL_ATTR_EXISTS: {
- const char *attr_name = HDva_arg(arguments, const char *);
- hbool_t * attr_exists = HDva_arg(arguments, hbool_t *);
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
/* Check if the attribute exists */
- if (H5O__attr_exists(loc.oloc, attr_name, attr_exists) < 0)
+ if (H5O__attr_exists(loc.oloc, args->args.exists.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
/* Check if the attribute exists */
- if (H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name, attr_exists) <
- 0)
+ if (H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, args->args.exists.name,
+ args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
} /* end else-if */
else
@@ -449,42 +475,38 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
break;
}
+ /* H5Aiterate/iterate_by_name */
case H5VL_ATTR_ITER: {
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t * idx = HDva_arg(arguments, hsize_t *);
- H5A_operator2_t op = HDva_arg(arguments, H5A_operator2_t);
- void * op_data = HDva_arg(arguments, void *);
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */
- /* Iterate over attributes */
- if ((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */
- /* Iterate over attributes by name */
- if ((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed");
- } /* end else-if */
+ H5VL_attr_iterate_args_t *iter_args = &args->args.iterate; /* Arguments to iterate operation */
+ static const char * self_name = "."; /* Name for 'self' location */
+ const char * loc_name; /* Location name */
+
+ /* Set correct name, for type of location */
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) /* H5Aiterate2 */
+ loc_name = self_name;
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) /* H5Aiterate_by_name */
+ loc_name = loc_params->loc_data.loc_by_name.name;
else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unsupported location type")
+
+ /* Iterate over attributes */
+ if ((ret_value = H5A__iterate(&loc, loc_name, iter_args->idx_type, iter_args->order,
+ iter_args->idx, iter_args->op, iter_args->op_data)) < 0)
+ HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
break;
}
/* H5Arename/rename_by_name */
case H5VL_ATTR_RENAME: {
- const char *old_name = HDva_arg(arguments, const char *);
- const char *new_name = HDva_arg(arguments, const char *);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */
/* Call attribute rename routine */
- if (H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
+ if (H5O__attr_rename(loc.oloc, args->args.rename.old_name, args->args.rename.new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */
/* Call attribute rename routine */
- if (H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0)
+ if (H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name,
+ args->args.rename.old_name, args->args.rename.new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end else-if */
else
@@ -510,24 +532,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
- va_list H5_ATTR_DEPRECATED_USED arguments)
+H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
- herr_t ret_value = SUCCEED; /* Return value */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5VL_native_attr_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (opt_type) {
+ switch (args->op_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
case H5VL_NATIVE_ATTR_ITERATE_OLD: {
- hid_t loc_id = HDva_arg(arguments, hid_t);
- unsigned * attr_num = HDva_arg(arguments, unsigned *);
- H5A_operator1_t op = HDva_arg(arguments, H5A_operator1_t);
- void * op_data = HDva_arg(arguments, void *);
+ H5VL_native_attr_iterate_old_t *iter_args = &opt_args->iterate_old;
/* Call the actual iteration routine */
- if ((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
+ if ((ret_value = H5A__iterate_old(iter_args->loc_id, iter_args->attr_num, iter_args->op,
+ iter_args->op_data)) < 0)
HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
break;
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index 170a5bc..1107227 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -145,7 +145,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments)
+H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
herr_t ret_value = SUCCEED; /* Return value */
@@ -156,44 +156,24 @@ H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specif
HDassert(f);
HDassert(blob_id);
- switch (specific_type) {
- case H5VL_BLOB_GETSIZE: {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- size_t * size = HDva_arg(arguments, size_t *);
- H5HG_t hobjid; /* blob's heap ID */
-
- /* Get heap information */
- H5F_addr_decode(f, &id, &(hobjid.addr));
- UINT32DECODE(id, hobjid.idx);
-
- /* Get heap object's size */
- if (hobjid.addr > 0) {
- if (H5HG_get_obj_size(f, &hobjid, size) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
- } /* end if */
- else
- *size = 0; /* Return '0' size for 'nil' blob ID */
-
- break;
- }
-
+ switch (args->op_type) {
case H5VL_BLOB_ISNULL: {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- hbool_t * isnull = HDva_arg(arguments, hbool_t *);
- haddr_t addr; /* Sequence's heap address */
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ haddr_t addr; /* Sequence's heap address */
/* Get the heap address */
H5F_addr_decode(f, &id, &addr);
/* Check if heap address is 'nil' */
- *isnull = (addr == 0 ? TRUE : FALSE);
+ *args->args.is_null.isnull = (addr == 0 ? TRUE : FALSE);
break;
}
case H5VL_BLOB_SETNULL: {
uint8_t *id = (uint8_t *)blob_id; /* Pointer to the blob ID */
- /* Encode the "nil" heap pointer information */
+
+ /* Encode the 'nil' heap pointer information */
H5F_addr_encode(f, &id, (haddr_t)0);
UINT32ENCODE(id, 0);
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index d78388e..1375344 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5D_FRIEND /* Suppress error about including H5Dpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Datasets */
@@ -30,6 +37,128 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Helper routines for read/write API calls */
+static herr_t H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id,
+ hid_t mem_space_id, H5S_t **file_space, H5S_t **mem_space);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__native_dataset_io_setup
+ *
+ * Purpose: Set up file and memory dataspaces for dataset I/O operation
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, hid_t mem_space_id,
+ H5S_t **file_space, H5S_t **mem_space)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(dset);
+ HDassert(file_space && NULL == *file_space);
+ HDassert(mem_space && NULL == *mem_space);
+
+ /* Set up file dataspace */
+ if (H5S_ALL == file_space_id)
+ /* Use dataspace for dataset */
+ *file_space = dset->shared->space;
+ else if (H5S_BLOCK == file_space_id)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_BLOCK is not allowed for file dataspace")
+ else if (H5S_PLIST == file_space_id) {
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5S_t * space; /* Dataspace to hold selection */
+
+ /* Get the plist structure */
+ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADID, FAIL, "bad dataset transfer property list")
+
+ /* See if a dataset I/O selection is already set, and free it if it is */
+ if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting dataset I/O selection")
+
+ /* Use dataspace for dataset */
+ *file_space = dset->shared->space;
+
+ /* Copy, but share, selection from property list to dataset's dataspace */
+ if (H5S_SELECT_COPY(*file_space, space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataset I/O selection")
+ } /* end else-if */
+ else {
+ /* Get the dataspace pointer */
+ if (NULL == (*file_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID")
+ } /* end else */
+
+ /* Get dataspace for memory buffer */
+ if (H5S_ALL == mem_space_id)
+ *mem_space = *file_space;
+ else if (H5S_BLOCK == mem_space_id) {
+ hsize_t nelmts; /* # of selected elements in file */
+
+ /* Get the # of elements selected */
+ nelmts = H5S_GET_SELECT_NPOINTS(*file_space);
+
+ /* Check for any elements */
+ if (nelmts > 0) {
+ /* Create a 1-D dataspace of the same # of elements */
+ if (NULL == (*mem_space = H5S_create_simple(1, &nelmts, NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace")
+ } /* end if */
+ else {
+ /* Create a NULL dataspace of the same # of elements */
+ if (NULL == (*mem_space = H5S_create(H5S_NULL)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create NULL memory dataspace")
+ } /* end else */
+ } /* end if */
+ else if (H5S_PLIST == mem_space_id)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_PLIST is not allowed for memory dataspace")
+ else {
+ /* Get the dataspace pointer */
+ if (NULL == (*mem_space = (H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID")
+ } /* end else */
+
+ /* Check for valid selections */
+ if (H5S_SELECT_VALID(*file_space) != TRUE)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
+ "selection + offset not within extent for file dataspace")
+ if (H5S_SELECT_VALID(*mem_space) != TRUE)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
+ "selection + offset not within extent for memory dataspace")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__native_dataset_io_setup() */
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_dataset_create
*
@@ -141,10 +270,10 @@ 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 dxpl_id, void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -152,11 +281,10 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_
if (NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- /* Get validated dataspace pointers */
- if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- 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")
+ /* Get file & memory dataspaces */
+ if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) <
+ 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
@@ -166,6 +294,17 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
+ /* Clean up */
+ if (H5S_BLOCK == mem_space_id && mem_space) {
+ if (H5S_close(mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release temporary memory dataspace for H5S_BLOCK")
+ } /* end if */
+ else if (H5S_PLIST == file_space_id && file_space)
+ if (H5S_select_all(file_space, TRUE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release file dataspace selection for H5S_PLIST")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_dataset_read() */
@@ -182,10 +321,10 @@ 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 dxpl_id, const void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -193,11 +332,10 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid
if (NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
- /* Get validated dataspace pointers */
- if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id")
- 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")
+ /* Get file & memory dataspaces */
+ if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) <
+ 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
@@ -207,6 +345,17 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
+ /* Clean up */
+ if (H5S_BLOCK == mem_space_id && mem_space) {
+ if (H5S_close(mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release temporary memory dataspace for H5S_BLOCK")
+ } /* end if */
+ else if (H5S_PLIST == file_space_id && file_space)
+ if (H5S_select_all(file_space, TRUE) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL,
+ "unable to release file dataspace selection for H5S_PLIST")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_dataset_write() */
@@ -220,31 +369,26 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5D_t *dset = (H5D_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* H5Dget_space */
case H5VL_DATASET_GET_SPACE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D__get_space(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset")
+ if ((args->args.get_space.space_id = H5D__get_space(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get space ID of dataset")
break;
}
/* H5Dget_space_status */
case H5VL_DATASET_GET_SPACE_STATUS: {
- H5D_space_status_t *allocation = HDva_arg(arguments, H5D_space_status_t *);
-
- /* Read data space address and return */
- if (H5D__get_space_status(dset, allocation) < 0)
+ if (H5D__get_space_status(dset, args->args.get_space_status.status) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
break;
@@ -252,40 +396,31 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_U
/* H5Dget_type */
case H5VL_DATASET_GET_TYPE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D__get_type(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
+ if ((args->args.get_type.type_id = H5D__get_type(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
break;
}
/* H5Dget_create_plist */
case H5VL_DATASET_GET_DCPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D_get_create_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
+ if ((args->args.get_dcpl.dcpl_id = H5D_get_create_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
break;
}
/* H5Dget_access_plist */
case H5VL_DATASET_GET_DAPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D_get_access_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset")
+ if ((args->args.get_dapl.dapl_id = H5D_get_access_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get access property list for dataset")
break;
}
/* H5Dget_storage_size */
case H5VL_DATASET_GET_STORAGE_SIZE: {
- hsize_t *ret = HDva_arg(arguments, hsize_t *);
-
- /* Set return value */
- if (H5D__get_storage_size(dset, ret) < 0)
+ if (H5D__get_storage_size(dset, args->args.get_storage_size.storage_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
break;
}
@@ -308,51 +443,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5D_t *dset = (H5D_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
- /* H5Dspecific_space */
- case H5VL_DATASET_SET_EXTENT: { /* H5Dset_extent (H5Dextend - deprecated) */
- const hsize_t *size = HDva_arg(arguments, const hsize_t *);
-
- if (H5D__set_extent(dset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset")
+ switch (args->op_type) {
+ /* H5Dset_extent (H5Dextend - deprecated) */
+ case H5VL_DATASET_SET_EXTENT: {
+ if (H5D__set_extent(dset, args->args.set_extent.size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set extent of dataset")
break;
}
- case H5VL_DATASET_FLUSH: { /* H5Dflush */
- hid_t dset_id = HDva_arg(arguments, hid_t);
-
- /* Flush the dataset */
- if (H5D__flush(dset, dset_id) < 0)
+ /* H5Dflush */
+ case H5VL_DATASET_FLUSH: {
+ if (H5D__flush(dset, args->args.flush.dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
break;
}
- case H5VL_DATASET_REFRESH: { /* H5Drefresh */
- hid_t dset_id = HDva_arg(arguments, hid_t);
-
- /* Refresh the dataset */
- if ((H5D__refresh(dset_id, dset)) < 0)
+ /* H5Drefresh */
+ case H5VL_DATASET_REFRESH: {
+ if (H5D__refresh(dset, args->args.refresh.dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
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 */
@@ -371,11 +493,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type, hid_t dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5D_t *dset = (H5D_t *)obj; /* Dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t * dset = (H5D_t *)obj; /* Dataset */
+ H5VL_native_dataset_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -385,13 +507,14 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- switch (optional_type) {
- case H5VL_NATIVE_DATASET_FORMAT_CONVERT: { /* H5Dformat_convert */
+ switch (args->op_type) {
+ /* H5Dformat_convert */
+ case H5VL_NATIVE_DATASET_FORMAT_CONVERT: {
switch (dset->shared->layout.type) {
case H5D_CHUNKED:
/* Convert the chunk indexing type to version 1 B-tree if not */
if (dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE)
- if ((H5D__format_convert(dset)) < 0)
+ if (H5D__format_convert(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL,
"unable to downgrade chunk indexing type for dataset")
break;
@@ -400,7 +523,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
case H5D_COMPACT:
/* Downgrade the layout version to 3 if greater than 3 */
if (dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT)
- if ((H5D__format_convert(dset)) < 0)
+ if (H5D__format_convert(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL,
"unable to downgrade layout version for dataset")
break;
@@ -420,47 +543,46 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: { /* H5Dget_chunk_index_type */
- H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
-
+ /* H5Dget_chunk_index_type */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: {
/* Make sure the dataset is chunked */
if (H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Get the chunk indexing type */
- *idx_type = dset->shared->layout.u.chunk.idx_type;
+ *opt_args->get_chunk_idx_type.idx_type = dset->shared->layout.u.chunk.idx_type;
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: { /* H5Dget_chunk_storage_size */
- hsize_t *offset = HDva_arg(arguments, hsize_t *);
- hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_storage_size */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: {
+ H5VL_native_dataset_get_chunk_storage_size_t *gcss_args = &opt_args->get_chunk_storage_size;
/* Make sure the dataset is chunked */
if (H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0)
+ if (H5D__get_chunk_storage_size(dset, gcss_args->offset, gcss_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
break;
}
- case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: { /* H5Dget_num_chunks */
- const H5S_t *space = NULL;
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t * nchunks = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_num_chunks */
+ case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: {
+ H5VL_native_dataset_get_num_chunks_t *gnc_args = &opt_args->get_num_chunks;
+ const H5S_t * space = NULL;
HDassert(dset->shared);
HDassert(dset->shared->space);
/* When default dataspace is given, use the dataset's dataspace */
- if (space_id == H5S_ALL)
+ if (gnc_args->space_id == H5S_ALL)
space = dset->shared->space;
else /* otherwise, use the given space ID */
- if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (const H5S_t *)H5I_object_verify(gnc_args->space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
/* Make sure the dataset is chunked */
@@ -468,29 +590,25 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_num_chunks(dset, space, nchunks) < 0)
+ if (H5D__get_num_chunks(dset, space, gnc_args->nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: { /* H5Dget_chunk_info */
- const H5S_t *space = NULL;
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t chk_index = HDva_arg(arguments, hsize_t);
- hsize_t * offset = HDva_arg(arguments, hsize_t *);
- unsigned * filter_mask = HDva_arg(arguments, unsigned *);
- haddr_t * addr = HDva_arg(arguments, haddr_t *);
- hsize_t * size = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_info */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: {
+ H5VL_native_dataset_get_chunk_info_by_idx_t *gcibi_args = &opt_args->get_chunk_info_by_idx;
+ const H5S_t * space;
HDassert(dset->shared);
HDassert(dset->shared->space);
/* When default dataspace is given, use the dataset's dataspace */
- if (space_id == H5S_ALL)
+ if (gcibi_args->space_id == H5S_ALL)
space = dset->shared->space;
else /* otherwise, use the given space ID */
- if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (const H5S_t *)H5I_object_verify(gcibi_args->space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
/* Make sure the dataset is chunked */
@@ -498,16 +616,16 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_info(dset, space, chk_index, offset, filter_mask, addr, size) < 0)
+ if (H5D__get_chunk_info(dset, space, gcibi_args->chk_index, gcibi_args->offset,
+ gcibi_args->filter_mask, gcibi_args->addr, gcibi_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index")
+
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: { /* H5Dget_chunk_info_by_coord */
- hsize_t * offset = HDva_arg(arguments, hsize_t *);
- unsigned *filter_mask = HDva_arg(arguments, unsigned *);
- haddr_t * addr = HDva_arg(arguments, haddr_t *);
- hsize_t * size = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_info_by_coord */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: {
+ H5VL_native_dataset_get_chunk_info_by_coord_t *gcibc_args = &opt_args->get_chunk_info_by_coord;
HDassert(dset->shared);
@@ -516,17 +634,17 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_info_by_coord(dset, offset, filter_mask, addr, size) < 0)
+ if (H5D__get_chunk_info_by_coord(dset, gcibc_args->offset, gcibc_args->filter_mask,
+ gcibc_args->addr, gcibc_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates")
break;
}
- case H5VL_NATIVE_DATASET_CHUNK_READ: { /* H5Dread_chunk */
- const hsize_t *offset = HDva_arg(arguments, hsize_t *);
- uint32_t * filters = HDva_arg(arguments, uint32_t *);
- void * buf = HDva_arg(arguments, void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ /* H5Dread_chunk */
+ case H5VL_NATIVE_DATASET_CHUNK_READ: {
+ H5VL_native_dataset_chunk_read_t *chunk_read_args = &opt_args->chunk_read;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
/* Check arguments */
if (NULL == dset->oloc.file)
@@ -537,22 +655,21 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Copy the user's offset array so we can be sure it's terminated properly.
* (we don't want to mess with the user's buffer).
*/
- if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+ if (H5D__chunk_get_offset_copy(dset, chunk_read_args->offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array")
/* Read the raw chunk */
- if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ if (H5D__chunk_direct_read(dset, offset_copy, &chunk_read_args->filters, chunk_read_args->buf) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
break;
}
- case H5VL_NATIVE_DATASET_CHUNK_WRITE: { /* H5Dwrite_chunk */
- uint32_t filters = HDva_arg(arguments, uint32_t);
- const hsize_t *offset = HDva_arg(arguments, const hsize_t *);
- uint32_t data_size_32 = HDva_arg(arguments, uint32_t);
- const void * buf = HDva_arg(arguments, const void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ /* H5Dwrite_chunk */
+ case H5VL_NATIVE_DATASET_CHUNK_WRITE: {
+ H5VL_native_dataset_chunk_write_t *chunk_write_args = &opt_args->chunk_write;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
/* Check arguments */
if (NULL == dset->oloc.file)
@@ -563,34 +680,48 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Copy the user's offset array so we can be sure it's terminated properly.
* (we don't want to mess with the user's buffer).
*/
- if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+ if (H5D__chunk_get_offset_copy(dset, chunk_write_args->offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array")
/* Write chunk */
- if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ if (H5D__chunk_direct_write(dset, chunk_write_args->filters, offset_copy, chunk_write_args->size,
+ chunk_write_args->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
break;
}
- case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: { /* H5Dvlen_get_buf_size */
- hid_t type_id = HDva_arg(arguments, hid_t);
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t *size = HDva_arg(arguments, hsize_t *);
+ /* H5Dvlen_get_buf_size */
+ case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: {
+ H5VL_native_dataset_get_vlen_buf_size_t *gvbs_args = &opt_args->get_vlen_buf_size;
- if (H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0)
+ if (H5D__vlen_get_buf_size(dset, gvbs_args->type_id, gvbs_args->space_id, gvbs_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed")
break;
}
/* H5Dget_offset */
case H5VL_NATIVE_DATASET_GET_OFFSET: {
- haddr_t *ret = HDva_arg(arguments, haddr_t *);
+ /* Get offset */
+ *opt_args->get_offset.offset = H5D__get_offset(dset);
+
+ break;
+ }
+
+ /* H5Dchunk_iter */
+ case H5VL_NATIVE_DATASET_CHUNK_ITER: {
+ /* Sanity check */
+ HDassert(dset->shared);
+
+ /* Make sure the dataset is chunked */
+ if (H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if ((ret_value = H5D__chunk_iter(dset, opt_args->chunk_iter.op, opt_args->chunk_iter.op_data)) <
+ 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "chunk iteration failed");
- /* Set return value */
- *ret = H5D__get_offset(dset);
- if (!H5F_addr_defined(*ret))
- *ret = HADDR_UNDEF;
break;
}
diff --git a/src/H5VLnative_datatype.c b/src/H5VLnative_datatype.c
index 9551f50..bf6f37c 100644
--- a/src/H5VLnative_datatype.c
+++ b/src/H5VLnative_datatype.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5T_FRIEND /* Suppress error about including H5Tpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */
@@ -28,6 +35,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_datatype_commit
*
@@ -144,32 +175,34 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5T_t *dt = (H5T_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
- case H5VL_DATATYPE_GET_BINARY: {
- ssize_t *nalloc = HDva_arg(arguments, ssize_t *);
- void * buf = HDva_arg(arguments, void *);
- size_t size = HDva_arg(arguments, size_t);
+ switch (args->op_type) {
+ /* H5T_construct_datatype (library private routine) */
+ case H5VL_DATATYPE_GET_BINARY_SIZE: {
+ if (H5T_encode(dt, NULL, args->args.get_binary_size.size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't determine serialized length of datatype")
- if (H5T_encode(dt, (unsigned char *)buf, &size) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype")
+ break;
+ }
+
+ /* H5T_construct_datatype (library private routine) */
+ case H5VL_DATATYPE_GET_BINARY: {
+ if (H5T_encode(dt, args->args.get_binary.buf, &args->args.get_binary.buf_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSERIALIZE, FAIL, "can't serialize datatype")
- *nalloc = (ssize_t)size;
break;
}
/* H5Tget_create_plist */
case H5VL_DATATYPE_GET_TCPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if (H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt)))
+ if (H5I_INVALID_HID == (args->args.get_tcpl.tcpl_id = H5T__get_create_plist(dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info");
break;
@@ -193,30 +226,26 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5T_t *dt = (H5T_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
+ /* H5VL_DATATYPE_FLUSH */
case H5VL_DATATYPE_FLUSH: {
- hid_t type_id = HDva_arg(arguments, hid_t);
-
- /* To flush metadata and invoke flush callback if there is */
- if (H5O_flush_common(&dt->oloc, type_id) < 0)
+ if (H5O_flush_common(&dt->oloc, args->args.flush.type_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
break;
}
+ /* H5VL_DATATYPE_REFRESH */
case H5VL_DATATYPE_REFRESH: {
- hid_t type_id = HDva_arg(arguments, hid_t);
-
- /* Call private function to refresh datatype object */
- if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
+ if ((H5O_refresh_metadata(&dt->oloc, args->args.refresh.type_id)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
break;
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index c4e4744..1e674dc 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Cprivate.h" /* Cache */
@@ -31,6 +38,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_file_create
*
@@ -116,21 +147,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5F_t *f = NULL; /* File struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* "get container info" */
case H5VL_FILE_GET_CONT_INFO: {
- H5VL_file_cont_info_t *info = HDva_arg(arguments, H5VL_file_cont_info_t *);
-
- /* Retrieve the file's container info */
- if (H5F__get_cont_info((H5F_t *)obj, info) < 0)
+ if (H5F__get_cont_info((H5F_t *)obj, args->args.get_cont_info.info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info")
break;
@@ -138,31 +166,22 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_access_plist */
case H5VL_FILE_GET_FAPL: {
- H5P_genplist_t *new_plist; /* New property list */
- hid_t * plist_id = HDva_arg(arguments, hid_t *);
-
- f = (H5F_t *)obj;
-
- /* Retrieve the file's access property list */
- if ((*plist_id = H5F_get_access_plist(f, TRUE)) < 0)
+ if ((args->args.get_fapl.fapl_id = H5F_get_access_plist((H5F_t *)obj, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list")
- if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
break;
}
/* H5Fget_create_plist */
case H5VL_FILE_GET_FCPL: {
H5P_genplist_t *plist; /* Property list */
- hid_t * plist_id = HDva_arg(arguments, hid_t *);
f = (H5F_t *)obj;
if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Create the property list object to return */
- if ((*plist_id = H5P_copy_plist(plist, TRUE)) < 0)
+ if ((args->args.get_fcpl.fcpl_id = H5P_copy_plist(plist, TRUE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
break;
@@ -170,8 +189,6 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_intent */
case H5VL_FILE_GET_INTENT: {
- unsigned *intent_flags = HDva_arg(arguments, unsigned *);
-
f = (H5F_t *)obj;
/* HDF5 uses some flags internally that users don't know about.
@@ -179,18 +196,18 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
* or H5F_ACC_RDONLY and any SWMR flags.
*/
if (H5F_INTENT(f) & H5F_ACC_RDWR) {
- *intent_flags = H5F_ACC_RDWR;
+ *args->args.get_intent.flags = H5F_ACC_RDWR;
/* Check for SWMR write access on the file */
if (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- *intent_flags |= H5F_ACC_SWMR_WRITE;
+ *args->args.get_intent.flags |= H5F_ACC_SWMR_WRITE;
} /* end if */
else {
- *intent_flags = H5F_ACC_RDONLY;
+ *args->args.get_intent.flags = H5F_ACC_RDONLY;
/* Check for SWMR read access on the file */
if (H5F_INTENT(f) & H5F_ACC_SWMR_READ)
- *intent_flags |= H5F_ACC_SWMR_READ;
+ *args->args.get_intent.flags |= H5F_ACC_SWMR_READ;
} /* end else */
break;
@@ -198,71 +215,52 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_fileno */
case H5VL_FILE_GET_FILENO: {
- unsigned long *fno = HDva_arg(arguments, unsigned long *);
- unsigned long my_fileno = 0;
+ unsigned long fileno = 0;
- f = (H5F_t *)obj;
- H5F_GET_FILENO(f, my_fileno);
- *fno = my_fileno; /* sigh */
+ H5F_GET_FILENO((H5F_t *)obj, fileno);
+ *args->args.get_fileno.fileno = fileno;
break;
}
/* H5Fget_name */
case H5VL_FILE_GET_NAME: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- size_t size = HDva_arg(arguments, size_t);
- char * name = HDva_arg(arguments, char *);
- ssize_t * ret = HDva_arg(arguments, ssize_t *);
- size_t len;
+ H5VL_file_get_name_args_t *file_args = &args->args.get_name;
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, file_args->type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- len = HDstrlen(H5F_OPEN_NAME(f));
+ /* Get length of file name */
+ *file_args->file_name_len = HDstrlen(H5F_OPEN_NAME(f));
- if (name) {
- HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1, size));
- if (len >= size)
- name[size - 1] = '\0';
+ /* Populate buffer with name, if given */
+ if (file_args->buf) {
+ HDstrncpy(file_args->buf, H5F_OPEN_NAME(f),
+ MIN(*file_args->file_name_len + 1, file_args->buf_size));
+ if (*file_args->file_name_len >= file_args->buf_size)
+ file_args->buf[file_args->buf_size - 1] = '\0';
} /* end if */
- /* Set the return value for the API call */
- *ret = (ssize_t)len;
break;
}
/* H5Fget_obj_count */
case H5VL_FILE_GET_OBJ_COUNT: {
- unsigned types = HDva_arg(arguments, unsigned);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
+ if (H5F_get_obj_count((H5F_t *)obj, args->args.get_obj_count.types, TRUE,
+ args->args.get_obj_count.count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object count")
- f = (H5F_t *)obj;
- /* Perform the query */
- if (H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
break;
}
/* H5Fget_obj_ids */
case H5VL_FILE_GET_OBJ_IDS: {
- unsigned types = HDva_arg(arguments, unsigned);
- size_t max_objs = HDva_arg(arguments, size_t);
- hid_t * oid_list = HDva_arg(arguments, hid_t *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
+ H5VL_file_get_obj_ids_args_t *file_args = &args->args.get_obj_ids;
- f = (H5F_t *)obj;
- /* Perform the query */
- if (H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+ if (H5F_get_obj_ids((H5F_t *)obj, file_args->types, file_args->max_objs, file_args->oid_list,
+ TRUE, file_args->count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object IDs")
- /* Set the return value */
- *ret = (ssize_t)obj_count;
break;
}
@@ -284,22 +282,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
/* H5Fflush */
case H5VL_FILE_FLUSH: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_scope_t scope = (H5F_scope_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_t * f = NULL; /* File to flush */
+ H5F_t *f = NULL; /* File to flush */
/* Get the file for the object */
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, args->args.flush.obj_type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Nothing to do if the file is read only. This determination is
@@ -310,7 +306,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
*/
if (H5F_ACC_RDWR & H5F_INTENT(f)) {
/* Flush other files, depending on scope */
- if (H5F_SCOPE_GLOBAL == scope) {
+ if (H5F_SCOPE_GLOBAL == args->args.flush.scope) {
/* Call the flush routine for mounted file hierarchies */
if (H5F_flush_mounts(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
@@ -322,93 +318,55 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
"unable to flush file's cached information")
} /* end else */
} /* end if */
+
break;
}
/* H5Freopen */
case H5VL_FILE_REOPEN: {
- void **ret = HDva_arg(arguments, void **);
- H5F_t *new_file = NULL;
+ H5F_t *new_file;
/* Reopen the file through the VOL connector */
if (NULL == (new_file = H5F__reopen((H5F_t *)obj)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
new_file->id_exists = TRUE;
- *ret = (void *)new_file;
- break;
- }
-
- /* H5Fmount */
- case H5VL_FILE_MOUNT: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- const char *name = HDva_arg(arguments, const char *);
- H5F_t * child = HDva_arg(arguments, H5F_t *);
- hid_t fmpl_id = HDva_arg(arguments, hid_t);
- H5G_loc_t loc;
-
- if (H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Do the mount */
- if (H5F__mount(&loc, name, child, fmpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
-
- break;
- }
-
- /* H5Funmount */
- case H5VL_FILE_UNMOUNT: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- const char *name = HDva_arg(arguments, const char *);
- H5G_loc_t loc;
-
- if (H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Unmount */
- if (H5F__unmount(&loc, name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
+ /* Set 'out' value */
+ *args->args.reopen.file = new_file;
break;
}
/* H5Fis_accessible */
case H5VL_FILE_IS_ACCESSIBLE: {
- hid_t fapl_id = HDva_arg(arguments, hid_t);
- const char *name = HDva_arg(arguments, const char *);
- htri_t * result = HDva_arg(arguments, htri_t *);
+ htri_t result;
+
+ if ((result = H5F__is_hdf5(args->args.is_accessible.filename, args->args.is_accessible.fapl_id)) <
+ 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "error in HDF5 file check")
+
+ /* Set 'out' value */
+ *args->args.is_accessible.accessible = (hbool_t)result;
- /* Call private routine */
- if ((*result = H5F__is_hdf5(name, fapl_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check")
break;
}
/* H5Fdelete */
case H5VL_FILE_DELETE: {
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL,
- "H5Fdelete() is currently not supported in the native VOL connector")
+ if (H5F__delete(args->args.del.filename, args->args.del.fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file deletion")
+
break;
}
/* Check if two files are the same */
case H5VL_FILE_IS_EQUAL: {
- H5F_t * file2 = (H5F_t *)HDva_arg(arguments, void *);
- hbool_t *is_equal = HDva_arg(arguments, hbool_t *);
-
- if (!obj || !file2)
- *is_equal = FALSE;
+ if (!obj || !args->args.is_equal.obj2)
+ *args->args.is_equal.same_file = FALSE;
else
- *is_equal = (((H5F_t *)obj)->shared == file2->shared);
- break;
- }
+ *args->args.is_equal.same_file =
+ (((H5F_t *)obj)->shared == ((H5F_t *)args->args.is_equal.obj2)->shared);
- /* H5Fwait */
- case H5VL_FILE_WAIT: {
- /* The native VOL connector doesn't support asynchronous
- * operations, so this is a no-op.
- */
break;
}
@@ -430,85 +388,78 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
- H5F_t *f = NULL; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f = (H5F_t *)obj; /* File */
+ H5VL_native_file_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- f = (H5F_t *)obj;
- switch (optional_type) {
+ switch (args->op_type) {
/* H5Fget_filesize */
case H5VL_NATIVE_FILE_GET_SIZE: {
- haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
- haddr_t base_addr; /* Base address for the file */
- hsize_t *size = HDva_arg(arguments, hsize_t *);
+ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
+ haddr_t base_addr; /* Base address for the file */
- /* Go get the actual file size */
+ /* Get the actual file size & base address */
if (H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
base_addr = H5FD_get_base_addr(f->shared->lf);
- if (size)
- *size = (hsize_t)(max_eof_eoa +
- base_addr); /* Convert relative base address for file to absolute address */
+ /* Convert relative base address for file to absolute address */
+ *opt_args->get_size.size = (hsize_t)(max_eof_eoa + base_addr);
break;
}
/* H5Fget_file_image */
case H5VL_NATIVE_FILE_GET_FILE_IMAGE: {
- void * buf_ptr = HDva_arg(arguments, void *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t buf_len = HDva_arg(arguments, size_t);
+ H5VL_native_file_get_file_image_t *gfi_args = &opt_args->get_file_image;
- /* Do the actual work */
- if ((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0)
+ /* Get file image */
+ if (H5F__get_file_image(f, gfi_args->buf, gfi_args->buf_size, gfi_args->image_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
+
break;
}
/* H5Fget_freespace */
case H5VL_NATIVE_FILE_GET_FREE_SPACE: {
- hsize_t tot_space; /* Amount of free space in the file */
- hssize_t *ret = HDva_arg(arguments, hssize_t *);
+ H5VL_native_file_get_freespace_t *gfs_args = &opt_args->get_freespace;
- /* Go get the actual amount of free space in the file */
- if (H5MF_get_freespace(f, &tot_space, NULL) < 0)
+ /* Get the actual amount of free space in the file */
+ if (H5MF_get_freespace(f, gfs_args->size, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
- *ret = (hssize_t)tot_space;
+
break;
}
/* H5Fget_free_sections */
case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: {
- H5F_sect_info_t *sect_info = HDva_arg(arguments, H5F_sect_info_t *);
- ssize_t * ret = HDva_arg(arguments, ssize_t *);
- H5F_mem_t type = (H5F_mem_t)HDva_arg(arguments, int); /* enum work-around */
- size_t nsects = HDva_arg(arguments, size_t);
+ H5VL_native_file_get_free_sections_t *gfs_args = &opt_args->get_free_sections;
/* Go get the free-space section information in the file */
- if ((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
+ if (H5MF_get_free_sections(f, gfs_args->type, gfs_args->nsects, gfs_args->sect_info,
+ gfs_args->sect_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+
break;
}
/* H5Fget_info1/2 */
case H5VL_NATIVE_FILE_GET_INFO: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_info2_t *finfo = HDva_arg(arguments, H5F_info2_t *);
+ H5VL_native_file_get_info_t *gfi_args = &opt_args->get_info;
/* Get the file struct. This call is careful to not return the file pointer
* for the top file in a mount hierarchy.
*/
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, gfi_args->type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
/* Get the file info */
- if (H5F__get_info(f, finfo) < 0)
+ if (H5F__get_info(f, gfi_args->finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
break;
@@ -516,50 +467,42 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_config */
case H5VL_NATIVE_FILE_GET_MDC_CONF: {
- H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+ /* Get the metadata cache configuration */
+ if (H5AC_get_cache_auto_resize_config(f->shared->cache, opt_args->get_mdc_config.config) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache configuration")
- /* Go get the resize configuration */
- if (H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
break;
}
/* H5Fget_mdc_hit_rate */
case H5VL_NATIVE_FILE_GET_MDC_HR: {
- double *hit_rate_ptr = HDva_arg(arguments, double *);
+ /* Get the current hit rate */
+ if (H5AC_get_cache_hit_rate(f->shared->cache, opt_args->get_mdc_hit_rate.hit_rate) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache hit rate")
- /* Go get the current hit rate */
- if (H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
break;
}
/* H5Fget_mdc_size */
case H5VL_NATIVE_FILE_GET_MDC_SIZE: {
- size_t * max_size_ptr = HDva_arg(arguments, size_t *);
- size_t * min_clean_size_ptr = HDva_arg(arguments, size_t *);
- size_t * cur_size_ptr = HDva_arg(arguments, size_t *);
- int * cur_num_entries_ptr = HDva_arg(arguments, int *);
- uint32_t cur_num_entries;
+ H5VL_native_file_get_mdc_size_t *gms_args = &opt_args->get_mdc_size;
- /* Go get the size data */
- if (H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr,
- &cur_num_entries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
+ /* Get the size data */
+ if (H5AC_get_cache_size(f->shared->cache, gms_args->max_size, gms_args->min_clean_size,
+ gms_args->cur_size, gms_args->cur_num_entries) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache size")
- if (cur_num_entries_ptr != NULL)
- *cur_num_entries_ptr = (int)cur_num_entries;
break;
}
/* H5Fget_vfd_handle */
case H5VL_NATIVE_FILE_GET_VFD_HANDLE: {
- void **file_handle = HDva_arg(arguments, void **);
- hid_t fapl_id = HDva_arg(arguments, hid_t);
+ H5VL_native_file_get_vfd_handle_t *gvh_args = &opt_args->get_vfd_handle;
/* Retrieve the VFD handle for the file */
- if (H5F_get_vfd_handle(f, fapl_id, file_handle) < 0)
+ if (H5F_get_vfd_handle(f, gvh_args->fapl_id, gvh_args->file_handle) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
+
break;
}
@@ -569,6 +512,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
if (f->shared->efc)
if (H5F__efc_release(f->shared->efc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+
break;
}
@@ -576,26 +520,24 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: {
/* Reset the hit rate statistic */
if (H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
+
break;
}
/* H5Fset_mdc_config */
case H5VL_NATIVE_FILE_SET_MDC_CONFIG: {
- H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+ /* Set the metadata cache configuration */
+ if (H5AC_set_cache_auto_resize_config(f->shared->cache, opt_args->set_mdc_config.config) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set metadata cache configuration")
- /* set the resize configuration */
- if (H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed")
break;
}
/* H5Fget_metadata_read_retry_info */
case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: {
- H5F_retry_info_t *info = HDva_arg(arguments, H5F_retry_info_t *);
-
- if (H5F_get_metadata_read_retry_info(f, info) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info")
+ if (H5F_get_metadata_read_retry_info(f, opt_args->get_metadata_read_retry_info.info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info")
break;
}
@@ -603,7 +545,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fstart_swmr_write */
case H5VL_NATIVE_FILE_START_SWMR_WRITE: {
if (H5F__start_swmr_write(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't start SWMR write")
break;
}
@@ -628,11 +570,11 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_logging_status */
case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: {
- hbool_t *is_enabled = HDva_arg(arguments, hbool_t *);
- hbool_t *is_currently_logging = HDva_arg(arguments, hbool_t *);
+ H5VL_native_file_get_mdc_logging_status_t *gmls_args = &opt_args->get_mdc_logging_status;
/* Call mdc logging function */
- if (H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0)
+ if (H5C_get_logging_status(f->shared->cache, gmls_args->is_enabled,
+ gmls_args->is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
break;
@@ -662,18 +604,15 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_page_buffering_stats */
case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: {
- unsigned *accesses = HDva_arg(arguments, unsigned *);
- unsigned *hits = HDva_arg(arguments, unsigned *);
- unsigned *misses = HDva_arg(arguments, unsigned *);
- unsigned *evictions = HDva_arg(arguments, unsigned *);
- unsigned *bypasses = HDva_arg(arguments, unsigned *);
+ H5VL_native_file_get_page_buffering_stats_t *gpbs_args = &opt_args->get_page_buffering_stats;
/* Sanity check */
if (NULL == f->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
/* Get the statistics */
- if (H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5PB_get_stats(f->shared->page_buf, gpbs_args->accesses, gpbs_args->hits, gpbs_args->misses,
+ gpbs_args->evictions, gpbs_args->bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
break;
@@ -681,11 +620,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_image_info */
case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: {
- haddr_t *image_addr = HDva_arg(arguments, haddr_t *);
- hsize_t *image_len = HDva_arg(arguments, hsize_t *);
+ H5VL_native_file_get_mdc_image_info_t *gmii_args = &opt_args->get_mdc_image_info;
/* Go get the address and size of the cache image */
- if (H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0)
+ if (H5AC_get_mdc_image_info(f->shared->cache, gmii_args->addr, gmii_args->len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
break;
@@ -693,11 +631,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_eoa */
case H5VL_NATIVE_FILE_GET_EOA: {
- haddr_t *eoa = HDva_arg(arguments, haddr_t *);
- haddr_t rel_eoa; /* Relative address of EOA */
-
- /* Sanity check */
- HDassert(eoa);
+ haddr_t rel_eoa; /* Relative address of EOA */
/* This routine will work only for drivers with this feature enabled.*/
/* We might introduce a new feature flag in the future */
@@ -711,14 +645,13 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* Set return value */
/* (Note compensating for base address subtraction in internal routine) */
- *eoa = rel_eoa + H5F_get_base_addr(f);
+ *opt_args->get_eoa.eoa = rel_eoa + H5F_get_base_addr(f);
break;
}
/* H5Fincrement_filesize */
case H5VL_NATIVE_FILE_INCR_FILESIZE: {
- hsize_t increment = HDva_arg(arguments, hsize_t);
haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
/* This public routine will work only for drivers with this feature enabled.*/
@@ -732,7 +665,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
/* Set EOA to the maximum value + increment */
- if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
+ if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + opt_args->increment_filesize.increment) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
break;
@@ -740,11 +673,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fset_latest_format, H5Fset_libver_bounds */
case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: {
- H5F_libver_t low = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_libver_t high = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
+ H5VL_native_file_set_libver_bounds_t *slb_args = &opt_args->set_libver_bounds;
/* Call internal set_libver_bounds function */
- if (H5F__set_libver_bounds(f, low, high) < 0)
+ if (H5F__set_libver_bounds(f, slb_args->low, slb_args->high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
break;
@@ -752,34 +684,34 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: {
- hbool_t *minimize = HDva_arg(arguments, hbool_t *);
- *minimize = H5F_GET_MIN_DSET_OHDR(f);
+ *opt_args->get_min_dset_ohdr_flag.minimize = H5F_GET_MIN_DSET_OHDR(f);
+
break;
}
/* H5Fset_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: {
- int minimize = HDva_arg(arguments, int);
- if (H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0)
+ if (H5F_set_min_dset_ohdr(f, opt_args->set_min_dset_ohdr_flag.minimize) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL,
"cannot set file's dataset object header minimization flag")
+
break;
}
#ifdef H5_HAVE_PARALLEL
/* H5Fget_mpi_atomicity */
case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: {
- hbool_t *flag = (hbool_t *)HDva_arg(arguments, hbool_t *);
- if (H5F_get_mpi_atomicity(f, flag) < 0)
+ if (H5F__get_mpi_atomicity(f, opt_args->get_mpi_atomicity.flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "cannot get MPI atomicity");
+
break;
}
/* H5Fset_mpi_atomicity */
case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: {
- hbool_t flag = (hbool_t)HDva_arg(arguments, int);
- if (H5F_set_mpi_atomicity(f, flag) < 0)
+ if (H5F__set_mpi_atomicity(f, opt_args->set_mpi_atomicity.flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set MPI atomicity");
+
break;
}
#endif /* H5_HAVE_PARALLEL */
@@ -787,7 +719,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* Finalize H5Fopen */
case H5VL_NATIVE_FILE_POST_OPEN: {
/* Call package routine */
- if (H5F__post_open((H5F_t *)obj) < 0)
+ if (H5F__post_open(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file")
break;
}
@@ -838,7 +770,7 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U
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")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
/* Close the file */
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index e3fa702..54f8337 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5G_FRIEND /* Suppress error about including H5Gpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
@@ -27,6 +34,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_group_create
*
@@ -138,55 +169,54 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* H5Gget_create_plist */
case H5VL_GROUP_GET_GCPL: {
- hid_t *new_gcpl_id = HDva_arg(arguments, hid_t *);
- H5G_t *grp = (H5G_t *)obj;
+ if ((args->args.get_gcpl.gcpl_id = H5G_get_create_plist((H5G_t *)obj)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get creation property list for group")
- if ((*new_gcpl_id = H5G_get_create_plist(grp)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group")
break;
}
/* H5Gget_info */
case H5VL_GROUP_GET_INFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- H5G_info_t * group_info = HDva_arg(arguments, H5G_info_t *);
- H5G_loc_t loc;
+ H5VL_group_get_info_args_t *get_info_args = &args->args.get_info;
+ H5G_loc_t loc;
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (get_info_args->loc_params.type == H5VL_OBJECT_BY_SELF) {
/* H5Gget_info */
/* Retrieve the group's information */
- if (H5G__obj_info(loc.oloc, group_info) < 0)
+ if (H5G__obj_info(loc.oloc, get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_NAME) {
/* H5Gget_info_by_name */
/* Retrieve the group's information */
- if (H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0)
+ if (H5G__get_info_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name,
+ get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end else-if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_IDX) {
/* H5Gget_info_by_idx */
/* Retrieve the group's information */
- if (H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, group_info) < 0)
+ if (H5G__get_info_by_idx(&loc, get_info_args->loc_params.loc_data.loc_by_idx.name,
+ get_info_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_info_args->loc_params.loc_data.loc_by_idx.order,
+ get_info_args->loc_params.loc_data.loc_by_idx.n,
+ get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end else-if */
else
@@ -212,30 +242,53 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5G_t *grp = (H5G_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
- case H5VL_GROUP_FLUSH: {
- hid_t group_id = HDva_arg(arguments, hid_t);
+ switch (args->op_type) {
+ /* H5Fmount */
+ case H5VL_GROUP_MOUNT: {
+ H5G_loc_t loc;
+
+ if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object")
+
+ if (H5F_mount(&loc, args->args.mount.name, args->args.mount.child_file,
+ args->args.mount.fmpl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+ break;
+ }
+
+ /* H5Funmount */
+ case H5VL_GROUP_UNMOUNT: {
+ H5G_loc_t loc;
+
+ if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object")
+
+ if (H5F_unmount(&loc, args->args.unmount.name) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_UNMOUNT, FAIL, "unable to unmount file")
+
+ break;
+ }
- /* Flush object's metadata to file */
- if (H5O_flush_common(&grp->oloc, group_id) < 0)
+ /* H5Gflush */
+ case H5VL_GROUP_FLUSH: {
+ if (H5O_flush_common(&grp->oloc, args->args.flush.grp_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
break;
}
+ /* H5Grefresh */
case H5VL_GROUP_REFRESH: {
- hid_t group_id = HDva_arg(arguments, hid_t);
-
- /* Call private function to refresh group object */
- if ((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
+ if ((H5O_refresh_metadata(&grp->oloc, args->args.refresh.grp_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
break;
@@ -259,50 +312,53 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_group_optional_t optional_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
- va_list H5_ATTR_DEPRECATED_USED arguments)
+H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- herr_t ret_value = SUCCEED; /* Return value */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5VL_native_group_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (optional_type) {
+ switch (args->op_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* H5Giterate (deprecated) */
case H5VL_NATIVE_GROUP_ITERATE_OLD: {
- const H5VL_loc_params_t * loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- hsize_t idx = HDva_arg(arguments, hsize_t);
- hsize_t * last_obj = HDva_arg(arguments, hsize_t *);
- const H5G_link_iterate_t *lnk_op = HDva_arg(arguments, const H5G_link_iterate_t *);
- void * op_data = HDva_arg(arguments, void *);
- H5G_loc_t grp_loc;
+ H5VL_native_group_iterate_old_t *iter_args = &opt_args->iterate_old;
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ H5G_loc_t grp_loc;
/* Get the location struct for the object */
- if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ if (H5G_loc_real(obj, iter_args->loc_params.obj_type, &grp_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ /* Set up link iteration callback struct */
+ lnk_op.op_type = H5G_LINK_OP_OLD;
+ lnk_op.op_func.op_old = iter_args->op;
+
/* Call the actual iteration routine */
- if ((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME,
- H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0)
- HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links");
+ if ((ret_value = H5G_iterate(&grp_loc, iter_args->loc_params.loc_data.loc_by_name.name,
+ H5_INDEX_NAME, H5_ITER_INC, iter_args->idx, iter_args->last_obj,
+ &lnk_op, iter_args->op_data)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
break;
}
/* H5Gget_objinfo (deprecated) */
case H5VL_NATIVE_GROUP_GET_OBJINFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- hbool_t follow_link = (hbool_t)HDva_arg(arguments, unsigned);
- H5G_stat_t * statbuf = HDva_arg(arguments, H5G_stat_t *);
- H5G_loc_t grp_loc;
+ H5VL_native_group_get_objinfo_t *goi_args = &opt_args->get_objinfo;
+ H5G_loc_t grp_loc;
/* Get the location struct for the object */
- if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ if (H5G_loc_real(obj, goi_args->loc_params.obj_type, &grp_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Call the actual group objinfo routine */
- if (H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0)
+ if (H5G__get_objinfo(&grp_loc, goi_args->loc_params.loc_data.loc_by_name.name,
+ goi_args->follow_link, goi_args->statbuf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
break;
diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c
index 6af33ba..fa11bea 100644
--- a/src/H5VLnative_introspect.c
+++ b/src/H5VLnative_introspect.c
@@ -15,14 +15,46 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
-/* Note: H5VL__native_introspect_get_conn_cls is in src/H5VLnative.c so that
- * it can return the address of the staticly declared class struct.
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Note: H5VL__native_introspect_get_conn_cls and H5VL__native_introspect_get_cap_flags
+ * are in src/H5VLnative.c so that they can work with the staticly declared
+ * class struct.
*/
/*---------------------------------------------------------------------------
@@ -150,8 +182,10 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc
case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS:
case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG:
case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG:
+#ifdef H5_HAVE_PARALLEL
case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY:
case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY:
+#endif /* H5_HAVE_PARALLEL */
case H5VL_NATIVE_FILE_POST_OPEN:
break;
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 72f6cde..042c778 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5L_FRIEND /* Suppress error about including H5Lpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */
@@ -27,6 +34,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_link_create
*
@@ -37,20 +68,20 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (create_type) {
+ switch (args->op_type) {
case H5VL_LINK_CREATE_HARD: {
H5G_loc_t cur_loc;
H5G_loc_t link_loc;
- void * cur_obj = HDva_arg(arguments, void *);
- H5VL_loc_params_t *cur_params = HDva_arg(arguments, H5VL_loc_params_t *);
+ void * cur_obj = args->args.hard.curr_obj;
+ H5VL_loc_params_t *cur_params = &args->args.hard.curr_loc_params;
if (NULL != cur_obj && H5G_loc_real(cur_obj, cur_params->obj_type, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
@@ -73,46 +104,40 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H
"source and destination should be in the same file.")
/* Create the link */
- if ((ret_value =
- H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p,
- loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
+ if (H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p,
+ loc_params->loc_data.loc_by_name.name, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else { /* H5Olink */
/* Link to the object */
if (H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else */
+
break;
}
case H5VL_LINK_CREATE_SOFT: {
- char * target_name = HDva_arg(arguments, char *);
H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if (H5L__create_soft(args->args.soft.target, &link_loc, loc_params->loc_data.loc_by_name.name,
+ lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
- /* Create the link */
- if ((ret_value = H5L__create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name,
- lcpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
break;
}
case H5VL_LINK_CREATE_UD: {
- H5G_loc_t link_loc; /* Group location for new link */
- H5L_type_t link_type = (H5L_type_t)HDva_arg(arguments, int);
- void * udata = HDva_arg(arguments, void *);
- size_t udata_size = HDva_arg(arguments, size_t);
+ H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Create link */
- if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type,
- lcpl_id) < 0)
+ if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, args->args.ud.buf,
+ args->args.ud.buf_size, args->args.ud.type, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+
break;
}
@@ -218,8 +243,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -229,20 +254,19 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (get_type) {
+ switch (args->op_type) {
/* H5Lget_info/H5Lget_info_by_idx */
case H5VL_LINK_GET_INFO: {
- H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *);
-
/* Get the link information */
- if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
- if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo2) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
- if (H5L__get_info_by_idx(
- &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0)
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
} /* end else-if */
else
@@ -253,15 +277,11 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_name_by_idx */
case H5VL_LINK_GET_NAME: {
- char * name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
-
- /* Get the link name */
- if ((*ret = H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
+ if (H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_name.name, args->args.get_name.name_size,
+ args->args.get_name.name_len) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
break;
@@ -269,20 +289,17 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_val/H5Lget_val_by_idx */
case H5VL_LINK_GET_VAL: {
- void * buf = HDva_arg(arguments, void *);
- size_t size = HDva_arg(arguments, size_t);
-
/* Get the link information */
- if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */
- if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_val.buf,
+ args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
}
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
-
- if (H5L__get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_val_by_idx(
+ &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_val.buf, args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
}
else
@@ -309,35 +326,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
case H5VL_LINK_EXISTS: {
- hbool_t * exists = HDva_arg(arguments, hbool_t *);
H5G_loc_t loc;
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Check for the existence of the link */
- if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, exists) < 0)
+ if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
+
break;
}
case H5VL_LINK_ITER: {
- H5G_loc_t loc;
- hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t * idx_p = HDva_arg(arguments, hsize_t *);
- H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t);
- void * op_data = HDva_arg(arguments, void *);
+ H5VL_link_iterate_args_t *iter_args = &args->args.iterate;
+ H5G_loc_t loc;
/* Get the location */
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
@@ -345,28 +355,32 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
/* Visit or iterate over the links */
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit */
- if ((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
+ if ((ret_value = H5G_visit(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate */
- if ((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->idx_p, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit_by_name */
- if ((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- op, op_data)) < 0)
+ if ((ret_value =
+ H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, iter_args->idx_type,
+ iter_args->order, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate_by_name */
- if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name,
+ iter_args->idx_type, iter_args->order, iter_args->idx_p,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end else-if */
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 449f389..d237617 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -15,9 +15,16 @@
*
*/
-#define H5O_FRIEND /* Suppress error about including H5Opkg */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+#define H5O_FRIEND /* Suppress error about including H5Opkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files (pkg needed for id_exists) */
@@ -29,6 +36,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_object_open
*
@@ -138,8 +169,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
H5G_loc_t loc; /* Location of group */
@@ -149,14 +180,12 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (get_type) {
+ switch (args->op_type) {
/* Object file */
case H5VL_OBJECT_GET_FILE: {
- void **ret = HDva_arg(arguments, void **);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- *ret = (void *)loc.oloc->file;
+ *args->args.get_file.file = (void *)loc.oloc->file;
/* TODO we currently need to set id_exists to TRUE because
* the upper layer will create an ID from the returned
@@ -166,18 +195,16 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
}
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters")
+
break;
}
/* Object name */
case H5VL_OBJECT_GET_NAME: {
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- char * name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
/* Retrieve object's name */
- if ((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ if (H5G_get_name(&loc, args->args.get_name.buf, args->args.get_name.buf_size,
+ args->args.get_name.name_len, NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_TOKEN) {
@@ -194,18 +221,18 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
"can't deserialize object token into address")
/* Retrieve object's name */
- if ((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
+ if (H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, args->args.get_name.buf,
+ args->args.get_name.buf_size, args->args.get_name.name_len) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters")
+
break;
}
/* Object type */
case H5VL_OBJECT_GET_TYPE: {
- H5O_type_t *obj_type = HDva_arg(arguments, H5O_type_t *);
-
if (loc_params->type == H5VL_OBJECT_BY_TOKEN) {
H5O_loc_t obj_oloc; /* Object location */
unsigned rc; /* Reference count of object */
@@ -222,35 +249,30 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
/* Get the # of links for object, and its type */
/* (To check to make certain that this object hasn't been deleted) */
- if (H5O_get_rc_and_type(&obj_oloc, &rc, obj_type) < 0 || 0 == rc)
+ if (H5O_get_rc_and_type(&obj_oloc, &rc, args->args.get_type.obj_type) < 0 || 0 == rc)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
}
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_type parameters")
+
break;
}
/* H5Oget_info(_name|_by_idx)3 */
case H5VL_OBJECT_GET_INFO: {
- H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *);
- unsigned fields = HDva_arg(arguments, unsigned);
-
- /* Use the original H5Oget_info code to get the data */
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if (H5G_loc_info(&loc, ".", oinfo, fields) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (H5G_loc_info(&loc, ".", args->args.get_info.oinfo, args->args.get_info.fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if (H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0)
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.oinfo,
+ args->args.get_info.fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
+ } /* end else-if */
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -265,7 +287,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
/* Retrieve the object's information */
- if (H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) {
+ if (H5O_get_info(obj_loc.oloc, args->args.get_info.oinfo, args->args.get_info.fields) < 0) {
H5G_loc_free(&obj_loc);
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
} /* end if */
@@ -276,6 +298,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
} /* end else-if */
else
HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+
break;
}
@@ -298,8 +321,8 @@ done:
*/
herr_t
H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -309,13 +332,10 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (specific_type) {
+ switch (args->op_type) {
/* H5Oincr_refcount / H5Odecr_refcount */
case H5VL_OBJECT_CHANGE_REF_COUNT: {
- int update_ref = HDva_arg(arguments, int);
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_link(oloc, update_ref) < 0)
+ if (H5O_link(loc.oloc, args->args.change_rc.delta) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
break;
@@ -323,25 +343,20 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
/* H5Oexists_by_name */
case H5VL_OBJECT_EXISTS: {
- htri_t *ret = HDva_arg(arguments, htri_t *);
-
if (loc_params->type == H5VL_OBJECT_BY_NAME) {
/* Check if the object exists */
- if ((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
+ if (H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists",
loc_params->loc_data.loc_by_name.name)
} /* end if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters")
+
break;
}
/* Lookup object */
case H5VL_OBJECT_LOOKUP: {
- H5O_token_t *token = HDva_arg(arguments, H5O_token_t *);
-
- HDassert(token);
-
if (loc_params->type == H5VL_OBJECT_BY_NAME) {
H5G_loc_t obj_loc; /* Group hier. location of object */
H5G_name_t obj_path; /* Object group hier. path */
@@ -357,7 +372,8 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
/* Encode token */
- if (H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0)
+ if (H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr,
+ args->args.lookup.token_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL,
"can't serialize address into object token")
@@ -370,46 +386,39 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
break;
}
+ /* H5Ovisit/H5Ovisit_by_name */
case H5VL_OBJECT_VISIT: {
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t);
- void * op_data = HDva_arg(arguments, void *);
- unsigned fields = HDva_arg(arguments, unsigned);
+ H5VL_object_visit_args_t *visit_args = &args->args.visit;
/* Call internal object visitation routine */
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Ovisit */
- if ((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
+ if ((ret_value = H5O__visit(&loc, ".", visit_args->idx_type, visit_args->order,
+ visit_args->op, visit_args->op_data, visit_args->fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Ovisit_by_name */
- if ((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op,
- op_data, fields)) < 0)
+ if ((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, visit_args->idx_type,
+ visit_args->order, visit_args->op, visit_args->op_data,
+ visit_args->fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params");
+
break;
}
case H5VL_OBJECT_FLUSH: {
- hid_t oid = HDva_arg(arguments, hid_t);
-
/* Flush the object's metadata */
- if (H5O_flush(loc.oloc, oid) < 0)
+ if (H5O_flush(loc.oloc, args->args.flush.obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
break;
}
case H5VL_OBJECT_REFRESH: {
- hid_t oid = HDva_arg(arguments, hid_t);
- H5O_loc_t *oloc = loc.oloc;
-
/* Refresh the metadata */
- if (H5O_refresh_metadata(oid, *oloc) < 0)
+ if (H5O_refresh_metadata(loc.oloc, args->args.refresh.obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
break;
@@ -433,64 +442,59 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *);
- H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Location of group */
+ H5VL_native_object_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (optional_type) {
+ switch (args->op_type) {
/* H5Oget_comment / H5Oget_comment_by_name */
case H5VL_NATIVE_OBJECT_GET_COMMENT: {
- char * comment = HDva_arg(arguments, char *);
- size_t bufsize = HDva_arg(arguments, size_t);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ H5VL_native_object_get_comment_t *gc_args = &opt_args->get_comment;
/* Retrieve the object's comment */
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */
- if ((*ret = H5G_loc_get_comment(&loc, ".", comment /*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ if (H5G_loc_get_comment(&loc, ".", gc_args->buf, gc_args->buf_size, gc_args->comment_len) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */
- if ((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment /*out*/,
- bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ if (H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, gc_args->buf,
+ gc_args->buf_size, gc_args->comment_len) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+
break;
}
/* H5Oset_comment */
case H5VL_NATIVE_OBJECT_SET_COMMENT: {
- const char *comment = HDva_arg(arguments, char *);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */
- /* (Re)set the object's comment */
- if (H5G_loc_set_comment(&loc, ".", comment) < 0)
+ if (H5G_loc_set_comment(&loc, ".", opt_args->set_comment.comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */
- /* (Re)set the object's comment */
- if (H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0)
+ if (H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name,
+ opt_args->set_comment.comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+
break;
}
/* H5Odisable_mdc_flushes */
case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: {
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_disable_mdc_flushes(oloc) < 0)
+ if (H5O__disable_mdc_flushes(loc.oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork the metadata cache");
break;
@@ -498,9 +502,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oenable_mdc_flushes */
case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: {
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_enable_mdc_flushes(oloc) < 0)
+ if (H5O__enable_mdc_flushes(loc.oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork the metadata cache");
break;
@@ -508,10 +510,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oare_mdc_flushes_disabled */
case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: {
- H5O_loc_t *oloc = loc.oloc;
- hbool_t * are_disabled = (hbool_t *)HDva_arg(arguments, hbool_t *);
-
- if (H5O_are_mdc_flushes_disabled(oloc, are_disabled) < 0)
+ if (H5O__are_mdc_flushes_disabled(loc.oloc, opt_args->are_mdc_flushes_disabled.flag) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine metadata cache cork status");
break;
@@ -519,19 +518,16 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oget_native_info(_name|_by_idx) */
case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: {
- H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *);
- unsigned fields = HDva_arg(arguments, unsigned);
+ H5VL_native_object_get_native_info_t *gni_args = &opt_args->get_native_info;
/* Use the original H5Oget_info code to get the data */
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if (H5G_loc_native_info(&loc, ".", native_info, fields) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (H5G_loc_native_info(&loc, ".", gni_args->ninfo, gni_args->fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if (H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0)
+ if (H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, gni_args->ninfo,
+ gni_args->fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end else-if */
else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
@@ -551,8 +547,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
loc_params->loc_data.loc_by_idx.n, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
- /* Retrieve the object's information */
- if (H5O_get_native_info(obj_loc.oloc, native_info, fields) < 0) {
+ if (H5O_get_native_info(obj_loc.oloc, gni_args->ninfo, gni_args->fields) < 0) {
H5G_loc_free(&obj_loc);
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
} /* end if */
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 687221a..1fd90c8 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -49,13 +49,10 @@ void * H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_par
hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -68,12 +65,11 @@ H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
-H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* Datatype callbacks */
@@ -82,10 +78,9 @@ H5_DLL void * H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *l
hid_t dxpl_id, void **req);
H5_DLL void * H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* File callbacks */
@@ -93,12 +88,10 @@ H5_DLL void * H5VL__native_file_create(const char *name, unsigned flags, hid_t f
hid_t dxpl_id, void **req);
H5_DLL void * H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -107,29 +100,26 @@ H5_DLL void * H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_
void **req);
H5_DLL void * H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
+H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments);
+ hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
/* Object callbacks */
H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
@@ -139,25 +129,23 @@ H5_DLL herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *l
const H5VL_loc_params_t *loc_params2, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Connector/container introspection functions */
H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL__native_introspect_get_cap_flags(const void *info, unsigned *cap_flags);
H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type,
uint64_t *flags);
/* Blob callbacks */
H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
-H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments);
+H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
/* Token callbacks */
H5_DLL herr_t H5VL__native_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2,
diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c
index 65591c7..bed0164 100644
--- a/src/H5VLnative_token.c
+++ b/src/H5VLnative_token.c
@@ -14,6 +14,10 @@
* Purpose: Object token callbacks for the native VOL connector
*/
+/****************/
+/* Module Setup */
+/****************/
+
/***********/
/* Headers */
/***********/
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 5ccc082..681531e 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -77,15 +77,6 @@ typedef struct H5VL_pass_through_wrap_ctx_t {
/********************* */
/* Helper routines */
-static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
- H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, ...);
-static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
- H5VL_request_specific_t specific_type, ...);
-static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- ...);
static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id);
static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
@@ -117,13 +108,11 @@ static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *b
void **req);
static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id,
void **req);
-static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -137,12 +126,12 @@ static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_
static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf,
void **req);
-static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* Datatype callbacks */
@@ -151,12 +140,12 @@ static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_
hid_t tapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t tapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* File callbacks */
@@ -164,12 +153,11 @@ static void * H5VL_pass_through_file_create(const char *name, unsigned flags, hi
hid_t dxpl_id, void **req);
static void * H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
void **req);
-static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -178,18 +166,17 @@ static void * H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t
void **req);
static void * H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
+static herr_t H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments);
+ hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
@@ -197,13 +184,11 @@ static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Object callbacks */
static void * H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
@@ -213,17 +198,16 @@ static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params
const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Container/connector introspection callbacks */
static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+static herr_t H5VL_pass_through_introspect_get_cap_flags(const void *info, unsigned *cap_flags);
static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type,
uint64_t *flags);
@@ -231,19 +215,15 @@ static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t
static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5VL_request_status_t *status);
static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx);
static herr_t H5VL_pass_through_request_cancel(void *req, H5VL_request_status_t *status);
-static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type,
- va_list arguments);
-static herr_t H5VL_pass_through_request_optional(void *req, H5VL_request_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_args_t *args);
+static herr_t H5VL_pass_through_request_optional(void *req, H5VL_optional_args_t *args);
static herr_t H5VL_pass_through_request_free(void *req);
/* Blob callbacks */
static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
-static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments);
-static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
+static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args);
/* Token callbacks */
static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2,
@@ -254,8 +234,7 @@ static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, c
H5O_token_t *token);
/* Generic optional callback */
-static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/*******************/
/* Local variables */
@@ -355,8 +334,9 @@ static const H5VL_class_t H5VL_pass_through_g = {
},
{
/* introspect_cls */
- H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */
- H5VL_pass_through_introspect_opt_query, /* opt_query */
+ H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL_pass_through_introspect_get_cap_flags, /* get_cap_flags */
+ H5VL_pass_through_introspect_opt_query, /* opt_query */
},
{
/* request_cls */
@@ -1025,7 +1005,7 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1034,7 +1014,7 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, v
printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
#endif
- ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLattr_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1055,8 +1035,7 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, v
*/
static herr_t
H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1065,8 +1044,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
#endif
- ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1086,8 +1064,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1096,7 +1073,7 @@ H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
#endif
- ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1285,8 +1262,7 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
@@ -1295,7 +1271,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxp
printf("------- PASS THROUGH VOL DATASET Get\n");
#endif
- ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1315,8 +1291,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxp
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -1326,12 +1301,12 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1351,8 +1326,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1361,7 +1335,7 @@ H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type,
printf("------- PASS THROUGH VOL DATASET Optional\n");
#endif
- ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1488,8 +1462,7 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
herr_t ret_value;
@@ -1498,7 +1471,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxp
printf("------- PASS THROUGH VOL DATATYPE Get\n");
#endif
- ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1518,8 +1491,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxp
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -1529,12 +1501,12 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1554,8 +1526,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1564,7 +1535,7 @@ H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type
printf("------- PASS THROUGH VOL DATATYPE Optional\n");
#endif
- ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1732,7 +1703,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
@@ -1741,7 +1712,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
printf("------- PASS THROUGH VOL FILE Get\n");
#endif
- ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLfile_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1751,31 +1722,6 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
} /* end H5VL_pass_through_file_get() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_file_specific_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * file specific callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, req);
- ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_file_specific_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_file_specific
*
* Purpose: Specific operation on file
@@ -1786,106 +1732,109 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, H5VL_file
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
{
- H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
- hid_t under_vol_id = -1;
- herr_t ret_value;
+ H5VL_pass_through_t * o = (H5VL_pass_through_t *)file;
+ H5VL_pass_through_t * new_o;
+ H5VL_file_specific_args_t my_args;
+ H5VL_file_specific_args_t *new_args;
+ H5VL_pass_through_info_t * info;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Specific\n");
#endif
- /* Unpack arguments to get at the child file pointer when mounting a file */
- if (specific_type == H5VL_FILE_MOUNT) {
- H5I_type_t loc_type;
- const char * name;
- H5VL_pass_through_t *child_file;
- hid_t plist_id;
-
- /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */
- loc_type = (H5I_type_t)va_arg(arguments, int); /* enum work-around */
- name = va_arg(arguments, const char *);
- child_file = (H5VL_pass_through_t *)va_arg(arguments, void *);
- plist_id = va_arg(arguments, hid_t);
-
- /* Keep the correct underlying VOL ID for possible async request token */
- under_vol_id = o->under_vol_id;
-
- /* Re-issue 'file specific' call, using the unwrapped pieces */
- ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type,
- dxpl_id, req, (int)loc_type, name,
- child_file->under_object, plist_id);
- } /* end if */
- else if (specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
- H5VL_pass_through_info_t *info;
- hid_t fapl_id, under_fapl_id;
- const char * name;
- htri_t * ret;
-
- /* Get the arguments for the 'is accessible' check */
- fapl_id = va_arg(arguments, hid_t);
- name = va_arg(arguments, const char *);
- ret = va_arg(arguments, htri_t *);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
+ /* Shallow copy the args */
+ memcpy(&my_args, args, sizeof(my_args));
/* Get copy of our VOL info from FAPL */
- H5Pget_vol_info(fapl_id, (void **)&info);
+ H5Pget_vol_info(args->args.is_accessible.fapl_id, (void **)&info);
/* Make sure we have info about the underlying VOL to be used */
if (!info)
return (-1);
+ /* Keep the correct underlying VOL ID for later */
+ under_vol_id = info->under_vol_id;
+
/* Copy the FAPL */
- under_fapl_id = H5Pcopy(fapl_id);
+ my_args.args.is_accessible.fapl_id = H5Pcopy(args->args.is_accessible.fapl_id);
/* Set the VOL ID and info for the underlying FAPL */
- H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+ H5Pset_vol(my_args.args.is_accessible.fapl_id, info->under_vol_id, info->under_vol_info);
- /* Keep the correct underlying VOL ID for possible async request token */
+ /* Set argument pointer to new arguments */
+ new_args = &my_args;
+
+ /* Set object pointer for operation */
+ new_o = NULL;
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_DELETE) {
+ /* Shallow copy the args */
+ memcpy(&my_args, args, sizeof(my_args));
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(args->args.del.fapl_id, (void **)&info);
+
+ /* Make sure we have info about the underlying VOL to be used */
+ if (!info)
+ return (-1);
+
+ /* Keep the correct underlying VOL ID for later */
under_vol_id = info->under_vol_id;
- /* Re-issue 'file specific' call */
- ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id,
- req, under_fapl_id, name, ret);
+ /* Copy the FAPL */
+ my_args.args.del.fapl_id = H5Pcopy(args->args.del.fapl_id);
- /* Close underlying FAPL */
- H5Pclose(under_fapl_id);
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(my_args.args.del.fapl_id, info->under_vol_id, info->under_vol_info);
- /* Release copy of our VOL info */
- H5VL_pass_through_info_free(info);
+ /* Set argument pointer to new arguments */
+ new_args = &my_args;
+
+ /* Set object pointer for operation */
+ new_o = NULL;
} /* end else-if */
else {
- va_list my_arguments;
-
- /* Make a copy of the argument list for later, if reopening */
- if (specific_type == H5VL_FILE_REOPEN)
- va_copy(my_arguments, arguments);
-
- /* Keep the correct underlying VOL ID for possible async request token */
+ /* Keep the correct underlying VOL ID for later */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
-
- /* Wrap file struct pointer, if we reopened one */
- if (specific_type == H5VL_FILE_REOPEN) {
- if (ret_value >= 0) {
- void **ret = va_arg(my_arguments, void **);
+ /* Set argument pointer to current arguments */
+ new_args = args;
- if (ret && *ret)
- *ret = H5VL_pass_through_new_obj(*ret, o->under_vol_id);
- } /* end if */
+ /* Set object pointer for operation */
+ new_o = o->under_object;
+ } /* end else */
- /* Finish use of copied vararg list */
- va_end(my_arguments);
- } /* end if */
- } /* end else */
+ ret_value = H5VLfile_specific(new_o, under_vol_id, new_args, dxpl_id, req);
/* Check for async request */
if (req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
+ /* Close underlying FAPL */
+ H5Pclose(my_args.args.is_accessible.fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_DELETE) {
+ /* Close underlying FAPL */
+ H5Pclose(my_args.args.del.fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_REOPEN) {
+ /* Wrap file struct pointer for 'reopen' operation, if we reopened one */
+ if (ret_value >= 0 && *args->args.reopen.file)
+ *args->args.reopen.file = H5VL_pass_through_new_obj(*args->args.reopen.file, under_vol_id);
+ } /* end else */
+
return ret_value;
} /* end H5VL_pass_through_file_specific() */
@@ -1900,8 +1849,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
@@ -1910,7 +1858,7 @@ H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL File Optional\n");
#endif
- ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2036,8 +1984,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, con
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2046,7 +1993,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
printf("------- PASS THROUGH VOL GROUP Get\n");
#endif
- ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2066,8 +2013,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -2077,11 +2023,27 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ /* Unpack arguments to get at the child file pointer when mounting a file */
+ if (args->op_type == H5VL_GROUP_MOUNT) {
+ H5VL_group_specific_args_t vol_cb_args; /* New group specific arg struct */
+
+ /* Set up new VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_MOUNT;
+ vol_cb_args.args.mount.name = args->args.mount.name;
+ vol_cb_args.args.mount.child_file =
+ ((H5VL_pass_through_t *)args->args.mount.child_file)->under_object;
+ vol_cb_args.args.mount.fmpl_id = args->args.mount.fmpl_id;
+
+ /* Re-issue 'group specific' call, using the unwrapped pieces */
+ ret_value = H5VLgroup_specific(o->under_object, under_vol_id, &vol_cb_args, dxpl_id, req);
+ } /* end if */
+ else
+ ret_value = H5VLgroup_specific(o->under_object, under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2101,8 +2063,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2111,7 +2072,7 @@ H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_
printf("------- PASS THROUGH VOL GROUP Optional\n");
#endif
- ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2154,33 +2115,6 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
} /* end H5VL_pass_through_group_close() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_create_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * link create callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, req);
- ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req,
- arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_link_create_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_link_create
*
* Purpose: Creates a hard / soft / UD / external link.
@@ -2191,9 +2125,8 @@ H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id = -1;
@@ -2208,32 +2141,22 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
under_vol_id = o->under_vol_id;
/* Fix up the link target object for hard link creation */
- if (H5VL_LINK_CREATE_HARD == create_type) {
- void * cur_obj;
- H5VL_loc_params_t *cur_params;
+ if (H5VL_LINK_CREATE_HARD == args->op_type) {
+ void *cur_obj = args->args.hard.curr_obj;
- /* Retrieve the object & loc params for the link target */
- cur_obj = va_arg(arguments, void *);
- cur_params = va_arg(arguments, H5VL_loc_params_t *);
-
- /* If it's a non-NULL pointer, find the 'under object' and re-set the property */
+ /* If cur_obj is a non-NULL pointer, find its 'under object' and update the pointer */
if (cur_obj) {
- /* Check if we still need the "under" VOL ID */
+ /* Check if we still haven't set the "under" VOL ID */
if (under_vol_id < 0)
under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
- /* Set the object for the link target */
- cur_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
+ /* Update the object for the link target */
+ args->args.hard.curr_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
} /* end if */
+ } /* end if */
- /* Re-issue 'link create' call, using the unwrapped pieces */
- ret_value = H5VL_pass_through_link_create_reissue(create_type, (o ? o->under_object : NULL),
- loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id,
- req, cur_obj, cur_params);
- } /* end if */
- else
- ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id,
- lcpl_id, lapl_id, dxpl_id, req, arguments);
+ ret_value = H5VLlink_create(args, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id,
+ lapl_id, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2347,8 +2270,8 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2357,7 +2280,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
printf("------- PASS THROUGH VOL LINK Get\n");
#endif
- ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2378,8 +2301,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
*/
static herr_t
H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2388,8 +2310,7 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL LINK Specific\n");
#endif
- ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2409,8 +2330,8 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2419,7 +2340,7 @@ H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL LINK Optional\n");
#endif
- ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLlink_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2509,8 +2430,8 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2519,8 +2440,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
printf("------- PASS THROUGH VOL OBJECT Get\n");
#endif
- ret_value =
- H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2541,8 +2461,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
*/
static herr_t
H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -2552,12 +2471,12 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2577,8 +2496,8 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2587,7 +2506,7 @@ H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hi
printf("------- PASS THROUGH VOL OBJECT Optional\n");
#endif
- ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLobject_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2597,7 +2516,7 @@ H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hi
} /* end H5VL_pass_through_object_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_introspect_get_conn_clss
+ * Function: H5VL_pass_through_introspect_get_conn_cls
*
* Purpose: Query the connector class.
*
@@ -2627,6 +2546,36 @@ H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, co
} /* end H5VL_pass_through_introspect_get_conn_cls() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_introspect_get_cap_flags
+ *
+ * Purpose: Query the capability flags for this connector and any
+ * underlying connector(s).
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_introspect_get_cap_flags(const void *_info, unsigned *cap_flags)
+{
+ const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INTROSPECT GetCapFlags\n");
+#endif
+
+ /* Invoke the query on the underlying VOL connector */
+ ret_value = H5VLintrospect_get_cap_flags(info->under_vol_info, info->under_vol_id, cap_flags);
+
+ /* Bitwise OR our capability flags in */
+ if (ret_value >= 0)
+ *cap_flags |= H5VL_pass_through_g.cap_flags;
+
+ return ret_value;
+} /* end H5VL_pass_through_introspect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_introspect_opt_query
*
* Purpose: Query if an optional operation is supported by this connector
@@ -2743,31 +2692,6 @@ H5VL_pass_through_request_cancel(void *obj, H5VL_request_status_t *status)
} /* end H5VL_pass_through_request_cancel() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_specific_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * request specific callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
- H5VL_request_specific_t specific_type, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, specific_type);
- ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_request_specific_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_request_specific
*
* Purpose: Specific operation on a request
@@ -2778,139 +2702,16 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, va_list arguments)
+H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_args_t *args)
{
- herr_t ret_value = -1;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value = -1;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Specific\n");
#endif
- if (H5VL_REQUEST_WAITANY == specific_type || H5VL_REQUEST_WAITSOME == specific_type ||
- H5VL_REQUEST_WAITALL == specific_type) {
- va_list tmp_arguments;
- size_t req_count;
-
- /* Sanity check */
- assert(obj == NULL);
-
- /* Get enough info to call the underlying connector */
- va_copy(tmp_arguments, arguments);
- req_count = va_arg(tmp_arguments, size_t);
-
- /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */
- if (req_count > 0) {
- void ** req_array;
- void ** under_req_array;
- uint64_t timeout;
- H5VL_pass_through_t *o;
- size_t u; /* Local index variable */
-
- /* Get the request array */
- req_array = va_arg(tmp_arguments, void **);
-
- /* Get a request to use for determining the underlying VOL connector */
- o = (H5VL_pass_through_t *)req_array[0];
-
- /* Create array of underlying VOL requests */
- under_req_array = (void **)malloc(req_count * sizeof(void **));
- for (u = 0; u < req_count; u++)
- under_req_array[u] = ((H5VL_pass_through_t *)req_array[u])->under_object;
-
- /* Remove the timeout value from the vararg list (it's used in all the calls below) */
- timeout = va_arg(tmp_arguments, uint64_t);
-
- /* Release requests that have completed */
- if (H5VL_REQUEST_WAITANY == specific_type) {
- size_t * idx; /* Pointer to the index of completed request */
- H5VL_request_status_t *status; /* Pointer to the request's status */
-
- /* Retrieve the remaining arguments */
- idx = va_arg(tmp_arguments, size_t *);
- assert(*idx <= req_count);
- status = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITANY 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id,
- specific_type, req_count,
- under_req_array, timeout, idx, status);
-
- /* Release the completed request, if it completed */
- if (ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[*idx];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end if */
- } /* end if */
- else if (H5VL_REQUEST_WAITSOME == specific_type) {
- size_t * outcount; /* # of completed requests */
- unsigned * array_of_indices; /* Array of indices for completed requests */
- H5VL_request_status_t *array_of_statuses; /* Array of statuses for completed requests */
-
- /* Retrieve the remaining arguments */
- outcount = va_arg(tmp_arguments, size_t *);
- assert(*outcount <= req_count);
- array_of_indices = va_arg(tmp_arguments, unsigned *);
- array_of_statuses = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITSOME 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(
- o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
- outcount, array_of_indices, array_of_statuses);
-
- /* If any requests completed, release them */
- if (ret_value >= 0 && *outcount > 0) {
- unsigned *idx_array; /* Array of indices of completed requests */
-
- /* Retrieve the array of completed request indices */
- idx_array = va_arg(tmp_arguments, unsigned *);
-
- /* Release the completed requests */
- for (u = 0; u < *outcount; u++) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[idx_array[u]];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end for */
- } /* end if */
- } /* end else-if */
- else { /* H5VL_REQUEST_WAITALL == specific_type */
- H5VL_request_status_t *array_of_statuses; /* Array of statuses for completed requests */
-
- /* Retrieve the remaining arguments */
- array_of_statuses = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITALL 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(
- o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
- array_of_statuses);
-
- /* Release the completed requests */
- if (ret_value >= 0) {
- for (u = 0; u < req_count; u++) {
- if (array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[u];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end if */
- } /* end for */
- } /* end if */
- } /* end else */
-
- /* Release array of requests for underlying connector */
- free(under_req_array);
- } /* end if */
-
- /* Finish use of copied vararg list */
- va_end(tmp_arguments);
- } /* end if */
- else {
- H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
-
- ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, specific_type, arguments);
- } /* end else */
+ ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, args);
return ret_value;
} /* end H5VL_pass_through_request_specific() */
@@ -2926,7 +2727,7 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type, va_list arguments)
+H5VL_pass_through_request_optional(void *obj, H5VL_optional_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2935,7 +2736,7 @@ H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type,
printf("------- PASS THROUGH VOL REQUEST Optional\n");
#endif
- ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments);
+ ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, args);
return ret_value;
} /* end H5VL_pass_through_request_optional() */
@@ -3027,8 +2828,7 @@ H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t siz
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3037,7 +2837,7 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t s
printf("------- PASS THROUGH VOL BLOB Specific\n");
#endif
- ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, specific_type, arguments);
+ ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, args);
return ret_value;
} /* end H5VL_pass_through_blob_specific() */
@@ -3052,7 +2852,7 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t s
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments)
+H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3061,7 +2861,7 @@ H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t o
printf("------- PASS THROUGH VOL BLOB Optional\n");
#endif
- ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, opt_type, arguments);
+ ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, args);
return ret_value;
} /* end H5VL_pass_through_blob_optional() */
@@ -3168,7 +2968,7 @@ H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *tok
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3177,7 +2977,7 @@ H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va
printf("------- PASS THROUGH VOL generic Optional\n");
#endif
- ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type, dxpl_id, req, arguments);
+ ret_value = H5VLoptional(o->under_object, o->under_vol_id, args, dxpl_id, req);
return ret_value;
} /* end H5VL_pass_through_optional() */
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index 7b8a877..5a4ccc1 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -43,6 +43,7 @@
/******************************/
/* Package Private Prototypes */
/******************************/
+H5_DLL herr_t H5VL__set_def_conn(void);
H5_DLL hid_t H5VL__register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_id);
@@ -56,5 +57,16 @@ H5_DLL hid_t H5VL__peek_connector_id_by_name(const char *name);
H5_DLL hid_t H5VL__peek_connector_id_by_value(H5VL_class_value_t value);
H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info);
H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size);
+H5_DLL void H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default);
+H5_DLL herr_t H5VL__register_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL size_t H5VL__num_opt_operation(void);
+H5_DLL herr_t H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name);
+H5_DLL herr_t H5VL__term_opt_operation(void);
+
+/* Testing functions */
+#ifdef H5VL_TESTING
+H5_DLL herr_t H5VL__reparse_def_vol_conn_variable_test(void);
+#endif /* H5VL_TESTING */
#endif /* H5VLpkg_H */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 34fb13d..f929d03 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -16,6 +16,11 @@
/* Include package's public header */
#include "H5VLpublic.h" /* Generic Functions */
+/* Include connector author public header(s) */
+#include "H5VLconnector.h" /* VOL connector author routines */
+#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
+#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
+
/* Private headers needed by this file */
/**************************/
@@ -61,13 +66,15 @@ typedef enum H5VL_get_connector_kind_t {
/******************************/
/* Utility functions */
-H5_DLL herr_t H5VL_init_phase1(void);
-H5_DLL herr_t H5VL_init_phase2(void);
+H5_DLL herr_t H5VL_init_phase1(void);
+H5_DLL herr_t H5VL_init_phase2(void);
+H5_DLL H5VL_t *H5VL_new_connector(hid_t connector_id);
H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2);
H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value);
H5_DLL int64_t H5VL_conn_inc_rc(H5VL_t *connector);
H5_DLL int64_t H5VL_conn_dec_rc(H5VL_t *connector);
H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
+H5_DLL herr_t H5VL_get_cap_flags(const H5VL_connector_prop_t *prop, unsigned *cap_flags);
/* Functions that deal with VOL connectors */
union H5PL_key_t;
@@ -109,8 +116,9 @@ H5_DLL herr_t H5VL_reset_vol_wrapper(void);
/* Library state functions */
H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
+H5_DLL herr_t H5VL_start_lib_state(void);
H5_DLL herr_t H5VL_restore_lib_state(const void *state);
-H5_DLL herr_t H5VL_reset_lib_state(void);
+H5_DLL herr_t H5VL_finish_lib_state(void);
H5_DLL herr_t H5VL_free_lib_state(void *state);
/* ID registration functions */
@@ -127,12 +135,11 @@ H5_DLL herr_t H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_lo
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_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_t lapl_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);
+ hsize_t n, hbool_t is_collective, hid_t lapl_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);
@@ -156,12 +163,12 @@ H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void
void **req);
H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- ...);
+H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Dataset functions */
@@ -174,12 +181,12 @@ H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
-H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Datatype functions */
@@ -188,12 +195,14 @@ H5_DLL void * H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_
hid_t tapl_id, hid_t dxpl_id, void **req);
H5_DLL void * H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req, H5VL_object_t **vol_obj_ptr);
H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* File functions */
@@ -201,12 +210,12 @@ H5_DLL void * H5VL_file_create(const H5VL_connector_prop_t *connector_prop, cons
hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL void * H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags,
hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- ...);
-H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
@@ -215,18 +224,18 @@ H5_DLL void * H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_par
void **req);
H5_DLL void * H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
-H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
+H5_DLL herr_t H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, ...);
+ hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1,
const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -234,11 +243,11 @@ H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_pa
const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Object functions */
H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params,
@@ -248,15 +257,16 @@ H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_para
const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id,
hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Connector/container introspection functions */
H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags);
H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type,
uint64_t *flags);
@@ -265,8 +275,8 @@ H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
H5VL_request_status_t *status);
H5_DLL herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx);
H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status);
-H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...);
-H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...);
+H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args);
+H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args);
H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
/* Blob functions */
@@ -275,9 +285,8 @@ H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_
H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size,
void *ctx);
H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id,
- H5VL_blob_specific_t specific_type, ...);
-H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type,
- ...);
+ H5VL_blob_specific_args_t *args);
+H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_args_t *args);
/* Token functions */
H5_DLL herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1,
@@ -288,6 +297,7 @@ H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_t
H5O_token_t *token);
/* Generic functions */
-H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
#endif /* H5VLprivate_H */
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index ce50653..78e39e3 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -93,9 +93,9 @@
* connectors. Subsequent values should be obtained from the HDF5
* development team at mailto:help@hdfgroup.org.
*/
-//! [H5VL_class_value_t_snip]
+//! <!-- [H5VL_class_value_t_snip] -->
typedef int H5VL_class_value_t;
-//! [H5VL_class_value_t_snip]
+//! <!-- [H5VL_class_value_t_snip] -->
/**
* \ingroup H5VLDEF
@@ -116,6 +116,9 @@ typedef enum H5VL_subclass_t {
H5VL_SUBCLS_REQUEST, /**< 'Request' subclass */
H5VL_SUBCLS_BLOB, /**< 'Blob' subclass */
H5VL_SUBCLS_TOKEN /**< 'Token' subclass */
+ /* NOTE: if more operations are added, the
+ * H5VL_opt_vals_g[] array size should be updated.
+ */
} H5VL_subclass_t;
/********************/
@@ -153,11 +156,10 @@ extern "C" {
* 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 VOL documentation.
- *
- * \todo Fix the reference to VOL documentation.
+ * \ref_vol_doc.
*
* \since 1.12.0
+ *
*/
H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
/**
@@ -192,11 +194,10 @@ H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vi
* 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 VOL documentation.
- *
- * \todo Fix the reference to VOL documentation.
+ * 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);
/**
@@ -360,9 +361,4 @@ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_t
}
#endif
-/* Semi-public headers mainly for VOL connector authors */
-#include "H5VLconnector.h" /* VOL connector author routines */
-#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
-#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
-
#endif /* H5VLpublic_H */
diff --git a/src/H5VLtest.c b/src/H5VLtest.c
new file mode 100644
index 0000000..1f99ce5
--- /dev/null
+++ b/src/H5VLtest.c
@@ -0,0 +1,96 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5VLtest.c
+ * Jan 3 2021
+ * Quincey Koziol
+ *
+ * Purpose: Virtual Object Layer (VOL) testing routines.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
+#define H5VL_TESTING /* Suppress warning about H5VL testing funcs */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__reparse_def_vol_conn_variable_test
+ *
+ * Purpose: Re-parse the default VOL connector environment variable.
+ *
+ * Since getenv(3) is fairly expensive, we only parse it once,
+ * when the library opens. This test function is used to
+ * re-parse the environment variable after we've changed it
+ * with setenv(3).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Feb 3, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__reparse_def_vol_conn_variable_test(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Re-check for the HDF5_VOL_CONNECTOR environment variable */
+ if (H5VL__set_def_conn() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize default VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__reparse_def_vol_conn_variable_test() */
diff --git a/src/H5VM.c b/src/H5VM.c
index 49cad20..4d65d75 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -43,20 +43,20 @@ static void H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_optimize1
+ * Function: H5VM__stride_optimize1
*
- * Purpose: Given a stride vector which references elements of the
- * specified size, optimize the dimensionality, the stride
- * vector, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given a stride vector which references elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vector, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -66,15 +66,12 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
{
FUNC_ENTER_STATIC_NOERR
- /*
- * This has to be true because if we optimize the dimensionality down to
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) {
*elmt_size *= size[*np - 1];
if (--*np)
@@ -85,20 +82,20 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
}
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_optimize2
+ * Function: H5VM__stride_optimize2
*
- * Purpose: Given two stride vectors which reference elements of the
- * specified size, optimize the dimensionality, the stride
- * vectors, and the element size to minimize the dimensionality
- * and the number of memory accesses.
+ * Purpose: Given two stride vectors which reference elements of the
+ * specified size, optimize the dimensionality, the stride
+ * vectors, and the element size to minimize the dimensionality
+ * and the number of memory accesses.
*
- * All arguments are passed by reference and their values may be
- * modified by this function.
+ * All arguments are passed by reference and their values may be
+ * modified by this function.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -108,16 +105,13 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
{
FUNC_ENTER_STATIC_NOERR
- /*
- * This has to be true because if we optimize the dimensionality down to
+ /* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
HDassert(1 == H5VM_vector_reduce_product(0, NULL));
HDassert(*elmt_size > 0);
- /*
- * Combine adjacent memory accesses
- */
+ /* Combine adjacent memory accesses */
/* Unroll loop for common cases */
switch (*np) {
@@ -206,29 +200,26 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_stride
- *
- * Purpose: Given a description of a hyperslab, this function returns
- * (through STRIDE[]) the byte strides appropriate for accessing
- * all bytes of the hyperslab and the byte offset where the
- * striding will begin. The SIZE can be passed to the various
- * stride functions.
+ * Function: H5VM_hyper_stride
*
- * The dimensionality of the whole array, the hyperslab, and the
- * returned stride array is N. The whole array dimensions are
- * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
- * dimensions SIZE.
+ * Purpose: Given a description of a hyperslab, this function returns
+ * (through STRIDE[]) the byte strides appropriate for accessing
+ * all bytes of the hyperslab and the byte offset where the
+ * striding will begin. The SIZE can be passed to the various
+ * stride functions.
*
- * The stride and starting point returned will cause the
- * hyperslab elements to be referenced in C order.
+ * The dimensionality of the whole array, the hyperslab, and the
+ * returned stride array is N. The whole array dimensions are
+ * TOTAL_SIZE and the hyperslab is at offset OFFSET and has
+ * dimensions SIZE.
*
- * Return: Success: Byte offset from beginning of array to start
- * of striding.
+ * The stride and starting point returned will cause the
+ * hyperslab elements to be referenced in C order.
*
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to start of striding.
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -308,23 +299,22 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_eq
+ * Function: H5VM_hyper_eq
*
- * Purpose: Determines whether two hyperslabs are equal. This function
- * assumes that both hyperslabs are relative to the same array,
- * for if not, they could not possibly be equal.
+ * Purpose: Determines whether two hyperslabs are equal. This function
+ * assumes that both hyperslabs are relative to the same array,
+ * for if not, they could not possibly be equal.
*
- * Return: Success: TRUE if the hyperslabs are equal (that is,
- * both refer to exactly the same elements of an
- * array)
+ * Return: TRUE if the hyperslabs are equal (that is,
+ * both refer to exactly the same elements of an
+ * array)
*
- * FALSE otherwise.
+ * FALSE otherwise
*
- * Failure: TRUE the rank is zero or if both hyperslabs
- * are of zero size.
+ * Never returns FAIL
*
- * Programmer: Robb Matzke
- * Friday, October 17, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 17, 1997
*
*-------------------------------------------------------------------------
*/
@@ -360,19 +350,19 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_hyper_fill
*
- * Purpose: Similar to memset() except it operates on hyperslabs...
+ * Purpose: Similar to memset() except it operates on hyperslabs...
*
- * Fills a hyperslab of array BUF with some value VAL. BUF
- * is treated like a C-order array with N dimensions where the
- * size of each dimension is TOTAL_SIZE[]. The hyperslab which
- * will be filled with VAL begins at byte offset OFFSET[] from
- * the minimum corner of BUF and continues for SIZE[] bytes in
- * each dimension.
+ * Fills a hyperslab of array BUF with some value VAL. BUF
+ * is treated like a C-order array with N dimensions where the
+ * size of each dimension is TOTAL_SIZE[]. The hyperslab which
+ * will be filled with VAL begins at byte offset OFFSET[] from
+ * the minimum corner of BUF and continues for SIZE[] bytes in
+ * each dimension.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -418,31 +408,31 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con
}
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_copy
+ * Function: H5VM_hyper_copy
*
- * Purpose: Copies a hyperslab from the source to the destination.
+ * Purpose: Copies a hyperslab from the source to the destination.
*
- * A hyperslab is a logically contiguous region of
- * multi-dimensional size SIZE of an array whose dimensionality
- * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
- * The minimum corner of the hyperslab begins at a
- * multi-dimensional offset from the minimum corner of the DST
- * (destination) or SRC (source) array. The sizes and offsets
- * are assumed to be in C order, that is, the first size/offset
- * varies the slowest while the last varies the fastest in the
- * mapping from N-dimensional space to linear space. This
- * function assumes that the array elements are single bytes (if
- * your array has multi-byte elements then add an additional
- * dimension whose size is that of your element).
+ * A hyperslab is a logically contiguous region of
+ * multi-dimensional size SIZE of an array whose dimensionality
+ * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE.
+ * The minimum corner of the hyperslab begins at a
+ * multi-dimensional offset from the minimum corner of the DST
+ * (destination) or SRC (source) array. The sizes and offsets
+ * are assumed to be in C order, that is, the first size/offset
+ * varies the slowest while the last varies the fastest in the
+ * mapping from N-dimensional space to linear space. This
+ * function assumes that the array elements are single bytes (if
+ * your array has multi-byte elements then add an additional
+ * dimension whose size is that of your element).
*
- * The SRC and DST array may be the same array, but the results
- * are undefined if the source hyperslab overlaps the
- * destination hyperslab.
+ * The SRC and DST array may be the same array, but the results
+ * are undefined if the source hyperslab overlaps the
+ * destination hyperslab.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -592,13 +582,13 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const
/*-------------------------------------------------------------------------
* Function: H5VM_stride_fill
*
- * Purpose: Fills all bytes of a hyperslab with the same value using
- * memset().
+ * Purpose: Fills all bytes of a hyperslab with the same value using
+ * memset().
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -643,19 +633,19 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -709,19 +699,19 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
/*-------------------------------------------------------------------------
* Function: H5VM_stride_copy_s
*
- * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
- * DST and SRC while copying bytes from SRC to DST. This
- * function minimizes the number of calls to memcpy() by
- * combining various strides, but it will never touch memory
- * outside the hyperslab defined by the strides.
+ * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays
+ * DST and SRC while copying bytes from SRC to DST. This
+ * function minimizes the number of calls to memcpy() by
+ * combining various strides, but it will never touch memory
+ * outside the hyperslab defined by the strides.
*
- * Note: If the src_stride is all zero and elmt_size is one, then it's
- * probably more efficient to use H5VM_stride_fill() instead.
+ * Note: If the src_stride is all zero and elmt_size is one, then it's
+ * probably more efficient to use H5VM_stride_fill() instead.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -775,17 +765,17 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss
#ifdef LATER
/*-------------------------------------------------------------------------
- * Function: H5VM__stride_copy2
+ * Function: H5VM__stride_copy2
*
- * Purpose: Similar to H5VM_stride_copy() except the source and
- * destination each have their own dimensionality and size and
- * we copy exactly NELMTS elements each of size ELMT_SIZE. The
- * size counters wrap if NELMTS is more than a size counter.
+ * Purpose: Similar to H5VM_stride_copy() except the source and
+ * destination each have their own dimensionality and size and
+ * we copy exactly NELMTS elements each of size ELMT_SIZE. The
+ * size counters wrap if NELMTS is more than a size counter.
*
- * Return: None
+ * Return: void
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
@@ -843,16 +833,16 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsiz
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_fill
+ * Function: H5VM_array_fill
*
- * Purpose: Fills all bytes of an array with the same value using
- * memset(). Increases amount copied by power of two until the
- * halfway point is crossed, then copies the rest in one swoop.
+ * Purpose: Fills all bytes of an array with the same value using
+ * memset(). Increases amount copied by power of two until the
+ * halfway point is crossed, then copies the rest in one swoop.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, June 18, 1998
+ * Programmer: Quincey Koziol
+ * Thursday, June 18, 1998
*
*-------------------------------------------------------------------------
*/
@@ -895,25 +885,25 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
} /* H5VM_array_fill() */
/*-------------------------------------------------------------------------
- * Function: H5VM_array_down
+ * Function: H5VM_array_down
*
- * Purpose: Given a set of dimension sizes, calculate the size of each
+ * Purpose: Given a set of dimension sizes, calculate the size of each
* "down" slice. This is the size of the dimensions for all the
* dimensions below the current one, which is used for indexing
* offsets in this dimension.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Monday, April 28, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 28, 2003
*
*-------------------------------------------------------------------------
*/
-herr_t
+void
H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
{
- hsize_t acc; /*accumulator */
- int i; /*counter */
+ hsize_t acc; /* Accumulator */
+ int i; /* Counter */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -921,31 +911,31 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
HDassert(total_size);
HDassert(down);
- /* Build the sizes of each dimension in the array */
- /* (From fastest to slowest) */
+ /* Build the sizes of each dimension in the array
+ * (From fastest to slowest)
+ */
for (i = (int)(n - 1), acc = 1; i >= 0; i--) {
down[i] = acc;
acc *= total_size[i];
- } /* end for */
+ }
- FUNC_LEAVE_NOAPI(SUCCEED)
+ FUNC_LEAVE_NOAPI_VOID
} /* end H5VM_array_down() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset_pre
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array, this
+ * function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -971,18 +961,17 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
/*-------------------------------------------------------------------------
* Function: H5VM_array_offset
*
- * Purpose: Given a coordinate description of a location in an array, this
- * function returns the byte offset of the coordinate.
+ * Purpose: Given a coordinate description of a location in an array,
+ * this function returns the byte offset of the coordinate.
*
- * The dimensionality of the whole array, and the offset is N.
+ * The dimensionality of the whole array, and the offset is N.
* The whole array dimensions are TOTAL_SIZE and the coordinate
* is at offset OFFSET.
*
- * Return: Success: Byte offset from beginning of array to element offset
- * Failure: abort() -- should never fail
+ * Return: Byte offset from beginning of array to element offset
*
* Programmer: Quincey Koziol
- * Tuesday, June 22, 1999
+ * Tuesday, June 22, 1999
*
*-------------------------------------------------------------------------
*/
@@ -992,38 +981,36 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset)
hsize_t acc_arr[H5VM_HYPER_NDIMS]; /* Accumulated size of down dimensions */
hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */
+ FUNC_ENTER_NOAPI_NOERR
HDassert(n <= H5VM_HYPER_NDIMS);
HDassert(total_size);
HDassert(offset);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, acc_arr) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, acc_arr);
/* Set return value */
ret_value = H5VM_array_offset_pre(n, acc_arr, offset);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VM_array_offset() */
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc_pre
*
- * Purpose: Given a linear offset in an array, the dimensions of that
+ * Purpose: Given a linear offset in an array, the dimensions of that
* array and the pre-computed 'down' (accumulator) sizes, this
* function computes the coordinates of that offset in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, July 16, 2009
+ * Programmer: Quincey Koziol
+ * Thursday, July 16, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1050,18 +1037,18 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co
/*-------------------------------------------------------------------------
* Function: H5VM_array_calc
*
- * Purpose: Given a linear offset in an array and the dimensions of that
+ * Purpose: Given a linear offset in an array and the dimensions of that
* array, this function computes the coordinates of that offset
* in the array.
*
- * The dimensionality of the whole array, and the coordinates is N.
+ * The dimensionality of the whole array, and the coordinates is N.
* The array dimensions are TOTAL_SIZE and the coordinates
* are returned in COORD. The linear offset is in OFFSET.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Wednesday, April 16, 2003
+ * Programmer: Quincey Koziol
+ * Wednesday, April 16, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1079,8 +1066,7 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *
HDassert(coords);
/* Build the sizes of each dimension in the array */
- if (H5VM_array_down(n, total_size, idx) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes")
+ H5VM_array_down(n, total_size, idx);
/* Compute the coordinates from the offset */
if (H5VM_array_calc_pre(offset, n, idx, coords) < 0)
@@ -1093,7 +1079,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1123,10 +1109,10 @@ done:
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Quincey Koziol
- * Monday, April 21, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1151,14 +1137,14 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co
} /* end H5VM_chunk_index() */
/*-------------------------------------------------------------------------
- * Function: H5VM_chunk_scaled
+ * Function: H5VM_chunk_scaled
*
- * Purpose: Compute the scaled coordinates for a chunk offset
+ * Purpose: Compute the scaled coordinates for a chunk offset
*
- * Return: <none>
+ * Return: void
*
- * Programmer: Quincey Koziol
- * Wednesday, November 19, 2014
+ * Programmer: Quincey Koziol
+ * Wednesday, November 19, 2014
*
*-------------------------------------------------------------------------
*/
@@ -1186,7 +1172,7 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index_scaled
*
- * Purpose: Given a coordinate offset (COORD), the size of each chunk
+ * Purpose: Given a coordinate offset (COORD), the size of each chunk
* (CHUNK), the number of chunks in each dimension (NCHUNKS)
* and the number of dimensions of all of these (NDIMS), calculate
* a "chunk index" for the chunk that the coordinate offset is
@@ -1216,13 +1202,13 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h
* The chunk index is placed in the CHUNK_IDX location for return
* from this function
*
- * Note: This routine is identical to H5VM_chunk_index(), except for
- * caching the scaled information. Make changes in both places.
+ * Note: This routine is identical to H5VM_chunk_index(), except for
+ * caching the scaled information. Make changes in both places.
*
- * Return: Chunk index on success (can't fail)
+ * Return: Chunk index on success (can't fail)
*
- * Programmer: Vailin Choi
- * Monday, February 9, 2015
+ * Programmer: Vailin Choi
+ * Monday, February 9, 2015
*
*-------------------------------------------------------------------------
*/
@@ -1257,22 +1243,22 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch
/*-------------------------------------------------------------------------
* Function: H5VM_opvv
*
- * Purpose: Perform an operation on a source & destination sequences
- * of offset/length pairs. Each set of sequnces has an array
- * of lengths, an array of offsets, the maximum number of
- * sequences and the current sequence to start at in the sequence.
+ * Purpose: Perform an operation on a source & destination sequences
+ * of offset/length pairs. Each set of sequnces has an array
+ * of lengths, an array of offsets, the maximum number of
+ * sequences and the current sequence to start at in the sequence.
*
* There may be different numbers of bytes in the source and
* destination sequences, the operation stops when either the
* source or destination sequence runs out of information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_memcpyvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_memcpyvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes operated on, on success/Negative on failure
+ * Return: Non-negative # of bytes operated on, on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, September 30, 2010
+ * Programmer: Quincey Koziol
+ * Thursday, September 30, 2010
*
*-------------------------------------------------------------------------
*/
@@ -1460,7 +1446,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5VM_memcpyvv
*
- * Purpose: Given source and destination buffers in memory (SRC & DST)
+ * Purpose: Given source and destination buffers in memory (SRC & DST)
* copy sequences of from the source buffer into the destination
* buffer. Each set of sequences has an array of lengths, an
* array of offsets, the maximum number of sequences and the
@@ -1470,13 +1456,13 @@ done:
* destination sequences, data copying stops when either the
* source or destination buffer runs out of sequence information.
*
- * Note: The algorithm in this routine is [basically] the same as for
- * H5VM_opvv(). Changes should be made to both!
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5VM_opvv(). Changes should be made to both!
*
- * Return: Non-negative # of bytes copied on success/Negative on failure
+ * Return: Non-negative # of bytes copied on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Friday, May 2, 2003
+ * Programmer: Quincey Koziol
+ * Friday, May 2, 2003
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index e24ce83..0d3bd0f 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -105,7 +105,7 @@ H5_DLL herr_t H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_
const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride,
const void *_src);
H5_DLL herr_t H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count);
-H5_DLL herr_t H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
+H5_DLL void H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down);
H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset);
H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset);
H5_DLL herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords);
@@ -143,7 +143,7 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE hsize_t H5_ATTR_UNUSED
+static inline hsize_t H5_ATTR_UNUSED
H5VM_vector_reduce_product(unsigned n, const hsize_t *v)
{
hsize_t ret_value = 1;
@@ -179,7 +179,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_u(int n, const hsize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -216,7 +216,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_s(int n, const hssize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -255,7 +255,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -303,7 +303,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -346,7 +346,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void H5_ATTR_UNUSED
+static inline void H5_ATTR_UNUSED
H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
{
while (n--)
@@ -390,7 +390,7 @@ static const unsigned char LogTable256[] = {
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_log2_gen(uint64_t n)
{
unsigned r; /* r will be log2(n) */
@@ -439,7 +439,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_PURE unsigned
+static inline H5_ATTR_PURE unsigned
H5VM_log2_of2(uint32_t n)
{
#ifndef NDEBUG
@@ -463,7 +463,7 @@ H5VM_log2_of2(uint32_t n)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_CONST hsize_t
+static inline H5_ATTR_CONST hsize_t
H5VM_power2up(hsize_t n)
{
hsize_t ret_value = 1; /* Return value */
@@ -495,7 +495,7 @@ H5VM_power2up(hsize_t n)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_limit_enc_size(uint64_t limit)
{
return (H5VM_log2_gen(limit) / 8) + 1;
@@ -527,7 +527,7 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE hbool_t H5_ATTR_UNUSED
+static inline hbool_t H5_ATTR_UNUSED
H5VM_bit_get(const unsigned char *buf, size_t offset)
{
/* Test the appropriate bit in the buffer */
@@ -557,7 +557,7 @@ H5VM_bit_get(const unsigned char *buf, size_t offset)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void H5_ATTR_UNUSED
+static inline void H5_ATTR_UNUSED
H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val)
{
/* Set/reset the appropriate bit in the buffer */
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index d8fed41..d29d8e5 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -48,7 +48,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z__filter_deflate, /* The actual filter function */
}};
-#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12)
+#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12)
/*-------------------------------------------------------------------------
* Function: H5Z__filter_deflate
diff --git a/src/H5Zdevelop.h b/src/H5Zdevelop.h
new file mode 100644
index 0000000..328e221
--- /dev/null
+++ b/src/H5Zdevelop.h
@@ -0,0 +1,421 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5Z (data filter) developer
+ * support routines.
+ */
+
+#ifndef _H5Zdevelop_H
+#define _H5Zdevelop_H
+
+/* Include package's public header */
+#include "H5Zpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/**
+ * Current version of the H5Z_class_t struct
+ */
+#define H5Z_CLASS_T_VERS (1)
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/**
+ * Structure for filter callback property
+ */
+typedef struct H5Z_cb_t {
+ H5Z_filter_func_t func;
+ void * op_data;
+} H5Z_cb_t;
+
+/**
+ * \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
+ *
+ * \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 \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 \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);
+//! <!-- [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
+ *
+ * \return \herr_t
+ *
+ * \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 \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] -->
+
+/**
+ * \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.
+ *
+ * \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 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 */
+} H5Z_class2_t;
+//! <!-- [H5Z_class2_t_snip] -->
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \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);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#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_class1_t;
+//! <!-- [H5Z_class1_t_snip] -->
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+#endif /* _H5Zdevelop_H */
diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h
index 25007b3..9312b72 100644
--- a/src/H5Zmodule.h
+++ b/src/H5Zmodule.h
@@ -29,59 +29,80 @@
#define H5_MY_PKG_ERR H5E_PLINE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5Z H5Z
+/**\defgroup H5Z H5Z
*
+ * Use the functions in this module to manage HDF5 filters.
*
- * \brief Filter and Compression Interface
+ * User-defined filters are created by registering a filter descriptor of
+ * type #H5Z_class_t with the library.
*
- * \details The functions in this module let you configure filters that process
- * data during I/O operation.
+ * Available filters can be read or examined at runtime.
*
- * HDF5 supports a filter pipeline that provides the capability for
- * standard and customized raw data processing during I/O operations.
- * HDF5 is distributed with a small set of standard filters such as
- * compression (gzip, SZIP, and a shuffling algorithm) and error
- * checking (Fletcher32 checksum). For further flexibility, the
- * library allows a user application to extend the pipeline through
- * the creation and registration of customized filters.
+ * It is conceivable that filters are stateful and that that state be
+ * updated at runtime.
*
- * The flexibility of the filter pipeline implementation enables the
- * definition of additional filters by a user application. A filter
- * \li is associated with a dataset when the dataset is created,
- * \li can be used only with chunked data (i.e., datasets stored in
- * the #H5D_CHUNKED storage layout), and
- * \li is applied independently to each chunk of the dataset.
+ * Filters are deleted by unregistering.
*
- * The HDF5 library does not support filters for contiguous datasets
- * because of the difficulty of implementing random access for partial
- * I/O. Compact dataset filters are not supported because it would not
- * produce significant results.
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5Z_examples.c filter
+ * \snippet{lineno} H5Z_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5Z_examples.c read
+ * </td>
+ * </tr>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5Z_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5Z_examples.c delete
+ * </tr>
+ * </table>
*
- * Filter identifiers for the filters distributed with the HDF5
- * Library are as follows:
- * <table>
- * <tr><td>#H5Z_FILTER_DEFLATE</td><td>The gzip compression, or
- * deflation, filter</td></tr>
- * <tr><td>#H5Z_FILTER_SZIP</td><td>The SZIP compression
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_NBIT</td><td>The N-bit compression
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_SCALEOFFSET</td><td>The scale-offset
- * compression filter</td></tr>
- * <tr><td>#H5Z_FILTER_SHUFFLE</td><td>The shuffle algorithm
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_FLETCHER32</td><td>The Fletcher32 checksum,
- * or error checking, filter</td></tr>
- * </table>
- * Custom filters that have been registered with the library will have
- * additional unique identifiers.
+ * HDF5 supports a filter pipeline that provides the capability for standard and
+ * customized raw data processing during I/O operations. HDF5 is distributed
+ * with a small set of standard filters such as compression (gzip, SZIP, and a
+ * shuffling algorithm) and error checking (Fletcher32 checksum). For further
+ * flexibility, the library allows a user application to extend the pipeline
+ * through the creation and registration of customized filters.
*
- * 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.
+ * The flexibility of the filter pipeline implementation enables the definition
+ * of additional filters by a user application. A filter
+ * \li is associated with a dataset when the dataset is created,
+ * \li can be used only with chunked data (i.e., datasets stored in the
+ * #H5D_CHUNKED storage layout), and
+ * \li is applied independently to each chunk of the dataset.
*
- * \todo Fix the reference.
+ * The HDF5 library does not support filters for contiguous datasets because of
+ * the difficulty of implementing random access for partial I/O. Compact dataset
+ * filters are not supported because it would not produce significant results.
+ *
+ * Filter identifiers for the filters distributed with the HDF5
+ * Library are as follows:
+ * <table>
+ * <tr><td>#H5Z_FILTER_DEFLATE</td><td>The gzip compression, or
+ * deflation, filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SZIP</td><td>The SZIP compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_NBIT</td><td>The N-bit compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SCALEOFFSET</td><td>The scale-offset
+ * compression filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SHUFFLE</td><td>The shuffle algorithm
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_FLETCHER32</td><td>The Fletcher32 checksum,
+ * or error checking, filter</td></tr>
+ * </table>
+ * Custom filters that have been registered with the library will have
+ * additional unique identifiers.
+ *
+ * See \ref_dld_filters for more information on how an HDF5 application can
+ * apply a filter that is not registered with the HDF5 library.
*
* \defgroup H5ZPRE Predefined Filters
* \ingroup H5Z
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 2b6f277..b696085 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -52,17 +52,19 @@ static herr_t H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index,
static herr_t H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[],
hbool_t *need_not_compress);
-static void H5Z__nbit_next_byte(size_t *j, size_t *buf_len);
-static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
+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_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 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,8 +73,8 @@ 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_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);
@@ -1026,7 +1028,7 @@ 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,
+ 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 */
@@ -1075,8 +1077,8 @@ H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned
}
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 */
@@ -1341,7 +1343,7 @@ done:
}
static void
-H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
+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)
{
@@ -1383,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 */
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 51690b4..13eb26f 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -21,8 +21,9 @@
/* Early typedefs to avoid circular dependencies */
typedef struct H5Z_filter_info_t H5Z_filter_info_t;
-/* Include package's public header */
+/* Include package's public headers */
#include "H5Zpublic.h"
+#include "H5Zdevelop.h"
/* Private headers needed by this file */
#include "H5Tprivate.h" /* Datatypes */
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 4c9b006..5d04c9a 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -207,11 +207,6 @@ typedef enum H5Z_SO_scale_type_t {
} H5Z_SO_scale_type_t;
/**
- * Current version of the H5Z_class_t struct
- */
-#define H5Z_CLASS_T_VERS (1)
-
-/**
* \ingroup FLETCHER32
* Values to decide if EDC is enabled for reading data
*/
@@ -230,330 +225,24 @@ typedef enum H5Z_EDC_t {
* 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;
+//! <!-- [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);
-
-/**
- * Structure for filter callback property
- */
-typedef struct H5Z_cb_t {
- H5Z_filter_func_t func;
- void * op_data;
-} H5Z_cb_t;
+//! <!-- [H5Z_filter_func_t_snip] -->
#ifdef __cplusplus
extern "C" {
#endif
/**
- * \details Before a dataset gets created, the \c 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).
- *
- * The \c 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.
- *
- * The \c 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 \c can_apply 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);
-//! [H5Z_can_apply_func_t_snip]
-/**
- * \details After the "can_apply" callbacks are checked for new datasets, the
- * \c 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).
- *
- * The \c 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.
- *
- * The \c 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.
- *
- * The \c set_local 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]
-/**
- * \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 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 */
-} 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
@@ -625,29 +314,8 @@ H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id);
*/
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.
- *
- * Use of these symbols is deprecated.
- */
-#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_class1_t;
-//! [H5Z_class1_t_snip]
-
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* _H5Zpublic_H */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 3f26623..a8a63bf 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -73,9 +73,9 @@ static herr_t H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts,
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 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(unsigned char *data, size_t data_offset, unsigned k,
+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,
@@ -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 */ \
@@ -209,11 +209,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
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 */ \
@@ -224,11 +224,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
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 */ \
@@ -252,7 +252,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
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]; \
@@ -425,22 +425,22 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \
{ \
if (sizeof(type) == sizeof(int)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(int) * 8 - 1))) { \
+ if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
+ pow_fun(2.0F, (type)(sizeof(int) * 8 - 1))) { \
*minbits = sizeof(int) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
+ pow_fun(2.0F, (type)(sizeof(long) * 8 - 1))) { \
*minbits = sizeof(long) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long long)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(long long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
+ pow_fun(2.0F, (type)(sizeof(long long) * 8 - 1))) { \
*minbits = sizeof(long long) * 8; \
goto done; \
} \
@@ -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; \
\
@@ -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; \
@@ -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, \
@@ -530,27 +530,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
*(int *)((void *)&buf[i]) = (int)(((unsigned int)1 << *minbits) - 1); \
else \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
+ min * pow_fun(10.0F, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
*(long *)((void *)&buf[i]) = (long)(((unsigned long)1 << *minbits) - 1); \
else \
- *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
+ min * pow_fun(10.0F, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
*(long long *)((void *)&buf[i]) = (long long)(((unsigned long long)1 << *minbits) - 1); \
else \
- *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
+ min * pow_fun(10.0F, (type)D_val)); \
} \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
@@ -561,16 +561,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
+ min * pow_fun(10.0F, (type)D_val)); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
*(long *)((void *)&buf[i]) = \
- lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \
+ lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
*(long long *)((void *)&buf[i]) = \
- llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \
+ llround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -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; \
@@ -606,8 +606,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \
H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)) + \
+ (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); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -617,8 +617,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
else { /* fill value undefined */ \
H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)) + \
+ (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); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -626,11 +626,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
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) \
@@ -685,19 +685,19 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
buf[i] = \
(type)((*(int *)((void *)&buf[i]) == (int)(((unsigned int)1 << minbits) - 1)) \
? filval \
- : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = \
(type)((*(long *)((void *)&buf[i]) == (long)(((unsigned long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = (type)( \
(*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -707,13 +707,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -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,7 +734,7 @@ 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
@@ -884,35 +884,32 @@ H5Z__scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum
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)
+ 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() */
/*-------------------------------------------------------------------------
@@ -1119,7 +1116,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
unsigned filavail; /* flag indicating if fill value is defined or not */
H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE; /* scale type */
int scale_factor = 0; /* scale factor */
- double D_val = 0.0f; /* decimal scale factor */
+ double D_val = 0.0; /* decimal scale factor */
uint32_t minbits = 0; /* minimum number of bits to store values */
unsigned long long minval = 0; /* minimum value of input buffer */
enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */
@@ -1443,76 +1440,75 @@ H5Z__scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffs
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 */
@@ -1524,39 +1520,38 @@ H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleo
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
@@ -1572,11 +1567,13 @@ H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoff
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
@@ -1593,11 +1590,13 @@ H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scale
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
@@ -1609,8 +1608,8 @@ 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)
+ 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 */
@@ -1695,9 +1694,9 @@ H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned cha
}
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 */
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index ef7d801..ab7e9be 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -90,8 +90,7 @@ 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 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,
@@ -1548,11 +1547,11 @@ H5Z_xform_create(const char *expr)
(HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
(HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
continue;
- }
+ } /* end if */
count++;
- }
- }
+ } /* end if */
+ } /* end for */
/* 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
@@ -1750,11 +1749,19 @@ done:
hbool_t
H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- ret_value = (data_xform_prop ? FALSE : TRUE);
+ if (data_xform_prop) {
+ ret_value = FALSE;
+
+ /* Check for trivial data tranformation: expression = "x" */
+ if ((HDstrlen(data_xform_prop->xform_exp) == 1) && data_xform_prop->dat_val_pointers &&
+ (data_xform_prop->dat_val_pointers->num_ptrs == 1)) {
+ ret_value = TRUE;
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5Z_xform_noop() */
diff --git a/src/H5detect.c b/src/H5detect.c
index 84b34e6..e8cded7 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -52,7 +52,7 @@ static const char *FileHeader = "\n\
/* Disable warning about cast increasing the alignment of the target type,
* that's _exactly_ what this code is probing. -QAK
*/
-H5_GCC_DIAG_OFF("cast-align")
+H5_GCC_CLANG_DIAG_OFF("cast-align")
#if defined(__has_attribute)
#if __has_attribute(no_sanitize_address)
@@ -80,7 +80,7 @@ H5_GCC_DIAG_OFF("cast-align")
#define H5SETJMP(buf) HDsigsetjmp(buf, 1)
#define H5LONGJMP(buf, val) HDsiglongjmp(buf, val)
#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */
-#elif defined(H5_HAVE_LONGJMP)
+#else
#define H5JMP_BUF jmp_buf
#define H5SETJMP(buf) HDsetjmp(buf)
#define H5LONGJMP(buf, val) HDlongjmp(buf, val)
@@ -149,12 +149,8 @@ static int sigbus_handler_called_g = 0; /* how many times called */
static int sigsegv_handler_called_g = 0; /* how many times called */
static int sigill_handler_called_g = 0; /* how many times called */
static int signal_handler_tested_g = 0; /* how many times tested */
-#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
-static int verify_signal_handlers(int signum, void (*handler)(int));
-#endif
-#ifdef H5JMP_BUF
-static H5JMP_BUF jbuf_g;
-#endif
+static int verify_signal_handlers(int signum, void (*handler)(int));
+static H5JMP_BUF jbuf_g;
/*-------------------------------------------------------------------------
* Function: precision
@@ -304,10 +300,10 @@ precision(detected_t *d)
for (_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char)(_byte_mask << 1)) { \
_buf1[_i] ^= _byte_mask; \
HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \
- H5_GCC_DIAG_OFF("float-equal") \
+ H5_GCC_CLANG_DIAG_OFF("float-equal") \
if (_v1 != _v2) \
_pad_mask[_i] |= _byte_mask; \
- H5_GCC_DIAG_ON("float-equal") \
+ H5_GCC_CLANG_DIAG_ON("float-equal") \
_buf1[_i] ^= _byte_mask; \
} /* end for */ \
\
@@ -388,7 +384,6 @@ precision(detected_t *d)
COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \
}
-#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
#define ALIGNMENT(TYPE, INFO) \
{ \
char *volatile _buf = NULL; \
@@ -419,10 +414,10 @@ precision(detected_t *d)
HDmemcpy(_buf + align_g[_ano] + (INFO.offset / 8), ((char *)&_val) + (INFO.offset / 8), \
(size_t)(INFO.precision / 8)); \
_val2 = *((TYPE *)(_buf + align_g[_ano])); \
- H5_GCC_DIAG_OFF("float-equal") \
+ H5_GCC_CLANG_DIAG_OFF("float-equal") \
if (_val != _val2) \
H5LONGJMP(jbuf_g, 1); \
- H5_GCC_DIAG_ON("float-equal") \
+ H5_GCC_CLANG_DIAG_ON("float-equal") \
/* End Cray Check */ \
(INFO.align) = align_g[_ano]; \
} \
@@ -435,15 +430,6 @@ precision(detected_t *d)
HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \
HDsignal(SIGILL, _handler3); /*restore original handler*/ \
}
-#else
-#define ALIGNMENT(TYPE, INFO) \
- { \
- align_status_g |= STA_NoALIGNMENT; \
- (INFO.align) = 0; \
- }
-#endif
-
-#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
/*-------------------------------------------------------------------------
* Function: sigsegv_handler
@@ -473,9 +459,6 @@ sigsegv_handler(int H5_ATTR_UNUSED signo)
HDsignal(SIGSEGV, sigsegv_handler);
H5LONGJMP(jbuf_g, SIGSEGV);
}
-#endif
-
-#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
/*-------------------------------------------------------------------------
* Function: sigbus_handler
@@ -505,9 +488,6 @@ sigbus_handler(int H5_ATTR_UNUSED signo)
HDsignal(SIGBUS, sigbus_handler);
H5LONGJMP(jbuf_g, SIGBUS);
}
-#endif
-
-#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL)
/*-------------------------------------------------------------------------
* Function: sigill_handler
@@ -537,7 +517,6 @@ sigill_handler(int H5_ATTR_UNUSED signo)
HDsignal(SIGILL, sigill_handler);
H5LONGJMP(jbuf_g, SIGILL);
}
-#endif
/*-------------------------------------------------------------------------
* Function: print_results
@@ -777,21 +756,6 @@ done:\n\
fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n");
/* The following is available in H5pubconf.h. Printing them here for */
/* convenience. */
-#ifdef H5_HAVE_SIGNAL
- fprintf(rawoutstream, "/* Signal() support: yes */\n");
-#else
- fprintf(rawoutstream, "/* Signal() support: no */\n");
-#endif
-#ifdef H5_HAVE_SETJMP
- fprintf(rawoutstream, "/* setjmp() support: yes */\n");
-#else
- fprintf(rawoutstream, "/* setjmp() support: no */\n");
-#endif
-#ifdef H5_HAVE_LONGJMP
- fprintf(rawoutstream, "/* longjmp() support: yes */\n");
-#else
- fprintf(rawoutstream, "/* longjmp() support: no */\n");
-#endif
#ifdef H5_HAVE_SIGSETJMP
fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n");
#else
@@ -1314,60 +1278,18 @@ detect_C89_floats(void)
static void HDF_NO_UBSAN
detect_C99_integers8(void)
{
-#if H5_SIZEOF_INT8_T > 0
-#if H5_SIZEOF_INT8_T == 1
DETECT_BYTE(int8_t, INT8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(int8_t, INT8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
-#if H5_SIZEOF_UINT8_T > 0
-#if H5_SIZEOF_UINT8_T == 1
DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(uint8_t, UINT8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
-#if H5_SIZEOF_INT_LEAST8_T > 0
-#if H5_SIZEOF_INT_LEAST8_T == 1
DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
-#if H5_SIZEOF_UINT_LEAST8_T > 0
-#if H5_SIZEOF_UINT_LEAST8_T == 1
DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
-#if H5_SIZEOF_INT_FAST8_T > 0
-#if H5_SIZEOF_INT_FAST8_T == 1
DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
-#if H5_SIZEOF_UINT_FAST8_T > 0
-#if H5_SIZEOF_UINT_FAST8_T == 1
DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]);
nd_g++;
-#else
- DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]);
- nd_g++;
-#endif
-#endif
}
/*-------------------------------------------------------------------------
@@ -1381,30 +1303,18 @@ detect_C99_integers8(void)
static void HDF_NO_UBSAN
detect_C99_integers16(void)
{
-#if H5_SIZEOF_INT16_T > 0
DETECT_I(int16_t, INT16, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT16_T > 0
DETECT_I(uint16_t, UINT16, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_LEAST16_T > 0
DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_LEAST16_T > 0
DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_FAST16_T > 0
DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_FAST16_T > 0
DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]);
nd_g++;
-#endif
}
/*-------------------------------------------------------------------------
@@ -1418,30 +1328,18 @@ detect_C99_integers16(void)
static void HDF_NO_UBSAN
detect_C99_integers32(void)
{
-#if H5_SIZEOF_INT32_T > 0
DETECT_I(int32_t, INT32, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT32_T > 0
DETECT_I(uint32_t, UINT32, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_LEAST32_T > 0
DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_LEAST32_T > 0
DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_FAST32_T > 0
DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_FAST32_T > 0
DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]);
nd_g++;
-#endif
}
/*-------------------------------------------------------------------------
@@ -1456,47 +1354,23 @@ detect_C99_integers32(void)
static void HDF_NO_UBSAN
detect_C99_integers64(void)
{
-#if H5_SIZEOF_INT64_T > 0
DETECT_I(int64_t, INT64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT64_T > 0
DETECT_I(uint64_t, UINT64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_LEAST64_T > 0
DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_LEAST64_T > 0
DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_INT_FAST64_T > 0
DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_UINT_FAST64_T > 0
DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]);
nd_g++;
-#endif
-#if H5_SIZEOF_LONG_LONG > 0
DETECT_I(long long, LLONG, d_g[nd_g]);
nd_g++;
DETECT_I(unsigned long long, ULLONG, d_g[nd_g]);
nd_g++;
-#else
- /*
- * This architecture doesn't support an integer type larger than `long'
- * so we'll just make H5T_NATIVE_LLONG the same as H5T_NATIVE_LONG since
- * `long long' is probably equivalent to `long' here anyway.
- */
- DETECT_I(long, LLONG, d_g[nd_g]);
- nd_g++;
- DETECT_I(unsigned long, ULLONG, d_g[nd_g]);
- nd_g++;
-#endif
}
/*-------------------------------------------------------------------------
@@ -1568,7 +1442,6 @@ detect_alignments(void)
na_g++;
}
-#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
/* Verify the signal handler for signal signum works correctly multiple times.
* One possible cause of failure is that the signal handling is blocked or
* changed to SIG_DFL after H5LONGJMP.
@@ -1625,7 +1498,6 @@ verify_signal_handlers(int signum, void (*handler)(int))
return 0;
}
}
-#endif
/*-------------------------------------------------------------------------
* Function: main
@@ -1655,22 +1527,6 @@ main(int argc, char *argv[])
if (!rawoutstream)
rawoutstream = stdout;
-#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS)
-#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS)
- /*
- * Make sure unaligned access generates SIGBUS and doesn't print warning
- * messages so that we can detect alignment constraints on the DEC Alpha.
- */
- int nvpairs[2];
- nvpairs[0] = SSIN_UACPROC;
- nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS;
- if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0) < 0) {
- fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno));
- }
-#endif
-#endif
-
-#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL)
/* verify the SIGBUS and SIGSEGV handlers work properly */
if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) {
fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS);
@@ -1681,9 +1537,6 @@ main(int argc, char *argv[])
if (verify_signal_handlers(SIGILL, sigill_handler) != 0) {
fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL);
}
-#else
- align_status_g |= STA_NoHandlerVerify;
-#endif
print_header();
@@ -1714,4 +1567,4 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
-H5_GCC_DIAG_ON("cast-align")
+H5_GCC_CLANG_DIAG_ON("cast-align")
diff --git a/src/H5err.txt b/src/H5err.txt
index 64452ec..d2f1093 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -105,7 +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, ASYNC, Asynchronous operation errors
SECTION, NONE, No error
# Minor errors
@@ -139,6 +139,7 @@ MINOR, FILEACC, H5E_NOTHDF5, Not an HDF5 file
MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed
MINOR, FILEACC, H5E_TRUNCATED, File has been truncated
MINOR, FILEACC, H5E_MOUNT, File mount error
+MINOR, FILEACC, H5E_UNMOUNT, File unmount error
MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file
MINOR, FILEACC, H5E_CANTLOCKFILE, Unable to lock file
MINOR, FILEACC, H5E_CANTUNLOCKFILE, Unable to unlock file
@@ -290,6 +291,7 @@ MINOR, MAP, H5E_CANTPUT, Can't put value
# Asynchronous operation errors
MINOR, ASYNC, H5E_CANTWAIT, Can't wait on operation
+MINOR, ASYNC, H5E_CANTCANCEL, Can't cancel operation
# No error, for backward compatibility */
MINOR, NONE, H5E_NONE_MINOR, No error
diff --git a/src/H5module.h b/src/H5module.h
index 64081bf..6d3cba8 100644
--- a/src/H5module.h
+++ b/src/H5module.h
@@ -27,8 +27,31 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5 H5
- * \brief General Library Functions
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage the life cycle of HDF5 library
+ * instances.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5_examples.c closing_shop
+ * \snippet{lineno} H5_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5module_H */
diff --git a/src/H5mpi.c b/src/H5mpi.c
index 9749721..4a8aa44 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -523,7 +523,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
}
- /* Set up the arguments for MPI_Type_struct constructor */
+ /* Set up the arguments for MPI_Type_create_struct() */
type[0] = outer_type;
type[1] = leftover_type;
block_len[0] = 1;
diff --git a/src/H5private.h b/src/H5private.h
index 46e669f..d1275dc 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -26,96 +26,46 @@
#include "H5public.h" /* Include Public Definitions */
-/* include the pthread header */
-#ifdef H5_HAVE_THREADSAFE
-#ifdef H5_HAVE_WIN32_API
-#ifndef H5_HAVE_WIN_THREADS
-#ifdef H5_HAVE_PTHREAD_H
-#include <pthread.h>
-#endif /* H5_HAVE_PTHREAD_H */
-#endif /* H5_HAVE_WIN_THREADS */
-#else /* H5_HAVE_WIN32_API */
-#ifdef H5_HAVE_PTHREAD_H
-#include <pthread.h>
-#endif /* H5_HAVE_PTHREAD_H */
-#endif /* H5_HAVE_WIN32_API */
-#endif /* H5_HAVE_THREADSAFE */
-
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
-#include <limits.h>
#include <math.h>
+#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
+#include <time.h>
-/*
- * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1
- * compliant. Otherwise all bets are off.
- */
+/* POSIX headers */
+#ifdef H5_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#ifdef H5_HAVE_UNISTD_H
-#include <sys/types.h>
-#include <unistd.h>
+#ifdef H5_HAVE_PWD_H
+#include <pwd.h>
#endif
-#ifdef _POSIX_VERSION
+#include <unistd.h>
#include <sys/wait.h>
-#include <pwd.h>
#endif
-/*
- * C9x integer types
- */
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
-#include <stdint.h>
-#endif
+/* Include the Pthreads header, if necessary */
+#if defined(H5_HAVE_THREADSAFE) && defined(H5_HAVE_PTHREAD_H)
+#include <pthread.h>
#endif
/*
- * The `struct stat' data type for stat() and fstat(). This is a Posix file
- * but often apears on non-Posix systems also. The `struct stat' is required
- * for hdf5 to compile, although only a few fields are actually used.
+ * The `struct stat' data type for stat() and fstat(). This is a POSIX file
+ * but often apears on non-POSIX systems also. The `struct stat' is required
+ * for HDF5 to compile, although only a few fields are actually used.
*/
#ifdef H5_HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/*
- * If a program may include both `time.h' and `sys/time.h' then
- * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac).
- * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not
- * protected against multiple inclusion, so programs should not explicitly
- * include both files. This macro is useful in programs that use, for example,
- * `struct timeval' or `struct timezone' as well as `struct tm'. It is best
- * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked
- * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac.
- */
-#if defined(H5_TIME_WITH_SYS_TIME)
-#include <sys/time.h>
-#include <time.h>
-#elif defined(H5_HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-
-/*
- * Longjumps are used to detect alignment constrants
- */
-#ifdef H5_HAVE_SETJMP_H
-#include <setjmp.h>
-#endif
-
-/*
* flock() in sys/file.h is used for the implementation of file locking.
*/
#if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H)
@@ -139,21 +89,6 @@
#endif
/*
- * System information. These are needed on the DEC Alpha to turn off fixing
- * of unaligned accesses by the operating system during detection of
- * alignment constraints in H5detect.c:main().
- */
-#ifdef H5_HAVE_SYS_SYSINFO_H
-#include <sys/sysinfo.h>
-#endif
-#ifdef H5_HAVE_SYS_PROC_H
-#include <sys/proc.h>
-#endif
-#ifdef H5_HAVE_IO_H
-#include <io.h>
-#endif
-
-/*
* Dynamic library handling. These are needed for dynamically loading I/O
* filters and VFDs.
*/
@@ -173,40 +108,23 @@
#define H5_DEFAULT_VOL H5VL_NATIVE
#ifdef H5_HAVE_WIN32_API
+
/* The following two defines must be before any windows headers are included */
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#define NOGDI /* Exclude Graphic Display Interface macros */
-#ifdef H5_HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
+#include <windows.h>
+
+#include <direct.h> /* For _getcwd() */
+#include <io.h> /* POSIX I/O */
+#include <winsock2.h> /* For GetUserName() */
#ifdef H5_HAVE_THREADSAFE
#include <process.h> /* For _beginthread() */
#endif
-#include <windows.h>
-#include <direct.h> /* For _getcwd() */
-
#endif /*H5_HAVE_WIN32_API*/
-/* Various ways that inline functions can be declared */
-#if defined(H5_HAVE___INLINE__)
-/* GNU (alternative form) */
-#define H5_INLINE __inline__
-#elif defined(H5_HAVE___INLINE)
-/* Visual Studio */
-#define H5_INLINE __inline
-#elif defined(H5_HAVE_INLINE)
-/* GNU, C++
- * Use "inline" as a last resort on the off-chance that there will
- * be C++ problems.
- */
-#define H5_INLINE inline
-#else
-#define H5_INLINE
-#endif /* inline choices */
-
#ifndef F_OK
#define F_OK 00
#define W_OK 02
@@ -233,8 +151,8 @@
#define eventa(func_name) h5_mpe_eventa
#define eventb(func_name) h5_mpe_eventb
#define MPE_LOG_VARS \
- static int eventa(FUNC) = -1; \
- static int eventb(FUNC) = -1; \
+ static int eventa(__func__) = -1; \
+ static int eventb(__func__) = -1; \
char p_event_start[128];
/* Hardwire the color to "red", since that's what all the routines are using
@@ -246,14 +164,14 @@
*/
#define BEGIN_MPE_LOG \
if (H5_MPEinit_g) { \
- sprintf(p_event_start, "start %s", FUNC); \
- if (eventa(FUNC) == -1 && eventb(FUNC) == -1) { \
+ sprintf(p_event_start, "start %s", __func__); \
+ if (eventa(__func__) == -1 && eventb(__func__) == -1) { \
const char *p_color = "red"; \
- eventa(FUNC) = MPE_Log_get_event_number(); \
- eventb(FUNC) = MPE_Log_get_event_number(); \
- MPE_Describe_state(eventa(FUNC), eventb(FUNC), FUNC, p_color); \
+ eventa(__func__) = MPE_Log_get_event_number(); \
+ eventb(__func__) = MPE_Log_get_event_number(); \
+ MPE_Describe_state(eventa(__func__), eventb(__func__), __func__, p_color); \
} \
- MPE_Log_event(eventa(FUNC), 0, p_event_start); \
+ MPE_Log_event(eventa(__func__), 0, p_event_start); \
}
/*------------------------------------------------------------------------
@@ -264,7 +182,7 @@
*/
#define FINISH_MPE_LOG \
if (H5_MPEinit_g) { \
- MPE_Log_event(eventb(FUNC), 0, FUNC); \
+ MPE_Log_event(eventb(__func__), 0, __func__); \
}
#else /* H5_HAVE_MPE */
@@ -380,7 +298,6 @@
*/
#define SUCCEED 0
#define FAIL (-1)
-#define UFAIL (unsigned)(-1)
/* The HDF5 library uses the symbol `ERR` frequently. So do
* header files for libraries such as curses(3), terminfo(3), etc.
@@ -440,74 +357,6 @@
#endif
/*
- * Numeric data types. Some of these might be defined in Posix.1g, otherwise
- * we define them with the closest available type which is at least as large
- * as the number of bits indicated in the type name. The `int8' types *must*
- * be exactly one byte wide because we use it for pointer calculations to
- * void* memory.
- */
-#if H5_SIZEOF_INT8_T == 0
-typedef signed char int8_t;
-#undef H5_SIZEOF_INT8_T
-#define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR
-#elif H5_SIZEOF_INT8_T == 1
-#else
-#error "the int8_t type must be 1 byte wide"
-#endif
-
-#if H5_SIZEOF_UINT8_T == 0
-typedef unsigned char uint8_t;
-#undef H5_SIZEOF_UINT8_T
-#define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR
-#elif H5_SIZEOF_UINT8_T == 1
-#else
-#error "the uint8_t type must be 1 byte wide"
-#endif
-
-#if H5_SIZEOF_INT16_T >= 2
-#elif H5_SIZEOF_SHORT >= 2
-typedef short int16_t;
-#undef H5_SIZEOF_INT16_T
-#define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 2
-typedef int int16_t;
-#undef H5_SIZEOF_INT16_T
-#define H5_SIZEOF_INT16_T H5_SIZEOF_INT
-#else
-#error "nothing appropriate for int16_t"
-#endif
-
-#if H5_SIZEOF_UINT16_T >= 2
-#elif H5_SIZEOF_SHORT >= 2
-typedef unsigned short uint16_t;
-#undef H5_SIZEOF_UINT16_T
-#define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 2
-typedef unsigned uint16_t;
-#undef H5_SIZEOF_UINT16_T
-#define H5_SIZEOF_UINT16_T H5_SIZEOF_INT
-#else
-#error "nothing appropriate for uint16_t"
-#endif
-
-#if H5_SIZEOF_INT32_T >= 4
-#elif H5_SIZEOF_SHORT >= 4
-typedef short int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 4
-typedef int int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 4
-typedef long int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_LONG
-#else
-#error "nothing appropriate for int32_t"
-#endif
-
-/*
* Maximum and minimum values. These should be defined in <limits.h> for the
* most part.
*/
@@ -602,6 +451,55 @@ typedef long int32_t;
#define LOCK_UN 0x08
#endif /* H5_HAVE_FLOCK */
+/* Macros for enabling/disabling particular GCC / clang warnings
+ *
+ * These are duplicated in H5FDmulti.c (we don't want to put them in the
+ * public header and the multi VFD can't use private headers). If you make
+ * changes here, be sure to update those as well.
+ *
+ * (see the following web-sites for more info:
+ * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
+ * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+ */
+#define H5_DIAG_JOINSTR(x, y) x y
+#define H5_DIAG_DO_PRAGMA(x) _Pragma(#x)
+#define H5_DIAG_PRAGMA(x) H5_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+#define H5_DIAG_OFF(x) H5_DIAG_PRAGMA(push) H5_DIAG_PRAGMA(ignored H5_DIAG_JOINSTR("-W", x))
+#define H5_DIAG_ON(x) H5_DIAG_PRAGMA(pop)
+
+/* Macros for enabling/disabling particular GCC-only warnings.
+ * These pragmas are only implemented usefully in gcc 4.6+
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
+#define H5_GCC_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_GCC_DIAG_OFF(x)
+#define H5_GCC_DIAG_ON(x)
+#endif
+
+/* Macros for enabling/disabling particular clang-only warnings.
+ */
+#if defined(__clang__)
+#define H5_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_CLANG_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x)
+#endif
+
+/* Macros for enabling/disabling particular GCC / clang warnings.
+ * These macros should be used for warnings supported by both gcc and clang.
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__)
+#define H5_GCC_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_GCC_CLANG_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x)
+#endif
+
/* Typedefs and functions for timing certain parts of the library. */
/* A set of elapsed/user/system times emitted as a time point by the
@@ -651,233 +549,231 @@ typedef struct {
haddr_t addr; /* The unique address of the object's header in that file */
} H5_obj_t;
-/*
- * Redefine all the POSIX functions. We should never see a POSIX
- * function (or any other non-HDF5 function) in the source!
+#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
+
+/* Put all Windows-specific definitions in H5win32defs.h so we
+ * can (mostly) assume a POSIX platform. Not all of the POSIX calls
+ * will have a Windows equivalent so some #ifdef protection is still
+ * necessary (e.g., fork()).
*/
+#include "H5win32defs.h"
-/* Put all platform-specific definitions in the following file */
-/* so that the following definitions are platform free. */
-#include "H5win32defs.h" /* For Windows-specific definitions */
+/* Platform-independent definitions for struct stat and off_t */
+#ifndef H5_HAVE_WIN32_API
+/* These definitions differ in Windows and are defined in
+ * H5win32defs for that platform.
+ */
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
+#endif
+
+#/* Redefine all the POSIX and C functions. We should never see an
+ * undecorated POSIX or C function (or any other non-HDF5 function)
+ * in the source.
+ */
#ifndef HDabort
#define HDabort() abort()
-#endif /* HDabort */
+#endif
#ifndef HDabs
#define HDabs(X) abs(X)
-#endif /* HDabs */
+#endif
#ifndef HDaccept
-#define HDaccept(A, B, C) accept((A), (B), (C)) /* mirror VFD */
-#endif /* HDaccept */
+#define HDaccept(A, B, C) accept((A), (B), (C))
+#endif
#ifndef HDaccess
#define HDaccess(F, M) access(F, M)
-#endif /* HDaccess */
+#endif
#ifndef HDacos
#define HDacos(X) acos(X)
-#endif /* HDacos */
-#ifndef HDvasprintf
-#ifdef H5_HAVE_VASPRINTF
-#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
-#endif /* H5_HAVE_VASPRINTF */
-#endif /* HDvasprintf */
+#endif
#ifndef HDalarm
-#ifdef H5_HAVE_ALARM
#define HDalarm(N) alarm(N)
-#else /* H5_HAVE_ALARM */
-#define HDalarm(N) (0)
-#endif /* H5_HAVE_ALARM */
-#endif /* HDalarm */
+#endif
#ifndef HDasctime
#define HDasctime(T) asctime(T)
-#endif /* HDasctime */
+#endif
#ifndef HDasin
#define HDasin(X) asin(X)
-#endif /* HDasin */
+#endif
#ifndef HDasprintf
#define HDasprintf asprintf /*varargs*/
-#endif /* HDasprintf */
+#endif
#ifndef HDassert
#define HDassert(X) assert(X)
-#endif /* HDassert */
+#endif
#ifndef HDatan
#define HDatan(X) atan(X)
-#endif /* HDatan */
+#endif
#ifndef HDatan2
#define HDatan2(X, Y) atan2(X, Y)
-#endif /* HDatan2 */
+#endif
#ifndef HDatexit
#define HDatexit(F) atexit(F)
-#endif /* HDatexit */
+#endif
#ifndef HDatof
#define HDatof(S) atof(S)
-#endif /* HDatof */
+#endif
#ifndef HDatoi
#define HDatoi(S) atoi(S)
-#endif /* HDatoi */
+#endif
#ifndef HDatol
#define HDatol(S) atol(S)
-#endif /* HDatol */
+#endif
#ifndef HDatoll
#define HDatoll(S) atoll(S)
-#endif /* HDatol */
+#endif
#ifndef HDbind
-#define HDbind(A, B, C) bind((A), (B), (C)) /* mirror VFD */
-#endif /* HDbind */
+#define HDbind(A, B, C) bind((A), (B), (C))
+#endif
#ifndef HDbsearch
#define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F)
-#endif /* HDbsearch */
+#endif
#ifndef HDcalloc
#define HDcalloc(N, Z) calloc(N, Z)
-#endif /* HDcalloc */
+#endif
#ifndef HDceil
#define HDceil(X) ceil(X)
-#endif /* HDceil */
+#endif
#ifndef HDcfgetispeed
#define HDcfgetispeed(T) cfgetispeed(T)
-#endif /* HDcfgetispeed */
+#endif
#ifndef HDcfgetospeed
#define HDcfgetospeed(T) cfgetospeed(T)
-#endif /* HDcfgetospeed */
+#endif
#ifndef HDcfsetispeed
#define HDcfsetispeed(T, S) cfsetispeed(T, S)
-#endif /* HDcfsetispeed */
+#endif
#ifndef HDcfsetospeed
#define HDcfsetospeed(T, S) cfsetospeed(T, S)
-#endif /* HDcfsetospeed */
+#endif
#ifndef HDchdir
#define HDchdir(S) chdir(S)
-#endif /* HDchdir */
+#endif
#ifndef HDchmod
#define HDchmod(S, M) chmod(S, M)
-#endif /* HDchmod */
+#endif
#ifndef HDchown
#define HDchown(S, O, G) chown(S, O, G)
-#endif /* HDchown */
+#endif
#ifndef HDclearerr
#define HDclearerr(F) clearerr(F)
-#endif /* HDclearerr */
+#endif
#ifndef HDclock
#define HDclock() clock()
-#endif /* HDclock */
+#endif
#ifndef HDclock_gettime
#define HDclock_gettime(CID, TS) clock_gettime(CID, TS)
-#endif /* HDclock_gettime */
+#endif
#ifndef HDclose
#define HDclose(F) close(F)
-#endif /* HDclose */
+#endif
#ifndef HDclosedir
#define HDclosedir(D) closedir(D)
-#endif /* HDclosedir */
+#endif
#ifndef HDconnect
-#define HDconnect(A, B, C) connect((A), (B), (C)) /* mirror VFD */
-#endif /* HDconnect */
+#define HDconnect(A, B, C) connect((A), (B), (C))
+#endif
#ifndef HDcos
#define HDcos(X) cos(X)
-#endif /* HDcos */
+#endif
#ifndef HDcosh
#define HDcosh(X) cosh(X)
-#endif /* HDcosh */
+#endif
#ifndef HDcreat
#define HDcreat(S, M) creat(S, M)
-#endif /* HDcreat */
+#endif
#ifndef HDctermid
#define HDctermid(S) ctermid(S)
-#endif /* HDctermid */
+#endif
#ifndef HDctime
#define HDctime(T) ctime(T)
-#endif /* HDctime */
+#endif
#ifndef HDcuserid
#define HDcuserid(S) cuserid(S)
-#endif /* HDcuserid */
+#endif
#ifndef HDdifftime
-#ifdef H5_HAVE_DIFFTIME
#define HDdifftime(X, Y) difftime(X, Y)
-#else /* H5_HAVE_DIFFTIME */
-#define HDdifftime(X, Y) ((double)(X) - (double)(Y))
-#endif /* H5_HAVE_DIFFTIME */
-#endif /* HDdifftime */
+#endif
#ifndef HDdiv
#define HDdiv(X, Y) div(X, Y)
-#endif /* HDdiv */
+#endif
#ifndef HDdup
#define HDdup(F) dup(F)
-#endif /* HDdup */
+#endif
#ifndef HDdup2
#define HDdup2(F, I) dup2(F, I)
-#endif /* HDdup2 */
-/* execl() variable arguments */
-/* execle() variable arguments */
-/* execlp() variable arguments */
+#endif
#ifndef HDexecv
#define HDexecv(S, AV) execv(S, AV)
-#endif /* HDexecv */
+#endif
#ifndef HDexecve
#define HDexecve(S, AV, E) execve(S, AV, E)
-#endif /* HDexecve */
+#endif
#ifndef HDexecvp
#define HDexecvp(S, AV) execvp(S, AV)
-#endif /* HDexecvp */
+#endif
#ifndef HDexit
#define HDexit(N) exit(N)
-#endif /* HDexit */
+#endif
#ifndef HD_exit
#define HD_exit(N) _exit(N)
-#endif /* HD_exit */
+#endif
#ifndef HDexp
#define HDexp(X) exp(X)
-#endif /* HDexp */
+#endif
#ifndef HDexp2
#define HDexp2(X) exp2(X)
-#endif /* HDexp2 */
+#endif
#ifndef HDfabs
#define HDfabs(X) fabs(X)
-#endif /* HDfabs */
-/* use ABS() because fabsf() fabsl() are not common yet. */
+#endif
#ifndef HDfabsf
-#define HDfabsf(X) ABS(X)
-#endif /* HDfabsf */
+#define HDfabsf(X) fabsf(X)
+#endif
#ifndef HDfabsl
-#define HDfabsl(X) ABS(X)
-#endif /* HDfabsl */
+#define HDfabsl(X) fabsl(X)
+#endif
#ifndef HDfclose
#define HDfclose(F) fclose(F)
-#endif /* HDfclose */
-#ifdef H5_HAVE_FCNTL
+#endif
#ifndef HDfcntl
#define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__)
-#endif /* HDfcntl */
-#endif /* H5_HAVE_FCNTL */
+#endif
#ifndef HDfdopen
#define HDfdopen(N, S) fdopen(N, S)
-#endif /* HDfdopen */
+#endif
#ifndef HDfeof
#define HDfeof(F) feof(F)
-#endif /* HDfeof */
+#endif
#ifndef HDferror
#define HDferror(F) ferror(F)
-#endif /* HDferror */
+#endif
#ifndef HDfflush
#define HDfflush(F) fflush(F)
-#endif /* HDfflush */
+#endif
#ifndef HDfgetc
#define HDfgetc(F) fgetc(F)
-#endif /* HDfgetc */
+#endif
#ifndef HDfgetpos
#define HDfgetpos(F, P) fgetpos(F, P)
-#endif /* HDfgetpos */
+#endif
#ifndef HDfgets
#define HDfgets(S, N, F) fgets(S, N, F)
-#endif /* HDfgets */
+#endif
#ifndef HDfileno
#define HDfileno(F) fileno(F)
-#endif /* HDfileno */
+#endif
+
/* Since flock is so prevalent, always build these functions
* when possible to avoid them becoming dead code.
*/
#ifdef H5_HAVE_FCNTL
H5_DLL int Pflock(int fd, int operation);
-#endif /* H5_HAVE_FCNTL */
+#endif
H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
+
#ifndef HDflock
/* NOTE: flock(2) is not present on all POSIX systems.
* If it is not present, we try a flock() equivalent based on
@@ -891,814 +787,801 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#define HDflock(F, L) Pflock(F, L)
#else
#define HDflock(F, L) Nflock(F, L)
-#endif /* H5_HAVE_FLOCK */
+#endif
+
#endif /* HDflock */
+
#ifndef HDfloor
#define HDfloor(X) floor(X)
-#endif /* HDfloor */
+#endif
#ifndef HDfmod
#define HDfmod(X, Y) fmod(X, Y)
-#endif /* HDfmod */
+#endif
#ifndef HDfopen
#define HDfopen(S, M) fopen(S, M)
-#endif /* HDfopen */
+#endif
#ifndef HDfork
#define HDfork() fork()
-#endif /* HDfork */
+#endif
#ifndef HDfprintf
#define HDfprintf fprintf
#endif
#ifndef HDfpathconf
#define HDfpathconf(F, N) fpathconf(F, N)
-#endif /* HDfpathconf */
+#endif
#ifndef HDfputc
#define HDfputc(C, F) fputc(C, F)
-#endif /* HDfputc */
+#endif
#ifndef HDfputs
#define HDfputs(S, F) fputs(S, F)
-#endif /* HDfputs */
+#endif
#ifndef HDfread
#define HDfread(M, Z, N, F) fread(M, Z, N, F)
-#endif /* HDfread */
+#endif
#ifndef HDfree
#define HDfree(M) free(M)
-#endif /* HDfree */
+#endif
#ifndef HDfreopen
#define HDfreopen(S, M, F) freopen(S, M, F)
-#endif /* HDfreopen */
+#endif
#ifndef HDfrexp
#define HDfrexp(X, N) frexp(X, N)
-#endif /* HDfrexp */
-/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
+#endif
#ifndef HDfrexpf
-#ifdef H5_HAVE_FREXPF
#define HDfrexpf(X, N) frexpf(X, N)
-#else /* H5_HAVE_FREXPF */
-#define HDfrexpf(X, N) frexp(X, N)
-#endif /* H5_HAVE_FREXPF */
-#endif /* HDfrexpf */
+#endif
#ifndef HDfrexpl
-#ifdef H5_HAVE_FREXPL
#define HDfrexpl(X, N) frexpl(X, N)
-#else /* H5_HAVE_FREXPL */
-#define HDfrexpl(X, N) frexp(X, N)
-#endif /* H5_HAVE_FREXPL */
-#endif /* HDfrexpl */
-/* fscanf() variable arguments */
+#endif
+#ifndef HDfscanf
+#define HDfscanf fscanf
+#endif
#ifndef HDfseek
#define HDfseek(F, O, W) fseeko(F, O, W)
-#endif /* HDfseek */
+#endif
#ifndef HDfsetpos
#define HDfsetpos(F, P) fsetpos(F, P)
-#endif /* HDfsetpos */
+#endif
#ifndef HDfstat
#define HDfstat(F, B) fstat(F, B)
-#endif /* HDfstat */
-#ifndef HDlstat
-#define HDlstat(S, B) lstat(S, B)
-#endif /* HDlstat */
-#ifndef HDstat
-#define HDstat(S, B) stat(S, B)
-#endif /* HDstat */
-
-#ifndef H5_HAVE_WIN32_API
-/* These definitions differ in Windows and are defined in
- * H5win32defs for that platform.
- */
-typedef struct stat h5_stat_t;
-typedef off_t h5_stat_size_t;
-#define HDoff_t off_t
-#endif /* H5_HAVE_WIN32_API */
-
-#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
-
+#endif
#ifndef HDftell
#define HDftell(F) ftell(F)
-#endif /* HDftell */
+#endif
#ifndef HDftruncate
#define HDftruncate(F, L) ftruncate(F, L)
-#endif /* HDftruncate */
+#endif
#ifndef HDfwrite
#define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F)
-#endif /* HDfwrite */
+#endif
#ifndef HDgetc
#define HDgetc(F) getc(F)
-#endif /* HDgetc */
+#endif
#ifndef HDgetchar
#define HDgetchar() getchar()
-#endif /* HDgetchar */
+#endif
#ifndef HDgetcwd
#define HDgetcwd(S, Z) getcwd(S, Z)
-#endif /* HDgetcwd */
+#endif
#ifndef HDgetdcwd
#define HDgetdcwd(D, S, Z) getcwd(S, Z)
-#endif /* HDgetdcwd */
+#endif
+
+/* Windows only - set to zero on other systems */
#ifndef HDgetdrive
#define HDgetdrive() 0
-#endif /* HDgetdrive */
+#endif
+
#ifndef HDgetegid
#define HDgetegid() getegid()
-#endif /* HDgetegid() */
+#endif
#ifndef HDgetenv
#define HDgetenv(S) getenv(S)
-#endif /* HDgetenv */
+#endif
#ifndef HDgeteuid
#define HDgeteuid() geteuid()
-#endif /* HDgeteuid */
+#endif
#ifndef HDgetgid
#define HDgetgid() getgid()
-#endif /* HDgetgid */
+#endif
#ifndef HDgetgrgid
#define HDgetgrgid(G) getgrgid(G)
-#endif /* HDgetgrgid */
+#endif
#ifndef HDgetgrnam
#define HDgetgrnam(S) getgrnam(S)
-#endif /* HDgetgrnam */
+#endif
#ifndef HDgetgroups
#define HDgetgroups(Z, G) getgroups(Z, G)
-#endif /* HDgetgroups */
+#endif
#ifndef HDgethostbyaddr
-#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) /* mirror VFD */
-#endif /* HDgethostbyaddr */
+#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C))
+#endif
#ifndef HDgethostname
#define HDgethostname(N, L) gethostname(N, L)
-#endif /* HDgethostname */
+#endif
#ifndef HDgetlogin
#define HDgetlogin() getlogin()
-#endif /* HDgetlogin */
+#endif
#ifndef HDgetpgrp
#define HDgetpgrp() getpgrp()
-#endif /* HDgetpgrp */
+#endif
#ifndef HDgetpid
#define HDgetpid() getpid()
-#endif /* HDgetpid */
+#endif
#ifndef HDgetppid
#define HDgetppid() getppid()
-#endif /* HDgetppid */
+#endif
#ifndef HDgetpwnam
#define HDgetpwnam(S) getpwnam(S)
-#endif /* HDgetpwnam */
+#endif
#ifndef HDgetpwuid
#define HDgetpwuid(U) getpwuid(U)
-#endif /* HDgetpwuid */
+#endif
#ifndef HDgetrusage
#define HDgetrusage(X, S) getrusage(X, S)
-#endif /* HDgetrusage */
+#endif
/* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */
#ifdef HDgets
#undef HDgets
-#endif /* HDgets */
+#endif
#ifndef HDgettimeofday
#define HDgettimeofday(S, P) gettimeofday(S, P)
-#endif /* HDgettimeofday */
+#endif
#ifndef HDgetuid
#define HDgetuid() getuid()
-#endif /* HDgetuid */
+#endif
#ifndef HDgmtime
#define HDgmtime(T) gmtime(T)
-#endif /* HDgmtime */
+#endif
#ifndef HDhtonl
-#define HDhtonl(X) htonl((X)) /* mirror VFD */
-#endif /* HDhtonl */
+#define HDhtonl(X) htonl((X))
+#endif
#ifndef HDhtons
-#define HDhtons(X) htons((X)) /* mirror VFD */
-#endif /* HDhtons */
+#define HDhtons(X) htons((X))
+#endif
#ifndef HDinet_addr
-#define HDinet_addr(C) inet_addr((C)) /* mirror VFD */
-#endif /* HDinet_addr */
+#define HDinet_addr(C) inet_addr((C))
+#endif
#ifndef HDinet_ntoa
-#define HDinet_ntoa(C) inet_ntoa((C)) /* mirror VFD */
-#endif /* HDinet_ntoa */
+#define HDinet_ntoa(C) inet_ntoa((C))
+#endif
#ifndef HDisalnum
-#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
-#endif /* HDisalnum */
+#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisalpha
-#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
-#endif /* HDisalpha */
+#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisatty
#define HDisatty(F) isatty(F)
-#endif /* HDisatty */
+#endif
#ifndef HDiscntrl
-#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
-#endif /* HDiscntrl */
+#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */
+#endif
#ifndef HDisdigit
-#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
-#endif /* HDisdigit */
+#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisgraph
-#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
-#endif /* HDisgraph */
+#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/
+#endif
#ifndef HDislower
-#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
-#endif /* HDislower */
+#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisnan
#define HDisnan(X) isnan(X)
-#endif /* HDisnan */
+#endif
#ifndef HDisprint
-#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
-#endif /* HDisprint */
+#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDispunct
-#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
-#endif /* HDispunct */
+#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisspace
-#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
-#endif /* HDisspace */
+#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisupper
-#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
-#endif /* HDisupper */
+#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDisxdigit
-#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
-#endif /* HDisxdigit */
+#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */
+#endif
#ifndef HDkill
#define HDkill(P, S) kill(P, S)
-#endif /* HDkill */
+#endif
#ifndef HDlabs
#define HDlabs(X) labs(X)
-#endif /* HDlabs */
+#endif
#ifndef HDldexp
#define HDldexp(X, N) ldexp(X, N)
-#endif /* HDldexp */
+#endif
#ifndef HDldiv
#define HDldiv(X, Y) ldiv(X, Y)
-#endif /* HDldiv */
+#endif
#ifndef HDlink
#define HDlink(OLD, NEW) link(OLD, NEW)
-#endif /* HDlink */
+#endif
#ifndef HDlisten
-#define HDlisten(A, B) listen((A), (B)) /* mirror VFD */
-#endif /* HDlisten */
+#define HDlisten(A, B) listen((A), (B))
+#endif
#ifndef HDllround
#define HDllround(V) llround(V)
-#endif /* HDround */
+#endif
#ifndef HDllroundf
#define HDllroundf(V) llroundf(V)
-#endif /* HDllroundf */
+#endif
#ifndef HDllroundl
#define HDllroundl(V) llroundl(V)
-#endif /* HDllroundl */
+#endif
#ifndef HDlocaleconv
#define HDlocaleconv() localeconv()
-#endif /* HDlocaleconv */
+#endif
#ifndef HDlocaltime
#define HDlocaltime(T) localtime(T)
-#endif /* HDlocaltime */
+#endif
#ifndef HDlog
#define HDlog(X) log(X)
-#endif /* HDlog */
+#endif
#ifndef HDlog10
#define HDlog10(X) log10(X)
-#endif /* HDlog10 */
+#endif
#ifndef HDlongjmp
#define HDlongjmp(J, N) longjmp(J, N)
-#endif /* HDlongjmp */
+#endif
#ifndef HDlround
#define HDlround(V) lround(V)
-#endif /* HDround */
+#endif
#ifndef HDlroundf
#define HDlroundf(V) lroundf(V)
-#endif /* HDlroundf */
+#endif
#ifndef HDlroundl
#define HDlroundl(V) lroundl(V)
-#endif /* HDroundl */
+#endif
#ifndef HDlseek
#define HDlseek(F, O, W) lseek(F, O, W)
-#endif /* HDlseek */
+#endif
+#ifndef HDlstat
+#define HDlstat(S, B) lstat(S, B)
+#endif
#ifndef HDmalloc
#define HDmalloc(Z) malloc(Z)
-#endif /* HDmalloc */
+#endif
#ifndef HDposix_memalign
#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z)
-#endif /* HDposix_memalign */
+#endif
#ifndef HDmblen
#define HDmblen(S, N) mblen(S, N)
-#endif /* HDmblen */
+#endif
#ifndef HDmbstowcs
#define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z)
-#endif /* HDmbstowcs */
+#endif
#ifndef HDmbtowc
#define HDmbtowc(P, S, Z) mbtowc(P, S, Z)
-#endif /* HDmbtowc */
+#endif
#ifndef HDmemchr
#define HDmemchr(S, C, Z) memchr(S, C, Z)
-#endif /* HDmemchr */
+#endif
#ifndef HDmemcmp
#define HDmemcmp(X, Y, Z) memcmp(X, Y, Z)
-#endif /* HDmemcmp */
+#endif
#ifndef HDmemcpy
#define HDmemcpy(X, Y, Z) memcpy(X, Y, Z)
-#endif /* HDmemcpy */
+#endif
#ifndef HDmemmove
#define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z)
-#endif /* HDmemmove */
+#endif
#ifndef HDmemset
#define HDmemset(X, C, Z) memset(X, C, Z)
-#endif /* HDmemset */
+#endif
#ifndef HDmkdir
#define HDmkdir(S, M) mkdir(S, M)
-#endif /* HDmkdir */
+#endif
#ifndef HDmkfifo
#define HDmkfifo(S, M) mkfifo(S, M)
-#endif /* HDmkfifo */
+#endif
#ifndef HDmktime
#define HDmktime(T) mktime(T)
-#endif /* HDmktime */
+#endif
#ifndef HDmodf
#define HDmodf(X, Y) modf(X, Y)
-#endif /* HDmodf */
+#endif
#ifndef HDnanosleep
#define HDnanosleep(N, O) nanosleep(N, O)
-#endif /* HDnanosleep */
+#endif
#ifndef HDntohl
-#define HDntohl(A) ntohl((A)) /* mirror VFD */
-#endif /* HDntohl */
+#define HDntohl(A) ntohl((A))
+#endif
#ifndef HDntohs
-#define HDntohs(A) ntohs((A)) /* mirror VFD */
-#endif /* HDntohs */
+#define HDntohs(A) ntohs((A))
+#endif
#ifndef HDopen
#define HDopen(F, ...) open(F, __VA_ARGS__)
-#endif /* HDopen */
+#endif
#ifndef HDopendir
#define HDopendir(S) opendir(S)
-#endif /* HDopendir */
+#endif
#ifndef HDpathconf
#define HDpathconf(S, N) pathconf(S, N)
-#endif /* HDpathconf */
+#endif
#ifndef HDpause
#define HDpause() pause()
-#endif /* HDpause */
+#endif
#ifndef HDperror
#define HDperror(S) perror(S)
-#endif /* HDperror */
+#endif
#ifndef HDpipe
#define HDpipe(F) pipe(F)
-#endif /* HDpipe */
+#endif
#ifndef HDpow
#define HDpow(X, Y) pow(X, Y)
-#endif /* HDpow */
+#endif
#ifndef HDpowf
#define HDpowf(X, Y) powf(X, Y)
-#endif /* HDpowf */
+#endif
#ifndef HDpread
#define HDpread(F, B, C, O) pread(F, B, C, O)
-#endif /* HDpread */
+#endif
#ifndef HDprintf
-#define HDprintf printf
-#endif /* HDprintf */
+#define HDprintf printf /*varargs*/
+#endif
#ifndef HDpthread_attr_destroy
#define HDpthread_attr_destroy(A) pthread_attr_destroy(A)
-#endif /* HDpthread_attr_destroy */
+#endif
#ifndef HDpthread_attr_init
#define HDpthread_attr_init(A) pthread_attr_init(A)
-#endif /* HDpthread_attr_init */
+#endif
#ifndef HDpthread_attr_setscope
#define HDpthread_attr_setscope(A, S) pthread_attr_setscope(A, S)
-#endif /* HDpthread_attr_setscope */
+#endif
#ifndef HDpthread_cond_init
#define HDpthread_cond_init(C, A) pthread_cond_init(C, A)
-#endif /* HDpthread_cond_init */
+#endif
#ifndef HDpthread_cond_signal
#define HDpthread_cond_signal(C) pthread_cond_signal(C)
-#endif /* HDpthread_cond_signal */
+#endif
#ifndef HDpthread_cond_wait
#define HDpthread_cond_wait(C, M) pthread_cond_wait(C, M)
-#endif /* HDpthread_cond_wait */
+#endif
#ifndef HDpthread_create
#define HDpthread_create(R, A, F, U) pthread_create(R, A, F, U)
-#endif /* HDpthread_create */
+#endif
#ifndef HDpthread_equal
#define HDpthread_equal(T1, T2) pthread_equal(T1, T2)
-#endif /* HDpthread_equal */
+#endif
#ifndef HDpthread_getspecific
#define HDpthread_getspecific(K) pthread_getspecific(K)
-#endif /* HDpthread_getspecific */
+#endif
#ifndef HDpthread_join
#define HDpthread_join(T, V) pthread_join(T, V)
-#endif /* HDpthread_join */
+#endif
#ifndef HDpthread_key_create
#define HDpthread_key_create(K, D) pthread_key_create(K, D)
-#endif /* HDpthread_key_create */
+#endif
#ifndef HDpthread_mutex_init
#define HDpthread_mutex_init(M, A) pthread_mutex_init(M, A)
-#endif /* HDpthread_mutex_init */
+#endif
#ifndef HDpthread_mutex_lock
#define HDpthread_mutex_lock(M) pthread_mutex_lock(M)
-#endif /* HDpthread_mutex_lock */
+#endif
#ifndef HDpthread_mutex_unlock
#define HDpthread_mutex_unlock(M) pthread_mutex_unlock(M)
-#endif /* HDpthread_mutex_unlock */
+#endif
#ifndef HDpthread_self
#define HDpthread_self() pthread_self()
-#endif /* HDpthread_self */
+#endif
#ifndef HDpthread_setcancelstate
#define HDpthread_setcancelstate(N, O) pthread_setcancelstate(N, O)
-#endif /* HDpthread_setcancelstate */
+#endif
#ifndef HDpthread_setspecific
#define HDpthread_setspecific(K, V) pthread_setspecific(K, V)
-#endif /* HDpthread_setspecific */
+#endif
#ifndef HDputc
#define HDputc(C, F) putc(C, F)
-#endif /* HDputc*/
+#endif
#ifndef HDputchar
#define HDputchar(C) putchar(C)
-#endif /* HDputchar */
+#endif
#ifndef HDputs
#define HDputs(S) puts(S)
-#endif /* HDputs */
+#endif
#ifndef HDpwrite
#define HDpwrite(F, B, C, O) pwrite(F, B, C, O)
-#endif /* HDpwrite */
+#endif
#ifndef HDqsort
#define HDqsort(M, N, Z, F) qsort(M, N, Z, F)
-#endif /* HDqsort*/
+#endif
#ifndef HDraise
#define HDraise(N) raise(N)
-#endif /* HDraise */
+#endif
+/* clang-format off */
#ifdef H5_HAVE_RAND_R
-#ifndef HDrandom
-#define HDrandom() HDrand()
-#endif /* HDrandom */
-H5_DLL int HDrand(void);
-#ifndef HDsrandom
-#define HDsrandom(S) HDsrand(S)
-#endif /* HDsrandom */
-H5_DLL void HDsrand(unsigned int seed);
+# ifndef HDrandom
+# define HDrandom() HDrand()
+# endif
+ H5_DLL int HDrand(void);
+# ifndef HDsrandom
+# define HDsrandom(S) HDsrand(S)
+# endif
+ H5_DLL void HDsrand(unsigned int seed);
#elif defined(H5_HAVE_RANDOM)
-#ifndef HDrand
-#define HDrand() random()
-#endif /* HDrand */
-#ifndef HDrandom
-#define HDrandom() random()
-#endif /* HDrandom */
-#ifndef HDsrand
-#define HDsrand(S) srandom(S)
-#endif /* HDsrand */
-#ifndef HDsrandom
-#define HDsrandom(S) srandom(S)
-#endif /* HDsrandom */
-#else /* H5_HAVE_RANDOM */
-#ifndef HDrand
-#define HDrand() rand()
-#endif /* HDrand */
-#ifndef HDrandom
-#define HDrandom() rand()
-#endif /* HDrandom */
-#ifndef HDsrand
-#define HDsrand(S) srand(S)
-#endif /* HDsrand */
-#ifndef HDsrandom
-#define HDsrandom(S) srand(S)
-#endif /* HDsrandom */
-#endif /* H5_HAVE_RANDOM */
+# ifndef HDrand
+# define HDrand() random()
+# endif
+# ifndef HDrandom
+# define HDrandom() random()
+# endif
+# ifndef HDsrand
+# define HDsrand(S) srandom(S)
+# endif
+# ifndef HDsrandom
+# define HDsrandom(S) srandom(S)
+# endif
+#else
+# ifndef HDrand
+# define HDrand() rand()
+# endif
+# ifndef HDrandom
+# define HDrandom() rand()
+# endif
+# ifndef HDsrand
+# define HDsrand(S) srand(S)
+# endif
+# ifndef HDsrandom
+# define HDsrandom(S) srand(S)
+# endif
+#endif
+/* clang-format on */
#ifndef HDread
#define HDread(F, M, Z) read(F, M, Z)
-#endif /* HDread */
+#endif
#ifndef HDreaddir
#define HDreaddir(D) readdir(D)
-#endif /* HDreaddir */
+#endif
#ifndef HDrealloc
#define HDrealloc(M, Z) realloc(M, Z)
-#endif /* HDrealloc */
+#endif
#ifndef HDrealpath
#define HDrealpath(F1, F2) realpath(F1, F2)
-#endif /* HDrealloc */
+#endif
#ifndef HDremove
#define HDremove(S) remove(S)
-#endif /* HDremove */
+#endif
#ifndef HDrename
#define HDrename(OLD, NEW) rename(OLD, NEW)
-#endif /* HDrename */
+#endif
#ifndef HDrewind
#define HDrewind(F) rewind(F)
-#endif /* HDrewind */
+#endif
#ifndef HDrewinddir
#define HDrewinddir(D) rewinddir(D)
-#endif /* HDrewinddir */
+#endif
#ifndef HDround
#define HDround(V) round(V)
-#endif /* HDround */
+#endif
#ifndef HDroundf
#define HDroundf(V) roundf(V)
-#endif /* HDroundf */
+#endif
#ifndef HDroundl
#define HDroundl(V) roundl(V)
-#endif /* HDroundl */
+#endif
#ifndef HDrmdir
#define HDrmdir(S) rmdir(S)
-#endif /* HDrmdir */
-/* scanf() variable arguments */
+#endif
+#ifndef HDscanf
+#define HDscanf scanf /*varargs*/
+#endif
#ifndef HDselect
#define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T)
-#endif /* HDsetbuf */
+#endif
#ifndef HDsetbuf
#define HDsetbuf(F, S) setbuf(F, S)
-#endif /* HDsetbuf */
+#endif
#ifndef HDsetenv
#define HDsetenv(N, V, O) setenv(N, V, O)
-#endif /* HDsetenv */
+#endif
#ifndef HDsetgid
#define HDsetgid(G) setgid(G)
-#endif /* HDsetgid */
+#endif
#ifndef HDsetjmp
#define HDsetjmp(J) setjmp(J)
-#endif /* HDsetjmp */
+#endif
#ifndef HDsetlocale
#define HDsetlocale(N, S) setlocale(N, S)
-#endif /* HDsetlocale */
+#endif
#ifndef HDsetpgid
#define HDsetpgid(P, PG) setpgid(P, PG)
-#endif /* HDsetpgid */
+#endif
#ifndef HDsetsid
#define HDsetsid() setsid()
-#endif /* HDsetsid */
+#endif
#ifndef HDsetsockopt
-#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) /* mirror VFD */
-#endif /* HDsetsockopt */
+#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E))
+#endif
#ifndef HDsetuid
#define HDsetuid(U) setuid(U)
-#endif /* HDsetuid */
+#endif
#ifndef HDsetvbuf
#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z)
-#endif /* HDsetvbuf */
+#endif
#ifndef HDshutdown
-#define HDshutdown(A, B) shutdown((A), (B)) /* mirror VFD */
-#endif /* HDshutdown */
+#define HDshutdown(A, B) shutdown((A), (B))
+#endif
#ifndef HDsigaction
#define HDsigaction(S, A, O) sigaction((S), (A), (O))
-#endif /* HDsigaction */
+#endif
#ifndef HDsigaddset
#define HDsigaddset(S, N) sigaddset(S, N)
-#endif /* HDsigaddset */
+#endif
#ifndef HDsigdelset
#define HDsigdelset(S, N) sigdelset(S, N)
-#endif /* HDsigdelset */
+#endif
#ifndef HDsigemptyset
#define HDsigemptyset(S) sigemptyset(S)
-#endif /* HDsigemptyset */
+#endif
#ifndef HDsigfillset
#define HDsigfillset(S) sigfillset(S)
-#endif /* HDsigfillset */
+#endif
#ifndef HDsigismember
#define HDsigismember(S, N) sigismember(S, N)
-#endif /* HDsigismember */
+#endif
#ifndef HDsiglongjmp
#define HDsiglongjmp(J, N) siglongjmp(J, N)
-#endif /* HDsiglongjmp */
+#endif
#ifndef HDsignal
#define HDsignal(N, F) signal(N, F)
-#endif /* HDsignal */
+#endif
#ifndef HDsigpending
#define HDsigpending(S) sigpending(S)
-#endif /* HDsigpending */
+#endif
#ifndef HDsigprocmask
#define HDsigprocmask(H, S, O) sigprocmask(H, S, O)
-#endif /* HDsigprocmask */
+#endif
#ifndef HDsigsetjmp
#define HDsigsetjmp(J, N) sigsetjmp(J, N)
-#endif /* HDsigsetjmp */
+#endif
#ifndef HDsigsuspend
#define HDsigsuspend(S) sigsuspend(S)
-#endif /* HDsigsuspend */
+#endif
#ifndef HDsin
#define HDsin(X) sin(X)
-#endif /* HDsin */
+#endif
#ifndef HDsinh
#define HDsinh(X) sinh(X)
-#endif /* HDsinh */
+#endif
#ifndef HDsleep
#define HDsleep(N) sleep(N)
-#endif /* HDsleep */
+#endif
#ifndef HDsnprintf
#define HDsnprintf snprintf /*varargs*/
-#endif /* HDsnprintf */
+#endif
#ifndef HDsocket
-#define HDsocket(A, B, C) socket((A), (B), (C)) /* mirror VFD */
-#endif /* HDsocket */
+#define HDsocket(A, B, C) socket((A), (B), (C))
+#endif
#ifndef HDsprintf
#define HDsprintf sprintf /*varargs*/
-#endif /* HDsprintf */
+#endif
#ifndef HDsqrt
#define HDsqrt(X) sqrt(X)
-#endif /* HDsqrt */
+#endif
#ifndef HDsscanf
-#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__)
-#endif /* HDsscanf */
+#define HDsscanf sscanf /*varargs*/
+#endif
+#ifndef HDstat
+#define HDstat(S, B) stat(S, B)
+#endif
#ifndef HDstrcat
#define HDstrcat(X, Y) strcat(X, Y)
-#endif /* HDstrcat */
+#endif
#ifndef HDstrchr
#define HDstrchr(S, C) strchr(S, C)
-#endif /* HDstrchr */
+#endif
#ifndef HDstrcmp
#define HDstrcmp(X, Y) strcmp(X, Y)
-#endif /* HDstrcmp */
+#endif
#ifndef HDstrcasecmp
#define HDstrcasecmp(X, Y) strcasecmp(X, Y)
-#endif /* HDstrcasecmp */
+#endif
#ifndef HDstrcoll
#define HDstrcoll(X, Y) strcoll(X, Y)
-#endif /* HDstrcoll */
+#endif
#ifndef HDstrcpy
#define HDstrcpy(X, Y) strcpy(X, Y)
-#endif /* HDstrcpy */
+#endif
#ifndef HDstrcspn
#define HDstrcspn(X, Y) strcspn(X, Y)
-#endif /* HDstrcspn */
+#endif
+#ifndef HDstrdup
+#define HDstrdup(S) strdup(S)
+#endif
#ifndef HDstrerror
#define HDstrerror(N) strerror(N)
-#endif /* HDstrerror */
+#endif
#ifndef HDstrftime
#define HDstrftime(S, Z, F, T) strftime(S, Z, F, T)
-#endif /* HDstrftime */
+#endif
#ifndef HDstrlen
#define HDstrlen(S) strlen(S)
-#endif /* HDstrlen */
+#endif
#ifndef HDstrncat
#define HDstrncat(X, Y, Z) strncat(X, Y, Z)
-#endif /* HDstrncat */
+#endif
#ifndef HDstrncmp
#define HDstrncmp(X, Y, Z) strncmp(X, Y, Z)
-#endif /* HDstrncmp */
+#endif
#ifndef HDstrncpy
#define HDstrncpy(X, Y, Z) strncpy(X, Y, Z)
-#endif /* HDstrncpy */
+#endif
#ifndef HDstrpbrk
#define HDstrpbrk(X, Y) strpbrk(X, Y)
-#endif /* HDstrpbrk */
+#endif
#ifndef HDstrrchr
#define HDstrrchr(S, C) strrchr(S, C)
-#endif /* HDstrrchr */
+#endif
#ifndef HDstrspn
#define HDstrspn(X, Y) strspn(X, Y)
-#endif /* HDstrspn */
+#endif
#ifndef HDstrstr
#define HDstrstr(X, Y) strstr(X, Y)
-#endif /* HDstrstr */
+#endif
#ifndef HDstrtod
#define HDstrtod(S, R) strtod(S, R)
-#endif /* HDstrtod */
+#endif
#ifndef HDstrtok
#define HDstrtok(X, Y) strtok(X, Y)
-#endif /* HDstrtok */
+#endif
#ifndef HDstrtok_r
#define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z)
-#endif /* HDstrtok */
+#endif
#ifndef HDstrtol
#define HDstrtol(S, R, N) strtol(S, R, N)
-#endif /* HDstrtol */
+#endif
#ifndef HDstrtoll
-#ifdef H5_HAVE_STRTOLL
#define HDstrtoll(S, R, N) strtoll(S, R, N)
-#else
-H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
-#endif /* H5_HAVE_STRTOLL */
-#endif /* HDstrtoll */
+#endif
#ifndef HDstrtoul
#define HDstrtoul(S, R, N) strtoul(S, R, N)
-#endif /* HDstrtoul */
+#endif
#ifndef HDstrtoull
#define HDstrtoull(S, R, N) strtoull(S, R, N)
-#endif /* HDstrtoul */
+#endif
#ifndef HDstrtoumax
#define HDstrtoumax(S, R, N) strtoumax(S, R, N)
-#endif /* HDstrtoumax */
+#endif
#ifndef HDstrxfrm
#define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z)
-#endif /* HDstrxfrm */
-#ifdef H5_HAVE_SYMLINK
+#endif
#ifndef HDsymlink
#define HDsymlink(F1, F2) symlink(F1, F2)
-#endif /* HDsymlink */
-#endif /* H5_HAVE_SYMLINK */
+#endif
#ifndef HDsysconf
#define HDsysconf(N) sysconf(N)
-#endif /* HDsysconf */
+#endif
#ifndef HDsystem
#define HDsystem(S) system(S)
-#endif /* HDsystem */
+#endif
#ifndef HDtan
#define HDtan(X) tan(X)
-#endif /* HDtan */
+#endif
#ifndef HDtanh
#define HDtanh(X) tanh(X)
-#endif /* HDtanh */
+#endif
#ifndef HDtcdrain
#define HDtcdrain(F) tcdrain(F)
-#endif /* HDtcdrain */
+#endif
#ifndef HDtcflow
#define HDtcflow(F, A) tcflow(F, A)
-#endif /* HDtcflow */
+#endif
#ifndef HDtcflush
#define HDtcflush(F, N) tcflush(F, N)
-#endif /* HDtcflush */
+#endif
#ifndef HDtcgetattr
#define HDtcgetattr(F, T) tcgetattr(F, T)
-#endif /* HDtcgetattr */
+#endif
#ifndef HDtcgetpgrp
#define HDtcgetpgrp(F) tcgetpgrp(F)
-#endif /* HDtcgetpgrp */
+#endif
#ifndef HDtcsendbreak
#define HDtcsendbreak(F, N) tcsendbreak(F, N)
-#endif /* HDtcsendbreak */
+#endif
#ifndef HDtcsetattr
#define HDtcsetattr(F, O, T) tcsetattr(F, O, T)
-#endif /* HDtcsetattr */
+#endif
#ifndef HDtcsetpgrp
#define HDtcsetpgrp(F, N) tcsetpgrp(F, N)
-#endif /* HDtcsetpgrp */
+#endif
#ifndef HDtime
#define HDtime(T) time(T)
-#endif /* HDtime */
+#endif
#ifndef HDtimes
#define HDtimes(T) times(T)
-#endif /* HDtimes*/
+#endif
#ifndef HDtmpfile
#define HDtmpfile() tmpfile()
-#endif /* HDtmpfile */
+#endif
#ifndef HDtmpnam
#define HDtmpnam(S) tmpnam(S)
-#endif /* HDtmpnam */
+#endif
#ifndef HDtolower
#define HDtolower(C) tolower(C)
-#endif /* HDtolower */
+#endif
#ifndef HDtoupper
#define HDtoupper(C) toupper(C)
-#endif /* HDtoupper */
+#endif
#ifndef HDttyname
#define HDttyname(F) ttyname(F)
-#endif /* HDttyname */
+#endif
#ifndef HDtzset
#define HDtzset() tzset()
-#endif /* HDtzset */
+#endif
#ifndef HDumask
#define HDumask(N) umask(N)
-#endif /* HDumask */
+#endif
#ifndef HDuname
#define HDuname(S) uname(S)
-#endif /* HDuname */
+#endif
#ifndef HDungetc
#define HDungetc(C, F) ungetc(C, F)
-#endif /* HDungetc */
+#endif
#ifndef HDunlink
#define HDunlink(S) unlink(S)
-#endif /* HDunlink */
+#endif
+#ifndef HDunsetenv
+#define HDunsetenv(S) unsetenv(S)
+#endif
#ifndef HDutime
#define HDutime(S, T) utime(S, T)
-#endif /* HDutime */
+#endif
+
+#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
+#endif
+
#ifndef HDva_arg
#define HDva_arg(A, T) va_arg(A, T)
-#endif /* HDva_arg */
+#endif
#ifndef HDva_copy
#define HDva_copy(D, S) va_copy(D, S)
-#endif /* HDva_copy */
+#endif
#ifndef HDva_end
#define HDva_end(A) va_end(A)
-#endif /* HDva_end */
+#endif
#ifndef HDva_start
#define HDva_start(A, P) va_start(A, P)
-#endif /* HDva_start */
+#endif
#ifndef HDvfprintf
#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A)
-#endif /* HDvfprintf */
+#endif
#ifndef HDvprintf
#define HDvprintf(FMT, A) vprintf(FMT, A)
-#endif /* HDvprintf */
+#endif
#ifndef HDvsprintf
#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A)
-#endif /* HDvsprintf */
+#endif
#ifndef HDvsnprintf
#define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A)
-#endif /* HDvsnprintf */
+#endif
#ifndef HDwait
#define HDwait(W) wait(W)
-#endif /* HDwait */
+#endif
#ifndef HDwaitpid
#define HDwaitpid(P, W, O) waitpid(P, W, O)
-#endif /* HDwaitpid */
+#endif
#ifndef HDwcstombs
#define HDwcstombs(S, P, Z) wcstombs(S, P, Z)
-#endif /* HDwcstombs */
+#endif
#ifndef HDwctomb
#define HDwctomb(S, C) wctomb(S, C)
-#endif /* HDwctomb */
+#endif
#ifndef HDwrite
#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
@@ -1826,15 +1709,6 @@ extern char * strdup(const char *s);
#define H5_COLON_SEPC ':'
-/* Use FUNC to safely handle variations of C99 __func__ keyword handling */
-#ifdef H5_HAVE_C99_FUNC
-#define FUNC __func__
-#elif defined(H5_HAVE_FUNCTION)
-#define FUNC __FUNCTION__
-#else
-#error "We need __func__ or __FUNCTION__ to test function names!"
-#endif
-
/*
* These macros check whether debugging has been requested for a certain
* package at run-time. Code for debugging is conditionally compiled by
@@ -1915,51 +1789,52 @@ extern char H5libhdf5_settings[]; /* embedded library information */
#define H5TRACE0(R, T) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T)
+ CALLTIME = H5_trace(NULL, __func__, T)
#define H5TRACE1(R, T, A0) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0)
#define H5TRACE2(R, T, A0, A1) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1)
#define H5TRACE3(R, T, A0, A1, A2) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2)
#define H5TRACE4(R, T, A0, A1, A2, A3) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3)
#define H5TRACE5(R, T, A0, A1, A2, A3, A4) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4)
#define H5TRACE6(R, T, A0, A1, A2, A3, A4, A5) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5)
#define H5TRACE7(R, T, A0, A1, A2, A3, A4, A5, A6) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6)
#define H5TRACE8(R, T, A0, A1, A2, A3, A4, A5, A6, A7) \
- RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7)
+ RTYPE = R; \
+ CALLTIME = \
+ H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7)
#define H5TRACE9(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8)
#define H5TRACE10(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9)
#define H5TRACE11(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9, #A10, A10)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9, #A10, A10)
#define H5TRACE12(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11)
#define H5TRACE_RETURN(V) \
if (RTYPE) { \
- H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \
+ H5_trace(&CALLTIME, __func__, RTYPE, NULL, V); \
RTYPE = NULL; \
}
#else
@@ -2135,7 +2010,7 @@ extern hbool_t H5_use_selection_io_g;
/* Include required function stack header */
#include "H5CSprivate.h"
-#define H5_PUSH_FUNC H5CS_push(FUNC);
+#define H5_PUSH_FUNC H5CS_push(__func__);
#define H5_POP_FUNC H5CS_pop();
#else /* H5_HAVE_CODESTACK */
#define H5_PUSH_FUNC /* void */
@@ -2220,7 +2095,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
#define FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE;
#define FUNC_ENTER_API_INIT(err) \
@@ -2240,6 +2115,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Push the API context */ \
if (H5CX_push() < 0) \
HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \
+ else \
+ api_ctx_pushed = TRUE; \
\
BEGIN_MPE_LOG
@@ -2247,6 +2124,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
#define FUNC_ENTER_API(err) \
{ \
{ \
+ hbool_t api_ctx_pushed = FALSE; \
+ \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
FUNC_ENTER_API_PUSH(err); \
@@ -2261,6 +2140,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
#define FUNC_ENTER_API_NOCLEAR(err) \
{ \
{ \
+ hbool_t api_ctx_pushed = FALSE; \
+ \
FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_INIT(err); \
FUNC_ENTER_API_PUSH(err); \
@@ -2295,7 +2176,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
{ \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE; \
BEGIN_MPE_LOG \
{
@@ -2312,7 +2193,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
{ \
{ \
- FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE; \
FUNC_ENTER_API_INIT(err); \
{
@@ -2321,7 +2202,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are: H5TSmutex_acquire,
+ * API name itself. Examples are: H5TSmutex_acquire,
*
*/
#define FUNC_ENTER_API_NAMECHECK_ONLY \
@@ -2331,7 +2212,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
{ \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \
{
/* Note: this macro only works when there's _no_ interface initialization routine for the module */
@@ -2345,14 +2226,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Use this macro for all "normal" non-API functions */
#define FUNC_ENTER_NOAPI(err) \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
FUNC_ENTER_NOAPI_INIT(err) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for all non-API functions, which propagate errors, but don't issue them */
#define FUNC_ENTER_NOAPI_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
FUNC_ENTER_NOAPI_INIT(-) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2366,7 +2247,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
*/
#define FUNC_ENTER_NOAPI_NOINIT \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2381,7 +2262,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
*/
#define FUNC_ENTER_NOAPI_NOINIT_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2393,7 +2274,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
*/
#define FUNC_ENTER_NOAPI_NOFS \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
\
/* Initialize the package, if appropriate */ \
H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
@@ -2410,19 +2291,19 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
*/
#define FUNC_ENTER_NOAPI_NOERR_NOFS \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/*
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are private routines in the H5TS package.
+ * API name itself. Examples are private routines in the H5TS package.
*
*/
#define FUNC_ENTER_NOAPI_NAMECHECK_ONLY \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC));
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__));
/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI
* and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set
@@ -2431,7 +2312,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5AC_tag(tag, &prev_tag); \
FUNC_ENTER_NOAPI_INIT(err) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2440,7 +2321,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2448,14 +2329,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Use this macro for all "normal" package-level functions */
#define FUNC_ENTER_PACKAGE \
{ \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for package-level functions which propgate errors, but don't issue them */
#define FUNC_ENTER_PACKAGE_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2465,7 +2346,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2473,14 +2354,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Use this macro for all "normal" staticly-scoped functions */
#define FUNC_ENTER_STATIC \
{ \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */
#define FUNC_ENTER_STATIC_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2488,19 +2369,19 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* And that shouldn't push their name on the function stack */
#define FUNC_ENTER_STATIC_NOERR_NOFS \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/*
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are static routines in the H5TS package.
+ * API name itself. Examples are static routines in the H5TS package.
*
*/
#define FUNC_ENTER_STATIC_NAMECHECK_ONLY \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC));
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__));
/* Use the following macro as replacement for the FUNC_ENTER_STATIC
* macro when the function needs to set up a metadata tag. */
@@ -2508,7 +2389,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2527,14 +2408,17 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
H5_API_SET_CANCEL
#define FUNC_LEAVE_API_COMMON(ret_value) \
- ; \
- } /*end scope from end of FUNC_ENTER*/ \
FINISH_MPE_LOG \
H5TRACE_RETURN(ret_value);
#define FUNC_LEAVE_API(ret_value) \
+ ; \
+ } /*end scope from end of FUNC_ENTER*/ \
FUNC_LEAVE_API_COMMON(ret_value); \
- (void)H5CX_pop(TRUE); \
+ if (api_ctx_pushed) { \
+ (void)H5CX_pop(TRUE); \
+ api_ctx_pushed = FALSE; \
+ } \
H5_POP_FUNC \
if (err_occurred) \
(void)H5E_dump_api_stack(TRUE); \
@@ -2545,6 +2429,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Use this macro to match the FUNC_ENTER_API_NOINIT macro */
#define FUNC_LEAVE_API_NOINIT(ret_value) \
+ ; \
+ } /*end scope from end of FUNC_ENTER*/ \
FUNC_LEAVE_API_COMMON(ret_value); \
H5_POP_FUNC \
if (err_occurred) \
@@ -2557,6 +2443,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
/* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */
#define FUNC_LEAVE_API_NOFS(ret_value) \
+ ; \
+ } /*end scope from end of FUNC_ENTER*/ \
FUNC_LEAVE_API_COMMON(ret_value); \
FUNC_LEAVE_API_THREADSAFE \
return (ret_value); \
@@ -2633,256 +2521,26 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
return (ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-/****************************************/
-/* Revisions to FUNC_ENTER/LEAVE Macros */
-/****************************************/
-
-/* Macros to check if a package is initialized */
-#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg));
-#define H5_CHECK_PACKAGE_INIT_REG_NO(asrt)
-#define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt)
-#define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt)
-#define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg)
-
-/* Macros to initialize package, if a package initialization routine is defined */
-#define H5_PKG_YES_INIT(pkg) \
- if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \
- H5_PACKAGE_INIT_VAR(pkg) = TRUE; \
- if (H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \
- H5_PACKAGE_INIT_VAR(pkg) = FALSE; \
- /* (Can't use H5E_THROW here) */ \
- H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
- ret_value = fail_value; \
- goto func_init_failed; \
- } /* end if */ \
- } /* end if */
-#define H5_PKG_NO_INIT(pkg) \
- if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \
- H5_PACKAGE_INIT_VAR(pkg) = TRUE;
-#define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg)
-
/* Macros to declare package initialization function, if a package initialization routine is defined */
#ifdef H5_PKG_SINGLE_SOURCE
#define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
-#else /* H5_PKG_SINGLE_SOURCE */
+#else
#define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
-#endif /* H5_PKG_SINGLE_SOURCE */
+#endif
#define H5_PKG_DECLARE_NO_FUNC(pkg)
/* Declare package initialization symbols (if in a package) */
#ifdef H5_PKG_SINGLE_SOURCE
#define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg);
-#else /* H5_PKG_SINGLE_SOURCE */
+#else
#define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg);
-#endif /* H5_PKG_SINGLE_SOURCE */
+#endif
#define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg)
+
#ifdef H5_MY_PKG
H5_PKG_DECLARE_VAR(H5_MY_PKG)
H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG)
-#endif /* H5_MY_PKG */
-
-/* API re-entrance variable */
-extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */
-
-/* Macros for entering different scopes of routines */
-#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \
- FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \
- \
- /* The library should be initialized already */ \
- HDassert(H5_INIT_GLOBAL); \
- \
- /* This interface should be initialized already */ \
- /* (except for package initialization routines :-) */ \
- H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- {
-
-#define H5_PRIVATE_ENTER(pkg, pkg_init) \
- FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \
- \
- /* The library should be initialized already */ \
- HDassert(H5_INIT_GLOBAL); \
- \
- /* Initialize this interface if desired */ \
- H5_PKG_INIT(pkg_init, pkg) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- { \
- {
-
-#define H5_PUBLIC_ENTER(pkg, pkg_init) \
- FUNC_ENTER_API_VARS \
- FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \
- \
- /* Clear thread error stack when entering public functions */ \
- H5E_clear_stack(NULL); \
- \
- /* Initialize the library or bust */ \
- if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
- if (H5_init_library() < 0) { \
- /* (Can't use H5E_THROW here) */ \
- H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
- ret_value = fail_value; \
- goto func_init_failed; \
- } /* end if */ \
- } /* end if */ \
- \
- /* Initialize this interface if desired */ \
- H5_PKG_INIT(pkg_init, pkg) \
- \
- /* Check for re-entering API routine */ \
- HDassert(!H5_api_entered_g); \
- H5_api_entered_g = TRUE; \
- \
- /* Start logging MPI's MPE information */ \
- BEGIN_MPE_LOG \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- { \
- { \
- {
-
-/* Macros for substituting the package name */
-#define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
-#define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT)
-#define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
-#define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init)
-#define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init)
-
-/* Macros for substituting a function prefix */
-#define FUNC_PREFIX_STATIC static
-#define FUNC_PREFIX_PKGINIT
-#define FUNC_PREFIX_PKG
-#define FUNC_PREFIX_PRIV
-#define FUNC_PREFIX_PUB
-
-/* Macros for declaring error variables */
-/* Function can detect errors and has a specific error return value */
-#define FUNC_ERR_VAR_ERR(ret_typ, err) \
- hbool_t past_catch = FALSE; \
- ret_typ fail_value = err;
-/* Function can detect errors but cannot return an error value (Cleanup only) */
-#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) hbool_t past_catch = FALSE;
-/* Function has no need to detect or clean up from errors */
-#define FUNC_ERR_VAR_NOERR(ret_typ, err)
-
-/* Use this macro when entering all functions */
-#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \
- H5_GLUE(FUNC_PREFIX_, scope) \
- ret_typ func \
- /* Open function */ \
- { \
- ret_typ ret_value = ret_init; \
- H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT)
-
-/* Use this macro when entering functions that have no return value */
-#define BEGIN_FUNC_VOID(scope, use_err, func) \
- H5_GLUE(FUNC_PREFIX_, scope) \
- void func \
- /* Open function */ \
- { \
- H5_GLUE(FUNC_ERR_VAR_, use_err)(void, -, -) H5_GLUE(FUNC_ENT_, scope)
-
-/* Macros for label when a function initialization can fail */
-#define H5_PRIV_YES_FUNC_INIT_FAILED \
-func_init_failed:
-#define H5_PRIV_NO_FUNC_INIT_FAILED
-#define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED)
-
-/* Macros for leaving different scopes of routines */
-#define FUNC_LEAVE_PKGINIT \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_STATIC \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PKG \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PRIV \
- /* Leave scope for this type of function */ \
- } \
- } \
- \
- /* Label for errors during FUNC_ENTER */ \
- H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PUB \
- /* Leave scope for this type of function */ \
- } \
- } \
- } \
- \
- /* Label for errors during FUNC_ENTER */ \
-func_init_failed: \
- \
- /* Dump error stack if an error occurred during API routine */ \
- if (ret_value == fail_value) \
- (void)H5E_dump_api_stack(TRUE); \
- \
- /* Finish the API tracing info */ \
- H5TRACE_RETURN(ret_value); \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC \
- \
- /* Finish the MPE tracing info */ \
- FINISH_MPE_LOG \
- \
- /* Check for leaving API routine */ \
- HDassert(H5_api_entered_g); \
- H5_api_entered_g = FALSE; \
- \
- /* Release thread-safety semaphore */ \
- FUNC_LEAVE_API_THREADSAFE
-
-/* Use this macro when leaving all functions */
-#define END_FUNC(scope) \
- /* Scope-specific function conclusion */ \
- H5_GLUE(FUNC_LEAVE_, scope) \
- \
- /* Leave routine */ \
- return (ret_value); \
- \
- /* Close Function */ \
- }
-
-/* Use this macro when leaving void functions */
-#define END_FUNC_VOID(scope) \
- /* Scope-specific function conclusion */ \
- H5_GLUE(FUNC_LEAVE_, scope) \
- \
- /* Leave routine */ \
- return; \
- \
- /* Close Function */ \
- }
+#endif
/* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient).
* Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */
@@ -2953,6 +2611,57 @@ H5_DLL double H5_get_time(void);
H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/);
H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/);
+/* getopt(3) equivalent that papers over the lack of long options on BSD
+ * and lack of Windows support.
+ */
+H5_DLLVAR int H5_opterr; /* get_option prints errors if this is on */
+H5_DLLVAR int H5_optind; /* token pointer */
+H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */
+
+enum h5_arg_level {
+ no_arg = 0, /* doesn't take an argument */
+ require_arg, /* requires an argument */
+ optional_arg /* argument is optional */
+};
+
+/*
+ * get_option determines which options are specified on the command line and
+ * returns a pointer to any arguments possibly associated with the option in
+ * the ``H5_optarg'' variable. get_option returns the shortname equivalent of
+ * the option. The long options are specified in the following way:
+ *
+ * struct h5_long_options foo[] = {
+ * { "filename", require_arg, 'f' },
+ * { "append", no_arg, 'a' },
+ * { "width", require_arg, 'w' },
+ * { NULL, 0, 0 }
+ * };
+ *
+ * Long named options can have arguments specified as either:
+ *
+ * ``--param=arg'' or ``--param arg''
+ *
+ * Short named options can have arguments specified as either:
+ *
+ * ``-w80'' or ``-w 80''
+ *
+ * and can have more than one short named option specified at one time:
+ *
+ * -aw80
+ *
+ * in which case those options which expect an argument need to come at the
+ * end.
+ */
+struct h5_long_options {
+ const char * name; /* Name of the long option */
+ enum h5_arg_level has_arg; /* Whether we should look for an arg */
+ char shortval; /* The shortname equivalent of long arg
+ * this gets returned from get_option
+ */
+};
+
+H5_DLL int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt);
+
#ifdef H5_HAVE_PARALLEL
/* Generic MPI functions */
H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count);
diff --git a/src/H5public.h b/src/H5public.h
index b319550..3e59e24 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -34,129 +34,238 @@
#ifdef H5_HAVE_FEATURES_H
#include <features.h> /* For setting POSIX, BSD, etc. compatibility */
#endif
-#ifdef H5_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef H5_STDC_HEADERS
-#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */
-#include <stdarg.h> /* For variadic functions in H5VLpublic.h */
-#endif
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
-#include <stdint.h> /* For C9x types */
-#endif
-#else
-#ifdef H5_HAVE_STDINT_H_CXX
-#include <stdint.h> /* For C9x types (when included from C++) */
-#endif
-#endif
-#ifdef H5_HAVE_INTTYPES_H
-#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
+
+/* C library header files for things that appear in HDF5 public headers */
+#ifdef __cplusplus
+#define __STDC_FORMAT_MACROS
#endif
-#ifdef H5_HAVE_STDDEF_H
+#include <inttypes.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdbool.h>
#include <stddef.h>
+#include <stdint.h>
+
+/* Unlike most sys/ headers, which are POSIX-only, sys/types.h is avaible
+ * on Windows, though it doesn't necessarily contain all the POSIX types
+ * we need for HDF5 (e.g. ssize_t).
+ */
+#ifdef H5_HAVE_SYS_TYPES_H
+#include <sys/types.h>
#endif
+
#ifdef H5_HAVE_PARALLEL
/* Don't link against MPI C++ bindings */
+#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX 1
-#define OMPI_SKIP_MPICXX 1
+#endif
+#ifndef OMPI_SKIP_MPICXX
+#define OMPI_SKIP_MPICXX 1
+#endif
#include <mpi.h>
#ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */
#include <mpio.h>
#endif
#endif
-/* Include the Windows API adapter header early */
-#include "H5api_adpt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Macros for enabling/disabling particular GCC warnings */
-/* (see the following web-sites for more info:
- * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
- * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
- */
-/* These pragmas are only implemented usefully in gcc 4.6+ */
-#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-#define H5_GCC_DIAG_JOINSTR(x, y) x y
-#define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
-#define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
-#define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR("-W", x))
-#define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
-#else
-#define H5_GCC_DIAG_OFF(x)
-#define H5_GCC_DIAG_ON(x)
-#endif
-
/* Macro to hide a symbol from further preprocessor substitutions */
#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 "7"
+/**
+ * Full version string
+ */
+#define H5_VERS_INFO "HDF5 library version: 1.13.0-7"
#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))
-/*
+/* Macros for various environment variables that HDF5 interprets */
+/**
+ * Used to specify the name of an HDF5 Virtual File Driver to use as
+ * the default file driver for file access. Setting this environment
+ * variable overrides the default file driver for File Access Property
+ * Lists.
+ */
+#define HDF5_DRIVER "HDF5_DRIVER"
+/**
+ * Used to specify a configuration string for the HDF5 Virtual File
+ * Driver being used for file access.
+ */
+#define HDF5_DRIVER_CONFIG "HDF5_DRIVER_CONFIG"
+/**
+ * Used to specify the name of an HDF5 Virtual Object Layer Connector
+ * to use as the default VOL connector for file access. Setting this
+ * environment variable overrides the default VOL connector for File
+ * Access Property Lists.
+ */
+#define HDF5_VOL_CONNECTOR "HDF5_VOL_CONNECTOR"
+/**
+ * Used to specify a delimiter-separated (currently, ';' for Windows
+ * and ':' for other systems) list of paths that HDF5 should search
+ * when loading plugins.
+ */
+#define HDF5_PLUGIN_PATH "HDF5_PLUGIN_PATH"
+/**
+ * Used to control the loading of HDF5 plugins at runtime. If this
+ * environment variable is set to the special string "::" (defined
+ * in H5PLpublic.h as H5PL_NO_PLUGIN), then dynamic loading of any
+ * HDF5 plugins will be disabled. No other values are valid for this
+ * environment variable.
+ */
+#define HDF5_PLUGIN_PRELOAD "HDF5_PLUGIN_PRELOAD"
+/**
+ * Used to control whether HDF5 uses file locking when creating or
+ * opening a file. Valid values for this environment variable are
+ * as follows:
+ *
+ * "TRUE" or "1" - Request that file locks should be used
+ * "FALSE" or "0" - Request that file locks should NOT be used
+ * "BEST_EFFORT" - Request that file locks should be used and
+ * that any locking errors caused by file
+ * locking being disabled on the system
+ * should be ignored
+ */
+#define HDF5_USE_FILE_LOCKING "HDF5_USE_FILE_LOCKING"
+/**
+ * Used to instruct HDF5 not to cleanup files created during testing.
+ */
+#define HDF5_NOCLEANUP "HDF5_NOCLEANUP"
+
+/**
* 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:
+ * The negative failure value is most commonly -1, but don't bet on it.
*
- * if((dset = H5Dopen2(file, name)) < 0)
- * fprintf(stderr, "unable to open the requested dataset\n");
+ * The proper way to detect failure is something like:
+ * \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
- * (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");
- * }
- */
-#ifdef H5_HAVE_STDBOOL_H
+/**
+ * C99-style Boolean type. Successful return values are zero (false) or positive
+ * (true). The typical true value is 1 but don't bet on it.
+ * \attention Boolean functions cannot fail.
+ */
#include <stdbool.h>
-#else /* H5_HAVE_STDBOOL_H */
-#ifndef __cplusplus
-#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0)
-#define bool _Bool
-#else
-#define bool unsigned int
-#endif
-#define true 1
-#define false 0
-#endif /* __cplusplus */
-#endif /* H5_HAVE_STDBOOL_H */
typedef bool hbool_t;
-typedef int htri_t;
+/**
+ * Three-valued Boolean type. 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:
+ * \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
+ */
+typedef int htri_t;
-/* Define the ssize_t type if it not is defined */
+/* The signed version of size_t
+ *
+ * ssize_t is POSIX and not defined in any C standard. It's used in some
+ * public HDF5 API calls so this work-around will define it if it's not
+ * present.
+ *
+ * Use of ssize_t should be discouraged in new code.
+ */
#if H5_SIZEOF_SSIZE_T == 0
/* Undefine this size, we will re-define it in one of the sections below */
#undef H5_SIZEOF_SSIZE_T
@@ -174,141 +283,50 @@ typedef long long ssize_t;
#endif
#endif
-/* int64_t type is used for creation order field for links. It may be
- * defined in Posix.1g, otherwise it is defined here.
- */
-#if H5_SIZEOF_INT64_T >= 8
-#elif H5_SIZEOF_INT >= 8
-typedef int int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 8
-typedef long int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG
-#elif H5_SIZEOF_LONG_LONG >= 8
-typedef long long int64_t;
-#undef H5_SIZEOF_INT64_T
-#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG
-#else
-#error "nothing appropriate for int64_t"
-#endif
-
-/* uint64_t type is used for fields for H5O_info_t. It may be
- * defined in Posix.1g, otherwise it is defined here.
+/**
+ * The size of file objects.
+ *
+ * \internal Defined as a (minimum) 64-bit integer type.
*/
-#if H5_SIZEOF_UINT64_T >= 8
-#ifndef UINT64_MAX
-#define UINT64_MAX ((uint64_t)-1)
-#endif
-#elif H5_SIZEOF_INT >= 8
-typedef unsigned uint64_t;
-#define UINT64_MAX UINT_MAX
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 8
-typedef unsigned long uint64_t;
-#define UINT64_MAX ULONG_MAX
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG
-#elif H5_SIZEOF_LONG_LONG >= 8
-typedef unsigned long long uint64_t;
-#define UINT64_MAX ULLONG_MAX
-#undef H5_SIZEOF_UINT64_T
-#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG
-#else
-#error "nothing appropriate for uint64_t"
-#endif
-
-/*
- * The sizes of file objects have their own types defined here, use a 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
+typedef uint64_t hsize_t;
+/**
+ * The size of file objects. Used when negative values are needed to indicate errors.
+ *
+ * \internal Defined as a (minimum) 64-bit integer type. Use of hssize_t
+ * should be discouraged in new code.
+ */
+typedef int64_t hssize_t;
+#define PRIdHSIZE PRId64
+#define PRIiHSIZE PRIi64
+#define PRIoHSIZE PRIo64
+#define PRIuHSIZE PRIu64
+#define PRIxHSIZE PRIx64
+#define PRIXHSIZE PRIX64
+#define H5_SIZEOF_HSIZE_T 8
+#define H5_SIZEOF_HSSIZE_T 8
+#define HSIZE_UNDEF UINT64_MAX
-/*
- * File addresses have their own types.
- */
-#if H5_SIZEOF_INT >= 8
-typedef unsigned haddr_t;
-#define HADDR_UNDEF UINT_MAX
-#define H5_SIZEOF_HADDR_T H5_SIZEOF_INT
-#ifdef H5_HAVE_PARALLEL
-#define HADDR_AS_MPI_TYPE MPI_UNSIGNED
-#endif /* H5_HAVE_PARALLEL */
-#define PRIdHADDR "d"
-#define PRIoHADDR "o"
-#define PRIuHADDR "u"
-#define PRIxHADDR "x"
-#define PRIXHADDR "X"
-#elif H5_SIZEOF_LONG >= 8
-typedef unsigned long haddr_t;
-#define HADDR_UNDEF ULONG_MAX
-#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG
-#ifdef H5_HAVE_PARALLEL
-#define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG
-#endif /* H5_HAVE_PARALLEL */
-#define PRIdHADDR "ld"
-#define PRIoHADDR "lo"
-#define PRIuHADDR "lu"
-#define PRIxHADDR "lx"
-#define PRIXHADDR "lX"
-#elif H5_SIZEOF_LONG_LONG >= 8
-typedef unsigned long long haddr_t;
-#define HADDR_UNDEF ULLONG_MAX
-#define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG
-#ifdef H5_HAVE_PARALLEL
-#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
-#endif /* H5_HAVE_PARALLEL */
-#define PRIdHADDR H5_PRINTF_LL_WIDTH "d"
-#define PRIoHADDR H5_PRINTF_LL_WIDTH "o"
-#define PRIuHADDR H5_PRINTF_LL_WIDTH "u"
-#define PRIxHADDR H5_PRINTF_LL_WIDTH "x"
-#define PRIXHADDR H5_PRINTF_LL_WIDTH "X"
-#else
-#error "nothing appropriate for haddr_t"
-#endif
+/**
+ * The address of an object in the file.
+ *
+ * \internal Defined as a (minimum) 64-bit unsigned integer type.
+ */
+typedef uint64_t haddr_t;
+#define PRIdHADDR PRId64
+#define PRIoHADDR PRIo64
+#define PRIuHADDR PRIu64
+#define PRIxHADDR PRIx64
+#define PRIXHADDR PRIX64
+#define H5_SIZEOF_HADDR_T 8
+#define HADDR_UNDEF UINT64_MAX
#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR
#define HADDR_MAX (HADDR_UNDEF - 1)
-/* uint32_t type is used for creation order field for messages. It may be
- * defined in Posix.1g, otherwise it is defined here.
- */
-#if H5_SIZEOF_UINT32_T >= 4
-#elif H5_SIZEOF_SHORT >= 4
-typedef short uint32_t;
-#undef H5_SIZEOF_UINT32_T
-#define H5_SIZEOF_UINT32_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 4
-typedef unsigned int uint32_t;
-#undef H5_SIZEOF_UINT32_T
-#define H5_SIZEOF_UINT32_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 4
-typedef unsigned long uint32_t;
-#undef H5_SIZEOF_UINT32_T
-#define H5_SIZEOF_UINT32_T H5_SIZEOF_LONG
-#else
-#error "nothing appropriate for uint32_t"
+#ifdef H5_HAVE_PARALLEL
+#define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
#endif
-//! [H5_iter_order_t_snip]
-
+//! <!-- [H5_iter_order_t_snip] -->
/**
* Common iteration orders
*/
@@ -319,19 +337,17 @@ 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
* that positive value to the function that called the iterator)
*/
-#define H5_ITER_ERROR (-1)
-#define H5_ITER_CONT (0)
-#define H5_ITER_STOP (1)
-
-//! [H5_index_t_snip]
+#define H5_ITER_ERROR (-1) /**< Error, stop iteration */
+#define H5_ITER_CONT (0) /**< Continue iteration */
+#define H5_ITER_STOP (1) /**< Stop iteration, short-circuit success */
+//! <!-- [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
@@ -343,18 +359,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
@@ -364,17 +379,17 @@ typedef struct H5_ih_info_t {
*/
#define H5O_MAX_TOKEN_SIZE (16)
-//! [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
@@ -394,6 +409,13 @@ typedef struct H5_alloc_stats_t {
*/
typedef void (*H5_atclose_func_t)(void *ctx);
+/* API adapter header (defines H5_DLL, etc.) */
+#include "H5api_adpt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Functions in H5.c */
/**
* \ingroup H5
@@ -435,7 +457,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);
/**
@@ -659,7 +681,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 2ac3f93..9a966b0 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -66,7 +66,7 @@
/* Track whether tzset routine was called */
static hbool_t H5_ntzset = FALSE;
-#ifndef HDvasprintf
+#ifndef H5_HAVE_VASPRINTF
/* HDvasprintf provides vasprintf-like function on targets where it is
* unavailable.
*/
@@ -94,132 +94,7 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap)
}
return -1;
}
-#endif
-
-/*-------------------------------------------------------------------------
- * Function: HDstrtoll
- *
- * Purpose: Converts the string S to an int64_t value according to the
- * given BASE, which must be between 2 and 36 inclusive, or be
- * the special value zero.
- *
- * The string must begin with an arbitrary amount of white space
- * (as determined by isspace(3c)) followed by a single optional
- * `+' or `-' sign. If BASE is zero or 16 the string may then
- * include a `0x' or `0X' prefix, and the number will be read in
- * base 16; otherwise a zero BASE is taken as 10 (decimal)
- * unless the next character is a `0', in which case it is taken
- * as 8 (octal).
- *
- * The remainder of the string is converted to an int64_t in the
- * obvious manner, stopping at the first character which is not
- * a valid digit in the given base. (In bases above 10, the
- * letter `A' in either upper or lower case represetns 10, `B'
- * represents 11, and so forth, with `Z' representing 35.)
- *
- * If REST is not null, the address of the first invalid
- * character in S is stored in *REST. If there were no digits
- * at all, the original value of S is stored in *REST. Thus, if
- * *S is not `\0' but **REST is `\0' on return the entire string
- * was valid.
- *
- * Return: Success: The result.
- *
- * Failure: If the input string does not contain any
- * digits then zero is returned and REST points
- * to the original value of S. If an overflow
- * or underflow occurs then the maximum or
- * minimum possible value is returned and the
- * global `errno' is set to ERANGE. If BASE is
- * incorrect then zero is returned.
- *
- * Programmer: Robb Matzke
- * Thursday, April 9, 1998
- *
- *-------------------------------------------------------------------------
- */
-#ifndef HDstrtoll
-int64_t
-HDstrtoll(const char *s, const char **rest, int base)
-{
- int64_t sign = 1, acc = 0;
- hbool_t overflow = FALSE;
-
- errno = 0;
- if (!s || (base && (base < 2 || base > 36))) {
- if (rest)
- *rest = s;
- return 0;
- }
-
- /* Skip white space */
- while (HDisspace(*s))
- s++;
-
- /* Optional minus or plus sign */
- if ('+' == *s) {
- s++;
- }
- else if ('-' == *s) {
- sign = -1;
- s++;
- }
-
- /* Zero base prefix */
- if (0 == base && '0' == *s && ('x' == s[1] || 'X' == s[1])) {
- base = 16;
- s += 2;
- }
- else if (0 == base && '0' == *s) {
- base = 8;
- s++;
- }
- else if (0 == base) {
- base = 10;
- }
-
- /* Digits */
- while ((base <= 10 && *s >= '0' && *s < '0' + base) ||
- (base > 10 && ((*s >= '0' && *s <= '9') || (*s >= 'a' && *s < 'a' + base - 10) ||
- (*s >= 'A' && *s < 'A' + base - 10)))) {
- if (!overflow) {
- int64_t digit = 0;
-
- if (*s >= '0' && *s <= '9')
- digit = *s - '0';
- else if (*s >= 'a' && *s <= 'z')
- digit = (*s - 'a') + 10;
- else
- digit = (*s - 'A') + 10;
-
- if (acc * base + digit < acc) {
- overflow = TRUE;
- }
- else {
- acc = acc * base + digit;
- }
- }
- s++;
- }
-
- /* Overflow */
- if (overflow) {
- if (sign > 0) {
- acc = ((uint64_t)1 << (8 * sizeof(int64_t) - 1)) - 1;
- }
- else {
- acc = (int64_t)((uint64_t)1 << (8 * sizeof(int64_t) - 1));
- }
- errno = ERANGE;
- }
-
- /* Return values */
- acc *= sign;
- if (rest)
- *rest = s;
- return acc;
-} /* end HDstrtoll() */
-#endif
+#endif /* H5_HAVE_VASPRINTF */
/*-------------------------------------------------------------------------
* Function: HDrand/HDsrand
@@ -460,6 +335,9 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
* Interestingly, getenv *is* available in the Windows
* POSIX layer, just not setenv.
*
+ * Note: Passing an empty string ("") for the value will remove
+ * the variable from the environment (like unsetenv(3))
+ *
* Return: Success: 0
* Failure: non-zero error code
*
@@ -471,14 +349,14 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
int
Wsetenv(const char *name, const char *value, int overwrite)
{
- size_t bufsize;
- errno_t err;
-
/* If we're not overwriting, check if the environment variable exists.
* If it does (i.e.: the required buffer size to store the variable's
* value is non-zero), then return an error code.
*/
if (!overwrite) {
+ size_t bufsize;
+ errno_t err;
+
err = getenv_s(&bufsize, NULL, 0, name);
if (err || bufsize)
return (int)err;
@@ -487,7 +365,7 @@ Wsetenv(const char *name, const char *value, int overwrite)
return (int)_putenv_s(name, value);
} /* end Wsetenv() */
-#ifdef H5_HAVE_WINSOCK2_H
+#ifdef H5_HAVE_WIN32_API
#pragma comment(lib, "advapi32.lib")
#endif
@@ -572,41 +450,15 @@ char *
Wgetlogin(void)
{
-#ifdef H5_HAVE_WINSOCK2_H
- long bufferCount = WloginBuffer_count;
- if (GetUserName(Wlogin_buffer, &bufferCount) == 0)
+#ifdef H5_HAVE_WIN32_API
+ DWORD bufferCount = WloginBuffer_count;
+ if (GetUserName(Wlogin_buffer, &bufferCount) != 0)
return (Wlogin_buffer);
else
-#endif /* H5_HAVE_WINSOCK2_H */
+#endif
return NULL;
}
-int
-c99_snprintf(char *str, size_t size, const char *format, ...)
-{
- int count;
- va_list ap;
-
- HDva_start(ap, format);
- count = c99_vsnprintf(str, size, format, ap);
- HDva_end(ap);
-
- return count;
-}
-
-int
-c99_vsnprintf(char *str, size_t size, const char *format, va_list ap)
-{
- int count = -1;
-
- if (size != 0)
- count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
- if (count == -1)
- count = _vscprintf(format, ap);
-
- return count;
-}
-
/*-------------------------------------------------------------------------
* Function: Wflock
*
@@ -618,110 +470,45 @@ c99_vsnprintf(char *str, size_t size, const char *format, va_list ap)
*-------------------------------------------------------------------------
*/
int
-Wflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation)
+Wflock(int fd, int operation)
{
-/* This is a no-op while we implement a Win32 VFD */
-#if 0
-int
-Wflock(int fd, int operation) {
-
- HANDLE hFile;
- DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
- DWORD dwReserved = 0;
- /* MAXDWORD for entire file */
- DWORD nNumberOfBytesToLockLow = MAXDWORD;
- DWORD nNumberOfBytesToLockHigh = MAXDWORD;
- /* Must initialize OVERLAPPED struct */
- OVERLAPPED overlapped = {0};
+ HANDLE hFile;
+ DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
+ DWORD dwReserved = 0;
+ /* MAXDWORD locks the entire file */
+ DWORD nNumberOfBytesToLockLow = MAXDWORD;
+ DWORD nNumberOfBytesToLockHigh = MAXDWORD;
+ /* Must initialize OVERLAPPED struct */
+ OVERLAPPED overlapped = {0};
/* Get Windows HANDLE */
- hFile = _get_osfhandle(fd);
+ if (INVALID_HANDLE_VALUE == (hFile = (HANDLE)_get_osfhandle(fd)))
+ return -1;
/* Convert to Windows flags */
- if(operation & LOCK_EX)
+ if (operation & LOCK_EX)
dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;
/* Lock or unlock */
- if(operation & LOCK_UN)
- if(0 == UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow,
- nNumberOfBytesToLockHigh, &overlapped))
- return -1;
- else
- if(0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow,
- nNumberOfBytesToLockHigh, &overlapped))
+ if (operation & LOCK_UN) {
+ if (0 ==
+ UnlockFileEx(hFile, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &overlapped)) {
+ /* Attempting to unlock an already unlocked file will fail and this can happen
+ * in H5Fstart_swmr_write(). For now, just ignore the "error" (error code: 0x9e / 158).
+ */
+ if (GetLastError() != 158)
+ return -1;
+ }
+ }
+ else {
+ if (0 == LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh,
+ &overlapped))
return -1;
-#endif /* 0 */
- return 0;
-} /* end Wflock() */
+ }
-/*--------------------------------------------------------------------------
- * Function: Wnanosleep
- *
- * Purpose: Sleep for a given # of nanoseconds (Windows version)
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Dana Robinson
- * Fall 2016
- *--------------------------------------------------------------------------
- */
-int
-Wnanosleep(const struct timespec *req, struct timespec *rem)
-{
- /* XXX: Currently just a placeholder */
return 0;
-
-} /* end Wnanosleep() */
-
-/*-------------------------------------------------------------------------
- * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf
- *
- * Purpose: Wrapper function for round functions for use with VS2012
- * and earlier.
- *
- * Return: The rounded value that was passed in.
- *
- * Programmer: Dana Robinson
- * December 2016
- *
- *-------------------------------------------------------------------------
- */
-long long
-Wllround(double arg)
-{
- return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
-}
-
-long long
-Wllroundf(float arg)
-{
- return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
-
-long
-Wlround(double arg)
-{
- return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
-}
-
-long
-Wlroundf(float arg)
-{
- return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
-
-double
-Wround(double arg)
-{
- return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5);
-}
-
-float
-Wroundf(float arg)
-{
- return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
-}
+} /* end Wflock() */
/*-------------------------------------------------------------------------
* Function: H5_get_utf16_str
@@ -737,7 +524,7 @@ Wroundf(float arg)
*
*-------------------------------------------------------------------------
*/
-const wchar_t *
+wchar_t *
H5_get_utf16_str(const char *s)
{
int nwchars = -1; /* Length of the UTF-16 buffer */
@@ -833,7 +620,7 @@ int
Wremove_utf8(const char *path)
{
wchar_t *wpath = NULL; /* UTF-16 version of the path */
- int ret;
+ int ret = -1;
/* Convert the input UTF-8 path to UTF-16 */
if (NULL == (wpath = H5_get_utf16_str(path)))
@@ -945,8 +732,8 @@ H5_build_extpath(const char *name, char **extpath /*out*/)
HDstrncpy(full_path, cwdpath, cwdlen + 1);
if (!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1]))
- HDstrncat(full_path, H5_DIR_SEPS, HDstrlen(H5_DIR_SEPS));
- HDstrncat(full_path, new_name, HDstrlen(new_name));
+ HDstrncat(full_path, H5_DIR_SEPS, path_len - (cwdlen + 1));
+ HDstrncat(full_path, new_name, path_len - (cwdlen + 1) - HDstrlen(H5_DIR_SEPS));
} /* end if */
} /* end else */
@@ -1052,24 +839,54 @@ done:
*
* Purpose: Sleep for a given # of nanoseconds
*
- * Return: SUCCEED/FAIL
+ * Note that commodity hardware is probably going to have a
+ * resolution of milliseconds, not nanoseconds.
*
- * Programmer: Quincey Koziol
- * October 01, 2016
+ * Return: void
*--------------------------------------------------------------------------
*/
void
H5_nanosleep(uint64_t nanosec)
{
- struct timespec sleeptime; /* Struct to hold time to sleep */
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
- /* Set up time to sleep */
- sleeptime.tv_sec = 0;
- sleeptime.tv_nsec = (long)nanosec;
+#ifdef H5_HAVE_WIN32_API
+ DWORD dwMilliseconds = (DWORD)HDceil(nanosec / 1.0e6);
+ DWORD ignore;
- HDnanosleep(&sleeptime, NULL);
+ /* Windows can't sleep at a ns resolution. Best we can do is ~1 ms. We
+ * don't care about the return value since the second parameter
+ * (bAlertable) is FALSE, so it will always be zero.
+ */
+ ignore = SleepEx(dwMilliseconds, FALSE);
+
+#else
+
+ const uint64_t nanosec_per_sec = 1000 * 1000 * 1000;
+ struct timespec sleeptime; /* Struct to hold time to sleep */
+
+ /* Set up time to sleep
+ *
+ * Assuming ILP32 or LP64 or wider architecture, (long)operand
+ * satisfies 0 <= operand < nanosec_per_sec < LONG_MAX.
+ *
+ * It's harder to be sure that we don't overflow time_t.
+ */
+ sleeptime.tv_sec = (time_t)(nanosec / nanosec_per_sec);
+ sleeptime.tv_nsec = (long)(nanosec % nanosec_per_sec);
+
+ /* Sleep for up to `sleeptime` and, in the event of an interruption,
+ * save the unslept time back to `sleeptime`.
+ */
+ while (HDnanosleep(&sleeptime, &sleeptime) == -1) {
+ /* If we were just interrupted, sleep for the remaining time.
+ * Otherwise, the error was essentially impossible, so just stop
+ * sleeping.
+ */
+ if (errno != EINTR)
+ break;
+ }
+#endif
FUNC_LEAVE_NOAPI_VOID
} /* end H5_nanosleep() */
@@ -1119,3 +936,167 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_expand_windows_env_vars() */
#endif /* H5_HAVE_WIN32_API */
+
+/* Global variables */
+int H5_opterr = 1; /* Get_option prints errors if this is on */
+int H5_optind = 1; /* Token pointer */
+const char *H5_optarg; /* Flag argument (or value) */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_get_option
+ *
+ * Purpose: Determine the command-line options a user specified. We can
+ * accept both short and long type command-lines.
+ *
+ * Return: Success: The short valued "name" of the command line
+ * parameter or EOF if there are no more
+ * parameters to process.
+ *
+ * Failure: A question mark.
+ *-------------------------------------------------------------------------
+ */
+int
+H5_get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts)
+{
+ static int sp = 1; /* character index in current token */
+ int optchar = '?'; /* option character passed back to user */
+
+ if (sp == 1) {
+ /* check for more flag-like tokens */
+ if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') {
+ return EOF;
+ }
+ else if (HDstrcmp(argv[H5_optind], "--") == 0) {
+ H5_optind++;
+ return EOF;
+ }
+ }
+
+ if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') {
+ /* long command line option */
+ int i;
+ const char ch = '=';
+ char * arg = HDstrdup(&argv[H5_optind][2]);
+ size_t arg_len = 0;
+
+ H5_optarg = strchr(&argv[H5_optind][2], ch);
+ arg_len = HDstrlen(&argv[H5_optind][2]);
+ if (H5_optarg) {
+ arg_len -= HDstrlen(H5_optarg);
+ H5_optarg++; /* skip the equal sign */
+ }
+ arg[arg_len] = 0;
+
+ for (i = 0; l_opts && l_opts[i].name; i++) {
+ if (HDstrcmp(arg, l_opts[i].name) == 0) {
+ /* we've found a matching long command line flag */
+ optchar = l_opts[i].shortval;
+
+ if (l_opts[i].has_arg != no_arg) {
+ if (H5_optarg == NULL) {
+ if (l_opts[i].has_arg != optional_arg) {
+ if (H5_optind < (argc - 1))
+ if (argv[H5_optind + 1][0] != '-')
+ H5_optarg = argv[++H5_optind];
+ }
+ else if (l_opts[i].has_arg == require_arg) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
+
+ optchar = '?';
+ }
+ }
+ }
+ else {
+ if (H5_optarg) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
+
+ optchar = '?';
+ }
+ }
+ break;
+ }
+ }
+
+ if (l_opts[i].name == NULL) {
+ /* exhausted all of the l_opts we have and still didn't match */
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
+
+ optchar = '?';
+ }
+
+ H5_optind++;
+ sp = 1;
+
+ HDfree(arg);
+ }
+ else {
+ register char *cp; /* pointer into current token */
+
+ /* short command line option */
+ optchar = argv[H5_optind][sp];
+
+ if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar);
+
+ /* if no chars left in this token, move to next token */
+ if (argv[H5_optind][++sp] == '\0') {
+ H5_optind++;
+ sp = 1;
+ }
+ return '?';
+ }
+
+ if (*++cp == ':') {
+ /* if a value is expected, get it */
+ if (argv[H5_optind][sp + 1] != '\0') {
+ /* flag value is rest of current token */
+ H5_optarg = &argv[H5_optind++][sp + 1];
+ }
+ else if (++H5_optind >= argc) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar);
+
+ optchar = '?';
+ }
+ else {
+ /* flag value is next token */
+ H5_optarg = argv[H5_optind++];
+ }
+
+ sp = 1;
+ }
+ /* wildcard argument */
+ else if (*cp == '*') {
+ /* check the next argument */
+ H5_optind++;
+ /* we do have an extra argument, check if not last */
+ if ((H5_optind + 1) < argc) {
+ if (argv[H5_optind][0] != '-') {
+ H5_optarg = argv[H5_optind++];
+ }
+ else {
+ H5_optarg = NULL;
+ }
+ }
+ else {
+ H5_optarg = NULL;
+ }
+ }
+ else {
+ /* set up to look at next char in token, next time */
+ if (argv[H5_optind][++sp] == '\0') {
+ /* no more in current token, so setup next token */
+ H5_optind++;
+ sp = 1;
+ }
+ H5_optarg = NULL;
+ }
+ }
+
+ /* return the current flag character found */
+ return optchar;
+}
diff --git a/src/H5timer.c b/src/H5timer.c
index 54a3365..b2cc5f0 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -42,9 +42,9 @@
#define H5TIMER_TIME_STRING_LEN 1536
/* Conversion factors */
-#define H5_SEC_PER_DAY (double)(24.0F * 60.0F * 60.0F)
-#define H5_SEC_PER_HOUR (double)(60.0F * 60.0F)
-#define H5_SEC_PER_MIN (double)(60.0F)
+#define H5_SEC_PER_DAY (24.0 * 60.0 * 60.0)
+#define H5_SEC_PER_HOUR (60.0 * 60.0)
+#define H5_SEC_PER_MIN (60.0)
/******************/
/* Local Typedefs */
@@ -100,13 +100,13 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds)
{
double bw;
- if (nseconds <= (double)0.0F)
+ if (nseconds <= 0.0)
HDstrcpy(buf, " NaN");
else {
bw = nbytes / nseconds;
- if (H5_DBL_ABS_EQUAL(bw, (double)0.0F))
+ if (H5_DBL_ABS_EQUAL(bw, 0.0))
HDstrcpy(buf, "0.000 B/s");
- else if (bw < (double)1.0F)
+ else if (bw < 1.0)
HDsprintf(buf, "%10.4e", bw);
else if (bw < (double)H5_KB) {
HDsprintf(buf, "%05.4f", bw);
@@ -224,7 +224,7 @@ H5_now_usec(void)
double
H5_get_time(void)
{
- double ret_value = (double)0.0f;
+ double ret_value = 0.0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -233,14 +233,14 @@ H5_get_time(void)
struct timespec ts;
HDclock_gettime(CLOCK_MONOTONIC, &ts);
- ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / (double)1000000000.0f);
+ ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY)
{
struct timeval now_tv;
HDgettimeofday(&now_tv, NULL);
- ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / (double)1000000.0f);
+ ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / 1000000.0);
}
#else
ret_value = (double)HDtime(NULL);
@@ -289,8 +289,8 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/)
if (HDgetrusage(RUSAGE_SELF, &res) < 0)
return -1;
- times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / (double)1.0E6F);
- times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / (double)1.0E6F);
+ times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / 1.0E6);
+ times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / 1.0E6);
}
#else
/* No suitable way to get system/user times */
@@ -589,7 +589,7 @@ H5_timer_get_time_string(double seconds)
double remainder_sec = 0.0;
/* Extract larger time units from count of seconds */
- if (seconds > (double)60.0F) {
+ if (seconds > 60.0) {
/* Set initial # of seconds */
remainder_sec = seconds;
@@ -617,19 +617,19 @@ H5_timer_get_time_string(double seconds)
* time unit. Perhaps this could be passed as an integer.
* (name? round_up_size? ?)
*/
- if (seconds < (double)0.0F)
+ if (seconds < 0.0)
HDsprintf(s, "N/A");
- else if (H5_DBL_ABS_EQUAL((double)0.0F, seconds))
+ else if (H5_DBL_ABS_EQUAL(0.0, seconds))
HDsprintf(s, "0.0 s");
- else if (seconds < (double)1.0E-6F)
+ else if (seconds < 1.0E-6)
/* t < 1 us, Print time in ns */
- HDsprintf(s, "%.f ns", seconds * (double)1.0E9F);
- else if (seconds < (double)1.0E-3F)
+ HDsprintf(s, "%.f ns", seconds * 1.0E9);
+ else if (seconds < 1.0E-3)
/* t < 1 ms, Print time in us */
- HDsprintf(s, "%.1f us", seconds * (double)1.0E6F);
- else if (seconds < (double)1.0F)
+ HDsprintf(s, "%.1f us", seconds * 1.0E6);
+ else if (seconds < 1.0)
/* t < 1 s, Print time in ms */
- HDsprintf(s, "%.1f ms", seconds * (double)1.0E3F);
+ HDsprintf(s, "%.1f ms", seconds * 1.0E3);
else if (seconds < H5_SEC_PER_MIN)
/* t < 1 m, Print time in s */
HDsprintf(s, "%.2f s", seconds);
diff --git a/src/H5trace.c b/src/H5trace.c
index aa9cfd4..0797f65 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1046,6 +1046,65 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'V': /* H5FD_class_value_t */
+ {
+ H5FD_class_value_t class_val =
+ (H5FD_class_value_t)HDva_arg(ap, H5FD_class_value_t);
+
+ switch (class_val) {
+ case H5_VFD_INVALID:
+ H5RS_acat(rs, "H5_VFD_INVALID");
+ break;
+ case H5_VFD_SEC2:
+ H5RS_acat(rs, "H5_VFD_SEC2");
+ break;
+ case H5_VFD_CORE:
+ H5RS_acat(rs, "H5_VFD_CORE");
+ break;
+ case H5_VFD_LOG:
+ H5RS_acat(rs, "H5_VFD_LOG");
+ break;
+ case H5_VFD_FAMILY:
+ H5RS_acat(rs, "H5_VFD_FAMILY");
+ break;
+ case H5_VFD_MULTI:
+ H5RS_acat(rs, "H5_VFD_MULTI");
+ break;
+ case H5_VFD_STDIO:
+ H5RS_acat(rs, "H5_VFD_STDIO");
+ break;
+#ifdef H5_HAVE_PARALLEL
+ case H5_VFD_MPIO:
+ H5RS_acat(rs, "H5_VFD_MPIO");
+ break;
+#endif
+#ifdef H5_HAVE_DIRECT
+ case H5_VFD_DIRECT:
+ H5RS_acat(rs, "H5_VFD_DIRECT");
+ break;
+#endif
+#ifdef H5_HAVE_MIRROR_VFD
+ case H5_VFD_MIRROR:
+ H5RS_acat(rs, "H5_VFD_MIRROR");
+ break;
+#endif
+#ifdef H5_HAVE_LIBHDFS
+ case H5_VFD_HDFS:
+ H5RS_acat(rs, "H5_VFD_HDFS");
+ break;
+#endif
+#ifdef H5_HAVE_ROS3_VFD
+ case H5_VFD_ROS3:
+ H5RS_acat(rs, "H5_VFD_ROS3");
+ break;
+#endif
+ default:
+ H5RS_asprintf_cat(rs, "%ld", (long)class_val);
+ break;
+ }
+ } /* end block */
+ break;
+
default:
H5RS_asprintf_cat(rs, "BADTYPE(D%c)", type[1]);
goto error;
@@ -1083,6 +1142,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'C': /* H5ES_event_complete_func_t */
+ {
+ H5ES_event_complete_func_t cfunc =
+ (H5ES_event_complete_func_t)HDva_arg(ap, H5ES_event_complete_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc);
+ } /* end block */
+ break;
+
case 'd': /* H5E_direction_t */
{
H5E_direction_t direction = (H5E_direction_t)HDva_arg(ap, int);
@@ -1111,6 +1179,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'I': /* H5ES_event_insert_func_t */
+ {
+ H5ES_event_insert_func_t ifunc =
+ (H5ES_event_insert_func_t)HDva_arg(ap, H5ES_event_insert_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifunc);
+ } /* end block */
+ break;
+
case 's': /* H5ES_status_t */
{
H5ES_status_t status = (H5ES_status_t)HDva_arg(ap, int);
@@ -1124,6 +1201,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5ES_STATUS_SUCCEED");
break;
+ case H5ES_STATUS_CANCELED:
+ H5RS_acat(rs, "H5ES_STATUS_CANCELED");
+ break;
+
case H5ES_STATUS_FAIL:
H5RS_acat(rs, "H5ES_STATUS_FAIL");
break;
@@ -1467,6 +1548,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'c': /* H5_atclose_func_t */
+ {
+ H5_atclose_func_t cfunc = (H5_atclose_func_t)HDva_arg(ap, H5_atclose_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc);
+ } /* end block */
+ break;
+
case 's': /* hssize_t */
{
hssize_t hssize = HDva_arg(ap, hssize_t);
@@ -2873,6 +2962,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_ATTR_DELETE");
break;
+ case H5VL_ATTR_DELETE_BY_IDX:
+ H5RS_acat(rs, "H5VL_ATTR_DELETE_BY_IDX");
+ break;
+
case H5VL_ATTR_EXISTS:
H5RS_acat(rs, "H5VL_ATTR_EXISTS");
break;
@@ -2901,10 +2994,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_BLOB_DELETE");
break;
- case H5VL_BLOB_GETSIZE:
- H5RS_acat(rs, "H5VL_BLOB_GETSIZE");
- break;
-
case H5VL_BLOB_ISNULL:
H5RS_acat(rs, "H5VL_BLOB_ISNULL");
break;
@@ -2985,10 +3074,6 @@ 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;
@@ -3001,6 +3086,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5VL_datatype_get_t get = (H5VL_datatype_get_t)HDva_arg(ap, int);
switch (get) {
+ case H5VL_DATATYPE_GET_BINARY_SIZE:
+ H5RS_acat(rs, "H5VL_DATATYPE_GET_BINARY_SIZE");
+ break;
+
case H5VL_DATATYPE_GET_BINARY:
H5RS_acat(rs, "H5VL_DATATYPE_GET_BINARY");
break;
@@ -3093,14 +3182,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_FILE_REOPEN");
break;
- case H5VL_FILE_MOUNT:
- H5RS_acat(rs, "H5VL_FILE_MOUNT");
- break;
-
- case H5VL_FILE_UNMOUNT:
- H5RS_acat(rs, "H5VL_FILE_UNMOUNT");
- break;
-
case H5VL_FILE_IS_ACCESSIBLE:
H5RS_acat(rs, "H5VL_FILE_IS_ACCESSIBLE");
break;
@@ -3113,10 +3194,6 @@ 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;
@@ -3149,6 +3226,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5VL_group_specific_t specific = (H5VL_group_specific_t)HDva_arg(ap, int);
switch (specific) {
+ case H5VL_GROUP_MOUNT:
+ H5RS_acat(rs, "H5VL_GROUP_MOUNT");
+ break;
+
+ case H5VL_GROUP_UNMOUNT:
+ H5RS_acat(rs, "H5VL_GROUP_UNMOUNT");
+ break;
+
case H5VL_GROUP_FLUSH:
H5RS_acat(rs, "H5VL_GROUP_FLUSH");
break;
@@ -3164,9 +3249,9 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
- case 'k': /* H5VL_link_create_type_t */
+ case 'k': /* H5VL_link_create_t */
{
- H5VL_link_create_type_t create = (H5VL_link_create_type_t)HDva_arg(ap, int);
+ H5VL_link_create_t create = (H5VL_link_create_t)HDva_arg(ap, int);
switch (create) {
case H5VL_LINK_CREATE_HARD:
@@ -3334,22 +3419,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
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;
+ case H5VL_REQUEST_GET_EXEC_TIME:
+ H5RS_acat(rs, "H5VL_REQUEST_GET_EXEC_TIME");
+ break;
+
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
@@ -3608,6 +3685,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG");
break;
+#ifdef H5_HAVE_PARALLEL
case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY:
H5RS_acat(rs, "H5VL_NATIVE_FILE_GET_MPI_ATOMICITY");
break;
@@ -3615,6 +3693,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY:
H5RS_acat(rs, "H5VL_NATIVE_FILE_SET_MPI_ATOMICITY");
break;
+#endif /* H5_HAVE_PARALLEL */
case H5VL_NATIVE_FILE_POST_OPEN:
H5RS_acat(rs, "H5VL_NATIVE_FILE_POST_OPEN");
@@ -3883,8 +3962,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
hssize_t i;
FILE * out = H5_debug_g.trace;
static hbool_t is_first_invocation = TRUE;
- H5_timer_t function_timer = {{0}, {0}, {0}, FALSE};
- H5_timevals_t function_times;
+ H5_timer_t function_timer;
+ H5_timevals_t function_times = {0.0, 0.0, 0.0};
static H5_timer_t running_timer;
H5_timevals_t running_times;
static int current_depth = 0;
@@ -3893,36 +3972,39 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* FUNC_ENTER() should not be called */
if (!out)
- return (double)0.0F; /*tracing is off*/
+ return 0.0; /* Tracing is off */
+
+ /* Initialize the timer for this function */
+ if (H5_debug_g.ttimes)
+ H5_timer_init(&function_timer);
if (H5_debug_g.ttop) {
if (returning) {
if (current_depth > 1) {
--current_depth;
- return (double)0.0F;
- } /* end if */
- } /* end if */
+ return 0.0;
+ }
+ }
else {
if (current_depth > 0) {
- /*do not update last_call_depth*/
+ /* Do not update last_call_depth */
current_depth++;
- return (double)0.0F;
- } /* end if */
- } /* end else */
- } /* end if */
+ return 0.0;
+ }
+ }
+ }
/* Get time for event if the trace times flag is set */
if (is_first_invocation && H5_debug_g.ttimes) {
- /* start the library-wide timer */
+ /* Start the library-wide timer */
is_first_invocation = FALSE;
H5_timer_init(&running_timer);
H5_timer_start(&running_timer);
- } /* end if */
- if (H5_debug_g.ttimes) {
- /* start the timer for this function */
- H5_timer_init(&function_timer);
+ }
+
+ /* Start the timer for this function */
+ if (H5_debug_g.ttimes)
H5_timer_start(&function_timer);
- } /* end if */
/* Create the ref-counted string */
rs = H5RS_create(NULL);
@@ -3945,15 +4027,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5_timer_get_times(running_timer, &running_times);
HDsprintf(tmp, "%.6f", (function_times.elapsed - running_times.elapsed));
H5RS_asprintf_cat(rs, " %*s ", (int)HDstrlen(tmp), "");
- } /* end if */
+ }
for (i = 0; i < current_depth; i++)
H5RS_aputc(rs, '+');
H5RS_asprintf_cat(rs, "%*s%s = ", 2 * current_depth, "", func);
- } /* end if */
+ }
else
/* Continue current line with return value */
H5RS_acat(rs, " = ");
- } /* end if */
+ }
else {
if (current_depth > last_call_depth)
H5RS_acat(rs, " = <delayed>\n");
@@ -3961,11 +4043,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5_timer_get_times(function_timer, &function_times);
H5_timer_get_times(running_timer, &running_times);
H5RS_asprintf_cat(rs, "@%.6f ", (function_times.elapsed - running_times.elapsed));
- } /* end if */
+ }
for (i = 0; i < current_depth; i++)
H5RS_aputc(rs, '+');
H5RS_asprintf_cat(rs, "%*s%s(", 2 * current_depth, "", func);
- } /* end else */
+ }
/* Format arguments into the refcounted string */
HDva_start(ap, type);
@@ -3978,7 +4060,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5_timer_get_times(running_timer, &running_times);
H5RS_asprintf_cat(rs, " @%.6f [dt=%.6f]", (function_times.elapsed - running_times.elapsed),
(function_times.elapsed - *returning));
- } /* end if */
+ }
/* Display generated string */
if (returning)
@@ -3986,7 +4068,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
else {
last_call_depth = current_depth++;
H5RS_acat(rs, ")");
- } /* end else */
+ }
HDfputs(H5RS_get_str(rs), out);
HDfflush(out);
H5RS_decr(rs);
@@ -3994,5 +4076,5 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if (H5_debug_g.ttimes)
return function_times.elapsed;
else
- return (double)0.0F;
+ return 0.0;
} /* end H5_trace() */
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index b4b253f..44cf50c 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -11,90 +11,53 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Scott Wegner
- * June 3, 2008
- *
- * Purpose: This file is used to map HDF macros to Windows functions. This
+/* Purpose: This file is used to map HDF macros to Windows functions. This
* should get included H5private mappings, so as to override them.
* Any macro not mapped here, however, will receive a similar mapping
* inside H5private.h
*
*/
-#ifndef H5_HAVE_INTTYPES_H
-/* The following definitions should be suitable for 64-bit Windows, which is
- * LLP64, and for 32-bit Windows, which is ILP32. Those are the only
- * platforms where <inttypes.h> is likely to be missing. VS2015 and later
- * *may* provide these definitions.
- */
-#ifdef _WIN64
-#define PRIdPTR "lld"
-#define PRIoPTR "llo"
-#define PRIuPTR "llu"
-#define PRIxPTR "llx"
-#define PRIXPTR "llX"
-#else /* _WIN64 */
-#define PRIdPTR "ld"
-#define PRIoPTR "lo"
-#define PRIuPTR "lu"
-#define PRIxPTR "lx"
-#define PRIXPTR "lX"
-#endif /* _WIN64 */
-
-#define PRId8 "d"
-#define PRIo8 "o"
-#define PRIu8 "u"
-#define PRIx8 "x"
-#define PRIX8 "X"
-#define PRId16 "d"
-#define PRIo16 "o"
-#define PRIu16 "u"
-#define PRIx16 "x"
-#define PRIX16 "X"
-#define PRId32 "d"
-#define PRIo32 "o"
-#define PRIu32 "u"
-#define PRIx32 "x"
-#define PRIX32 "X"
-#define PRId64 "lld"
-#define PRIo64 "llo"
-#define PRIu64 "llu"
-#define PRIx64 "llx"
-#define PRIX64 "llX"
-#define PRIdMAX "lld"
-#define PRIoMAX "llo"
-#define PRIuMAX "llu"
-#define PRIxMAX "llx"
-#define PRIXMAX "llX"
-#endif
-/*
- * _MSC_VER = 1900 VS2015
- * _MSC_VER = 1800 VS2013
- * _MSC_VER = 1700 VS2012
+/* _MSC_VER = 192x VS2019
+ * _MSC_VER = 191x VS2017
+ * _MSC_VER = 1900 VS2015
+ * _MSC_VER = 1800 VS2013
+ * _MSC_VER = 1700 VS2012
*/
#ifdef H5_HAVE_WIN32_API
typedef struct _stati64 h5_stat_t;
typedef __int64 h5_stat_size_t;
-#define HDaccess(F, M) _access(F, M)
-#define HDchdir(S) _chdir(S)
-#define HDclose(F) _close(F)
-#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M)
-#define HDdup(F) _dup(F)
-#define HDfdopen(N, S) _fdopen(N, S)
-#define HDfileno(F) _fileno(F)
-#define HDfstat(F, B) _fstati64(F, B)
-#define HDisatty(F) _isatty(F)
+#ifdef H5_HAVE_VISUAL_STUDIO
+
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+
+#endif /* H5_HAVE_VISUAL_STUDIO */
-#define HDgetcwd(S, Z) _getcwd(S, Z)
-#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z)
-#define HDgetdrive() _getdrive()
-#define HDlseek(F, O, W) _lseeki64(F, O, W)
-#define HDlstat(S, B) _lstati64(S, B)
-#define HDmkdir(S, M) _mkdir(S)
-#define HDnanosleep(N, O) Wnanosleep(N, O)
-#define HDoff_t __int64
+#define HDaccess(F, M) _access(F, M)
+#define HDchdir(S) _chdir(S)
+#define HDclose(F) _close(F)
+#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M)
+#define HDdup(F) _dup(F)
+#define HDfdopen(N, S) _fdopen(N, S)
+#define HDfileno(F) _fileno(F)
+#define HDflock(F, L) Wflock(F, L)
+#define HDfstat(F, B) _fstati64(F, B)
+#define HDgetcwd(S, Z) _getcwd(S, Z)
+#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z)
+#define HDgetdrive() _getdrive()
+#define HDgetlogin() Wgetlogin()
+#define HDgettimeofday(V, Z) Wgettimeofday(V, Z)
+#define HDisatty(F) _isatty(F)
+#define HDlseek(F, O, W) _lseeki64(F, O, W)
+#define HDlstat(S, B) _lstati64(S, B)
+#define HDmemset(X, C, Z) memset((void *)(X), C, Z) /* Cast avoids MSVC warning */
+#define HDmkdir(S, M) _mkdir(S)
+#define HDoff_t __int64
/* Note that the variadic HDopen macro is using a VC++ extension
* where the comma is dropped if nothing is passed to the ellipsis.
@@ -104,9 +67,11 @@ typedef __int64 h5_stat_size_t;
#else
#define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__)
#endif
+
#define HDread(F, M, Z) _read(F, M, Z)
#define HDremove(S) Wremove_utf8(S)
#define HDrmdir(S) _rmdir(S)
+#define HDsetenv(N, V, O) Wsetenv(N, V, O)
#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2))
#define HDsleep(S) Sleep(S * 1000)
#define HDstat(S, B) _stati64(S, B)
@@ -115,55 +80,13 @@ typedef __int64 h5_stat_size_t;
#define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z)
#define HDtzset() _tzset()
#define HDunlink(S) _unlink(S)
+#define HDunsetenv(N) Wsetenv(N, "", 1)
#define HDwrite(F, M, Z) _write(F, M, Z)
-#ifdef H5_HAVE_VISUAL_STUDIO
-
-#if (_MSC_VER < 1800)
-#ifndef H5_HAVE_STRTOLL
-#define HDstrtoll(S, R, N) _strtoi64(S, R, N)
-#endif /* H5_HAVE_STRTOLL */
-#ifndef H5_HAVE_STRTOULL
-#define HDstrtoull(S, R, N) _strtoui64(S, R, N)
-#endif /* H5_HAVE_STRTOULL */
-/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are
- * just pointers into the stack in those CRTs, the usual work-around
- * is to just define the operation as a pointer copy.
- */
-#define HDva_copy(D, S) ((D) = (S))
-#endif /* MSC_VER < 1800 */
-
-/*
- * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
- */
-#define HDmemset(X, C, Z) memset((void *)(X), C, Z)
-
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-
-/* time.h before VS2015 does not include timespec */
-#if (_MSC_VER < 1900)
-struct timespec {
- time_t tv_sec; /* Seconds - >= 0 */
- long tv_nsec; /* Nanoseconds - [0, 999999999] */
-};
-#endif /* MSC_VER < 1900 */
-
-#if (_MSC_VER <= 1700)
-/* The isnan function needs underscore in VS2012 and earlier */
-#define HDisnan(X) _isnan(X)
-/* The round functions do not exist in VS2012 and earlier */
-#define HDllround(V) Wllround(V)
-#define HDllroundf(V) Wllroundf(V)
-#define HDlround(V) Wlround(V)
-#define HDlroundf(V) Wlroundf(V)
-#define HDround(V) Wround(V)
-#define HDroundf(V) Wroundf(V)
-#endif /* MSC_VER < 1700 */
-
-#endif /* H5_HAVE_VISUAL_STUDIO */
+#ifndef H5_HAVE_MINGW
+#define HDftruncate(F, L) _chsize_s(F, L)
+#define HDfseek(F, O, W) _fseeki64(F, O, W)
+#endif /* H5_HAVE_MINGW */
#ifdef __cplusplus
extern "C" {
@@ -172,41 +95,13 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
H5_DLL int Wsetenv(const char *name, const char *value, int overwrite);
H5_DLL int Wflock(int fd, int operation);
H5_DLL char * Wgetlogin(void);
-H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...);
-H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap);
-H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem);
H5_DLL herr_t H5_expand_windows_env_vars(char **env_var);
-H5_DLL const wchar_t *H5_get_utf16_str(const char *s);
-H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
-H5_DLL int Wremove_utf8(const char *path);
-
-/* Round functions only needed for VS2012 and earlier.
- * They are always built to ensure they don't go stale and
- * can be deleted (along with their #defines, above) when we
- * drop VS2012 support.
- */
-H5_DLL long long Wllround(double arg);
-H5_DLL long long Wllroundf(float arg);
-H5_DLL long Wlround(double arg);
-H5_DLL long Wlroundf(float arg);
-H5_DLL double Wround(double arg);
-H5_DLL float Wroundf(float arg);
+H5_DLL wchar_t *H5_get_utf16_str(const char *s);
+H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
+H5_DLL int Wremove_utf8(const char *path);
+H5_DLL int H5_get_win32_times(H5_timevals_t *tvs);
#ifdef __cplusplus
}
#endif /* __cplusplus */
-#define HDgettimeofday(V, Z) Wgettimeofday(V, Z)
-#define HDsetenv(N, V, O) Wsetenv(N, V, O)
-#define HDflock(F, L) Wflock(F, L)
-#define HDgetlogin() Wgetlogin()
-#define HDsnprintf c99_snprintf /*varargs*/
-#define HDvsnprintf c99_vsnprintf /*varargs*/
-
-/* Non-POSIX functions */
-
-#ifndef H5_HAVE_MINGW
-#define HDftruncate(F, L) _chsize_s(F, L)
-#define HDfseek(F, O, W) _fseeki64(F, O, W)
-#endif /* H5_HAVE_MINGW */
-
#endif /* H5_HAVE_WIN32_API */
diff --git a/src/Makefile.am b/src/Makefile.am
index 514f77c..04b0d40 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 \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \
H5HP.c \
H5I.c H5Idbg.c H5Iint.c H5Itest.c \
- H5L.c H5Ldeprec.c H5Lexternal.c \
+ H5L.c H5Ldeprec.c H5Lexternal.c H5Lint.c \
H5M.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
@@ -102,19 +99,17 @@ 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 \
H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \
H5Tvlen.c \
H5TS.c \
- H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \
+ H5VL.c H5VLcallback.c H5VLdyn_ops.c H5VLint.c H5VLnative.c \
H5VLnative_attr.c H5VLnative_blob.c H5VLnative_dataset.c \
H5VLnative_datatype.c H5VLnative_file.c H5VLnative_group.c \
H5VLnative_link.c H5VLnative_introspect.c H5VLnative_object.c \
- H5VLnative_token.c \
- H5VLpassthru.c \
+ H5VLnative_token.c H5VLpassthru.c H5VLtest.c \
H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zscaleoffset.c \
H5Zszip.c H5Ztrans.c
@@ -161,11 +156,15 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
- H5Rpublic.h H5Spublic.h H5Tpublic.h H5TSpublic.h \
+ H5Rpublic.h H5Spublic.h H5Tpublic.h \
H5VLconnector.h H5VLconnector_passthru.h \
H5VLnative.h H5VLpassthru.h H5VLpublic.h \
H5Zpublic.h
+# Public component author headers
+include_HEADERS += H5ESdevelop.h H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \
+ H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h
+
if HAVE_MERCURY_CONDITIONAL
include_HEADERS += mercury/src/util/mercury_thread.h \
mercury/src/util/mercury_thread_mutex.h mercury/src/util/mercury_thread_pool.h
@@ -225,11 +224,6 @@ $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt
$(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt
perl $(top_srcdir)/bin/make_overflow $?
-# doxygen support
-if BUILD_DOXYGEN_CONDITIONAL
-doxygen: doxygen-doc
-endif
-
# Add TRACE macros to library source files. This is done via the trace script
# in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean"
# version of the source file is saved with a tilde (~) after its name and
diff --git a/src/hdf5.h b/src/hdf5.h
index 6edc084..8751ec5 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -38,10 +38,23 @@
#include "H5Rpublic.h" /* References */
#include "H5Spublic.h" /* Dataspaces */
#include "H5Tpublic.h" /* Datatypes */
-#include "H5TSpublic.h" /* Thread-safety */
#include "H5VLpublic.h" /* Virtual Object Layer */
#include "H5Zpublic.h" /* Data filters */
+/* Plugin/component developer headers */
+#include "H5ESdevelop.h" /* Event Sets */
+#include "H5FDdevelop.h" /* File drivers */
+#include "H5Idevelop.h" /* ID management */
+#include "H5Ldevelop.h" /* Links */
+#include "H5Tdevelop.h" /* Datatypes */
+#include "H5TSdevelop.h" /* Threadsafety */
+#include "H5Zdevelop.h" /* Data filters */
+
+/* Virtual object layer (VOL) connector developer support */
+#include "H5VLconnector.h" /* VOL connector author routines */
+#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
+#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
+
/* Predefined file drivers */
#include "H5FDcore.h" /* Files stored entirely in memory */
#include "H5FDdirect.h" /* Linux direct I/O */
diff --git a/src/mercury/include/mercury_log.h b/src/mercury/include/mercury_log.h
index 0e98710..bb1b52f 100644
--- a/src/mercury/include/mercury_log.h
+++ b/src/mercury/include/mercury_log.h
@@ -143,7 +143,10 @@
*/
#define HG_LOG_OUTLET_INITIALIZER(name, state, parent, debug_log) \
{ \
- HG_UTIL_STRINGIFY(name), state, HG_LOG_LEVEL_NONE, parent, debug_log, { NULL } \
+ HG_UTIL_STRINGIFY(name), state, HG_LOG_LEVEL_NONE, parent, debug_log, \
+ { \
+ NULL \
+ } \
}
/* HG_LOG_OUTLET_SUBSYS_INITIALIZER: initializer for a sub-system log. */
@@ -158,7 +161,10 @@
/* HG_LOG_SUBSYS_REGISTER: register a name */
#define HG_LOG_SUBSYS_REGISTER(name) \
static void HG_UTIL_CAT(hg_log_outlet_, name)(void) HG_UTIL_CONSTRUCTOR; \
- static void HG_UTIL_CAT(hg_log_outlet_, name)(void) { hg_log_outlet_register(&HG_LOG_OUTLET(name)); } \
+ static void HG_UTIL_CAT(hg_log_outlet_, name)(void) \
+ { \
+ hg_log_outlet_register(&HG_LOG_OUTLET(name)); \
+ } \
/* Keep unused prototype to use semicolon at end of macro */ \
void hg_log_outlet_##name##_unused(void)
diff --git a/src/mercury/src/util/mercury_log.h b/src/mercury/src/util/mercury_log.h
index 0e98710..bb1b52f 100644
--- a/src/mercury/src/util/mercury_log.h
+++ b/src/mercury/src/util/mercury_log.h
@@ -143,7 +143,10 @@
*/
#define HG_LOG_OUTLET_INITIALIZER(name, state, parent, debug_log) \
{ \
- HG_UTIL_STRINGIFY(name), state, HG_LOG_LEVEL_NONE, parent, debug_log, { NULL } \
+ HG_UTIL_STRINGIFY(name), state, HG_LOG_LEVEL_NONE, parent, debug_log, \
+ { \
+ NULL \
+ } \
}
/* HG_LOG_OUTLET_SUBSYS_INITIALIZER: initializer for a sub-system log. */
@@ -158,7 +161,10 @@
/* HG_LOG_SUBSYS_REGISTER: register a name */
#define HG_LOG_SUBSYS_REGISTER(name) \
static void HG_UTIL_CAT(hg_log_outlet_, name)(void) HG_UTIL_CONSTRUCTOR; \
- static void HG_UTIL_CAT(hg_log_outlet_, name)(void) { hg_log_outlet_register(&HG_LOG_OUTLET(name)); } \
+ static void HG_UTIL_CAT(hg_log_outlet_, name)(void) \
+ { \
+ hg_log_outlet_register(&HG_LOG_OUTLET(name)); \
+ } \
/* Keep unused prototype to use semicolon at end of macro */ \
void hg_log_outlet_##name##_unused(void)
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 */